[Mesa-dev] [PATCH 1/2] i965: Don't bother trying to extend the current vertex buffers.
This essentially reverts the following: commit c625aa19cb53ed27f91bfd16fea6ea727e9a5bbd Author: Chris Wilson ch...@chris-wilson.co.uk Date: Fri Feb 18 10:37:43 2011 + intel: extend current vertex buffers While working on optimizing an upcoming Steam title, I broke this code. Eric expressed his doubts about this optimization, and noted that the original commit offered no performance data. I ran before and after benchmarks on Xonotic and Citybench, and found that this code made no difference. So, remove it to reduce complexity and make future work simpler. Cc: Eric Anholt e...@anholt.net --- src/mesa/drivers/dri/i965/brw_context.h | 8 +-- src/mesa/drivers/dri/i965/brw_draw_upload.c | 34 - src/mesa/drivers/dri/i965/brw_vtbl.c| 1 - 3 files changed, 1 insertion(+), 42 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 9232a72..19c6af7 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -773,16 +773,10 @@ struct brw_context struct { struct brw_vertex_element inputs[VERT_ATTRIB_MAX]; struct brw_vertex_buffer buffers[VERT_ATTRIB_MAX]; - struct { - uint32_t handle; - uint32_t offset; - uint32_t stride; - uint32_t step_rate; - } current_buffers[VERT_ATTRIB_MAX]; struct brw_vertex_element *enabled[VERT_ATTRIB_MAX]; GLuint nr_enabled; - GLuint nr_buffers, nr_current_buffers; + GLuint nr_buffers; /* Summary of size and varying of active arrays, so we can check * for changes to this state: diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 4a4237d..722166c 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -536,34 +536,6 @@ static void brw_prepare_vertices(struct brw_context *brw) upload[i]-offset = 0; } - /* can we simply extend the current vb? */ - if (j == brw-vb.nr_current_buffers) { - int delta = 0; - for (i = 0; i j; i++) { -int d; - -if (brw-vb.current_buffers[i].handle != brw-vb.buffers[i].bo-handle || -brw-vb.current_buffers[i].stride != brw-vb.buffers[i].stride || -brw-vb.current_buffers[i].step_rate != brw-vb.buffers[i].step_rate) - break; - -d = brw-vb.buffers[i].offset - brw-vb.current_buffers[i].offset; -if (d 0) - break; -if (i == 0) - delta = d / brw-vb.current_buffers[i].stride; -if (delta * brw-vb.current_buffers[i].stride != d) - break; - } - - if (i == j) { -brw-vb.start_vertex_bias += delta; -while (--j = 0) - drm_intel_bo_unreference(brw-vb.buffers[j].bo); -j = 0; - } - } - brw-vb.nr_buffers = j; } @@ -644,13 +616,7 @@ static void brw_emit_vertices(struct brw_context *brw) } else OUT_BATCH(0); OUT_BATCH(buffer-step_rate); - -brw-vb.current_buffers[i].handle = buffer-bo-handle; -brw-vb.current_buffers[i].offset = buffer-offset; -brw-vb.current_buffers[i].stride = buffer-stride; -brw-vb.current_buffers[i].step_rate = buffer-step_rate; } - brw-vb.nr_current_buffers = i; ADVANCE_BATCH(); } diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index ca2e7a9..3709777 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -196,7 +196,6 @@ static void brw_new_batch( struct intel_context *intel ) */ brw-sol.offset_0_batch_start = brw-sol.svbi_0_starting_index; - brw-vb.nr_current_buffers = 0; brw-ib.type = -1; /* Mark that the current program cache BO has been used by the GPU. -- 1.8.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] i965: Don't replicate data for zero-stride arrays when copying to VBOs.
When copy_array_to_vbo_array encountered an array with src_stride == 0 and dst_stride != 0, we would replicate out the single element to the whole size (max - min + 1). This is unnecessary: we can simply upload one copy and set the buffer's stride to 0. Decreases vertex upload overhead in an upcoming Steam for Linux title. Prior to this patch, copy_array_to_vbo_array appeared very high in the profile (Eric quoted 20%). After the patch, it disappeared completely. Cc: Eric Anholt e...@anholt.net Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 722166c..ad7fe7c 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -311,13 +311,13 @@ copy_array_to_vbo_array(struct brw_context *brw, struct brw_vertex_buffer *buffer, GLuint dst_stride) { - if (min == -1) { - /* If we don't have computed min/max bounds, then this must be a use of - * the current attribute, which has a 0 stride. Otherwise, we wouldn't - * know what data to upload. - */ - assert(element-glarray-StrideB == 0); + const int src_stride = element-glarray-StrideB; + /* If the source stride is zero, we just want to upload the current +* attribute once and set the buffer's stride to 0. There's no need +* to replicate it out. +*/ + if (src_stride == 0) { intel_upload_data(brw-intel, element-glarray-Ptr, element-element_size, element-element_size, @@ -327,7 +327,6 @@ copy_array_to_vbo_array(struct brw_context *brw, return; } - int src_stride = element-glarray-StrideB; const unsigned char *src = element-glarray-Ptr + min * src_stride; int count = max - min + 1; GLuint size = count * dst_stride; -- 1.8.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Add alpha to coverage to performance debug recompile messages.
This was missing and got labeled Something else. Signed-off-by: Kenneth Graunke kenn...@whitecape.org --- src/mesa/drivers/dri/i965/brw_wm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index bfb36db..ad4059c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -361,6 +361,7 @@ brw_wm_debug_recompile(struct brw_context *brw, found |= key_debug(depth statistics, old_key-stats_wm, key-stats_wm); found |= key_debug(flat shading, old_key-flat_shade, key-flat_shade); found |= key_debug(number of color buffers, old_key-nr_color_regions, key-nr_color_regions); + found |= key_debug(sample to alpha coverage, old_key-sample_alpha_to_coverage, key-sample_alpha_to_coverage); found |= key_debug(rendering to FBO, old_key-render_to_fbo, key-render_to_fbo); found |= key_debug(fragment color clamping, old_key-clamp_fragment_color, key-clamp_fragment_color); found |= key_debug(line smoothing, old_key-line_aa, key-line_aa); -- 1.8.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] R600 tiling halves the frame rate
If you upload the texture every frame, set pipe_resource::usage to PIPE_USAGE_STAGING. That will make the texture linear. Marek On Sat, Oct 27, 2012 at 4:26 AM, Tzvetan Mikov tmi...@jupiter.com wrote: -Original Message- From: Jerome Glisse Can anyone shed some light on this? Is this by design - e.g. is this a case of we know that tiling is currently slower than linear but the huge payoff is scheduled to arrive in a future revision? Thanks! Tzvetan No, in all benchmark i made on various gpu from hd2xxx to hd6xxx tiling always gave a performance boost btw 5% up to 20%. This is interesting. All I am doing is rotating a big texture on the screen. I am using EGL+Gallium, so it is as simple as it gets. The hack I am using to disable texture tiling is also extremely simple (see below). It speeds up the FPS measurably, up to the extreme case of doubling it on HD6460. What am I missing? Regards, Tzvetan commit 1bb7da091ccf875571d376eb8f9451cb711eb978 Author: Tzvetan Mikov tmi...@jupiter.com Date: Thu Oct 18 12:29:00 2012 -0700 A VERY quick and drity hack to enable linear textures diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c index 85e4e0c..dc572f1 100644 --- a/src/gallium/drivers/r600/r600_texture.c +++ b/src/gallium/drivers/r600/r600_texture.c @@ -467,6 +467,9 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen, if (util_format_description(templ-format)-layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) array_mode = V_038000_ARRAY_LINEAR_ALIGNED; +// HACK HACK +array_mode = V_038000_ARRAY_LINEAR_ALIGNED; + r = r600_init_surface(rscreen, surface, templ, array_mode, templ-flags R600_RESOURCE_FLAG_TRANSFER, templ-flags R600_RESOURCE_FLAG_FLUSHED_DEPTH); ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] r600g: avoid shader needing too many gpr to lockup the gpu
FWIW, instead of putting the discard_draw flag in r600_context, it would be cleaner to have r600_adjust_gprs return false if drawing should be skipped, then r600_update_derived_state would return false and draw_vbo would skip rendering. That way you wouldn't have to add any comments in draw_vbo, because it would be clear where the error is coming from. Using R600_ERR to report the error should be sufficient. r600_adjust_gprs seems to be the best place for that. Marek On Sat, Oct 27, 2012 at 3:47 AM, Jerome Glisse j.gli...@gmail.com wrote: On Fri, Oct 26, 2012 at 10:01 PM, j.gli...@gmail.com wrote: From: Jerome Glisse jgli...@redhat.com On r6xx/r7xx shader resource management need to make sure that the shader does not goes over the gpr register limit. Each specific asic has a maxmimum register that can be split btw shader stage. For each stage the shader must not use more register than the limit programmed. Signed-off-by: Jerome Glisse jgli...@redhat.com I haven't yet fully tested it on wide range of GPU but it fixes piglit case that were locking up o one can directly use quick-drivers. I mostly would like feedback on if we should print a warning when we discard a draw command because shader exceed limit. Note that with this patch the test that were locking up fails but with a simple patch on top of that (decreasing clause temp gpr to 2) they pass. Regards, Jerome --- src/gallium/drivers/r600/r600_pipe.h | 1 + src/gallium/drivers/r600/r600_state.c| 60 +++- src/gallium/drivers/r600/r600_state_common.c | 22 +- 3 files changed, 55 insertions(+), 28 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index ff2a5fd..2045af3 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -363,6 +363,7 @@ struct r600_context { enum chip_class chip_class; boolean has_vertex_cache; boolean keep_tiling_flags; + booldiscard_draw; unsigneddefault_ps_gprs, default_vs_gprs; unsignedr6xx_num_clause_temp_gprs; unsignedbackend_mask; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 7d07008..43af934 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -2189,30 +2189,54 @@ void r600_init_state_functions(struct r600_context *rctx) /* Adjust GPR allocation on R6xx/R7xx */ void r600_adjust_gprs(struct r600_context *rctx) { - unsigned num_ps_gprs = rctx-default_ps_gprs; - unsigned num_vs_gprs = rctx-default_vs_gprs; + unsigned num_ps_gprs = rctx-ps_shader-current-shader.bc.ngpr; + unsigned num_vs_gprs = rctx-vs_shader-current-shader.bc.ngpr; + unsigned new_num_ps_gprs = num_ps_gprs; + unsigned new_num_vs_gprs = num_vs_gprs; + unsigned cur_num_ps_gprs = G_008C04_NUM_PS_GPRS(rctx-config_state.sq_gpr_resource_mgmt_1); + unsigned cur_num_vs_gprs = G_008C04_NUM_VS_GPRS(rctx-config_state.sq_gpr_resource_mgmt_1); + unsigned def_num_ps_gprs = rctx-default_ps_gprs; + unsigned def_num_vs_gprs = rctx-default_vs_gprs; + unsigned def_num_clause_temp_gprs = rctx-r6xx_num_clause_temp_gprs; + /* hardware will reserve twice num_clause_temp_gprs */ + unsigned max_gprs = def_num_ps_gprs + def_num_vs_gprs + def_num_clause_temp_gprs * 2; unsigned tmp; - int diff; - if (rctx-ps_shader-current-shader.bc.ngpr rctx-default_ps_gprs) { - diff = rctx-ps_shader-current-shader.bc.ngpr - rctx-default_ps_gprs; - num_vs_gprs -= diff; - num_ps_gprs += diff; + /* the sum of all SQ_GPR_RESOURCE_MGMT*.NUM_*_GPRS must = to max_gprs */ + if (new_num_ps_gprs cur_num_ps_gprs || new_num_vs_gprs cur_num_vs_gprs) { + /* try to use switch back to default */ + if (new_num_ps_gprs def_num_ps_gprs || new_num_vs_gprs def_num_vs_gprs) { + /* always privilege vs stage so that at worst we have the +* pixel stage producing wrong output (not the vertex +* stage) */ + new_num_ps_gprs = max_gprs - (new_num_vs_gprs + def_num_clause_temp_gprs * 2); + new_num_vs_gprs = num_vs_gprs; + } else { + new_num_ps_gprs = def_num_ps_gprs; + new_num_vs_gprs = def_num_vs_gprs; + } + } else { + rctx-discard_draw = false; + return; } - if (rctx-vs_shader-current-shader.bc.ngpr rctx-default_vs_gprs) - { - diff
[Mesa-dev] [PATCH] r600g: use better sample positions for 8x MSAA
Taken from the intel driver. The sample positions are actually a solution to the 8 queens puzzle. It gives more accurate and smoother AA. --- src/gallium/drivers/r600/evergreen_state.c | 18 +- src/gallium/drivers/r600/r600_state.c |6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 17b7e9d..ab9a7a5 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1723,16 +1723,16 @@ static void evergreen_emit_msaa_state(struct r600_context *rctx, int nr_samples) static unsigned max_dist_4x = 6; /* 8xMSAA */ static uint32_t sample_locs_8x[] = { - FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2), - FILL_SREG( 6, 0, 0, 0, -5, 3, 4, 4), - FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2), - FILL_SREG( 6, 0, 0, 0, -5, 3, 4, 4), - FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2), - FILL_SREG( 6, 0, 0, 0, -5, 3, 4, 4), - FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2), - FILL_SREG( 6, 0, 0, 0, -5, 3, 4, 4), + FILL_SREG(-1, 1, 1, 5, 3, -5, 5, 3), + FILL_SREG(-7, -1, -3, -7, 7, -3, -5, 7), + FILL_SREG(-1, 1, 1, 5, 3, -5, 5, 3), + FILL_SREG(-7, -1, -3, -7, 7, -3, -5, 7), + FILL_SREG(-1, 1, 1, 5, 3, -5, 5, 3), + FILL_SREG(-7, -1, -3, -7, 7, -3, -5, 7), + FILL_SREG(-1, 1, 1, 5, 3, -5, 5, 3), + FILL_SREG(-7, -1, -3, -7, 7, -3, -5, 7), }; - static unsigned max_dist_8x = 8; + static unsigned max_dist_8x = 7; struct radeon_winsys_cs *cs = rctx-cs; unsigned max_dist = 0; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 1a8d55e..607a89e 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -1587,10 +1587,10 @@ static void r600_emit_msaa_state(struct r600_context *rctx, int nr_samples) }; static unsigned max_dist_4x = 6; static uint32_t sample_locs_8x[] = { - FILL_SREG(-2, -5, 3, -4, -1, 5, -6, -2), - FILL_SREG( 6, 0, 0, 0, -5, 3, 4, 4), + FILL_SREG(-1, 1, 1, 5, 3, -5, 5, 3), + FILL_SREG(-7, -1, -3, -7, 7, -3, -5, 7), }; - static unsigned max_dist_8x = 8; + static unsigned max_dist_8x = 7; struct radeon_winsys_cs *cs = rctx-cs; unsigned max_dist = 0; -- 1.7.9.5 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/8] mesa: silence MSVC double/float assignment warnings in pixel unpack code
--- src/mesa/main/format_unpack.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/format_unpack.c b/src/mesa/main/format_unpack.c index 7b46dfc..04fd1d6 100644 --- a/src/mesa/main/format_unpack.c +++ b/src/mesa/main/format_unpack.c @@ -633,7 +633,7 @@ unpack_Z24_S8(const void *src, GLfloat dst[][4], GLuint n) for (i = 0; i n; i++) { dst[i][0] = dst[i][1] = - dst[i][2] = (s[i] 8) * scale; + dst[i][2] = (GLfloat) ((s[i] 8) * scale); dst[i][3] = 1.0F; ASSERT(dst[i][0] = 0.0F); ASSERT(dst[i][0] = 1.0F); @@ -650,7 +650,7 @@ unpack_S8_Z24(const void *src, GLfloat dst[][4], GLuint n) for (i = 0; i n; i++) { dst[i][0] = dst[i][1] = - dst[i][2] = (s[i] 0x00ff) * scale; + dst[i][2] = (float) ((s[i] 0x00ff) * scale); dst[i][3] = 1.0F; ASSERT(dst[i][0] = 0.0F); ASSERT(dst[i][0] = 1.0F); @@ -2856,7 +2856,7 @@ unpack_float_z_Z24_X8(GLuint n, const void *src, GLfloat *dst) const GLdouble scale = 1.0 / (GLdouble) 0xff; GLuint i; for (i = 0; i n; i++) { - dst[i] = (s[i] 8) * scale; + dst[i] = (GLfloat) ((s[i] 8) * scale); ASSERT(dst[i] = 0.0F); ASSERT(dst[i] = 1.0F); } @@ -2870,7 +2870,7 @@ unpack_float_z_X8_Z24(GLuint n, const void *src, GLfloat *dst) const GLdouble scale = 1.0 / (GLdouble) 0xff; GLuint i; for (i = 0; i n; i++) { - dst[i] = (s[i] 0x00ff) * scale; + dst[i] = (GLfloat) ((s[i] 0x00ff) * scale); ASSERT(dst[i] = 0.0F); ASSERT(dst[i] = 1.0F); } -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/8] mesa: silence MSVC signed/unsigned comparison warning in texstorage.c
--- src/mesa/main/texstorage.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index ca02ef3..283aefa 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -284,7 +284,7 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target, } /* check levels against maximum (note different error than above) */ - if (levels _mesa_max_texture_levels(ctx, target)) { + if (levels (GLint) _mesa_max_texture_levels(ctx, target)) { _mesa_error(ctx, GL_INVALID_OPERATION, glTexStorage%uD(levels too large), dims); return GL_TRUE; -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/8] mesa: silence MSVC signed/unsigned comparision warnings in accum.c
--- src/mesa/main/accum.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 8b71640..e2d7726 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -205,7 +205,7 @@ accum_scale_or_bias(struct gl_context *ctx, GLfloat value, if (accRb-Format == MESA_FORMAT_SIGNED_RGBA_16) { const GLshort incr = (GLshort) (value * 32767.0f); - GLuint i, j; + GLint i, j; if (bias) { for (j = 0; j height; j++) { GLshort *acc = (GLshort *) accMap; @@ -283,7 +283,7 @@ accum_or_load(struct gl_context *ctx, GLfloat value, if (accRb-Format == MESA_FORMAT_SIGNED_RGBA_16) { const GLfloat scale = value * 32767.0f; - GLuint i, j; + GLint i, j; GLfloat (*rgba)[4]; rgba = malloc(width * 4 * sizeof(GLfloat)); -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 4/8] mesa: silence MSVC signed/unsigned comparision warnings in transformfeedback.c
--- src/mesa/main/transformfeedback.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/transformfeedback.c b/src/mesa/main/transformfeedback.c index 0669b3a..1afc0dc 100644 --- a/src/mesa/main/transformfeedback.c +++ b/src/mesa/main/transformfeedback.c @@ -277,7 +277,7 @@ _mesa_BeginTransformFeedback(GLenum mode) { struct gl_transform_feedback_object *obj; struct gl_transform_feedback_info *info; - int i; + GLuint i; GET_CURRENT_CONTEXT(ctx); obj = ctx-TransformFeedback.CurrentObject; @@ -537,7 +537,7 @@ _mesa_TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar **varyings, GLenum bufferMode) { struct gl_shader_program *shProg; - GLuint i; + GLint i; GET_CURRENT_CONTEXT(ctx); switch (bufferMode) { @@ -648,7 +648,7 @@ _mesa_GetTransformFeedbackVarying(GLuint program, GLuint index, } linked_xfb_info = shProg-LinkedTransformFeedback; - if (index = linked_xfb_info-NumVarying) { + if (index = (GLuint) linked_xfb_info-NumVarying) { _mesa_error(ctx, GL_INVALID_VALUE, glGetTransformFeedbackVaryings(index=%u), index); return; -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 5/8] mesa: silence MSVC signed/unsigned comparision warnings in hash_table.c
--- src/mesa/program/hash_table.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/program/hash_table.c b/src/mesa/program/hash_table.c index 7dabadc..f45ed46 100644 --- a/src/mesa/program/hash_table.c +++ b/src/mesa/program/hash_table.c @@ -193,7 +193,7 @@ hash_table_call_foreach(struct hash_table *ht, void *closure), void *closure) { - int bucket; + unsigned bucket; for (bucket = 0; bucket ht-num_buckets; bucket++) { struct node *node, *temp; -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 6/8] mesa: silence some MSVC conversion warnings in get.c
--- src/mesa/main/get.c |6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index e38d594..805f0f9 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1149,7 +1149,7 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params) break; case TYPE_DOUBLEN: - params[0] = ((GLdouble *) p)[0]; + params[0] = (GLfloat) (((GLdouble *) p)[0]); break; case TYPE_INT_4: @@ -1170,7 +1170,7 @@ _mesa_GetFloatv(GLenum pname, GLfloat *params) break; case TYPE_INT64: - params[0] = ((GLint64 *) p)[0]; + params[0] = (GLfloat) (((GLint64 *) p)[0]); break; case TYPE_BOOLEAN: @@ -1449,7 +1449,7 @@ _mesa_GetDoublev(GLenum pname, GLdouble *params) break; case TYPE_INT64: - params[0] = ((GLint64 *) p)[0]; + params[0] = (GLdouble) (((GLint64 *) p)[0]); break; case TYPE_BOOLEAN: -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 7/8] vbo: silence MSVC double/float conversion warnings
--- src/mesa/vbo/vbo_attrib_tmp.h |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mesa/vbo/vbo_attrib_tmp.h b/src/mesa/vbo/vbo_attrib_tmp.h index d3fc77e..ece9394 100644 --- a/src/mesa/vbo/vbo_attrib_tmp.h +++ b/src/mesa/vbo/vbo_attrib_tmp.h @@ -61,12 +61,12 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. static inline float conv_ui10_to_norm_float(unsigned ui10) { - return (float)(ui10) / 1023.0; + return (float)(ui10) / 1023.0f; } static inline float conv_ui2_to_norm_float(unsigned ui2) { - return (float)(ui2) / 3.0; + return (float)(ui2) / 3.0f; } #define ATTRUI10_1( A, UI ) ATTR( A, 1, (UI) 0x3ff, 0, 0, 1 ) -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 8/8] mesa: use GLuint for more gl_constants fields
To silence assorted MSVC warnings. --- src/mesa/main/mtypes.h | 12 ++-- 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index c3378cd..7f2adc7 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2763,12 +2763,12 @@ struct gl_program_constants */ struct gl_constants { - GLint MaxTextureMbytes; /** Max memory per image, in MB */ - GLint MaxTextureLevels; /** Max mipmap levels. */ - GLint Max3DTextureLevels;/** Max mipmap levels for 3D textures */ - GLint MaxCubeTextureLevels; /** Max mipmap levels for cube textures */ - GLint MaxArrayTextureLayers; /** Max layers in array textures */ - GLint MaxTextureRectSize;/** Max rectangle texture size, in pixes */ + GLuint MaxTextureMbytes; /** Max memory per image, in MB */ + GLuint MaxTextureLevels; /** Max mipmap levels. */ + GLuint Max3DTextureLevels;/** Max mipmap levels for 3D textures */ + GLuint MaxCubeTextureLevels; /** Max mipmap levels for cube textures */ + GLuint MaxArrayTextureLayers; /** Max layers in array textures */ + GLuint MaxTextureRectSize;/** Max rectangle texture size, in pixes */ GLuint MaxTextureCoordUnits; GLuint MaxTextureImageUnits; GLuint MaxVertexTextureImageUnits; -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] mesa: remove array size so the static assert can work
With the explit NUM_TEXTURE_TARGETS array size, the assertion that Elements(targets) == NUM_TEXTURE_TARGETS would pass even if elements were missing. --- src/mesa/main/shared.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index fab2995..2d2f7bd 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -89,7 +89,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx) /* Create default texture objects */ for (i = 0; i NUM_TEXTURE_TARGETS; i++) { /* NOTE: the order of these enums matches the TEXTURE_x_INDEX values */ - static const GLenum targets[NUM_TEXTURE_TARGETS] = { + static const GLenum targets[] = { GL_TEXTURE_BUFFER, GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_1D_ARRAY_EXT, -- 1.7.3.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] gallium/auxiliary: Fix build with newer LLVM.
rtti was removed from more llvm libraries. Thanks to d0k for the hint via IRC #llvm on irc.oftc.net --- src/gallium/auxiliary/Makefile |4 1 Datei geändert, 4 Zeilen hinzugefügt(+) diff --git a/src/gallium/auxiliary/Makefile b/src/gallium/auxiliary/Makefile index 3ba3f9c..690b7f5 100644 --- a/src/gallium/auxiliary/Makefile +++ b/src/gallium/auxiliary/Makefile @@ -3,6 +3,10 @@ include $(TOP)/configs/current LIBNAME = gallium +ifeq ($(LLVM_VERSION),3.2) + CXXFLAGS += -fno-exceptions -fno-rtti +endif + # get source lists include Makefile.sources -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 55788] mesa fails to build against git version of xserver
https://bugs.freedesktop.org/show_bug.cgi?id=55788 --- Comment #3 from Marvin Schmidt marvin_schm...@gmx.net --- Created attachment 69161 -- https://bugs.freedesktop.org/attachment.cgi?id=69161action=edit remove miInitializeBackingStore call The fix has to be made in mesa, as the mentioned commit in xserver explains: commit 1cb0261ef54b7dd6a7ef84e1c3959e424706228b Author: Daniel Martin consume.no...@gmail.com Date: Thu Sep 6 00:38:26 2012 +0200 dix: Delete mibstore.h Since Nov 2010 (commit c4c4676) the only purpose of mibstore.h was to define an empty function (miInitializeBackingStore()) for backward compatibility. Time to say goodbye. Reviewed-by: Adam Jackson a...@redhat.com Signed-off-by: Keith Packard kei...@keithp.com and the previous definition of miInitializeBackingStore() shows [...] -#define miInitializeBackingStore(x) do {} while (0) - [...] I'm attaching a patch which removes the superfluous call and makes master build fine again -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 55788] mesa fails to build against git version of xserver
https://bugs.freedesktop.org/show_bug.cgi?id=55788 Marvin Schmidt marvin_schm...@gmx.net changed: What|Removed |Added Attachment #69161|0 |1 is obsolete|| --- Comment #4 from Marvin Schmidt marvin_schm...@gmx.net --- Created attachment 69164 -- https://bugs.freedesktop.org/attachment.cgi?id=69164action=edit remove miInitializeBackingStore call fix typo in commit message -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] glsl: Make access to type flyweight global state thread safe
On 10/25/2012 11:17 AM, Eric Anholt wrote: Ian Romanick i...@freedesktop.org writes: From: Ian Romanick ian.d.roman...@intel.com This should fix some problems related to compiling shaders in different contextes from multiple threads. This is pretty nasty. I think de-rallocing this file might end up nicer (we'd need a destructor that frees type-name and type-fields.whatever, and a hash walk that calls it in _mesa_glsl_release_types and frees the key string), then mutexes would only be needed for the structure/array hash table inserts with no recursion issues. Does that sound reasonable? Yeah...the random booleans everywhere is pretty nasty. This is usually the sort of thing you do as a last resort...let's try something else first. Eric's suggestion of de-rallocing makes sense to me. Making the fields allocated normally (new/delete/delete[] via ctors/dtors) is straightforward and removes the contention on mem_ctx. The top-level allocation of glsl_type objects appears to be done without ralloc already, which surprised me. At that point, you should really only have to lock the hash table insertions in get_array_instance() and get_record_instance(), which seems quite reasonable. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] r600g: tgsi-to-llvm emits right input intrinsics
--- src/gallium/drivers/r600/r600_llvm.c | 62 +++--- src/gallium/drivers/r600/r600_shader.c | 22 2 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 321966e..3dec8ae 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -90,11 +90,11 @@ llvm_face_select_helper( LLVMValueRef backcolor = llvm_load_input_helper( ctx, - llvm.R600.load.input, + intrinsic, backcolor_regiser); LLVMValueRef front_color = llvm_load_input_helper( ctx, - llvm.R600.load.input, + intrinsic, frontcolor_register); LLVMValueRef face = llvm_load_input_helper( ctx, @@ -120,6 +120,29 @@ static void llvm_load_input( { unsigned chan; + const char *intrinsics = llvm.R600.load.input; + unsigned offset = 4 * ctx-reserved_reg_count; + + if (ctx-type == TGSI_PROCESSOR_FRAGMENT ctx-chip_class = EVERGREEN) { + switch (decl-Interp.Interpolate) { + case TGSI_INTERPOLATE_COLOR: + case TGSI_INTERPOLATE_PERSPECTIVE: + offset = 0; + intrinsics = llvm.R600.load.input.perspective; + break; + case TGSI_INTERPOLATE_LINEAR: + offset = 0; + intrinsics = llvm.R600.load.input.linear; + break; + case TGSI_INTERPOLATE_CONSTANT: + offset = 0; + intrinsics = llvm.R600.load.input.constant; + break; + default: + assert(0 Unknow Interpolate mode); + } + } + for (chan = 0; chan 4; chan++) { unsigned soa_index = radeon_llvm_reg_index_soa(input_index, chan); @@ -145,24 +168,37 @@ static void llvm_load_input( break; case TGSI_SEMANTIC_COLOR: if (ctx-two_side) { + unsigned front_location, back_location; unsigned back_reg = ctx-r600_inputs[input_index] .potential_back_facing_reg; - unsigned back_soa_index = radeon_llvm_reg_index_soa( - ctx-r600_inputs[back_reg].gpr, - chan); + if (ctx-chip_class = EVERGREEN) { + front_location = 4 * ctx-r600_inputs[input_index].lds_pos + chan; + back_location = 4 * ctx-r600_inputs[back_reg].lds_pos + chan; + } else { + front_location = soa_index + 4 * ctx-reserved_reg_count; + back_location = radeon_llvm_reg_index_soa( + ctx-r600_inputs[back_reg].gpr, + chan); + } ctx-inputs[soa_index] = llvm_face_select_helper(ctx, - llvm.R600.load.input, - 4 * ctx-face_input, - soa_index + 4 * ctx-reserved_reg_count, - back_soa_index); + intrinsics, + 4 * ctx-face_input, front_location, back_location); break; } default: - /* The * 4 is assuming that we are in soa mode. */ - ctx-inputs[soa_index] = llvm_load_input_helper(ctx, - llvm.R600.load.input, - soa_index + (ctx-reserved_reg_count * 4)); + { + unsigned location; + if (ctx-chip_class = EVERGREEN) { + location = 4 * ctx-r600_inputs[input_index].lds_pos + chan; + } else { + location = soa_index + 4 * ctx-reserved_reg_count; + } + /* The * 4 is assuming that we are in soa mode. */ + ctx-inputs[soa_index] = llvm_load_input_helper(ctx, + intrinsics, location); + break; + } } } } diff --git
Re: [Mesa-dev] [PATCH 3/7] r600g: fix evergreen 8x MSAA sample positions
On Tue, Aug 28, 2012 at 2:18 AM, Paul Berry stereotype...@gmail.com wrote: On 26 August 2012 18:04, Marek Olšák mar...@gmail.com wrote: On Thu, Aug 23, 2012 at 11:39 PM, Paul Berry stereotype...@gmail.com wrote: On 23 August 2012 10:42, Marek Olšák mar...@gmail.com wrote: On Thu, Aug 23, 2012 at 6:42 PM, Paul Berry stereotype...@gmail.com wrote: On 22 August 2012 18:54, Marek Olšák mar...@gmail.com wrote: The original samples positions took samples outside of the pixel boundary, leading to dark pixels on the edge of the colorbuffer, among other things. Does this address the issues you were having with the error thresholds in the EXT_framebuffer_multisample piglit tests (Re: your Aug 13 email [Piglit] [PATCH] ext_framebuffer_multisample: relax MSAA precision)? Yes, it does. The accuracy tests now pass for me. Marek Excellent. Glad to hear it. Sorry, the tests actually don't pass, I tested with the piglit patch applied. :( However this patch reduces the error quite a lot, it's just not enough. I guess I have to choose the sample positions very carefully. Marek If it helps any, here are the positions I used for 8x MSAA on Intel hardware (from src/mesa/drivers/dri/i965/gen6_multisample_state.c). I don't know what the capabilities of r600g are, but if it can reproduce the same sample positions that would be a nice quick way to double check whether the remaining inaccuracy is caused by sample positions: * Sample positions: * 1 3 5 7 9 b d f * 1 5 * 3 2 * 5 6 * 7 4 * 9 0 * b 3 * d 1 * f 7 Intel hardware specifies the sample positions in offsets of 1/16 pixel, with 8=pixel center, so for example in the above diagram, sample number 2 has x coordinate of 0xb, meaning 3/16 pixel to the right of center. I *think* that means you'll have to subtract 8 from each coordinate to get the values you want to use on r600g. Here's the results I get for ext_framebuffer_multisample-accuracy 8 color on Ivy Bridge: Pixels that should be unlit count = 214644 Perfect output Pixels that should be totally lit count = 28972 Perfect output Pixels that should be partially lit count = 18528 RMS error = 0.060891 The error threshold for this test is 0.071928 I also tried using your sample positions with the Intel driver (I think I'm interpreting eg_sample_locs_8x correctly), and I got these results: Pixels that should be unlit count = 214644 Perfect output Pixels that should be totally lit count = 28972 Perfect output Pixels that should be partially lit count = 18528 RMS error = 0.068037 The error threshold for this test is 0.071928 Which also passes, but by a narrower margin. I'm curious what results you are getting. Perhaps there is a problem with downsampling? There was another issue. The hardware operated at very small subsample precision, leading to sample positions being rounded or something. I don't really know how exactly it works. The good thing is it has been fixed. Now I get 0.061324 with your sample positions and 0.067873 with mine. Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] xlib: Do not undefine _R, _G, and _B.
Fixes build error on Cygwin and Solaris. _R, _G, and _B are used in ctype.h on those platforms. Signed-off-by: Vinson Lee v...@freedesktop.org --- src/mesa/drivers/x11/xfonts.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index 9957e89..a92d24a 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -41,9 +41,6 @@ /* Some debugging info. */ #ifdef DEBUG -#undef _R -#undef _G -#undef _B #include ctype.h int debug_xfonts = 0; -- 1.7.9 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] scons: Add -fno-rtti to CXXFLAGS with llvm-3.2.
llvm-3.2svn r166772 no longer requires RTTI for lib/Support. Signed-off-by: Vinson Lee v...@freedesktop.org --- scons/llvm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scons/llvm.py b/scons/llvm.py index f87766a..e1ed760 100644 --- a/scons/llvm.py +++ b/scons/llvm.py @@ -183,6 +183,9 @@ def generate(env): if llvm_version = distutils.version.LooseVersion('3.1'): components.append('mcjit') +if llvm_version = distutils.version.LooseVersion('3.2'): +env.Append(CXXFLAGS = ('-fno-rtti',)) + env.ParseConfig('llvm-config --libs ' + ' '.join(components)) env.ParseConfig('llvm-config --ldflags') except OSError: -- 1.7.12.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] r600g: avoid shader needing too many gpr to lockup the gpu
On Fri, Oct 26, 2012 at 10:01 PM, j.gli...@gmail.com wrote: From: Jerome Glisse jgli...@redhat.com On r6xx/r7xx shader resource management need to make sure that the shader does not goes over the gpr register limit. Each specific asic has a maxmimum register that can be split btw shader stage. For each stage the shader must not use more register than the limit programmed. We may also want to add a new parameter to the radeon info ioctl to fetch the GPR limit for each asic. Alex Signed-off-by: Jerome Glisse jgli...@redhat.com --- src/gallium/drivers/r600/r600_pipe.h | 1 + src/gallium/drivers/r600/r600_state.c| 60 +++- src/gallium/drivers/r600/r600_state_common.c | 22 +- 3 files changed, 55 insertions(+), 28 deletions(-) diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index ff2a5fd..2045af3 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -363,6 +363,7 @@ struct r600_context { enum chip_class chip_class; boolean has_vertex_cache; boolean keep_tiling_flags; + booldiscard_draw; unsigneddefault_ps_gprs, default_vs_gprs; unsignedr6xx_num_clause_temp_gprs; unsignedbackend_mask; diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 7d07008..43af934 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -2189,30 +2189,54 @@ void r600_init_state_functions(struct r600_context *rctx) /* Adjust GPR allocation on R6xx/R7xx */ void r600_adjust_gprs(struct r600_context *rctx) { - unsigned num_ps_gprs = rctx-default_ps_gprs; - unsigned num_vs_gprs = rctx-default_vs_gprs; + unsigned num_ps_gprs = rctx-ps_shader-current-shader.bc.ngpr; + unsigned num_vs_gprs = rctx-vs_shader-current-shader.bc.ngpr; + unsigned new_num_ps_gprs = num_ps_gprs; + unsigned new_num_vs_gprs = num_vs_gprs; + unsigned cur_num_ps_gprs = G_008C04_NUM_PS_GPRS(rctx-config_state.sq_gpr_resource_mgmt_1); + unsigned cur_num_vs_gprs = G_008C04_NUM_VS_GPRS(rctx-config_state.sq_gpr_resource_mgmt_1); + unsigned def_num_ps_gprs = rctx-default_ps_gprs; + unsigned def_num_vs_gprs = rctx-default_vs_gprs; + unsigned def_num_clause_temp_gprs = rctx-r6xx_num_clause_temp_gprs; + /* hardware will reserve twice num_clause_temp_gprs */ + unsigned max_gprs = def_num_ps_gprs + def_num_vs_gprs + def_num_clause_temp_gprs * 2; unsigned tmp; - int diff; - if (rctx-ps_shader-current-shader.bc.ngpr rctx-default_ps_gprs) { - diff = rctx-ps_shader-current-shader.bc.ngpr - rctx-default_ps_gprs; - num_vs_gprs -= diff; - num_ps_gprs += diff; + /* the sum of all SQ_GPR_RESOURCE_MGMT*.NUM_*_GPRS must = to max_gprs */ + if (new_num_ps_gprs cur_num_ps_gprs || new_num_vs_gprs cur_num_vs_gprs) { + /* try to use switch back to default */ + if (new_num_ps_gprs def_num_ps_gprs || new_num_vs_gprs def_num_vs_gprs) { + /* always privilege vs stage so that at worst we have the +* pixel stage producing wrong output (not the vertex +* stage) */ + new_num_ps_gprs = max_gprs - (new_num_vs_gprs + def_num_clause_temp_gprs * 2); + new_num_vs_gprs = num_vs_gprs; + } else { + new_num_ps_gprs = def_num_ps_gprs; + new_num_vs_gprs = def_num_vs_gprs; + } + } else { + rctx-discard_draw = false; + return; } - if (rctx-vs_shader-current-shader.bc.ngpr rctx-default_vs_gprs) - { - diff = rctx-vs_shader-current-shader.bc.ngpr - rctx-default_vs_gprs; - num_ps_gprs -= diff; - num_vs_gprs += diff; + /* SQ_PGM_RESOURCES_*.NUM_GPRS must always be program to a value = +* SQ_GPR_RESOURCE_MGMT*.NUM_*_GPRS otherwise the GPU will lockup +* Also if a shader use more gpr than SQ_GPR_RESOURCE_MGMT*.NUM_*_GPRS +* it will lockup. So in this case just discard the draw command +* and don't change the current gprs repartitions. +*/ + rctx-discard_draw = false; + if (num_ps_gprs new_num_ps_gprs || num_vs_gprs new_num_vs_gprs) { + rctx-discard_draw = true; + return; } - tmp = 0; - tmp |= S_008C04_NUM_PS_GPRS(num_ps_gprs); - tmp |= S_008C04_NUM_VS_GPRS(num_vs_gprs); - tmp |=
[Mesa-dev] [PATCH] wayland: Destroy frame callback when destroying surface
If a frame callback is not destroyed when destroying a surface, its handler function will be invoked if the surface was destroyed after the callback was requested but before it was invoked, causing a write on free:ed memory. This can happen if eglDestroySurface() is called shortly after eglSwapBuffers(). --- Hi, This a one part of a two-part fix. Further explanation can be found here: http://lists.freedesktop.org/archives/wayland-devel/2012-October/006021.html Jonas src/egl/drivers/dri2/platform_wayland.c |3 +++ src/gallium/state_trackers/egl/wayland/native_wayland.c |3 +++ 2 files changed, 6 insertions(+) diff --git a/src/egl/drivers/dri2/platform_wayland.c b/src/egl/drivers/dri2/platform_wayland.c index 9153ef9..1c0ab38 100644 --- a/src/egl/drivers/dri2/platform_wayland.c +++ b/src/egl/drivers/dri2/platform_wayland.c @@ -213,6 +213,9 @@ dri2_destroy_surface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) dri2_surf-third_buffer); } + if (dri2_surf-frame_callback) + wl_callback_destroy(dri2_surf-frame_callback); + free(surf); return EGL_TRUE; diff --git a/src/gallium/state_trackers/egl/wayland/native_wayland.c b/src/gallium/state_trackers/egl/wayland/native_wayland.c index 62c87f3..560e40d 100644 --- a/src/gallium/state_trackers/egl/wayland/native_wayland.c +++ b/src/gallium/state_trackers/egl/wayland/native_wayland.c @@ -355,6 +355,9 @@ wayland_surface_destroy(struct native_surface *nsurf) wl_buffer_destroy(surface-buffer[buffer]); } + if (surface-frame_callback) + wl_callback_destroy(surface-frame_callback); + resource_surface_destroy(surface-rsurf); FREE(surface); } -- 1.7.10.4 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] R600 tiling halves the frame rate
On 10/26/2012 08:45 PM, Jerome Glisse wrote: This is interesting. All I am doing is rotating a big texture on the screen. I am using EGL+Gallium, so it is as simple as it gets. The hack I am using to disable texture tiling is also extremely simple (see below). It speeds up the FPS measurably, up to the extreme case of doubling it on HD6460. What am I missing? Regards, Tzvetan Could you provide a simple gl demo or point to one that shows the same behavior with your patch. So i have something to know if i am reproducing or not Cheers, Jerome The source of my test app is included below. thanks! Tzvetan #include EGL/egl.h #include EGL/eglmesaext.h #include GL/gl.h #include stdio.h #include string.h #include sys/time.h #include stdint.h #include err.h #include unistd.h #include assert.h #include stdarg.h #include stdlib.h #define NELEM(x) (sizeof(x) / sizeof((x)[0])) #define TW 1024 #define TH 768 static GLubyte texImg[TH][TW][4]; static GLuint texName; static void makeTexImg () { for ( int i = 0; i TH; ++i ) for ( int j = 0; j TW; ++j ) { int c = (((i8)==0) ^ ((j8)==0)) * 255; texImg[i][j][0] = 0; texImg[i][j][1] = (GLubyte)c; texImg[i][j][2] = 0; texImg[i][j][3] = 255; } } static void init () { makeTexImg(); glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); glPixelStorei( GL_UNPACK_ROW_LENGTH, TW ); glGenTextures( 1, texName ); glBindTexture( GL_TEXTURE_2D, texName ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, TW, TH, 0, GL_RGBA, GL_UNSIGNED_BYTE, texImg ); glClearColor( 0, 0, 0, 0 ); glShadeModel( GL_FLAT ); glEnable( GL_DEPTH_TEST ); } static void reshape ( int w, int h ) { glViewport( 0, 0, (GLsizei)w, (GLsizei)h ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho( 0, 1, 0, 1, -1, 1 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); } static void rect () { glBegin( GL_QUADS ); glTexCoord2f( 0, 1 ); glVertex3f( 0, 0, 0.0 ); glTexCoord2f( 1, 1 ); glVertex3f( 1, 0, 0.0 ); glTexCoord2f( 1, 0 ); glVertex3f( 1, 1, 0.0 ); glTexCoord2f( 0, 0 ); glVertex3f( 0, 1, 0.0 ); glEnd(); } static void display ( float angle ) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glEnable( GL_TEXTURE_2D ); glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glBindTexture( GL_TEXTURE_2D, texName ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glPushMatrix(); glTranslatef( 0.1, 0.1, 0 ); glScalef( 0.8, 0.8, 1 ); rect(); glPopMatrix(); glTranslatef( 0.1, 0.1, 0 ); glTranslatef( 0.4, 0.4, 0 ); glRotatef( angle, 0, 0, 1 ); glTranslatef( -0.4, -0.4, 0 ); glScalef( 0.8, 0.8, 1 ); glTranslatef( 0, 0, -0.2 ); rect(); } static void errEgl ( int code, const char * msg, ... ) { va_list ap; EGLint err = eglGetError(); va_start( ap, msg ); vfprintf( stderr, msg, ap ); fprintf( stderr, : EGL error %d\n, (int)err ); va_end( ap ); exit( code ); } static uint32_t getTickMs () { struct timeval tv; gettimeofday( tv, NULL ); return tv.tv_sec * 1000 + tv.tv_usec/1000; } int main(int argc, char** argv) { EGLDisplay dpy = eglGetDisplay( EGL_DEFAULT_DISPLAY ); assert( dpy ); EGLint major, minor; if (!eglInitialize( dpy, major, minor )) errEgl( 1, eglInitialize ); printf( EGL version = %d.%d\n, major, minor ); printf( EGL_VENDOR = %s\n, eglQueryString( dpy, EGL_VENDOR ) ); if (!strstr( eglQueryString( dpy, EGL_EXTENSIONS ),EGL_MESA_screen_surface)) errEgl( 1, EGL_MESA_screen_surface is not supported ); EGLConfig configs[32]; EGLint numConfigs; if (!eglGetConfigs( dpy, configs, NELEM(configs), numConfigs )) errEgl( 1, eglGetConfigs ); EGLScreenMESA screens[16]; EGLint numScreens; if (!eglGetScreensMESA( dpy, screens, NELEM(screens), numScreens )) errEgl( 1, eglGetScreensMESA ); EGLModeMESA modes[16]; EGLint numModes; if (!eglGetModesMESA( dpy, screens[0], modes, NELEM(modes), numModes )) errEgl( 1, eglGetModesMESA ); if (!eglBindAPI( EGL_OPENGL_API )) errEgl( 1, eglBindAPI ); EGLContext ctx; if ( (ctx = eglCreateContext( dpy, configs[0], NULL, NULL )) == EGL_NO_CONTEXT) errEgl( 1, eglCreateContext ); EGLint attribs[32], * pa; pa = attribs; *pa++ = EGL_WIDTH; eglGetModeAttribMESA( dpy, modes[0], EGL_WIDTH, pa++ ); *pa++ = EGL_HEIGHT; eglGetModeAttribMESA( dpy, modes[0], EGL_HEIGHT, pa++ ); *pa++ = EGL_NONE; EGLSurface screenSurf; if ( (screenSurf = eglCreateScreenSurfaceMESA( dpy, configs[0], attribs )) == EGL_NO_SURFACE) errEgl( 1, eglCreateScreenSurfaceMESA ); eglSurfaceAttrib( dpy, screenSurf, EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED ); if
Re: [Mesa-dev] R600 tiling halves the frame rate
On 10/27/2012 06:58 AM, Marek Olšák wrote: If you upload the texture every frame, set pipe_resource::usage to PIPE_USAGE_STAGING. That will make the texture linear. Marek No, I am not uploading it for every frame. It is a static texture. I am getting only 35 FPS on a HD6460, which is pathetic. When I disable tiling I am up to 70 FPS though (which is still pretty low, technically). regards, Tzvetan ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] xlib: Do not undefine _R, _G, and _B.
On 10/27/2012 01:01 PM, Vinson Lee wrote: Fixes build error on Cygwin and Solaris. _R, _G, and _B are used in ctype.h on those platforms. Signed-off-by: Vinson Lee v...@freedesktop.org --- src/mesa/drivers/x11/xfonts.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index 9957e89..a92d24a 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -41,9 +41,6 @@ /* Some debugging info. */ #ifdef DEBUG -#undef _R -#undef _G -#undef _B #include ctype.h int debug_xfonts = 0; I'm somewhat skeptical that ctype.h actually needs _R, _G, and _B macros defined...and if it does, I'm -really- skeptical that we're #define'ing them to the expected values. We probably define macros that have a different meaning... ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] R600 tiling halves the frame rate
On Sat, Oct 27, 2012 at 4:51 PM, Tzvetan Mikov tmi...@jupiter.com wrote: On 10/26/2012 08:45 PM, Jerome Glisse wrote: This is interesting. All I am doing is rotating a big texture on the screen. I am using EGL+Gallium, so it is as simple as it gets. The hack I am using to disable texture tiling is also extremely simple (see below). It speeds up the FPS measurably, up to the extreme case of doubling it on HD6460. What am I missing? Regards, Tzvetan Could you provide a simple gl demo or point to one that shows the same behavior with your patch. So i have something to know if i am reproducing or not Cheers, Jerome The source of my test app is included below. thanks! Tzvetan #include EGL/egl.h #include EGL/eglmesaext.h #include GL/gl.h #include stdio.h #include string.h #include sys/time.h #include stdint.h #include err.h #include unistd.h #include assert.h #include stdarg.h #include stdlib.h #define NELEM(x) (sizeof(x) / sizeof((x)[0])) #define TW 1024 #define TH 768 static GLubyte texImg[TH][TW][4]; static GLuint texName; static void makeTexImg () { for ( int i = 0; i TH; ++i ) for ( int j = 0; j TW; ++j ) { int c = (((i8)==0) ^ ((j8)==0)) * 255; texImg[i][j][0] = 0; texImg[i][j][1] = (GLubyte)c; texImg[i][j][2] = 0; texImg[i][j][3] = 255; } } static void init () { makeTexImg(); glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); glPixelStorei( GL_UNPACK_ROW_LENGTH, TW ); glGenTextures( 1, texName ); glBindTexture( GL_TEXTURE_2D, texName ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR ); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, TW, TH, 0, GL_RGBA, GL_UNSIGNED_BYTE, texImg ); glClearColor( 0, 0, 0, 0 ); glShadeModel( GL_FLAT ); glEnable( GL_DEPTH_TEST ); } static void reshape ( int w, int h ) { glViewport( 0, 0, (GLsizei)w, (GLsizei)h ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho( 0, 1, 0, 1, -1, 1 ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); } static void rect () { glBegin( GL_QUADS ); glTexCoord2f( 0, 1 ); glVertex3f( 0, 0, 0.0 ); glTexCoord2f( 1, 1 ); glVertex3f( 1, 0, 0.0 ); glTexCoord2f( 1, 0 ); glVertex3f( 1, 1, 0.0 ); glTexCoord2f( 0, 0 ); glVertex3f( 0, 1, 0.0 ); glEnd(); } static void display ( float angle ) { glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); glEnable( GL_TEXTURE_2D ); glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE ); glBindTexture( GL_TEXTURE_2D, texName ); glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glPushMatrix(); glTranslatef( 0.1, 0.1, 0 ); glScalef( 0.8, 0.8, 1 ); rect(); glPopMatrix(); glTranslatef( 0.1, 0.1, 0 ); glTranslatef( 0.4, 0.4, 0 ); glRotatef( angle, 0, 0, 1 ); glTranslatef( -0.4, -0.4, 0 ); glScalef( 0.8, 0.8, 1 ); glTranslatef( 0, 0, -0.2 ); rect(); } static void errEgl ( int code, const char * msg, ... ) { va_list ap; EGLint err = eglGetError(); va_start( ap, msg ); vfprintf( stderr, msg, ap ); fprintf( stderr, : EGL error %d\n, (int)err ); va_end( ap ); exit( code ); } static uint32_t getTickMs () { struct timeval tv; gettimeofday( tv, NULL ); return tv.tv_sec * 1000 + tv.tv_usec/1000; } int main(int argc, char** argv) { EGLDisplay dpy = eglGetDisplay( EGL_DEFAULT_DISPLAY ); assert( dpy ); EGLint major, minor; if (!eglInitialize( dpy, major, minor )) errEgl( 1, eglInitialize ); printf( EGL version = %d.%d\n, major, minor ); printf( EGL_VENDOR = %s\n, eglQueryString( dpy, EGL_VENDOR ) ); if (!strstr( eglQueryString( dpy, EGL_EXTENSIONS ),EGL_MESA_screen_surface)) errEgl( 1, EGL_MESA_screen_surface is not supported ); EGLConfig configs[32]; EGLint numConfigs; if (!eglGetConfigs( dpy, configs, NELEM(configs), numConfigs )) errEgl( 1, eglGetConfigs ); EGLScreenMESA screens[16]; EGLint numScreens; if (!eglGetScreensMESA( dpy, screens, NELEM(screens), numScreens )) errEgl( 1, eglGetScreensMESA ); EGLModeMESA modes[16]; EGLint numModes; if (!eglGetModesMESA( dpy, screens[0], modes, NELEM(modes), numModes )) errEgl( 1, eglGetModesMESA ); if (!eglBindAPI( EGL_OPENGL_API )) errEgl( 1, eglBindAPI ); EGLContext ctx; if ( (ctx = eglCreateContext( dpy, configs[0], NULL, NULL )) == EGL_NO_CONTEXT) errEgl( 1, eglCreateContext ); EGLint attribs[32], * pa; pa = attribs; *pa++ = EGL_WIDTH; eglGetModeAttribMESA( dpy, modes[0], EGL_WIDTH, pa++ ); *pa++ = EGL_HEIGHT; eglGetModeAttribMESA( dpy, modes[0], EGL_HEIGHT, pa++ ); *pa++ = EGL_NONE; EGLSurface screenSurf; if ( (screenSurf =
Re: [Mesa-dev] [PATCH] xlib: Do not undefine _R, _G, and _B.
On Sat, Oct 27, 2012 at 7:15 PM, Kenneth Graunke kenn...@whitecape.org wrote: On 10/27/2012 01:01 PM, Vinson Lee wrote: Fixes build error on Cygwin and Solaris. _R, _G, and _B are used in ctype.h on those platforms. Signed-off-by: Vinson Lee v...@freedesktop.org --- src/mesa/drivers/x11/xfonts.c |3 --- 1 files changed, 0 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index 9957e89..a92d24a 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -41,9 +41,6 @@ /* Some debugging info. */ #ifdef DEBUG -#undef _R -#undef _G -#undef _B #include ctype.h int debug_xfonts = 0; I'm somewhat skeptical that ctype.h actually needs _R, _G, and _B macros defined...and if it does, I'm -really- skeptical that we're #define'ing them to the expected values. We probably define macros that have a different meaning... I think what is happening is ctype.h is already include indirectly through another header. xfonts.c undefines _B. dump_font_struct uses the function isprint which is a macro from ctype.h that uses _B. The build error occurs because _B was undefined. Here is the build error. src/mesa/drivers/x11/xfonts.c: In function ‘dump_font_struct’: src/mesa/drivers/x11/xfonts.c:69:12: error: ‘_B’ undeclared (first use in this function) xfonts.c 60 static void 61 dump_font_struct(XFontStruct * font) [...] 68 printf(default_char = %c (\\%03o)\n, 69(char) (isprint(font-default_char) ? font-default_char : ' '), 70font-default_char); ctype.h 40 #define _B 0200 [...] 67 #define isprint(__c)(__ctype_lookup(__c)(_P|_U|_L|_N|_B)) Kenneth, what do you think is the right approach here to fix the build error? ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev