Re: [Mesa-dev] [PATCH v3] mesa: Optionally build a dricore support library (v3)
On Thu, 3 Feb 2011 11:19:32 +1100, Christopher James Halse Rogers wrote: > This an adds --enable-shared-dricore option to configure. When enabled, > DRI modules will link against a shared copy of the common mesa routines > rather than statically linking these. > > This saves about 30MB on disc with a full complement of classic DRI > drivers. > > v2: Only enable with a gcc-compatible compiler that handles rpath > Handle DRI_CFLAGS without filter-out magic > Build shared libraries with the full mklib voodoo > Fix typos > v3: Resolve conflicts with talloc removal patches Didn't see any further complaints, so I pushed it. This saves 30MB on disc (just 4.4% of the working tree size) for my compile of swrast,i915,i965, but as a result reduced my build time for "touch src/mesa/main/context.c; make" by 13.8% +/- 3.8% (n=5). I don't even care about distros, I want shorter build times for myself :) pgp6fE2hBruxp.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glx: Put null check before use
On Thu, 19 Aug 2010 14:06:21 -0400, nobled wrote: > 'dpy' was being checked for null *after* it was already used once. > From 606d6522e90abe526755d80d28754a8229a99baf Mon Sep 17 00:00:00 2001 > From: nobled > Date: Fri, 30 Jul 2010 12:09:18 + > Subject: [PATCH] glx: Put null check before use > > 'dpy' was being checked for null *after* it was already used once. > > Also add a null check for psc, and drop gc's redundant initialization. Applied. Thanks! (though, if you could get git-send-email working, that's nicer for applying patches than attachments). pgpBTjN7PKZIr.pgp Description: PGP signature ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Building Mesa 7.10 on Windows 7 / Visual Studio 2010
Hi All, I've been trying to build Mesa 7.10 on Windows 7 / Visual Studio 2010 and I have been having some problems. When I opened \windows\VC8\mesa\mesa.sln, it was automatically converted to VS2010. When I tried to build the various projects there were a number of problems including a number of misconfigured build directories. Additionally, when building the mesa project in VS2010, it has trouble finding a path for building "predefined shaders". Finally, the "glsl_apps_compile" project seems to be out of date. Is there an updated version of this solution file for Mesa7.10 / VS2010, or has anyone successfully built Mesa7.10 with CMAKE? Any suggestions on successfully building Mesa7.10 for Windows7 / VS2010 would be greatly appreciated. Sincerely, Yahya Mirza Aurora Borealis Software LLC ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] docs: Fix typo in GL3.txt
Signed-off-by: Sedat Dilek --- docs/GL3.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/docs/GL3.txt b/docs/GL3.txt index b4ca99b..9ff25a9 100644 --- a/docs/GL3.txt +++ b/docs/GL3.txt @@ -33,7 +33,7 @@ Transform feedback (GL_EXT_transform_feedback)~50% done glBindFragDataLocation, glGetFragDataLocation, glBindBufferRange, glBindBufferBase commands Vertex array objects (GL_APPLE_vertex_array_object) DONE -sRGB framebuffer format (GL_EXT_framebuffer_sRGB) core GL done (i965, galliuum), GLX todo +sRGB framebuffer format (GL_EXT_framebuffer_sRGB) core GL done (i965, gallium), GLX todo glClearBuffer commandsDONE glGetStringi command DONE glTexParameterI, glGetTexParameterI commands DONE -- 1.7.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/6] vbo: notify a driver that we change buffer offsets, strides, etc.
--- src/mesa/vbo/vbo_exec_draw.c |1 + src/mesa/vbo/vbo_save_draw.c |1 + 2 files changed, 2 insertions(+), 0 deletions(-) diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 87f6431..f8be83e 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -245,6 +245,7 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) arrays[attr]._MaxElement = count; /* ??? */ varying_inputs |= 1 << attr; + ctx->NewState |= _NEW_ARRAY; } } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index d0454bf..634a6d3 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -202,6 +202,7 @@ static void vbo_bind_vertex_list(struct gl_context *ctx, buffer_offset += node->attrsz[src] * sizeof(GLfloat); varying_inputs |= 1
[Mesa-dev] [PATCH 2/6] vbo: bind arrays only when necessary
We don't need to call bind_arrays in the vbo module if the states which the function depends on are not dirty. --- src/mesa/main/mtypes.h|1 + src/mesa/main/state.c |2 ++ src/mesa/vbo/vbo_exec_array.c |5 + 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 09e17d9..b7473e1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1643,6 +1643,7 @@ struct gl_array_attrib GLuint RestartIndex; GLbitfield NewState;/**< mask of _NEW_ARRAY_* values */ + GLboolean RebindArrays; /**< whether the VBO module should rebind arrays */ /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index cce1b46..502c429 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -662,6 +662,8 @@ _mesa_update_state_locked( struct gl_context *ctx ) ctx->NewState = 0; ctx->Driver.UpdateState(ctx, new_state); ctx->Array.NewState = 0; + if (!ctx->Array.RebindArrays) + ctx->Array.RebindArrays = (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) != 0; } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 80085c1..6749541 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -502,8 +502,13 @@ recalculate_input_bindings(struct gl_context *ctx) static void bind_arrays(struct gl_context *ctx) { + if (!ctx->Array.RebindArrays) { + return; + } + bind_array_obj(ctx); recalculate_input_bindings(ctx); + ctx->Array.RebindArrays = GL_FALSE; } -- 1.7.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/6] gallium: always save and restore vertex buffers using cso_cache
--- src/gallium/auxiliary/cso_cache/cso_context.c | 45 +++ src/gallium/auxiliary/cso_cache/cso_context.h |7 src/gallium/auxiliary/util/u_blit.c |8 +++- src/gallium/auxiliary/util/u_blitter.c |4 +- src/gallium/auxiliary/util/u_draw_quad.c| 13 +-- src/gallium/auxiliary/util/u_draw_quad.h|5 ++- src/gallium/auxiliary/util/u_gen_mipmap.c |3 +- src/gallium/state_trackers/vega/renderer.c |4 +- src/gallium/state_trackers/xorg/xorg_renderer.c |4 +- src/mesa/state_tracker/st_cb_bitmap.c |4 ++- src/mesa/state_tracker/st_cb_clear.c|5 ++- src/mesa/state_tracker/st_cb_drawpixels.c |4 ++- src/mesa/state_tracker/st_cb_drawtex.c |2 + src/mesa/state_tracker/st_draw.c|2 +- 14 files changed, 92 insertions(+), 18 deletions(-) diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 9b148b2..fdd40fc 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -81,6 +81,12 @@ struct cso_context { struct sampler_info fragment_samplers; struct sampler_info vertex_samplers; + uint nr_vertex_buffers; + struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; + + uint nr_vertex_buffers_saved; + struct pipe_vertex_buffer vertex_buffers_saved[PIPE_MAX_ATTRIBS]; + /** Current and saved state. * The saved state is used as a 1-deep stack. */ @@ -312,6 +318,13 @@ void cso_release_all( struct cso_context *ctx ) util_unreference_framebuffer_state(&ctx->fb); util_unreference_framebuffer_state(&ctx->fb_saved); + util_copy_vertex_buffers(ctx->vertex_buffers, +&ctx->nr_vertex_buffers, +NULL, 0); + util_copy_vertex_buffers(ctx->vertex_buffers_saved, +&ctx->nr_vertex_buffers_saved, +NULL, 0); + if (ctx->cache) { cso_cache_delete( ctx->cache ); ctx->cache = NULL; @@ -921,6 +934,38 @@ void cso_restore_vertex_elements(struct cso_context *ctx) ctx->velements_saved = NULL; } +/* vertex buffers */ + +void cso_set_vertex_buffers(struct cso_context *ctx, +unsigned count, +const struct pipe_vertex_buffer *buffers) +{ + if (count != ctx->nr_vertex_buffers || + memcmp(buffers, ctx->vertex_buffers, + sizeof(struct pipe_vertex_buffer) * count) != 0) { + util_copy_vertex_buffers(ctx->vertex_buffers, &ctx->nr_vertex_buffers, + buffers, count); + ctx->pipe->set_vertex_buffers(ctx->pipe, count, buffers); + } +} + +void cso_save_vertex_buffers(struct cso_context *ctx) +{ + util_copy_vertex_buffers(ctx->vertex_buffers_saved, +&ctx->nr_vertex_buffers_saved, +ctx->vertex_buffers, +ctx->nr_vertex_buffers); +} + +void cso_restore_vertex_buffers(struct cso_context *ctx) +{ + util_copy_vertex_buffers(ctx->vertex_buffers, +&ctx->nr_vertex_buffers, +ctx->vertex_buffers_saved, +ctx->nr_vertex_buffers_saved); + ctx->pipe->set_vertex_buffers(ctx->pipe, ctx->nr_vertex_buffers, + ctx->vertex_buffers); +} / fragment/vertex sampler view state */ diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index f0b07f7..00edc9f 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -110,6 +110,13 @@ void cso_save_vertex_elements(struct cso_context *ctx); void cso_restore_vertex_elements(struct cso_context *ctx); +void cso_set_vertex_buffers(struct cso_context *ctx, +unsigned count, +const struct pipe_vertex_buffer *buffers); +void cso_save_vertex_buffers(struct cso_context *ctx); +void cso_restore_vertex_buffers(struct cso_context *ctx); + + /* These aren't really sensible -- most of the time the api provides * object semantics for shaders anyway, and the cases where it doesn't * (eg mesa's internall-generated texenv programs), it will be up to diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index c11f7d3..f07ae2a 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -480,6 +480,7 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_save_vertex_shader(ctx->cso); cso_save_clip(ctx->cso); cso_save_vertex_elements(ctx->cso); + cso_save_vertex_buffers(ctx->cso); /* set misc state we care about */ cso_set_blend(ctx->cso, &ctx->blend); @@ -554,7 +555,7 @@ util
[Mesa-dev] [PATCH 4/6] gallium: remove pipe_vertex_buffer::max_index
This is redundant to pipe_draw_info::max_index and doesn't really fit in the optimizations I plan. --- src/gallium/auxiliary/draw/draw_llvm.c | 17 - src/gallium/auxiliary/draw/draw_llvm.h |5 + src/gallium/auxiliary/draw/draw_pt.c |3 +-- src/gallium/auxiliary/draw/draw_pt_fetch.c |4 ++-- src/gallium/auxiliary/draw/draw_pt_fetch_emit.c|2 +- .../auxiliary/draw/draw_pt_fetch_shade_emit.c |2 +- src/gallium/auxiliary/util/u_draw_quad.c |1 - src/gallium/auxiliary/util/u_dump_state.c |1 - src/gallium/docs/d3d11ddi.txt |1 - src/gallium/drivers/svga/svga_state_vs.c |2 +- src/gallium/drivers/trace/tr_dump_state.c |1 - src/gallium/include/pipe/p_state.h |1 - .../state_trackers/d3d1x/dxgi/src/dxgi_native.cpp |1 - .../state_trackers/d3d1x/gd3d11/d3d11_context.h|1 - src/gallium/state_trackers/vega/polygon.c |2 -- src/gallium/tests/graw/fs-test.c |1 - src/gallium/tests/graw/gs-test.c |2 -- src/gallium/tests/graw/quad-tex.c |1 - src/gallium/tests/graw/shader-leak.c |1 - src/gallium/tests/graw/tri-gs.c|1 - src/gallium/tests/graw/tri-instanced.c |2 -- src/gallium/tests/graw/tri.c |1 - src/gallium/tests/graw/vs-test.c |1 - src/mesa/state_tracker/st_draw.c |5 - src/mesa/state_tracker/st_draw_feedback.c |1 - 25 files changed, 11 insertions(+), 49 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index a73bdd7..a5217c1 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -214,13 +214,12 @@ static LLVMTypeRef create_jit_vertex_buffer_type(struct gallivm_state *gallivm) { LLVMTargetDataRef target = gallivm->target; - LLVMTypeRef elem_types[4]; + LLVMTypeRef elem_types[3]; LLVMTypeRef vb_type; elem_types[0] = - elem_types[1] = - elem_types[2] = LLVMInt32TypeInContext(gallivm->context); - elem_types[3] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); /* vs_constants */ + elem_types[1] = LLVMInt32TypeInContext(gallivm->context); + elem_types[2] = LLVMPointerType(LLVMInt8TypeInContext(gallivm->context), 0); /* vs_constants */ vb_type = LLVMStructTypeInContext(gallivm->context, elem_types, Elements(elem_types), 0); @@ -229,10 +228,8 @@ create_jit_vertex_buffer_type(struct gallivm_state *gallivm) LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, stride, target, vb_type, 0); - LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, max_index, - target, vb_type, 1); LP_CHECK_MEMBER_OFFSET(struct pipe_vertex_buffer, buffer_offset, - target, vb_type, 2); + target, vb_type, 1); LP_CHECK_STRUCT_SIZE(struct pipe_vertex_buffer, target, vb_type); @@ -513,9 +510,7 @@ generate_fetch(struct gallivm_state *gallivm, LLVMValueRef vbuffer_ptr = LLVMBuildGEP(builder, vbuffers_ptr, &indices, 1, ""); LLVMValueRef vb_stride = draw_jit_vbuffer_stride(gallivm, vbuf); - LLVMValueRef vb_max_index = draw_jit_vbuffer_max_index(gallivm, vbuf); LLVMValueRef vb_buffer_offset = draw_jit_vbuffer_offset(gallivm, vbuf); - LLVMValueRef cond; LLVMValueRef stride; if (velem->instance_divisor) { @@ -525,10 +520,6 @@ generate_fetch(struct gallivm_state *gallivm, "instance_divisor"); } - /* limit index to min(index, vb_max_index) */ - cond = LLVMBuildICmp(builder, LLVMIntULE, index, vb_max_index, ""); - index = LLVMBuildSelect(builder, cond, index, vb_max_index, ""); - stride = LLVMBuildMul(builder, vb_stride, index, ""); vbuffer_ptr = LLVMBuildLoad(builder, vbuffer_ptr, "vbuffer"); diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 9f038f1..e8623e7 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -133,11 +133,8 @@ struct draw_jit_context #define draw_jit_vbuffer_stride(_gallivm, _ptr) \ lp_build_struct_get(_gallivm, _ptr, 0, "stride") -#define draw_jit_vbuffer_max_index(_gallivm, _ptr) \ - lp_build_struct_get(_gallivm, _ptr, 1, "max_index") - #define draw_jit_vbuffer_offset(_gallivm, _ptr) \ - lp_build_struct_get(_gallivm, _ptr, 2, "buffer_offset") + lp_build_struct_get(_gallivm, _ptr, 1, "buffer_offset") typedef int diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 4078b2a..c3d7e87 100644 --- a/src/gallium/auxiliary/
[Mesa-dev] [PATCH 5/6] st/mesa: set vertex arrays state only when necessary
The vertex arrays state should be set only when (_NEW_ARRAY | _NEW_PROGRAM) is dirty. This assumes user buffer content is mutable, which will be sorted out in the next commit. The following usage case should be much faster now: for (i = 0; i < 1000; i++) { glDrawElements(...); } Or even: for (i = 0; i < 1000; i++) { glSomeStateChangeOtherThanArraysOrProgram(...); glDrawElements(...); } The performance increase from this may be significant in some apps and negligible in others. It is especially noticable in the Torcs game (r300g): Before: 15.4 fps After: 20 fps Also less looping over attribs in st_draw_vbo yields slight speed-up in apps with lots of glDraw* calls. --- src/mesa/state_tracker/st_draw.c | 292 ++ 1 files changed, 110 insertions(+), 182 deletions(-) diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 4cbcecf..34f75a3 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -243,13 +243,11 @@ st_pipe_vertex_format(GLenum type, GLuint size, GLenum format, static GLboolean is_interleaved_arrays(const struct st_vertex_program *vp, const struct st_vp_variant *vpv, - const struct gl_client_array **arrays, - GLboolean *userSpace) + const struct gl_client_array **arrays) { GLuint attr; const struct gl_buffer_object *firstBufObj = NULL; GLint firstStride = -1; - GLuint num_client_arrays = 0; const GLubyte *client_addr = NULL; for (attr = 0; attr < vpv->num_inputs; attr++) { @@ -263,9 +261,8 @@ is_interleaved_arrays(const struct st_vertex_program *vp, else if (firstStride != stride) { return GL_FALSE; } - + if (!bufObj || !bufObj->Name) { - num_client_arrays++; /* Try to detect if the client-space arrays are * "close" to each other. */ @@ -285,57 +282,11 @@ is_interleaved_arrays(const struct st_vertex_program *vp, } } - *userSpace = (num_client_arrays == vpv->num_inputs); - /* debug_printf("user space: %s (%d arrays, %d inputs)\n", - (int)*userSpace ? "Yes" : "No", num_client_arrays, vp->num_inputs); */ - return GL_TRUE; } /** - * Compute the memory range occupied by the arrays. - */ -static void -get_arrays_bounds(const struct st_vertex_program *vp, - const struct st_vp_variant *vpv, - const struct gl_client_array **arrays, - GLuint max_index, - const GLubyte **low, const GLubyte **high) -{ - const GLubyte *low_addr = NULL; - const GLubyte *high_addr = NULL; - GLuint attr; - - /* debug_printf("get_arrays_bounds: Handling %u attrs\n", vpv->num_inputs); */ - - for (attr = 0; attr < vpv->num_inputs; attr++) { - const GLuint mesaAttr = vp->index_to_input[attr]; - const GLint stride = arrays[mesaAttr]->StrideB; - const GLubyte *start = arrays[mesaAttr]->Ptr; - const unsigned sz = (arrays[mesaAttr]->Size * - _mesa_sizeof_type(arrays[mesaAttr]->Type)); - const GLubyte *end = start + (max_index * stride) + sz; - - /* debug_printf("attr %u: stride %d size %u start %p end %p\n", - attr, stride, sz, start, end); */ - - if (attr == 0) { - low_addr = start; - high_addr = end; - } - else { - low_addr = MIN2(low_addr, start); - high_addr = MAX2(high_addr, end); - } - } - - *low = low_addr; - *high = high_addr; -} - - -/** * Set up for drawing interleaved arrays that all live in one VBO * or all live in user space. * \param vbuffer returns vertex buffer info @@ -346,15 +297,21 @@ setup_interleaved_attribs(struct gl_context *ctx, const struct st_vertex_program *vp, const struct st_vp_variant *vpv, const struct gl_client_array **arrays, - GLuint max_index, - GLboolean userSpace, struct pipe_vertex_buffer *vbuffer, - struct pipe_vertex_element velements[]) + struct pipe_vertex_element velements[], + unsigned max_index) { struct st_context *st = st_context(ctx); struct pipe_context *pipe = st->pipe; GLuint attr; - const GLubyte *offset0 = NULL; + const GLubyte *low_addr = NULL; + + /* Find the lowest address. */ + for (attr = 0; attr < vpv->num_inputs; attr++) { + const GLubyte *start = arrays[vp->index_to_input[attr]]->Ptr; + + low_addr = !low_addr ? start : MIN2(low_addr, start); + } for (attr = 0; attr < vpv->num_inputs; attr++) { const GLuint mesaAttr = vp->index_to_input[attr]; @@ -362,39 +319,23 @@ setup_interleaved_attribs(struct gl_context *ctx, struct st_buffer_object *stobj = st_bu
[Mesa-dev] [PATCH 6/6] gallium: notify drivers about possible changes in user buffer contents
Also implement the redefine_user_buffer hook in the drivers. --- src/gallium/auxiliary/util/u_blitter.c |4 ++ src/gallium/auxiliary/util/u_transfer.c |7 src/gallium/auxiliary/util/u_transfer.h | 10 ++--- src/gallium/docs/source/context.rst | 16 + src/gallium/drivers/cell/ppu/cell_state_vertex.c |2 + src/gallium/drivers/failover/fo_state.c |2 + src/gallium/drivers/galahad/glhd_context.c | 14 src/gallium/drivers/i915/i915_state.c|2 + src/gallium/drivers/i965/brw_pipe_vertex.c |2 + src/gallium/drivers/identity/id_context.c| 14 src/gallium/drivers/llvmpipe/lp_state_vertex.c |3 ++ src/gallium/drivers/noop/noop_state.c|2 + src/gallium/drivers/nv50/nv50_state.c|2 + src/gallium/drivers/nvc0/nvc0_state.c|3 ++ src/gallium/drivers/nvfx/nvfx_vbo.c |3 ++ src/gallium/drivers/r300/r300_state.c|2 + src/gallium/drivers/r600/evergreen_state.c |1 + src/gallium/drivers/r600/r600_state.c|2 + src/gallium/drivers/rbug/rbug_context.c | 14 src/gallium/drivers/softpipe/sp_state_vertex.c |2 + src/gallium/drivers/svga/svga_pipe_vertex.c |2 + src/gallium/drivers/trace/tr_context.c | 23 + src/gallium/include/pipe/p_context.h |8 src/mesa/state_tracker/st_context.c |5 +++ src/mesa/state_tracker/st_context.h |5 +++ src/mesa/state_tracker/st_draw.c | 38 ++ 26 files changed, 182 insertions(+), 6 deletions(-) diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index e27c445..fd1c2b7 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -639,6 +639,8 @@ static void blitter_draw_rectangle(struct blitter_context *blitter, } blitter_set_rectangle(ctx, x1, y1, x2, y2, depth); + ctx->base.pipe->redefine_user_buffer(ctx->base.pipe, ctx->vbuf, +0, ctx->vbuf->width0); util_draw_vertex_buffer(ctx->base.pipe, NULL, ctx->vbuf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, 2); } @@ -867,6 +869,8 @@ void util_blitter_copy_region(struct blitter_context *blitter, /* Draw. */ blitter_set_rectangle(ctx, dstx, dsty, dstx+width, dsty+height, 0); + ctx->base.pipe->redefine_user_buffer(ctx->base.pipe, ctx->vbuf, + 0, ctx->vbuf->width0); util_draw_vertex_buffer(ctx->base.pipe, NULL, ctx->vbuf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, 2); break; diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index e2828cf..b6c63d9 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -112,3 +112,10 @@ void u_default_transfer_destroy(struct pipe_context *pipe, FREE(transfer); } +void u_default_redefine_user_buffer(struct pipe_context *ctx, +struct pipe_resource *resource, +unsigned offset, +unsigned size) +{ + resource->width0 = MAX2(resource->width0, offset + size); +} diff --git a/src/gallium/auxiliary/util/u_transfer.h b/src/gallium/auxiliary/util/u_transfer.h index 5219151..8cf9c41 100644 --- a/src/gallium/auxiliary/util/u_transfer.h +++ b/src/gallium/auxiliary/util/u_transfer.h @@ -136,11 +136,9 @@ void u_transfer_inline_write_vtbl( struct pipe_context *rm_ctx, unsigned stride, unsigned layer_stride); - - - - - - +void u_default_redefine_user_buffer(struct pipe_context *ctx, +struct pipe_resource *resource, +unsigned offset, +unsigned size); #endif diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index da84726..04a3951 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -392,6 +392,22 @@ be flushed on write or unmap. Flushes must be requested with ``transfer_flush_region``. Flush ranges are relative to the mapped range, not the beginning of the resource. + + +.. _redefine_user_buffer: + +redefine_user_buffer + + +This function notifies a driver that the user buffer content has been changed. +The updated region starts at ``offset`` and is ``size`` bytes large. +The ``offset`` is relative to the pointer specified in ``user_buffer_create``. +While uploading the user buffer, the driver is allowed not to upload +the memory outside of this region. +The width0 is redefined to ``MAX2(wid
[Mesa-dev] [PATCH 0/6] Mesa/Gallium vertex array state optimizations
Hi, this patch series optimizes vertex array state changes in Mesa/Gallium. The problem with the vbo module and st/mesa is that it re-binds vertex arrays every draw operation instead of only when they get changed by the application, and this series aims to address that issue. Some new issues arose during the implemention though: 1) The VBO module didn't notify the underlying driver when it was changing buffer offsets and other vertex array properties. This is fixed in the 1st patch. 2) If we do not re-bind vertex arrays every draw operation, we must assure that the state is preserved after operations like glBlitFramebuffer. This is resolved in the 3rd patch using cso_cache. 3) Unfortunately, user buffers must be mutable in order to prevent re-binding vertex buffers because we have no way to know how large they are. Instead, a new context hook has been added to Gallium called 'redefine_user_buffer', which notifies a driver that a subrange of a user buffer should be reuploaded, and also redefines its size. I've only tested softpipe and r300g and there were no regressions. r600g should also work and Christopher told me his Nouveau drivers should be ready for this series too. Please review. Marek Olšák (6): vbo: notify a driver that we change buffer offsets, strides, etc. vbo: bind arrays only when necessary gallium: always save and restore vertex buffers using cso_cache gallium: remove pipe_vertex_buffer::max_index st/mesa: set vertex arrays state only when necessary gallium: notify drivers about possible changes in user buffer contents Best regards Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] RE: Mesa garbage collection and threads
On 02/11/11 16:31, Andy Skinner wrote: > -void XMesaGarbageCollect( void ) > +void XMesaGarbageCollect( XMesaDisplay* dpy ) > { > XMesaBuffer b, next; > for (b=XMesaBufferList; b; b=next) { >next = b->Next; > - if (b->display && b->frontxrb->drawable && b->type == WINDOW) { > + if (b->display && b->display == dpy && b->frontxrb->drawable && > b->type == WINDOW) { Why not just check for dpy == NULL once at the beginning and leave out the b->display check then ? Best regards Tolga Dalman ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev