Mesa (master): gallivm: honor explicit derivatives values for cube maps.
Module: Mesa Branch: master Commit: ce5096a0a959b97f70c3df46a35bfe694e8c349c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce5096a0a959b97f70c3df46a35bfe694e8c349c Author: Roland Scheidegger Date: Thu Apr 4 00:56:23 2013 +0200 gallivm: honor explicit derivatives values for cube maps. This is trivial now, though need to make sure we pass all the necessary derivative values (which is 3 each for ddx/ddy not 2). Passes piglit arb_shader_texture_lod-texgradcube test. v2: add the forgotten abs() for all incoming derivatives (discovered by new piglit arb_shader_texture_lod-texgradcube test, though more by luck as it was failing only for exactly one pixel...). Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 19 -- src/gallium/auxiliary/gallivm/lp_bld_sample.h |1 + src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |2 +- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 66 ++--- 4 files changed, 60 insertions(+), 28 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 5d50921..fe29d25 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -1287,6 +1287,7 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, + const struct lp_derivatives *derivs, /* optional */ LLVMValueRef *face, LLVMValueRef *face_s, LLVMValueRef *face_t, @@ -1296,7 +1297,6 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, LLVMBuilderRef builder = bld->gallivm->builder; struct gallivm_state *gallivm = bld->gallivm; LLVMValueRef si, ti, ri; - boolean implicit_derivs = TRUE; boolean need_derivs = TRUE; if (1 || coord_bld->type.length > 4) { @@ -1334,9 +1334,9 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, assert(PIPE_TEX_FACE_NEG_Z == PIPE_TEX_FACE_POS_Z + 1); /* - * TODO do this only when needed, and implement explicit derivs (trivial). + * TODO do this only when needed. */ - if (need_derivs && implicit_derivs) { + if (need_derivs && !derivs) { LLVMValueRef ddx_ddy[2], tmp[2]; /* * This isn't quite the same as the "ordinary" path since @@ -1374,9 +1374,16 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, dmax[2] = lp_build_max(coord_bld, tmp[0], tmp[1]); } else if (need_derivs) { - /* dmax[0] = lp_build_max(coord_bld, derivs->ddx[0], derivs->ddy[0]); - dmax[1] = lp_build_max(coord_bld, derivs->ddx[1], derivs->ddy[1]); - dmax[2] = lp_build_max(coord_bld, derivs->ddx[2], derivs->ddy[2]); */ + LLVMValueRef abs_ddx[3], abs_ddy[3]; + abs_ddx[0] = lp_build_abs(coord_bld, derivs->ddx[0]); + abs_ddx[1] = lp_build_abs(coord_bld, derivs->ddx[1]); + abs_ddx[2] = lp_build_abs(coord_bld, derivs->ddx[2]); + abs_ddy[0] = lp_build_abs(coord_bld, derivs->ddy[0]); + abs_ddy[1] = lp_build_abs(coord_bld, derivs->ddy[1]); + abs_ddy[2] = lp_build_abs(coord_bld, derivs->ddy[2]); + dmax[0] = lp_build_max(coord_bld, abs_ddx[0], abs_ddy[0]); + dmax[1] = lp_build_max(coord_bld, abs_ddx[1], abs_ddy[1]); + dmax[2] = lp_build_max(coord_bld, abs_ddx[2], abs_ddy[2]); } si = LLVMBuildBitCast(builder, s, lp_build_vec_type(gallivm, intctype), ""); diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.h b/src/gallium/auxiliary/gallivm/lp_bld_sample.h index 5026b0a..72af813 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.h +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.h @@ -433,6 +433,7 @@ lp_build_cube_lookup(struct lp_build_sample_context *bld, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, + const struct lp_derivatives *derivs, /* optional */ LLVMValueRef *face, LLVMValueRef *face_s, LLVMValueRef *face_t, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c index 3b950ea..d2cc0f3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c @@ -1102,7 +1102,7 @@ lp_build_sample_common(struct lp_build_sample_context *bld, */ if (target == PIPE_TEXTURE_CUBE) { LLVMValueRef face, face_s, face_t; - lp_build_cube_lookup(bld, *s, *t, *r, &face, &face_s, &face_t, &cube_rho); + lp_build_cube_lookup(bld, *s, *t, *r, derivs, &face, &face_s, &face_t, &cube_rho); *s = face_s; /* vec */ *t = face_t; /* vec */ /* use 'r' to indicate cube face */ diff --
Mesa (master): gallivm: do per-pixel cube face selection (finally!!!)
Module: Mesa Branch: master Commit: f621015cb55ed6901f571710c808113129b1b939 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f621015cb55ed6901f571710c808113129b1b939 Author: Roland Scheidegger Date: Wed Apr 3 03:26:22 2013 +0200 gallivm: do per-pixel cube face selection (finally!!!) This proved to be tricky, the problem is that after selection/mirroring we cannot calculate reasonable derivatives (if not all pixels in a quad end up on the same face the derivatives could get "randomly" exceedingly large). However, it is actually quite easy to simply calculate the derivatives before selection/mirroring and then transform them similar to the cube coordinates (they only need selection/projection, but not mirroring as we're not interested in the sign bit, of course). While there is a tiny bit more work to do (need to calculate derivs for 3 coords instead of 2, and additional selects) it also simplifies things somewhat for the coord selection itself (as we save some broadcast aos shuffles, and we don't need to calculate the average vector) - hence if derivatives aren't needed this should actually be faster. Also, this has the benefit that this will (trivially) work for explicit derivatives too, which we completely ignored before that (will be in a separate commit for better trackability). Note that while the way for getting rho looks very different, it should result in "nearly" the same values as before (the "nearly" is only because before the code would choose the face based on an "average" vector and hence the derivatives calculated according to this face, where now (for implicit derivatives) the derivatives are projected on the face selected for the first (top-left) pixel in a quad, so not necessarly the same face). The transformation done might not quite be state-of-the-art, calculating length(dx,dy) as max(dx,dy) certainly isn't neither but this stays the same as before (that is I think a better transform would _somehow_ take the "derivative major axis" into account so that derivative changes in the major axis wouldn't get ignored). Should solve some accuracy problems with cubemaps (can easily be seen with the cubemap demo when switching wrapping/filtering), though we still don't do seamless filtering to fix it completely (so not per-sample but per-pixel is certainly better than per-quad and already sufficient for accurate results with nearest tex filter). As for performance, it seems to be a tiny bit faster too (maybe 3% or so with cubemap demo). Which I'd have expected with nearest/nearest filtering where this will be less instructions, but the difference seems to actually be larger with linear/linear_mipmap_linear where it is slightly more instructions, probably the code appears less serialized allowing better scheduling (on a sandy bridge cpu). It actually seems to be now at least as fast as the old path using a conditional when using 128bit vectors too (that is probably more a result of testing with a newer cpu though), for now that old path is still there but unused. No piglit regressions. Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 249 ++--- src/gallium/auxiliary/gallivm/lp_bld_sample.h |4 +- src/gallium/auxiliary/gallivm/lp_bld_sample_soa.c |9 +- 3 files changed, 180 insertions(+), 82 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 9a00897..5d50921 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -207,6 +207,7 @@ lp_build_rho(struct lp_build_sample_context *bld, LLVMValueRef s, LLVMValueRef t, LLVMValueRef r, + LLVMValueRef cube_rho, const struct lp_derivatives *derivs) { struct gallivm_state *gallivm = bld->gallivm; @@ -240,8 +241,22 @@ lp_build_rho(struct lp_build_sample_context *bld, int_size = lp_build_minify(int_size_bld, bld->int_size, first_level_vec); float_size = lp_build_int_to_float(float_size_bld, int_size); - /* XXX ignoring explicit derivs for cube maps for now */ - if (derivs && !(bld->static_texture_state->target == PIPE_TEXTURE_CUBE)) { + if (cube_rho) { + LLVMValueRef cubesize; + LLVMValueRef index0 = lp_build_const_int32(gallivm, 0); + /* + * If we have derivs too then we have per-pixel cube_rho - doesn't matter + * though until we do per-pixel lod. + * Cube map code did already everything except size mul and per-quad extraction. + */ + /* Could optimize this for single quad just skip the broadcast */ + cubesize = lp_build_extract_broadcast(gallivm, bld->float_size_in_type, +coord_bld->type, float_size, index0); + rho_vec = lp_build_mul(coord_bld, cubesize, cube_rho); + rho = lp_build_pack_aos_scalars(bld->gallivm, coord_bld->type, +
Mesa (master): gallivm: minor rho calculation optimization for 1 or 3 coords
Module: Mesa Branch: master Commit: bdfbeb9633eb3f8cf1ad76723f6c3839e57a08a3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bdfbeb9633eb3f8cf1ad76723f6c3839e57a08a3 Author: Roland Scheidegger Date: Wed Apr 3 02:49:56 2013 +0200 gallivm: minor rho calculation optimization for 1 or 3 coords Using a different packing for the single coord case should save a shuffle. Plus some minor style fixes. Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/gallivm/lp_bld_quad.c | 20 +++- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 31 ++-- 2 files changed, 22 insertions(+), 29 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_quad.c b/src/gallium/auxiliary/gallivm/lp_bld_quad.c index 1955add..f2a762a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_quad.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_quad.c @@ -81,7 +81,8 @@ lp_build_ddy(struct lp_build_context *bld, /* * Helper for building packed ddx/ddy vector for one coord (scalar per quad * values). The vector will look like this (8-wide): - * dr1dx dr1dy _ _ dr2dx dr2dy _ _ + * dr1dx _ -dr1dy _ dr2dx _ -dr2dy _ + * This only requires one shuffle instead of two for more straightforward packing. */ LLVMValueRef lp_build_packed_ddx_ddy_onecoord(struct lp_build_context *bld, @@ -91,19 +92,15 @@ lp_build_packed_ddx_ddy_onecoord(struct lp_build_context *bld, LLVMBuilderRef builder = gallivm->builder; LLVMValueRef vec1, vec2; - /* same packing as _twocoord, but can use aos swizzle helper */ + /* use aos swizzle helper */ - /* -* XXX could make swizzle1 a noop swizzle by using right top/bottom -* pair for ddy -*/ - static const unsigned char swizzle1[] = { - LP_BLD_QUAD_TOP_LEFT, LP_BLD_QUAD_TOP_LEFT, - LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE + static const unsigned char swizzle1[] = { /* no-op swizzle */ + LP_BLD_QUAD_TOP_LEFT, LP_BLD_SWIZZLE_DONTCARE, + LP_BLD_QUAD_BOTTOM_LEFT, LP_BLD_SWIZZLE_DONTCARE }; static const unsigned char swizzle2[] = { - LP_BLD_QUAD_TOP_RIGHT, LP_BLD_QUAD_BOTTOM_LEFT, - LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE + LP_BLD_QUAD_TOP_RIGHT, LP_BLD_SWIZZLE_DONTCARE, + LP_BLD_QUAD_TOP_LEFT, LP_BLD_SWIZZLE_DONTCARE }; vec1 = lp_build_swizzle_aos(bld, a, swizzle1); @@ -120,6 +117,7 @@ lp_build_packed_ddx_ddy_onecoord(struct lp_build_context *bld, * Helper for building packed ddx/ddy vector for one coord (scalar per quad * values). The vector will look like this (8-wide): * ds1dx ds1dy dt1dx dt1dy ds2dx ds2dy dt2dx dt2dy + * This only needs 2 (v)shufps. */ LLVMValueRef lp_build_packed_ddx_ddy_twocoord(struct lp_build_context *bld, diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index fc8bae7..9a00897 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -226,7 +226,6 @@ lp_build_rho(struct lp_build_sample_context *bld, LLVMValueRef int_size, float_size; LLVMValueRef rho; LLVMValueRef first_level, first_level_vec; - LLVMValueRef abs_ddx_ddy[2]; unsigned length = coord_bld->type.length; unsigned num_quads = length / 4; unsigned i; @@ -279,32 +278,28 @@ lp_build_rho(struct lp_build_sample_context *bld, ddx_ddy[0] = lp_build_packed_ddx_ddy_onecoord(coord_bld, s); } else if (dims >= 2) { - ddx_ddy[0] = lp_build_packed_ddx_ddy_twocoord(coord_bld, - s, t); + ddx_ddy[0] = lp_build_packed_ddx_ddy_twocoord(coord_bld, s, t); if (dims > 2) { ddx_ddy[1] = lp_build_packed_ddx_ddy_onecoord(coord_bld, r); } } - abs_ddx_ddy[0] = lp_build_abs(coord_bld, ddx_ddy[0]); + ddx_ddy[0] = lp_build_abs(coord_bld, ddx_ddy[0]); if (dims > 2) { - abs_ddx_ddy[1] = lp_build_abs(coord_bld, ddx_ddy[1]); - } - else { - abs_ddx_ddy[1] = NULL; + ddx_ddy[1] = lp_build_abs(coord_bld, ddx_ddy[1]); } - if (dims == 1) { - static const unsigned char swizzle1[] = { + if (dims < 2) { + static const unsigned char swizzle1[] = { /* no-op swizzle */ 0, LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE }; static const unsigned char swizzle2[] = { -1, LP_BLD_SWIZZLE_DONTCARE, +2, LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE, LP_BLD_SWIZZLE_DONTCARE }; - rho_xvec = lp_build_swizzle_aos(coord_bld, abs_ddx_ddy[0], swizzle1); - rho_yvec = lp_build_swizzle_aos(coord_bld, abs_ddx_ddy[0], swizzle2); + rho_xvec = lp_build_swizzle_aos(coord_bld, ddx_ddy[0], swizzle1); + rho_yvec = lp_build_swizzle_aos(coord_bld, ddx_ddy[0], swizzle2); } else if (dims
Mesa (master): gallivm: use f16c hw support for float->half and half-> float conversion
Module: Mesa Branch: master Commit: 067a0ae42017f327edce7634890e699b4ec8492c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=067a0ae42017f327edce7634890e699b4ec8492c Author: Roland Scheidegger Date: Wed Apr 3 01:06:52 2013 +0200 gallivm: use f16c hw support for float->half and half->float conversion Should be way faster of course on cpus supporting this (includes AMD Bulldozer and Jaguar cores, Intel Ivy Bridge and up (except budget models)). Passes piglit fbo-blending-formats GL_ARB_texture_float -auto on Ivy Bridge. Reviewed-by: Brian Paul --- src/gallium/auxiliary/gallivm/lp_bld_conv.c | 45 -- src/gallium/auxiliary/gallivm/lp_bld_init.c | 10 ++ src/gallium/auxiliary/util/u_cpu_detect.c |1 + src/gallium/auxiliary/util/u_cpu_detect.h |1 + 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index 38a577c..eb2d096 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -175,9 +175,24 @@ lp_build_half_to_float(struct gallivm_state *gallivm, struct lp_type f32_type = lp_type_float_vec(32, 32 * src_length); struct lp_type i32_type = lp_type_int_vec(32, 32 * src_length); LLVMTypeRef int_vec_type = lp_build_vec_type(gallivm, i32_type); + LLVMValueRef h; + + if (util_cpu_caps.has_f16c && HAVE_LLVM >= 0x0301 && + (src_length == 4 || src_length == 8)) { + const char *intrinsic = NULL; + if (src_length == 4) { + src = lp_build_pad_vector(gallivm, src, 8); + intrinsic = "llvm.x86.vcvtph2ps.128"; + } + else { + intrinsic = "llvm.x86.vcvtph2ps.256"; + } + return lp_build_intrinsic_unary(builder, intrinsic, + lp_build_vec_type(gallivm, f32_type), src); + } /* Convert int16 vector to int32 vector by zero ext (might generate bad code) */ - LLVMValueRef h = LLVMBuildZExt(builder, src, int_vec_type, ""); + h = LLVMBuildZExt(builder, src, int_vec_type, ""); return lp_build_smallfloat_to_float(gallivm, f32_type, h, 10, 5, 0, true); } @@ -204,9 +219,31 @@ lp_build_float_to_half(struct gallivm_state *gallivm, struct lp_type i16_type = lp_type_int_vec(16, 16 * length); LLVMValueRef result; - result = lp_build_float_to_smallfloat(gallivm, i32_type, src, 10, 5, 0, true); - /* Convert int32 vector to int16 vector by trunc (might generate bad code) */ - result = LLVMBuildTrunc(builder, result, lp_build_vec_type(gallivm, i16_type), ""); + if (util_cpu_caps.has_f16c && HAVE_LLVM >= 0x0301 && + (length == 4 || length == 8)) { + struct lp_type i168_type = lp_type_int_vec(16, 16 * 8); + unsigned mode = 3; /* same as LP_BUILD_ROUND_TRUNCATE */ + LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context); + const char *intrinsic = NULL; + if (length == 4) { + intrinsic = "llvm.x86.vcvtps2ph.128"; + } + else { + intrinsic = "llvm.x86.vcvtps2ph.256"; + } + result = lp_build_intrinsic_binary(builder, intrinsic, + lp_build_vec_type(gallivm, i168_type), + src, LLVMConstInt(i32t, mode, 0)); + if (length == 4) { + result = lp_build_extract_range(gallivm, result, 0, 4); + } + } + + else { + result = lp_build_float_to_smallfloat(gallivm, i32_type, src, 10, 5, 0, true); + /* Convert int32 vector to int16 vector by trunc (might generate bad code) */ + result = LLVMBuildTrunc(builder, result, lp_build_vec_type(gallivm, i16_type), ""); + } /* * Debugging code. diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 050eba7..4fa5887 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -468,6 +468,15 @@ lp_build_init(void) util_cpu_caps.has_avx = 0; } + if (!HAVE_AVX) { + /* + * note these instructions are VEX-only, so can only emit if we use + * avx (don't want to base it on has_avx & has_f16c later as that would + * omit it unnecessarily on amd cpus, see above). + */ + util_cpu_caps.has_f16c = 0; + } + #ifdef PIPE_ARCH_PPC_64 /* Set the NJ bit in VSCR to 0 so denormalized values are handled as * specified by IEEE standard (PowerISA 2.06 - Section 6.3). This garantees @@ -495,6 +504,7 @@ lp_build_init(void) util_cpu_caps.has_ssse3 = 0; util_cpu_caps.has_sse4_1 = 0; util_cpu_caps.has_avx = 0; + util_cpu_caps.has_f16c = 0; #endif } diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index 0328051..7e6df9d 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -279,6 +279,7 @@ util_cpu_det
Mesa (master): llvmpipe: reset so buffers when not appending
Module: Mesa Branch: master Commit: 246e68735fe22b4d9f510f8fb1bb8b7bb448b068 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=246e68735fe22b4d9f510f8fb1bb8b7bb448b068 Author: Zack Rusin Date: Sat Mar 30 00:21:03 2013 -0700 llvmpipe: reset so buffers when not appending We need to reset the internal state of the so buffers or we'll keep appending even though we're not supposed to. Signed-off-by: Zack Rusin Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/drivers/llvmpipe/lp_state_so.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_state_so.c b/src/gallium/drivers/llvmpipe/lp_state_so.c index 58bab39..fa58f79 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_so.c +++ b/src/gallium/drivers/llvmpipe/lp_state_so.c @@ -70,6 +70,12 @@ llvmpipe_set_so_targets(struct pipe_context *pipe, int i; for (i = 0; i < num_targets; i++) { pipe_so_target_reference((struct pipe_stream_output_target **)&llvmpipe->so_targets[i], targets[i]); + /* if we're not appending then lets reset the internal + data of our so target */ + if (!(append_bitmask & (1 << i)) && llvmpipe->so_targets[i]) { + llvmpipe->so_targets[i]->internal_offset = 0; + llvmpipe->so_targets[i]->emitted_vertices = 0; + } } for (; i < llvmpipe->num_so_targets; i++) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw/llvmpipe: allow independent so attachments to the vs
Module: Mesa Branch: master Commit: 302df7cc85b0e2ce47c40048f30bd116b0d692fc URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=302df7cc85b0e2ce47c40048f30bd116b0d692fc Author: Zack Rusin Date: Sat Mar 30 06:21:41 2013 -0700 draw/llvmpipe: allow independent so attachments to the vs When geometry shaders are present, one needs to be able to create an empty geometry shader with stream output that needs to be resolved later and attached to the currently bound vertex shader. Lets add support for it to llvmpipe and draw. draw allows attaching independent stream output info to any vertex shader and llvmpipe resolves at draw time which vertex shader the given empty geometry shader should be linked to. Signed-off-by: Zack Rusin Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_context.c |9 - src/gallium/auxiliary/draw/draw_context.h |7 +++ src/gallium/auxiliary/draw/draw_private.h |1 - src/gallium/auxiliary/draw/draw_vs.c | 13 + src/gallium/drivers/llvmpipe/lp_draw_arrays.c | 15 +++ src/gallium/drivers/llvmpipe/lp_state_gs.c| 19 +++ 6 files changed, 42 insertions(+), 22 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index bb56f1b..2fb9bac 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -735,15 +735,6 @@ draw_set_mapped_so_targets(struct draw_context *draw, } void -draw_set_so_state(struct draw_context *draw, - struct pipe_stream_output_info *state) -{ - memcpy(&draw->so.state, - state, - sizeof(struct pipe_stream_output_info)); -} - -void draw_set_sampler_views(struct draw_context *draw, unsigned shader_stage, struct pipe_sampler_view **views, diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 426fd44..1d25b7f 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -171,6 +171,9 @@ void draw_bind_vertex_shader(struct draw_context *draw, struct draw_vertex_shader *dvs); void draw_delete_vertex_shader(struct draw_context *draw, struct draw_vertex_shader *dvs); +void draw_vs_attach_so(struct draw_vertex_shader *dvs, + const struct pipe_stream_output_info *info); +void draw_vs_reset_so(struct draw_vertex_shader *dvs); /* @@ -226,10 +229,6 @@ draw_set_mapped_so_targets(struct draw_context *draw, int num_targets, struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]); -void -draw_set_so_state(struct draw_context *draw, - struct pipe_stream_output_info *state); - /*** * draw_pt.c diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h index 5063c3c..757ed26 100644 --- a/src/gallium/auxiliary/draw/draw_private.h +++ b/src/gallium/auxiliary/draw/draw_private.h @@ -279,7 +279,6 @@ struct draw_context /** Stream output (vertex feedback) state */ struct { - struct pipe_stream_output_info state; struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]; uint num_targets; } so; diff --git a/src/gallium/auxiliary/draw/draw_vs.c b/src/gallium/auxiliary/draw/draw_vs.c index 266cca7..afec376 100644 --- a/src/gallium/auxiliary/draw/draw_vs.c +++ b/src/gallium/auxiliary/draw/draw_vs.c @@ -245,3 +245,16 @@ draw_vs_get_emit( struct draw_context *draw, return draw->vs.emit; } + +void +draw_vs_attach_so(struct draw_vertex_shader *dvs, + const struct pipe_stream_output_info *info) +{ + dvs->state.stream_output = *info; +} + +void +draw_vs_reset_so(struct draw_vertex_shader *dvs) +{ + memset(&dvs->state.stream_output, 0, sizeof(dvs->state.stream_output)); +} diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c index ae00c49..efeca25 100644 --- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c +++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c @@ -101,6 +101,13 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) llvmpipe_prepare_geometry_sampling(lp, lp->num_sampler_views[PIPE_SHADER_GEOMETRY], lp->sampler_views[PIPE_SHADER_GEOMETRY]); + if (lp->gs && !lp->gs->shader.tokens) { + /* we have an empty geometry shader with stream output, so + attach the stream output info to the current vertex shader */ + if (lp->vs) { + draw_vs_attach_so(lp->vs->draw_data, &lp->gs->shader.stream_output); + } + } /* draw! */ draw_vbo(draw, info); @@
Mesa (master): draw: remove unused function
Module: Mesa Branch: master Commit: 7ca65a68e1bb9b53737facb9e787944cfeaec0aa URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ca65a68e1bb9b53737facb9e787944cfeaec0aa Author: Zack Rusin Date: Sat Mar 30 00:20:05 2013 -0700 draw: remove unused function we use draw_set_mapped_so_targets nowadays Signed-off-by: Zack Rusin Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_context.c |7 --- src/gallium/auxiliary/draw/draw_context.h |5 - 2 files changed, 0 insertions(+), 12 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.c b/src/gallium/auxiliary/draw/draw_context.c index ceb74df..bb56f1b 100644 --- a/src/gallium/auxiliary/draw/draw_context.c +++ b/src/gallium/auxiliary/draw/draw_context.c @@ -735,13 +735,6 @@ draw_set_mapped_so_targets(struct draw_context *draw, } void -draw_set_mapped_so_buffers(struct draw_context *draw, - void *buffers[PIPE_MAX_SO_BUFFERS], - unsigned num_buffers) -{ -} - -void draw_set_so_state(struct draw_context *draw, struct pipe_stream_output_info *state) { diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index b333457..426fd44 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -222,11 +222,6 @@ draw_set_mapped_constant_buffer(struct draw_context *draw, unsigned size); void -draw_set_mapped_so_buffers(struct draw_context *draw, - void *buffers[PIPE_MAX_SO_BUFFERS], - unsigned num_buffers); - -void draw_set_mapped_so_targets(struct draw_context *draw, int num_targets, struct draw_so_target *targets[PIPE_MAX_SO_BUFFERS]); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw/llvm: use an enum instead of magic numbers
Module: Mesa Branch: master Commit: b16ae0f792ed1980e86c45f9e3d203412b5a80d3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b16ae0f792ed1980e86c45f9e3d203412b5a80d3 Author: Zack Rusin Date: Fri Mar 29 19:33:34 2013 -0700 draw/llvm: use an enum instead of magic numbers I think this was there before and got accidently removed during a merge. Same code as for the GS context, which is also using an enum instead of hardcoded numbers. Signed-off-by: Zack Rusin Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c |8 src/gallium/auxiliary/draw/draw_llvm.h | 17 +++-- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index d0199bb..5100ce0 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -203,7 +203,7 @@ create_jit_context_type(struct gallivm_state *gallivm, { LLVMTargetDataRef target = gallivm->target; LLVMTypeRef float_type = LLVMFloatTypeInContext(gallivm->context); - LLVMTypeRef elem_types[5]; + LLVMTypeRef elem_types[DRAW_JIT_CTX_NUM_FIELDS]; LLVMTypeRef context_type; elem_types[0] = LLVMArrayType(LLVMPointerType(float_type, 0), /* vs_constants */ @@ -224,11 +224,11 @@ create_jit_context_type(struct gallivm_state *gallivm, #endif LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, vs_constants, - target, context_type, 0); + target, context_type, DRAW_JIT_CTX_CONSTANTS); LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, planes, - target, context_type, 1); + target, context_type, DRAW_JIT_CTX_PLANES); LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, viewport, - target, context_type, 2); + target, context_type, DRAW_JIT_CTX_VIEWPORT); LP_CHECK_MEMBER_OFFSET(struct draw_jit_context, textures, target, context_type, DRAW_JIT_CTX_TEXTURES); diff --git a/src/gallium/auxiliary/draw/draw_llvm.h b/src/gallium/auxiliary/draw/draw_llvm.h index 8df02a2..5909fc1 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.h +++ b/src/gallium/auxiliary/draw/draw_llvm.h @@ -130,18 +130,23 @@ struct draw_jit_context struct draw_jit_sampler samplers[PIPE_MAX_SAMPLERS]; }; +enum { + DRAW_JIT_CTX_CONSTANTS = 0, + DRAW_JIT_CTX_PLANES = 1, + DRAW_JIT_CTX_VIEWPORT= 2, + DRAW_JIT_CTX_TEXTURES= 3, + DRAW_JIT_CTX_SAMPLERS= 4, + DRAW_JIT_CTX_NUM_FIELDS +}; #define draw_jit_context_vs_constants(_gallivm, _ptr) \ - lp_build_struct_get_ptr(_gallivm, _ptr, 0, "vs_constants") + lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_CONSTANTS, "vs_constants") #define draw_jit_context_planes(_gallivm, _ptr) \ - lp_build_struct_get(_gallivm, _ptr, 1, "planes") + lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_CTX_PLANES, "planes") #define draw_jit_context_viewport(_gallivm, _ptr) \ - lp_build_struct_get(_gallivm, _ptr, 2, "viewport") - -#define DRAW_JIT_CTX_TEXTURES 3 -#define DRAW_JIT_CTX_SAMPLERS 4 + lp_build_struct_get(_gallivm, _ptr, DRAW_JIT_CTX_VIEWPORT, "viewport") #define draw_jit_context_textures(_gallivm, _ptr) \ lp_build_struct_get_ptr(_gallivm, _ptr, DRAW_JIT_CTX_TEXTURES, "textures") ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw/gs: cleanup some debugging code
Module: Mesa Branch: master Commit: 49b7d933f8608df9d20606f022a032785e243ab9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49b7d933f8608df9d20606f022a032785e243ab9 Author: Zack Rusin Date: Fri Mar 29 17:18:42 2013 -0700 draw/gs: cleanup some debugging code Signed-off-by: Zack Rusin Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_gs.c |4 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index b98b133..70db837 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -160,8 +160,6 @@ static void tgsi_fetch_gs_input(struct draw_geometry_shader *shader, #if DEBUG_INPUTS debug_printf("\tSlot = %d, vs_slot = %d, idx = %d:\n", slot, vs_slot, idx); -#endif -#if 1 assert(!util_is_inf_or_nan(input[vs_slot][0])); assert(!util_is_inf_or_nan(input[vs_slot][1])); assert(!util_is_inf_or_nan(input[vs_slot][2])); @@ -249,8 +247,6 @@ llvm_fetch_gs_input(struct draw_geometry_shader *shader, #if DEBUG_INPUTS debug_printf("\tSlot = %d, vs_slot = %d, i = %d:\n", slot, vs_slot, i); -#endif -#if 0 assert(!util_is_inf_or_nan(input[vs_slot][0])); assert(!util_is_inf_or_nan(input[vs_slot][1])); assert(!util_is_inf_or_nan(input[vs_slot][2])); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw/so: maintain an exact number of written vertices
Module: Mesa Branch: master Commit: 822c21c7763afde4d4a94af3935b4b629d4eb34a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=822c21c7763afde4d4a94af3935b4b629d4eb34a Author: Zack Rusin Date: Fri Mar 29 04:52:29 2013 -0700 draw/so: maintain an exact number of written vertices It's quite helpful during the rendering when we know exactly the count of the vertices available in the buffer. Signed-off-by: Zack Rusin Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_context.h|1 + src/gallium/auxiliary/draw/draw_pt.c | 35 + src/gallium/auxiliary/draw/draw_pt_so_emit.c |4 ++- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h index 369f6c8..b333457 100644 --- a/src/gallium/auxiliary/draw/draw_context.h +++ b/src/gallium/auxiliary/draw/draw_context.h @@ -60,6 +60,7 @@ struct draw_so_target { struct pipe_stream_output_target target; void *mapping; int internal_offset; + int emitted_vertices; }; struct draw_context *draw_create( struct pipe_context *pipe ); diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index 50b9efa..853bd67 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -451,6 +451,28 @@ draw_arrays_instanced(struct draw_context *draw, draw_vbo(draw, &info); } +/** + * Resolve true values within pipe_draw_info. + * If we're rendering from transform feedback/stream output + * buffers both the count and max_index need to be computed + * from the attached stream output target. + */ +static void +resolve_draw_info(const struct pipe_draw_info *raw_info, + struct pipe_draw_info *info) +{ + memcpy(info, raw_info, sizeof(struct pipe_draw_info)); + + if (raw_info->count_from_stream_output) { + struct draw_so_target *target = + (struct draw_so_target *)info->count_from_stream_output; + info->count = target->emitted_vertices; + + /* Stream output draw can not be indexed */ + debug_assert(!info->indexed); + info->max_index = info->count - 1; + } +} /** * Draw vertex arrays. @@ -465,9 +487,16 @@ draw_vbo(struct draw_context *draw, unsigned instance; unsigned index_limit; unsigned count; + struct pipe_draw_info resolved_info; + + resolve_draw_info(info, &resolved_info); + info = &resolved_info; + assert(info->instance_count > 0); if (info->indexed) assert(draw->pt.user.elts); + + count = info->count; draw->pt.user.eltBias = info->index_bias; draw->pt.user.min_index = info->min_index; @@ -518,12 +547,6 @@ draw_vbo(struct draw_context *draw, draw->pt.max_index = index_limit - 1; - count = info->count; - if (count == 0) { - if (info->count_from_stream_output) - count = draw->pt.max_index + 1; - } - /* * TODO: We could use draw->pt.max_index to further narrow * the min_index/max_index hints given by the state tracker. diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c index 25584a9..ae071a6 100644 --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c @@ -174,8 +174,10 @@ static void so_emit_prim(struct pt_so_emit *so, else memcpy(buffer, &input[idx][start_comp], num_comps * sizeof(float)); } - for (ob = 0; ob < draw->so.num_targets; ++ob) + for (ob = 0; ob < draw->so.num_targets; ++ob) { draw->so.targets[ob]->internal_offset += state->stride[ob] * sizeof(float); + draw->so.targets[ob]->emitted_vertices += 1; + } } so->emitted_vertices += num_vertices; ++so->emitted_primitives; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw: Implement support for primitive id
Module: Mesa Branch: master Commit: d8543bd7528de05e5ce3ac407838e7500428a93d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d8543bd7528de05e5ce3ac407838e7500428a93d Author: Zack Rusin Date: Fri Mar 29 04:50:32 2013 -0700 draw: Implement support for primitive id We were largely ignoring primitive id. Signed-off-by: Zack Rusin Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_gs.c| 13 - src/gallium/auxiliary/draw/draw_gs.h|1 + src/gallium/auxiliary/draw/draw_llvm.c | 15 +-- src/gallium/auxiliary/draw/draw_llvm.h |3 ++- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h |1 + src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c |5 + src/gallium/auxiliary/tgsi/tgsi_scan.c |2 ++ src/gallium/auxiliary/tgsi/tgsi_scan.h |1 + 8 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 378d158..b98b133 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -225,6 +225,9 @@ llvm_fetch_gs_input(struct draw_geometry_shader *shader, const float (*input_ptr)[4]; float (*input_data)[6][PIPE_MAX_SHADER_INPUTS][TGSI_NUM_CHANNELS][TGSI_NUM_CHANNELS] = &shader->gs_input->data; + shader->llvm_prim_ids[shader->fetched_prim_count] = + shader->in_prim_idx; + input_ptr = shader->input; for (i = 0; i < num_vertices; ++i) { @@ -237,10 +240,7 @@ llvm_fetch_gs_input(struct draw_geometry_shader *shader, (const char *)input_ptr + (indices[i] * input_vertex_stride)); for (slot = 0, vs_slot = 0; slot < shader->info.num_inputs; ++slot) { if (shader->info.input_semantic_name[slot] == TGSI_SEMANTIC_PRIMID) { -(*input_data)[i][slot][0][prim_idx] = (float)shader->in_prim_idx; -(*input_data)[i][slot][1][prim_idx] = (float)shader->in_prim_idx; -(*input_data)[i][slot][2][prim_idx] = (float)shader->in_prim_idx; -(*input_data)[i][slot][3][prim_idx] = (float)shader->in_prim_idx; +/* skip. we handle system values through gallivm */ } else { vs_slot = draw_gs_get_input_index( shader->info.input_semantic_name[slot], @@ -343,7 +343,8 @@ llvm_gs_run(struct draw_geometry_shader *shader, shader->jit_context, shader->gs_input->data, (struct vertex_header*)input, input_primitives, - shader->draw->instance_id); + shader->draw->instance_id, + shader->llvm_prim_ids); return ret; } @@ -728,6 +729,7 @@ draw_create_geometry_shader(struct draw_context *draw, gs->llvm_emitted_primitives = align_malloc(vector_size, vector_size); gs->llvm_emitted_vertices = align_malloc(vector_size, vector_size); + gs->llvm_prim_ids = align_malloc(vector_size, vector_size); gs->fetch_outputs = llvm_fetch_gs_outputs; gs->fetch_inputs = llvm_fetch_gs_input; @@ -796,6 +798,7 @@ void draw_delete_geometry_shader(struct draw_context *draw, } align_free(dgs->llvm_emitted_primitives); align_free(dgs->llvm_emitted_vertices); + align_free(dgs->llvm_prim_ids); align_free(dgs->gs_input); } diff --git a/src/gallium/auxiliary/draw/draw_gs.h b/src/gallium/auxiliary/draw/draw_gs.h index 9c82648..7c84139 100644 --- a/src/gallium/auxiliary/draw/draw_gs.h +++ b/src/gallium/auxiliary/draw/draw_gs.h @@ -95,6 +95,7 @@ struct draw_geometry_shader { int **llvm_prim_lengths; int *llvm_emitted_primitives; int *llvm_emitted_vertices; + int *llvm_prim_ids; #endif void (*fetch_inputs)(struct draw_geometry_shader *shader, diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 4731c8c..d0199bb 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -1891,10 +1891,11 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, struct gallivm_state *gallivm = variant->gallivm; LLVMContextRef context = gallivm->context; LLVMTypeRef int32_type = LLVMInt32TypeInContext(context); - LLVMTypeRef arg_types[5]; + LLVMTypeRef arg_types[6]; LLVMTypeRef func_type; LLVMValueRef variant_func; LLVMValueRef context_ptr; + LLVMValueRef prim_id_ptr; LLVMBasicBlockRef block; LLVMBuilderRef builder; LLVMValueRef io_ptr, input_array, num_prims, mask_val; @@ -1908,6 +1909,8 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, LLVMValueRef consts_ptr; LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][TGSI_NUM_CHANNELS]; struct lp_build_mask_context mask; + const struct tgsi_shader_info *gs_info = &variant->shader->base.info; + unsigned vector_length = variant->shader->base.vector_length; memset(&system_values, 0, sizeof(system_values)); @@ -1918,6 +1921,8 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, arg_types[2] = variant->ver
Mesa (master): draw/so: Fix bogus assert
Module: Mesa Branch: master Commit: f6bfb62c500c059464e66a4246a2e6089752d3db URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6bfb62c500c059464e66a4246a2e6089752d3db Author: Zack Rusin Date: Wed Mar 27 20:13:13 2013 -0700 draw/so: Fix bogus assert We do support so with multiple primitives. Signed-off-by: Zack Rusin Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_so_emit_tmp.h |1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h index ec31c3f..4611cd0 100644 --- a/src/gallium/auxiliary/draw/draw_so_emit_tmp.h +++ b/src/gallium/auxiliary/draw/draw_so_emit_tmp.h @@ -12,7 +12,6 @@ const boolean quads_flatshade_last = FALSE;\ const boolean last_vertex_last = TRUE; \ do { \ - debug_assert(input_prims->primitive_count == 1);\ switch (prim) { \ case PIPE_PRIM_LINES_ADJACENCY: \ case PIPE_PRIM_LINE_STRIP_ADJACENCY:\ ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): draw/gs: Fix memory corruption with multiple primitives
Module: Mesa Branch: master Commit: e6fc63535176f01606048b441f2c411c4906c424 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e6fc63535176f01606048b441f2c411c4906c424 Author: Zack Rusin Date: Wed Mar 27 20:11:16 2013 -0700 draw/gs: Fix memory corruption with multiple primitives We were flushing with incorrect number of primitives. TGSI exec can only work with a single primitive at a time. Plus the fetching with multiple primitives on llvm paths wasn't copying the last element. Signed-off-by: Zack Rusin Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_gs.c | 25 +++-- 1 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_gs.c b/src/gallium/auxiliary/draw/draw_gs.c index 9af82e2..378d158 100644 --- a/src/gallium/auxiliary/draw/draw_gs.c +++ b/src/gallium/auxiliary/draw/draw_gs.c @@ -247,8 +247,8 @@ llvm_fetch_gs_input(struct draw_geometry_shader *shader, shader->info.input_semantic_index[slot], shader->input_info); #if DEBUG_INPUTS -debug_printf("\tSlot = %d, vs_slot = %d, idx = %d:\n", - slot, vs_slot, idx); +debug_printf("\tSlot = %d, vs_slot = %d, i = %d:\n", + slot, vs_slot, i); #endif #if 0 assert(!util_is_inf_or_nan(input[vs_slot][0])); @@ -302,7 +302,7 @@ llvm_fetch_gs_outputs(struct draw_geometry_shader *shader, if (current_verts != shader->max_output_vertices) { memcpy(output_ptr + (vertex_count + current_verts) * shader->vertex_size, output_ptr + (vertex_count + shader->max_output_vertices) * shader->vertex_size, -shader->vertex_size * (total_verts - vertex_count - current_verts)); +shader->vertex_size * (total_verts - vertex_count)); } vertex_count += current_verts; } @@ -384,7 +384,8 @@ static void gs_point(struct draw_geometry_shader *shader, ++shader->in_prim_idx; ++shader->fetched_prim_count; - gs_flush(shader); + if (draw_gs_should_flush(shader)) + gs_flush(shader); } static void gs_line(struct draw_geometry_shader *shader, @@ -399,8 +400,9 @@ static void gs_line(struct draw_geometry_shader *shader, shader->fetched_prim_count); ++shader->in_prim_idx; ++shader->fetched_prim_count; - - gs_flush(shader); + + if (draw_gs_should_flush(shader)) + gs_flush(shader); } static void gs_line_adj(struct draw_geometry_shader *shader, @@ -418,7 +420,8 @@ static void gs_line_adj(struct draw_geometry_shader *shader, ++shader->in_prim_idx; ++shader->fetched_prim_count; - gs_flush(shader); + if (draw_gs_should_flush(shader)) + gs_flush(shader); } static void gs_tri(struct draw_geometry_shader *shader, @@ -435,7 +438,8 @@ static void gs_tri(struct draw_geometry_shader *shader, ++shader->in_prim_idx; ++shader->fetched_prim_count; - gs_flush(shader); + if (draw_gs_should_flush(shader)) + gs_flush(shader); } static void gs_tri_adj(struct draw_geometry_shader *shader, @@ -456,7 +460,8 @@ static void gs_tri_adj(struct draw_geometry_shader *shader, ++shader->in_prim_idx; ++shader->fetched_prim_count; - gs_flush(shader); + if (draw_gs_should_flush(shader)) + gs_flush(shader); } #define FUNC gs_run @@ -691,7 +696,7 @@ draw_create_geometry_shader(struct draw_context *draw, } else #endif { - gs->vector_length = TGSI_NUM_CHANNELS; + gs->vector_length = 1; } for (i = 0; i < gs->info.num_properties; ++i) { ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallivm: cleanup the gs interface
Module: Mesa Branch: master Commit: f313b0c8502868dab2a87237af295a34ec0dea26 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f313b0c8502868dab2a87237af295a34ec0dea26 Author: Zack Rusin Date: Wed Mar 27 04:27:59 2013 -0700 gallivm: cleanup the gs interface Instead of void pointers use a base interface. Signed-off-by: Zack Rusin Reviewed-by: Brian Paul Reviewed-by: José Fonseca --- src/gallium/auxiliary/draw/draw_llvm.c | 79 +-- src/gallium/auxiliary/gallivm/lp_bld_tgsi.h | 25 --- src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 31 - 3 files changed, 85 insertions(+), 50 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_llvm.c b/src/gallium/auxiliary/draw/draw_llvm.c index 3ce48d8..4731c8c 100644 --- a/src/gallium/auxiliary/draw/draw_llvm.c +++ b/src/gallium/auxiliary/draw/draw_llvm.c @@ -64,6 +64,19 @@ draw_llvm_generate(struct draw_llvm *llvm, struct draw_llvm_variant *var, boolean elts); +struct draw_gs_llvm_iface { + struct lp_build_tgsi_gs_iface base; + + struct draw_gs_llvm_variant *variant; + LLVMValueRef input; +}; + +static INLINE const struct draw_gs_llvm_iface * +draw_gs_llvm_iface(const struct lp_build_tgsi_gs_iface *iface) +{ + return (const struct draw_gs_llvm_iface *)iface; +} + /** * Create LLVM type for struct draw_jit_texture */ @@ -1237,14 +1250,37 @@ clipmask_booli32(struct gallivm_state *gallivm, return ret; } +static LLVMValueRef +draw_gs_llvm_fetch_input(const struct lp_build_tgsi_gs_iface *gs_iface, + struct lp_build_tgsi_context * bld_base, + LLVMValueRef vertex_index, + LLVMValueRef attrib_index, + LLVMValueRef swizzle_index) +{ + const struct draw_gs_llvm_iface *gs = draw_gs_llvm_iface(gs_iface); + struct gallivm_state *gallivm = bld_base->base.gallivm; + LLVMBuilderRef builder = gallivm->builder; + LLVMValueRef indices[3]; + LLVMValueRef res; + + indices[0] = vertex_index; + indices[1] = attrib_index; + indices[2] = swizzle_index; + + res = LLVMBuildGEP(builder, gs->input, indices, 3, ""); + res = LLVMBuildLoad(builder, res, ""); + + return res; +} + static void -draw_gs_llvm_emit_vertex(struct lp_build_tgsi_context * bld_base, +draw_gs_llvm_emit_vertex(const struct lp_build_tgsi_gs_iface *gs_base, + struct lp_build_tgsi_context * bld_base, LLVMValueRef (*outputs)[4], - LLVMValueRef emitted_vertices_vec, - void *user_data) + LLVMValueRef emitted_vertices_vec) { - struct draw_gs_llvm_variant *variant = - (struct draw_gs_llvm_variant *)user_data; + const struct draw_gs_llvm_iface *gs_iface = draw_gs_llvm_iface(gs_base); + struct draw_gs_llvm_variant *variant = gs_iface->variant; struct gallivm_state *gallivm = variant->gallivm; LLVMBuilderRef builder = gallivm->builder; struct lp_type gs_type = bld_base->base.type; @@ -1272,13 +1308,13 @@ draw_gs_llvm_emit_vertex(struct lp_build_tgsi_context * bld_base, } static void -draw_gs_llvm_end_primitive(struct lp_build_tgsi_context * bld_base, +draw_gs_llvm_end_primitive(const struct lp_build_tgsi_gs_iface *gs_base, + struct lp_build_tgsi_context * bld_base, LLVMValueRef verts_per_prim_vec, - LLVMValueRef emitted_prims_vec, - void *user_data) + LLVMValueRef emitted_prims_vec) { - struct draw_gs_llvm_variant *variant = - (struct draw_gs_llvm_variant *)user_data; + const struct draw_gs_llvm_iface *gs_iface = draw_gs_llvm_iface(gs_base); + struct draw_gs_llvm_variant *variant = gs_iface->variant; struct gallivm_state *gallivm = variant->gallivm; LLVMBuilderRef builder = gallivm->builder; LLVMValueRef prim_lengts_ptr = @@ -1301,13 +1337,13 @@ draw_gs_llvm_end_primitive(struct lp_build_tgsi_context * bld_base, } static void -draw_gs_llvm_epilogue(struct lp_build_tgsi_context * bld_base, +draw_gs_llvm_epilogue(const struct lp_build_tgsi_gs_iface *gs_base, + struct lp_build_tgsi_context * bld_base, LLVMValueRef total_emitted_vertices_vec, - LLVMValueRef emitted_prims_vec, - void *user_data) + LLVMValueRef emitted_prims_vec) { - struct draw_gs_llvm_variant *variant = - (struct draw_gs_llvm_variant *)user_data; + const struct draw_gs_llvm_iface *gs_iface = draw_gs_llvm_iface(gs_base); + struct draw_gs_llvm_variant *variant = gs_iface->variant; struct gallivm_state *gallivm = variant->gallivm; LLVMBuilderRef builder = gallivm->builder; LLVMValueRef emitted_verts_ptr = @@ -1867,7 +1903,7 @@ draw_gs_llvm_generate(struct draw_llvm *llvm, struct lp_bld_tgsi_system_va
Mesa (master): svga: add new memory-used HUD query
Module: Mesa Branch: master Commit: ac114c682413065a5b8baa678733555e94e43120 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ac114c682413065a5b8baa678733555e94e43120 Author: Brian Paul Date: Wed Apr 3 10:23:57 2013 -0600 svga: add new memory-used HUD query To track the amount of memory used by all pipe_resources (textures and buffers). Reviewed-by: Jose Fonseca --- src/gallium/drivers/svga/svga_context.h |1 + src/gallium/drivers/svga/svga_pipe_query.c | 11 +++ src/gallium/drivers/svga/svga_resource_buffer.c |6 ++ src/gallium/drivers/svga/svga_resource_buffer.h |2 ++ src/gallium/drivers/svga/svga_resource_texture.c |6 ++ src/gallium/drivers/svga/svga_resource_texture.h |2 ++ src/gallium/drivers/svga/svga_screen.c |3 ++- src/gallium/drivers/svga/svga_screen.h |3 +++ 8 files changed, 33 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index e27778e..517102d 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -45,6 +45,7 @@ /** Non-GPU queries for gallium HUD */ #define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) #define SVGA_QUERY_FALLBACKS(PIPE_QUERY_DRIVER_SPECIFIC + 1) +#define SVGA_QUERY_MEMORY_USED (PIPE_QUERY_DRIVER_SPECIFIC + 2) struct draw_vertex_shader; diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 11f6a05..de84189 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -111,6 +111,7 @@ static struct pipe_query *svga_create_query( struct pipe_context *pipe, break; case SVGA_QUERY_DRAW_CALLS: case SVGA_QUERY_FALLBACKS: + case SVGA_QUERY_MEMORY_USED: break; default: assert(!"unexpected query type in svga_create_query()"); @@ -144,6 +145,7 @@ static void svga_destroy_query(struct pipe_context *pipe, break; case SVGA_QUERY_DRAW_CALLS: case SVGA_QUERY_FALLBACKS: + case SVGA_QUERY_MEMORY_USED: /* nothing */ break; default: @@ -203,6 +205,9 @@ static void svga_begin_query(struct pipe_context *pipe, case SVGA_QUERY_FALLBACKS: sq->begin_count = svga->num_fallbacks; break; + case SVGA_QUERY_MEMORY_USED: + /* nothing */ + break; default: assert(!"unexpected query type in svga_begin_query()"); } @@ -246,6 +251,9 @@ static void svga_end_query(struct pipe_context *pipe, case SVGA_QUERY_FALLBACKS: sq->end_count = svga->num_fallbacks; break; + case SVGA_QUERY_MEMORY_USED: + /* nothing */ + break; default: assert(!"unexpected query type in svga_end_query()"); } @@ -304,6 +312,9 @@ static boolean svga_get_query_result(struct pipe_context *pipe, case SVGA_QUERY_FALLBACKS: vresult->u64 = sq->end_count - sq->begin_count; break; + case SVGA_QUERY_MEMORY_USED: + vresult->u64 = svgascreen->total_resource_bytes; + break; default: assert(!"unexpected query type in svga_get_query_result"); } diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c index 3aa6644..8ba2252 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.c +++ b/src/gallium/drivers/svga/svga_resource_buffer.c @@ -31,6 +31,7 @@ #include "os/os_thread.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_resource.h" #include "svga_context.h" #include "svga_screen.h" @@ -297,6 +298,8 @@ svga_buffer_destroy( struct pipe_screen *screen, if(sbuf->swbuf && !sbuf->user) align_free(sbuf->swbuf); + ss->total_resource_bytes -= sbuf->size; + FREE(sbuf); } @@ -342,6 +345,9 @@ svga_buffer_create(struct pipe_screen *screen, debug_reference(&sbuf->b.b.reference, (debug_reference_descriptor)debug_describe_resource, 0); + sbuf->size = util_resource_size(template); + ss->total_resource_bytes += sbuf->size; + return &sbuf->b.b; error2: diff --git a/src/gallium/drivers/svga/svga_resource_buffer.h b/src/gallium/drivers/svga/svga_resource_buffer.h index ee12acf..b431d7b 100644 --- a/src/gallium/drivers/svga/svga_resource_buffer.h +++ b/src/gallium/drivers/svga/svga_resource_buffer.h @@ -177,6 +177,8 @@ struct svga_buffer * a context. It is only valid if the dma.pending is set above. */ struct list_head head; + + unsigned size; /**< Approximate size in bytes */ }; diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c index 7f36da8..3cb7d34 100644 --- a/src/gallium/drivers/svga/svga_resource_texture.c +++ b/src/gallium/drivers/svga/svga_resource_texture.c @@ -32,6 +32,7 @@ #include "util/u_format.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_resourc
Mesa (master): util: add new util_resource_size() function in u_resource.[ ch]
Module: Mesa Branch: master Commit: a69efa9482d7d4dee476a50b3788544ba9b14a50 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a69efa9482d7d4dee476a50b3788544ba9b14a50 Author: Brian Paul Date: Wed Apr 3 10:23:16 2013 -0600 util: add new util_resource_size() function in u_resource.[ch] Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/util/u_resource.c | 65 ++- src/gallium/auxiliary/util/u_resource.h | 34 2 files changed, 98 insertions(+), 1 deletions(-) diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c index 8d15f8d..66caaae 100644 --- a/src/gallium/auxiliary/util/u_resource.c +++ b/src/gallium/auxiliary/util/u_resource.c @@ -1,2 +1,65 @@ +/* + * Copyright 2013 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ -/* temporarily empty */ + +#include "pipe/p_defines.h" +#include "pipe/p_state.h" +#include "util/u_format.h" +#include "util/u_math.h" +#include "util/u_resource.h" + + +/** + * Return the size of the resource in bytes. + */ +unsigned +util_resource_size(const struct pipe_resource *res) +{ + unsigned width = res->width0; + unsigned height = res->height0; + unsigned depth = res->depth0; + unsigned size = 0; + unsigned level; + + for (level = 0; level <= res->last_level; level++) { + unsigned slices; + + if (res->target == PIPE_TEXTURE_CUBE) + slices = 6; + else if (res->target == PIPE_TEXTURE_3D) + slices = depth; + else + slices = res->array_size; + + size += (util_format_get_nblocksy(res->format, height) * + util_format_get_stride(res->format, width) * slices); + + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); + } + + return size; +} diff --git a/src/gallium/auxiliary/util/u_resource.h b/src/gallium/auxiliary/util/u_resource.h new file mode 100644 index 000..977e013 --- /dev/null +++ b/src/gallium/auxiliary/util/u_resource.h @@ -0,0 +1,34 @@ +/* + * Copyright 2013 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef U_RESOURCE_H +#define U_RESOURCE_H + +struct pipe_resource; + +unsigned +util_resource_size(const struct pipe_resource *res); + +#endif ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): util: move functions from u_resource.c to u_transfer.c
Module: Mesa Branch: master Commit: a3cccdec900106f7783881e42dff79ddbb11d7ed URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a3cccdec900106f7783881e42dff79ddbb11d7ed Author: Brian Paul Date: Wed Apr 3 10:21:34 2013 -0600 util: move functions from u_resource.c to u_transfer.c The functions are prototyped in u_transfer.h and are related to the other functions in u_transfer.c. The next patch will re-use the u_resource.c file for new code. Reviewed-by: Jose Fonseca --- src/gallium/auxiliary/util/u_resource.c | 76 +-- src/gallium/auxiliary/util/u_transfer.c | 73 + 2 files changed, 74 insertions(+), 75 deletions(-) diff --git a/src/gallium/auxiliary/util/u_resource.c b/src/gallium/auxiliary/util/u_resource.c index a32c4f6..8d15f8d 100644 --- a/src/gallium/auxiliary/util/u_resource.c +++ b/src/gallium/auxiliary/util/u_resource.c @@ -1,76 +1,2 @@ - -#include "util/u_inlines.h" -#include "util/u_transfer.h" - -static INLINE struct u_resource * -u_resource( struct pipe_resource *res ) -{ - return (struct u_resource *)res; -} - -boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, - struct pipe_resource *resource, - struct winsys_handle *handle) -{ - struct u_resource *ur = u_resource(resource); - return ur->vtbl->resource_get_handle(screen, resource, handle); -} - -void u_resource_destroy_vtbl(struct pipe_screen *screen, - struct pipe_resource *resource) -{ - struct u_resource *ur = u_resource(resource); - ur->vtbl->resource_destroy(screen, resource); -} - -void *u_transfer_map_vtbl(struct pipe_context *context, - struct pipe_resource *resource, - unsigned level, - unsigned usage, - const struct pipe_box *box, - struct pipe_transfer **transfer) -{ - struct u_resource *ur = u_resource(resource); - return ur->vtbl->transfer_map(context, resource, level, usage, box, - transfer); -} - -void u_transfer_flush_region_vtbl( struct pipe_context *pipe, - struct pipe_transfer *transfer, - const struct pipe_box *box) -{ - struct u_resource *ur = u_resource(transfer->resource); - ur->vtbl->transfer_flush_region(pipe, transfer, box); -} - -void u_transfer_unmap_vtbl( struct pipe_context *pipe, -struct pipe_transfer *transfer ) -{ - struct u_resource *ur = u_resource(transfer->resource); - ur->vtbl->transfer_unmap(pipe, transfer); -} - -void u_transfer_inline_write_vtbl( struct pipe_context *pipe, - struct pipe_resource *resource, - unsigned level, - unsigned usage, - const struct pipe_box *box, - const void *data, - unsigned stride, - unsigned layer_stride) -{ - struct u_resource *ur = u_resource(resource); - ur->vtbl->transfer_inline_write(pipe, - resource, - level, - usage, - box, - data, - stride, - layer_stride); -} - - - - +/* temporarily empty */ diff --git a/src/gallium/auxiliary/util/u_transfer.c b/src/gallium/auxiliary/util/u_transfer.c index 8616825..56e059b 100644 --- a/src/gallium/auxiliary/util/u_transfer.c +++ b/src/gallium/auxiliary/util/u_transfer.c @@ -87,3 +87,76 @@ void u_default_transfer_unmap( struct pipe_context *pipe, struct pipe_transfer *transfer ) { } + + +static INLINE struct u_resource * +u_resource( struct pipe_resource *res ) +{ + return (struct u_resource *)res; +} + +boolean u_resource_get_handle_vtbl(struct pipe_screen *screen, + struct pipe_resource *resource, + struct winsys_handle *handle) +{ + struct u_resource *ur = u_resource(resource); + return ur->vtbl->resource_get_handle(screen, resource, handle); +} + +void u_resource_destroy_vtbl(struct pipe_screen *screen, + struct pipe_resource *resource) +{ + struct u_resource *ur = u_resource(resource); + ur->vtbl->resource_destroy(screen, resource); +} + +void *u_transfer_map_vtbl(struct pipe_context *context, + struct pipe_resource *resource, + unsigned level, + unsigned usage, + const struct pipe_box *box, + struct pipe_transfer **transfer) +{ + struc
Mesa (master): r600g/llvm: Do not override llvm provided stack_size
Module: Mesa Branch: master Commit: 159d9340662a70df3dcc9da1681f5b0a8e7650cf URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=159d9340662a70df3dcc9da1681f5b0a8e7650cf Author: Vincent Lejeune Date: Wed Apr 3 18:39:18 2013 +0200 r600g/llvm: Do not override llvm provided stack_size --- src/gallium/drivers/r600/r600_asm.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index c88b48d..a0dc1de 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -1557,7 +1557,8 @@ int r600_bytecode_build(struct r600_bytecode *bc) unsigned addr; int i, r; - bc->nstack = bc->stack.max_entries; + if (!bc->nstack) // If not 0, Stack_size already provided by llvm + bc->nstack = bc->stack.max_entries; if (bc->type == TGSI_PROCESSOR_VERTEX && !bc->nstack) { bc->nstack = 1; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): r600g/llvm: Do not change cf_alu inst when adding alus
Module: Mesa Branch: master Commit: 097a6ecdfe592fdf2c5f3b48a17da6507eaa405c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=097a6ecdfe592fdf2c5f3b48a17da6507eaa405c Author: Vincent Lejeune Date: Tue Apr 2 19:19:24 2013 +0200 r600g/llvm: Do not change cf_alu inst when adding alus --- src/gallium/drivers/r600/r600_shader.c |9 ++--- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 82885d1..d24d8e7 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -399,12 +399,7 @@ static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx, return bytes_read; } - if (alu.execute_mask) { - alu.pred_sel = 0; - r600_bytecode_add_alu_type(ctx->bc, &alu, CF_OP_ALU_PUSH_BEFORE); - } else { - r600_bytecode_add_alu(ctx->bc, &alu); - } + r600_bytecode_add_alu_type(ctx->bc, &alu, ctx->bc->cf_last->op); /* XXX: Handle other KILL instructions */ if (alu_op->flags & AF_KILL) { @@ -632,7 +627,7 @@ static void r600_bytecode_from_byte_stream(struct r600_shader_ctx *ctx, int32_t word1 = i32_from_byte_stream(bytes, &bytes_read); r600_bytecode_add_cf(ctx->bc); - ctx->bc->cf_last->op = r600_isa_cf_by_opcode(ctx->bc->isa, 8/* CF_ALU*/, 1); + ctx->bc->cf_last->op = r600_isa_cf_by_opcode(ctx->bc->isa, G_SQ_CF_ALU_WORD1_CF_INST(word1), 1); ctx->bc->cf_last->kcache[0].bank = G_SQ_CF_ALU_WORD0_KCACHE_BANK0(word0); ctx->bc->cf_last->kcache[0].addr = G_SQ_CF_ALU_WORD1_KCACHE_ADDR0(word1); ctx->bc->cf_last->kcache[0].mode = G_SQ_CF_ALU_WORD0_KCACHE_MODE0(word0); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): radeonsi: add more cases for copying unsupported formats to resource_copy_region
Module: Mesa Branch: master Commit: ff01e0db0e45b47b6012e7c28f331a4a8e518df9 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff01e0db0e45b47b6012e7c28f331a4a8e518df9 Author: Marek Olšák Date: Tue Apr 2 18:47:06 2013 -0400 radeonsi: add more cases for copying unsupported formats to resource_copy_region Ported from r600g commit: 8891b2f9c91b2f6c8625184c23a10b8e55875dc0 Reviewed-by: Michel Dänzer Reviewed-by: Christian König NOTE: This is a candidate for the 9.1 branch. --- src/gallium/drivers/radeonsi/r600_blit.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/radeonsi/r600_blit.c b/src/gallium/drivers/radeonsi/r600_blit.c index f9d2568..f11f110 100644 --- a/src/gallium/drivers/radeonsi/r600_blit.c +++ b/src/gallium/drivers/radeonsi/r600_blit.c @@ -429,6 +429,18 @@ static void r600_resource_copy_region(struct pipe_context *ctx, r600_change_format(dst, dst_level, &orig_info[1], PIPE_FORMAT_R8G8B8A8_UNORM); break; + case 8: + r600_change_format(src, src_level, &orig_info[0], + PIPE_FORMAT_R16G16B16A16_UINT); + r600_change_format(dst, dst_level, &orig_info[1], + PIPE_FORMAT_R16G16B16A16_UINT); + break; + case 16: + r600_change_format(src, src_level, &orig_info[0], + PIPE_FORMAT_R32G32B32A32_UINT); + r600_change_format(dst, dst_level, &orig_info[1], + PIPE_FORMAT_R32G32B32A32_UINT); + break; default: fprintf(stderr, "Unhandled format %s with blocksize %u\n", util_format_short_name(src->format), blocksize); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: add HUD queries for number of draw calls, number of fallbacks
Module: Mesa Branch: master Commit: 3838edaf5d3f75ca5c2276db22ea0b96fce2bad7 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3838edaf5d3f75ca5c2276db22ea0b96fce2bad7 Author: Brian Paul Date: Mon Apr 1 17:51:43 2013 -0600 svga: add HUD queries for number of draw calls, number of fallbacks The fallbacks count is the number of drawing calls that use a "draw" module fallback, such as polygon stipple. Reviewed-by: Jose Fonseca --- src/gallium/drivers/svga/svga_context.h|9 + src/gallium/drivers/svga/svga_pipe_draw.c |3 +++ src/gallium/drivers/svga/svga_pipe_query.c | 27 +++ src/gallium/drivers/svga/svga_screen.c | 22 ++ 4 files changed, 61 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 32671ec..e27778e 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -42,6 +42,11 @@ #include "svga3d_shaderdefs.h" +/** Non-GPU queries for gallium HUD */ +#define SVGA_QUERY_DRAW_CALLS (PIPE_QUERY_DRIVER_SPECIFIC + 0) +#define SVGA_QUERY_FALLBACKS(PIPE_QUERY_DRIVER_SPECIFIC + 1) + + struct draw_vertex_shader; struct draw_fragment_shader; struct svga_shader_result; @@ -370,6 +375,10 @@ struct svga_context /** List of buffers with queued transfers */ struct list_head dirty_buffers; + + /** performance / info queries */ + uint64_t num_draw_calls; /**< SVGA_QUERY_DRAW_CALLS */ + uint64_t num_fallbacks; /**< SVGA_QUERY_FALLBACKS */ }; /* A flag for each state_tracker state object: diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c index e72032e..f0da170 100644 --- a/src/gallium/drivers/svga/svga_pipe_draw.c +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -330,6 +330,8 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) enum pipe_error ret = 0; boolean needed_swtnl; + svga->num_draw_calls++; /* for SVGA_QUERY_DRAW_CALLS */ + if (!u_trim_pipe_prim( info->mode, &count )) return; @@ -358,6 +360,7 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) #endif if (svga->state.sw.need_swtnl) { + svga->num_fallbacks++; /* for SVGA_QUERY_FALLBACKS */ if (!needed_swtnl) { /* * We're switching from HW to SW TNL. SW TNL will require mapping all diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 5cfebaf..11f6a05 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -51,6 +51,9 @@ struct svga_query { struct svga_winsys_buffer *hwbuf; volatile SVGA3dQueryResult *queryResult; struct pipe_fence_handle *fence; + + /** For non-GPU SVGA_QUERY_x queries */ + uint64_t begin_count, end_count; }; /*** @@ -106,6 +109,9 @@ static struct pipe_query *svga_create_query( struct pipe_context *pipe, */ sws->buffer_unmap(sws, sq->hwbuf); break; + case SVGA_QUERY_DRAW_CALLS: + case SVGA_QUERY_FALLBACKS: + break; default: assert(!"unexpected query type in svga_create_query()"); } @@ -136,6 +142,10 @@ static void svga_destroy_query(struct pipe_context *pipe, sws->buffer_destroy(sws, sq->hwbuf); sws->fence_reference(sws, &sq->fence, NULL); break; + case SVGA_QUERY_DRAW_CALLS: + case SVGA_QUERY_FALLBACKS: + /* nothing */ + break; default: assert(!"svga: unexpected query type in svga_destroy_query()"); } @@ -187,6 +197,12 @@ static void svga_begin_query(struct pipe_context *pipe, svga->sq = sq; break; + case SVGA_QUERY_DRAW_CALLS: + sq->begin_count = svga->num_draw_calls; + break; + case SVGA_QUERY_FALLBACKS: + sq->begin_count = svga->num_fallbacks; + break; default: assert(!"unexpected query type in svga_begin_query()"); } @@ -224,6 +240,12 @@ static void svga_end_query(struct pipe_context *pipe, svga->sq = NULL; break; + case SVGA_QUERY_DRAW_CALLS: + sq->end_count = svga->num_draw_calls; + break; + case SVGA_QUERY_FALLBACKS: + sq->end_count = svga->num_fallbacks; + break; default: assert(!"unexpected query type in svga_end_query()"); } @@ -277,6 +299,11 @@ static boolean svga_get_query_result(struct pipe_context *pipe, *result = (uint64_t)sq->queryResult->result32; break; + case SVGA_QUERY_DRAW_CALLS: + /* fall-through */ + case SVGA_QUERY_FALLBACKS: + vresult->u64 = sq->end_count - sq->begin_count; + break; default: assert(!"unexpected query type in svga_get_query_result"); } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 49059a5..bd
Mesa (master): svga: refactor occlusion query code
Module: Mesa Branch: master Commit: 49ed1f3cb335fada1f9ee26d5420889292da3c92 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49ed1f3cb335fada1f9ee26d5420889292da3c92 Author: Brian Paul Date: Mon Apr 1 17:49:31 2013 -0600 svga: refactor occlusion query code This is in preparation for adding new query types for the HUD. Reviewed-by: Jose Fonseca --- src/gallium/drivers/svga/svga_pipe_query.c | 218 1 files changed, 124 insertions(+), 94 deletions(-) diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c index 902f84c..5cfebaf 100644 --- a/src/gallium/drivers/svga/svga_pipe_query.c +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -44,7 +44,10 @@ struct pipe_query { struct svga_query { struct pipe_query base; - SVGA3dQueryType type; + unsigned type; /**< PIPE_QUERY_x or SVGA_QUERY_x */ + SVGA3dQueryType svga_type; /**< SVGA3D_QUERYTYPE_x or unused */ + + /** For PIPE_QUERY_OCCLUSION_COUNTER / SVGA3D_QUERYTYPE_OCCLUSION */ struct svga_winsys_buffer *hwbuf; volatile SVGA3dQueryResult *queryResult; struct pipe_fence_handle *fence; @@ -79,31 +82,35 @@ static struct pipe_query *svga_create_query( struct pipe_context *pipe, if (!sq) goto no_sq; - sq->type = SVGA3D_QUERYTYPE_OCCLUSION; - - sq->hwbuf = svga_winsys_buffer_create(svga, - 1, - SVGA_BUFFER_USAGE_PINNED, - sizeof *sq->queryResult); - if(!sq->hwbuf) - goto no_hwbuf; - - sq->queryResult = (SVGA3dQueryResult *)sws->buffer_map(sws, - sq->hwbuf, - PIPE_TRANSFER_WRITE); - if(!sq->queryResult) - goto no_query_result; - - sq->queryResult->totalSize = sizeof *sq->queryResult; - sq->queryResult->state = SVGA3D_QUERYSTATE_NEW; - - /* -* We request the buffer to be pinned and assume it is always mapped. -* -* The reason is that we don't want to wait for fences when checking the -* query status. -*/ - sws->buffer_unmap(sws, sq->hwbuf); + switch (query_type) { + case PIPE_QUERY_OCCLUSION_COUNTER: + sq->svga_type = SVGA3D_QUERYTYPE_OCCLUSION; + + sq->hwbuf = svga_winsys_buffer_create(svga, 1, +SVGA_BUFFER_USAGE_PINNED, +sizeof *sq->queryResult); + if (!sq->hwbuf) + goto no_hwbuf; + + sq->queryResult = (SVGA3dQueryResult *) + sws->buffer_map(sws, sq->hwbuf, PIPE_TRANSFER_WRITE); + if (!sq->queryResult) + goto no_query_result; + + sq->queryResult->totalSize = sizeof *sq->queryResult; + sq->queryResult->state = SVGA3D_QUERYSTATE_NEW; + + /* We request the buffer to be pinned and assume it is always mapped. + * The reason is that we don't want to wait for fences when checking the + * query status. + */ + sws->buffer_unmap(sws, sq->hwbuf); + break; + default: + assert(!"unexpected query type in svga_create_query()"); + } + + sq->type = query_type; return &sq->base; @@ -123,8 +130,16 @@ static void svga_destroy_query(struct pipe_context *pipe, struct svga_query *sq = svga_query( q ); SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__); - sws->buffer_destroy(sws, sq->hwbuf); - sws->fence_reference(sws, &sq->fence, NULL); + + switch (sq->type) { + case PIPE_QUERY_OCCLUSION_COUNTER: + sws->buffer_destroy(sws, sq->hwbuf); + sws->fence_reference(sws, &sq->fence, NULL); + break; + default: + assert(!"svga: unexpected query type in svga_destroy_query()"); + } + FREE(sq); } @@ -139,39 +154,42 @@ static void svga_begin_query(struct pipe_context *pipe, SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__); - assert(!svga->sq); - /* Need to flush out buffered drawing commands so that they don't * get counted in the query results. */ svga_hwtnl_flush_retry(svga); - if(sq->queryResult->state == SVGA3D_QUERYSTATE_PENDING) { - /* The application doesn't care for the pending query result. We cannot - * let go the existing buffer and just get a new one because its storage - * may be reused for other purposes and clobbered by the host when it - * determines the query result. So the only option here is to wait for - * the existing query's result -- not a big deal, given that no sane - * application would do this. - */ - uint64_t result; + switch (sq->type) { + case PIPE_QUERY_OCCLUSION_COUNTER: + assert(!svga->sq); + if (sq->queryResult->state == SVGA3D_QUERYSTATE_PENDING) { + /* The application doesn't care for the pending query result. We cannot + * let go the existing buffer and just get a new one becau
Mesa (master): gallium/hud: try L8 texture for font if I8 format isn' t supported
Module: Mesa Branch: master Commit: a9ae7e9c28335e5c0822fdd7e456780e5ea01d45 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9ae7e9c28335e5c0822fdd7e456780e5ea01d45 Author: Brian Paul Date: Mon Apr 1 16:44:50 2013 -0600 gallium/hud: try L8 texture for font if I8 format isn't supported --- src/gallium/auxiliary/hud/font.c | 17 + 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/hud/font.c b/src/gallium/auxiliary/hud/font.c index 5c4a4d0..6747874 100644 --- a/src/gallium/auxiliary/hud/font.c +++ b/src/gallium/auxiliary/hud/font.c @@ -377,17 +377,26 @@ util_font_create_fixed_8x13(struct pipe_context *pipe, struct pipe_resource tex_templ, *tex; struct pipe_transfer *transfer = NULL; char *map; + enum pipe_format tex_format; int i; - if (!screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, -PIPE_TEXTURE_RECT, 0, -PIPE_BIND_SAMPLER_VIEW)) { + if (screen->is_format_supported(screen, PIPE_FORMAT_I8_UNORM, + PIPE_TEXTURE_RECT, 0, + PIPE_BIND_SAMPLER_VIEW)) { + tex_format = PIPE_FORMAT_I8_UNORM; + } + else if (screen->is_format_supported(screen, PIPE_FORMAT_L8_UNORM, + PIPE_TEXTURE_RECT, 0, + PIPE_BIND_SAMPLER_VIEW)) { + tex_format = PIPE_FORMAT_L8_UNORM; + } + else { return FALSE; } memset(&tex_templ, 0, sizeof(tex_templ)); tex_templ.target = PIPE_TEXTURE_RECT; - tex_templ.format = PIPE_FORMAT_I8_UNORM; + tex_templ.format = tex_format; tex_templ.width0 = 128; tex_templ.height0 = 256; tex_templ.depth0 = 1; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): svga: add case for PIPE_CAP_QUERY_PIPELINE_STATISTICS
Module: Mesa Branch: master Commit: 0289ebaa0f13154ff0bdcfaf12d56bdf8094be25 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0289ebaa0f13154ff0bdcfaf12d56bdf8094be25 Author: Brian Paul Date: Wed Apr 3 08:19:44 2013 -0600 svga: add case for PIPE_CAP_QUERY_PIPELINE_STATISTICS --- src/gallium/drivers/svga/svga_screen.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 0558a46..49059a5 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -262,6 +262,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_CUBE_MAP_ARRAY: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: return 0; case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY: return 1; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: rewrite comment in st_manager.c
Module: Mesa Branch: master Commit: 7e28debb6fffed395d7e6d8fa6ebdd3056fffb72 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7e28debb6fffed395d7e6d8fa6ebdd3056fffb72 Author: Brian Paul Date: Tue Apr 2 14:33:42 2013 -0600 st/mesa: rewrite comment in st_manager.c --- src/mesa/state_tracker/st_manager.c |5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c index 0b025d9..03e086a 100644 --- a/src/mesa/state_tracker/st_manager.c +++ b/src/mesa/state_tracker/st_manager.c @@ -170,9 +170,8 @@ st_context_validate(struct st_context *st, /** * Validate a framebuffer to make sure up-to-date pipe_textures are used. - * The context we need to pass in is s dummy context needed only to be - * able to get a pipe context to create pipe surfaces, and to have a - * context to call _mesa_resize_framebuffer(): + * The context is only used for creating pipe surfaces and for calling + * _mesa_resize_framebuffer(). * (That should probably be rethought, since those surfaces become * drawable state, not context state, and can be freed by another pipe * context). ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nv50,nvc0: remove MS resolve formats hack
Module: Mesa Branch: master Commit: 80eef069f032af921554ba0e03062d84488d3f6c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=80eef069f032af921554ba0e03062d84488d3f6c Author: Christoph Bumiller Date: Wed Apr 3 13:19:15 2013 +0200 nv50,nvc0: remove MS resolve formats hack Mesa now allows BlitFramebuffer resolve between RGBA and BGRA. --- src/gallium/drivers/nv50/nv50_screen.c |5 - src/gallium/drivers/nvc0/nvc0_screen.c | 10 -- 2 files changed, 0 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 53eeeb6..55081be 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -65,11 +65,6 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, if (nv50_screen(pscreen)->tesla->oclass < NVA0_3D_CLASS) return FALSE; break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - case PIPE_FORMAT_R8G8B8X8_UNORM: - /* HACK: GL requires equal formats for MS resolve and window is BGRA */ - if (bindings & PIPE_BIND_RENDER_TARGET) - return FALSE; default: break; } diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index a46fb38..f2dd65b 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -51,16 +51,6 @@ nvc0_screen_is_format_supported(struct pipe_screen *pscreen, if (!util_format_is_supported(format, bindings)) return FALSE; - switch (format) { - case PIPE_FORMAT_R8G8B8A8_UNORM: - case PIPE_FORMAT_R8G8B8X8_UNORM: - /* HACK: GL requires equal formats for MS resolve and window is BGRA */ - if (bindings & PIPE_BIND_RENDER_TARGET) - return FALSE; - default: - break; - } - if ((bindings & PIPE_BIND_SAMPLER_VIEW) && (target != PIPE_BUFFER)) if (util_format_get_blocksizebits(format) == 3 * 32) return FALSE; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nvc0: fix 128 bit compressed storage type selection
Module: Mesa Branch: master Commit: 4de70bf43c5715711b1d287590470df16e6cf837 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4de70bf43c5715711b1d287590470df16e6cf837 Author: Christoph Bumiller Date: Wed Apr 3 01:17:46 2013 +0200 nvc0: fix 128 bit compressed storage type selection --- src/gallium/drivers/nvc0/nvc0_miptree.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index 2913363..3d50735 100644 --- a/src/gallium/drivers/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c @@ -82,7 +82,7 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, boolean compressed) switch (util_format_get_blocksizebits(mt->base.base.format)) { case 128: if (compressed) -tile_flags = 0xf4 + ms; +tile_flags = 0xf4 + ms * 2; else tile_flags = 0xfe; break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nvc0: place staging textures in GART and map them directly
Module: Mesa Branch: master Commit: 8e1dd58a7e76834c1fb6d117b6ea5755e05cfb77 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8e1dd58a7e76834c1fb6d117b6ea5755e05cfb77 Author: Christoph Bumiller Date: Wed Apr 3 00:18:55 2013 +0200 nvc0: place staging textures in GART and map them directly --- src/gallium/drivers/nv50/nv50_miptree.c |6 ++-- src/gallium/drivers/nv50/nv50_resource.h |2 +- src/gallium/drivers/nvc0/nvc0_2d.xml.h |2 +- src/gallium/drivers/nvc0/nvc0_miptree.c | 25 --- src/gallium/drivers/nvc0/nvc0_screen.c |2 + src/gallium/drivers/nvc0/nvc0_surface.c |3 +- src/gallium/drivers/nvc0/nvc0_transfer.c | 47 ++ 7 files changed, 76 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index ed0f8c2..fe48188 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -213,7 +213,7 @@ nv50_miptree_init_ms_mode(struct nv50_miptree *mt) } boolean -nv50_miptree_init_layout_linear(struct nv50_miptree *mt) +nv50_miptree_init_layout_linear(struct nv50_miptree *mt, unsigned pitch_align) { struct pipe_resource *pt = &mt->base.base; const unsigned blocksize = util_format_get_blocksize(pt->format); @@ -227,7 +227,7 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt) if (mt->ms_x | mt->ms_y) return FALSE; - mt->level[0].pitch = align(pt->width0 * blocksize, 64); + mt->level[0].pitch = align(pt->width0 * blocksize, pitch_align); /* Account for very generous prefetch (allocate size as if tiled). */ h = MAX2(h, 8); @@ -314,7 +314,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, if (bo_config.nv50.memtype != 0) { nv50_miptree_init_layout_tiled(mt); } else - if (!nv50_miptree_init_layout_linear(mt)) { + if (!nv50_miptree_init_layout_linear(mt, 64)) { FREE(mt); return NULL; } diff --git a/src/gallium/drivers/nv50/nv50_resource.h b/src/gallium/drivers/nv50/nv50_resource.h index a2bc980..469d812 100644 --- a/src/gallium/drivers/nv50/nv50_resource.h +++ b/src/gallium/drivers/nv50/nv50_resource.h @@ -67,7 +67,7 @@ nv50_miptree(struct pipe_resource *pt) /* Internal functions: */ boolean -nv50_miptree_init_layout_linear(struct nv50_miptree *mt); +nv50_miptree_init_layout_linear(struct nv50_miptree *mt, unsigned pitch_align); struct pipe_resource * nv50_miptree_create(struct pipe_screen *pscreen, diff --git a/src/gallium/drivers/nvc0/nvc0_2d.xml.h b/src/gallium/drivers/nvc0/nvc0_2d.xml.h index 93dba34..9a488c1 100644 --- a/src/gallium/drivers/nvc0/nvc0_2d.xml.h +++ b/src/gallium/drivers/nvc0/nvc0_2d.xml.h @@ -122,7 +122,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NVC0_2D_UNK258 0x0258 -#define NVC0_2D_UNK260 0x0260 +#define NVC0_2D_SINGLE_GPC 0x0260 #define NVC0_2D_COND_ADDRESS_HIGH 0x0264 diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index 9fcd788..2913363 100644 --- a/src/gallium/drivers/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c @@ -158,9 +158,6 @@ nvc0_miptree_init_ms_mode(struct nv50_miptree *mt) return TRUE; } -boolean -nv50_miptree_init_layout_linear(struct nv50_miptree *); - static void nvc0_miptree_init_layout_video(struct nv50_miptree *mt) { @@ -260,6 +257,21 @@ nvc0_miptree_create(struct pipe_screen *pscreen, pipe_reference_init(&pt->reference, 1); pt->screen = pscreen; + if (pt->usage == PIPE_USAGE_STAGING) { + switch (pt->target) { + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_RECT: + if (pt->last_level == 0 && + !util_format_is_depth_or_stencil(pt->format) && + pt->nr_samples <= 1) +pt->flags |= NOUVEAU_RESOURCE_FLAG_LINEAR; + break; + default: + break; + } + } + bo_config.nvc0.memtype = nvc0_mt_choose_storage_type(mt, compressed); if (!nvc0_miptree_init_ms_mode(mt)) { @@ -273,13 +285,16 @@ nvc0_miptree_create(struct pipe_screen *pscreen, if (likely(bo_config.nvc0.memtype)) { nvc0_miptree_init_layout_tiled(mt); } else - if (!nv50_miptree_init_layout_linear(mt)) { + if (!nv50_miptree_init_layout_linear(mt, 128)) { FREE(mt); return NULL; } bo_config.nvc0.tile_mode = mt->level[0].tile_mode; - mt->base.domain = NOUVEAU_BO_VRAM; + if (!bo_config.nvc0.memtype && pt->usage == PIPE_USAGE_STAGING) + mt->base.domain = NOUVEAU_BO_GART; + else + mt->base.domain = NOUVEAU_BO_VRAM; bo_flags = mt->base.domain | NOUVEAU_BO_NOSNOOP; diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 3a32539..a46fb3
Mesa (master): nvc0: honour scaled coordiantes setting for linear textures
Module: Mesa Branch: master Commit: f0a0d59f0fdceb756838ad6dad012852ba48362e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0a0d59f0fdceb756838ad6dad012852ba48362e Author: Christoph Bumiller Date: Tue Apr 2 16:24:06 2013 +0200 nvc0: honour scaled coordiantes setting for linear textures --- src/gallium/drivers/nvc0/nvc0_tex.c | 11 +-- 1 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_tex.c b/src/gallium/drivers/nvc0/nvc0_tex.c index b0e02fc..ffd2854 100644 --- a/src/gallium/drivers/nvc0/nvc0_tex.c +++ b/src/gallium/drivers/nvc0/nvc0_tex.c @@ -61,7 +61,7 @@ nvc0_create_sampler_view(struct pipe_context *pipe, { uint32_t flags = 0; - if (res->target == PIPE_TEXTURE_RECT) + if (res->target == PIPE_TEXTURE_RECT || res->target == PIPE_BUFFER) flags |= NV50_TEXVIEW_SCALED_COORDS; return nvc0_create_texture_view(pipe, res, templ, flags, res->target); @@ -122,9 +122,13 @@ nvc0_create_texture_view(struct pipe_context *pipe, if (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB) tic[2] |= NV50_TIC_2_COLORSPACE_SRGB; + if (!(flags & NV50_TEXVIEW_SCALED_COORDS)) + tic[2] |= NV50_TIC_2_NORMALIZED_COORDS; + /* check for linear storage type */ if (unlikely(!nouveau_bo_memtype(nv04_resource(texture)->bo))) { if (texture->target == PIPE_BUFFER) { + assert(!(tic[2] & NV50_TIC_2_NORMALIZED_COORDS)); address += view->pipe.u.buf.first_element * desc->block.bits / 8; tic[2] |= NV50_TIC_2_LINEAR | NV50_TIC_2_TARGET_BUFFER; @@ -135,8 +139,6 @@ nvc0_create_texture_view(struct pipe_context *pipe, } else { /* must be 2D texture without mip maps */ tic[2] |= NV50_TIC_2_LINEAR | NV50_TIC_2_TARGET_RECT; - if (texture->target != PIPE_TEXTURE_RECT) -tic[2] |= NV50_TIC_2_NORMALIZED_COORDS; tic[3] = mt->level[0].pitch; tic[4] = mt->base.base.width0; tic[5] = (1 << 16) | mt->base.base.height0; @@ -148,9 +150,6 @@ nvc0_create_texture_view(struct pipe_context *pipe, return &view->pipe; } - if (!(flags & NV50_TEXVIEW_SCALED_COORDS)) - tic[2] |= NV50_TIC_2_NORMALIZED_COORDS; - tic[2] |= ((mt->level[0].tile_mode & 0x0f0) << (22 - 4)) | ((mt->level[0].tile_mode & 0xf00) << (25 - 8)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nv50: account for pesky prefetch in size calculation of linear textures
Module: Mesa Branch: master Commit: ba9b0b682f51222752ac56e7a0615f9bbb686089 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ba9b0b682f51222752ac56e7a0615f9bbb686089 Author: Christoph Bumiller Date: Wed Apr 3 00:18:29 2013 +0200 nv50: account for pesky prefetch in size calculation of linear textures --- src/gallium/drivers/nv50/nv50_miptree.c |7 ++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 5c839a8..ed0f8c2 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -217,6 +217,7 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt) { struct pipe_resource *pt = &mt->base.base; const unsigned blocksize = util_format_get_blocksize(pt->format); + unsigned h = pt->height0; if (util_format_is_depth_or_stencil(pt->format)) return FALSE; @@ -228,7 +229,11 @@ nv50_miptree_init_layout_linear(struct nv50_miptree *mt) mt->level[0].pitch = align(pt->width0 * blocksize, 64); - mt->total_size = mt->level[0].pitch * pt->height0; + /* Account for very generous prefetch (allocate size as if tiled). */ + h = MAX2(h, 8); + h = util_next_power_of_two(h); + + mt->total_size = mt->level[0].pitch * h; return TRUE; } ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nvc0: fix for 2d engine R source formats writing RRR1 and not R001
Module: Mesa Branch: master Commit: d801545964f8183bb17ed913b7c19482dad43b6c URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d801545964f8183bb17ed913b7c19482dad43b6c Author: Christoph Bumiller Date: Sat Mar 30 21:28:30 2013 +0100 nvc0: fix for 2d engine R source formats writing RRR1 and not R001 --- src/gallium/drivers/nv50/nv50_blit.h| 40 ++ src/gallium/drivers/nv50/nv50_surface.c | 71 src/gallium/drivers/nvc0/nvc0_surface.c | 89 +-- 3 files changed, 148 insertions(+), 52 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_blit.h b/src/gallium/drivers/nv50/nv50_blit.h index d409f21..bdd6a63 100644 --- a/src/gallium/drivers/nv50/nv50_blit.h +++ b/src/gallium/drivers/nv50/nv50_blit.h @@ -180,4 +180,44 @@ nv50_blit_eng2d_get_mask(const struct pipe_blit_info *info) return mask; } +#if NOUVEAU_DRIVER == 0xc0 +# define nv50_format_table nvc0_format_table +#endif + +/* return TRUE for formats that can be converted among each other by NVC0_2D */ +static INLINE boolean +nv50_2d_dst_format_faithful(enum pipe_format format) +{ + const uint64_t mask = + NV50_ENG2D_SUPPORTED_FORMATS & + ~NV50_ENG2D_NOCONVERT_FORMATS; + uint8_t id = nv50_format_table[format].rt; + return (id >= 0xc0) && (mask & (1ULL << (id - 0xc0))); +} +static INLINE boolean +nv50_2d_src_format_faithful(enum pipe_format format) +{ + const uint64_t mask = + NV50_ENG2D_SUPPORTED_FORMATS & +~(NV50_ENG2D_LUMINANCE_FORMATS | NV50_ENG2D_INTENSITY_FORMATS); + uint8_t id = nv50_format_table[format].rt; + return (id >= 0xc0) && (mask & (1ULL << (id - 0xc0))); +} + +static INLINE boolean +nv50_2d_format_supported(enum pipe_format format) +{ + uint8_t id = nv50_format_table[format].rt; + return (id >= 0xc0) && + (NV50_ENG2D_SUPPORTED_FORMATS & (1ULL << (id - 0xc0))); +} + +static INLINE boolean +nv50_2d_dst_format_ops_supported(enum pipe_format format) +{ + uint8_t id = nv50_format_table[format].rt; + return (id >= 0xc0) && + (NV50_ENG2D_OPERATION_FORMATS & (1ULL << (id - 0xc0))); +} + #endif /* __NV50_BLIT_H__ */ diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index d482477..5d0b313 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -35,25 +35,22 @@ #include "nv50_context.h" #include "nv50_resource.h" -#include "nv50_blit.h" #include "nv50_defs.xml.h" #include "nv50_texture.xml.h" +/* these are used in nv50_blit.h */ #define NV50_ENG2D_SUPPORTED_FORMATS 0xff0843e080608409ULL +#define NV50_ENG2D_NOCONVERT_FORMATS 0x00084020ULL +#define NV50_ENG2D_LUMINANCE_FORMATS 0x00084020ULL +#define NV50_ENG2D_INTENSITY_FORMATS 0xULL +#define NV50_ENG2D_OPERATION_FORMATS 0x060001c000608000ULL -/* return TRUE for formats that can be converted among each other by NV50_2D */ -static INLINE boolean -nv50_2d_format_faithful(enum pipe_format format) -{ - uint8_t id = nv50_format_table[format].rt; - - return (id >= 0xc0) && - (NV50_ENG2D_SUPPORTED_FORMATS & (1ULL << (id - 0xc0))); -} +#define NOUVEAU_DRIVER 0x50 +#include "nv50_blit.h" static INLINE uint8_t -nv50_2d_format(enum pipe_format format) +nv50_2d_format(enum pipe_format format, boolean dst, boolean dst_src_equal) { uint8_t id = nv50_format_table[format].rt; @@ -62,6 +59,7 @@ nv50_2d_format(enum pipe_format format) */ if ((id >= 0xc0) && (NV50_ENG2D_SUPPORTED_FORMATS & (1ULL << (id - 0xc0 return id; + assert(dst_src_equal); switch (util_format_get_blocksize(format)) { case 1: @@ -78,7 +76,7 @@ nv50_2d_format(enum pipe_format format) static int nv50_2d_texture_set(struct nouveau_pushbuf *push, int dst, struct nv50_miptree *mt, unsigned level, unsigned layer, -enum pipe_format pformat) +enum pipe_format pformat, boolean dst_src_pformat_equal) { struct nouveau_bo *bo = mt->base.bo; uint32_t width, height, depth; @@ -86,7 +84,7 @@ nv50_2d_texture_set(struct nouveau_pushbuf *push, int dst, uint32_t mthd = dst ? NV50_2D_DST_FORMAT : NV50_2D_SRC_FORMAT; uint32_t offset = mt->level[level].offset; - format = nv50_2d_format(pformat); + format = nv50_2d_format(pformat, dst, dst_src_pformat_equal); if (!format) { NOUVEAU_ERR("invalid/unsupported surface format: %s\n", util_format_name(pformat)); @@ -155,15 +153,16 @@ nv50_2d_texture_do_copy(struct nouveau_pushbuf *push, const enum pipe_format dfmt = dst->base.base.format; const enum pipe_format sfmt = src->base.base.format; int ret; + boolean eqfmt = dfmt == sfmt; if (!PUSH_SPACE(push, 2 * 16 + 32)) return PIPE_ERROR; - ret = nv50_2d_texture_set(push, 1, dst, dst_level, dz, dfmt); + ret = nv50_2d_texture_set(push, 1, dst, dst_level, dz, dfmt, eqfmt); if (ret) return ret; - r
Mesa (master): nv50, nvc0: disable DEPTH_RANGE_NEAR/FAR clipping during blit
Module: Mesa Branch: master Commit: 6417d56c1921c311a7b59001e0d37822a0ed1a65 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6417d56c1921c311a7b59001e0d37822a0ed1a65 Author: Christoph Bumiller Date: Sun Mar 31 22:10:02 2013 +0200 nv50,nvc0: disable DEPTH_RANGE_NEAR/FAR clipping during blit We send position.z == 0, DEPTH_RANGE may be some arbitrary range not including 0 (for exmaple in piglit's hiz tests). --- src/gallium/drivers/nv50/nv50_surface.c |2 ++ src/gallium/drivers/nvc0/nvc0_3d.xml.h |2 +- src/gallium/drivers/nvc0/nvc0_surface.c |2 ++ 3 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 51e702c..d482477 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -976,6 +976,8 @@ nv50_blit_3d(struct nv50_context *nv50, const struct pipe_blit_info *info) BEGIN_NV04(push, NV50_3D(VIEWPORT_TRANSFORM_EN), 1); PUSH_DATA (push, 0); + BEGIN_NV04(push, NV50_3D(VIEW_VOLUME_CLIP_CTRL), 1); + PUSH_DATA (push, 0x1); /* Draw a large triangle in screen coordinates covering the whole * render target, with scissors defining the destination region. diff --git a/src/gallium/drivers/nvc0/nvc0_3d.xml.h b/src/gallium/drivers/nvc0/nvc0_3d.xml.h index 44f96a2..d3f719d 100644 --- a/src/gallium/drivers/nvc0/nvc0_3d.xml.h +++ b/src/gallium/drivers/nvc0/nvc0_3d.xml.h @@ -1041,7 +1041,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define NVC0_3D_VIEWPORT_TRANSFORM_EN 0x192c #define NVC0_3D_VIEW_VOLUME_CLIP_CTRL 0x193c -#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK0 0x0001 +#define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_DEPTH_RANGE_0_1 0x0001 #define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1__MASK 0x0006 #define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1__SHIFT 1 #define NVC0_3D_VIEW_VOLUME_CLIP_CTRL_UNK1_UNK0 0x diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c index de71127..2af7fcd 100644 --- a/src/gallium/drivers/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nvc0/nvc0_surface.c @@ -869,6 +869,8 @@ nvc0_blit_3d(struct nvc0_context *nvc0, const struct pipe_blit_info *info) z += 0.5f * dz; IMMED_NVC0(push, NVC0_3D(VIEWPORT_TRANSFORM_EN), 0); + IMMED_NVC0(push, NVC0_3D(VIEW_VOLUME_CLIP_CTRL), 0x2 | + NVC0_3D_VIEW_VOLUME_CLIP_CTRL_DEPTH_RANGE_0_1); BEGIN_NVC0(push, NVC0_3D(VIEWPORT_HORIZ(0)), 2); PUSH_DATA (push, nvc0->framebuffer.width << 16); PUSH_DATA (push, nvc0->framebuffer.height << 16); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): st/mesa: fix bitmap,drawpix, drawtex for PIPE_CAP_TGSI_TEXCOORD
Module: Mesa Branch: master Commit: e45c969fe5890472d0a49bf2f7d561f3d315be2a URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=e45c969fe5890472d0a49bf2f7d561f3d315be2a Author: Christoph Bumiller Date: Sat Mar 30 14:57:21 2013 +0100 st/mesa: fix bitmap,drawpix,drawtex for PIPE_CAP_TGSI_TEXCOORD NOTE: Changed the semantic index for the drawtex coordinate to be the texture unit index instead of always 0. Not sure if this is correct but since the value seems to depend on the unit it would make sense to use different varying slots. --- src/mesa/state_tracker/st_cb_bitmap.c |1 + src/mesa/state_tracker/st_cb_drawpixels.c |5 - src/mesa/state_tracker/st_cb_drawtex.c|4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index bae9ff8..0513814 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -766,6 +766,7 @@ st_Bitmap(struct gl_context *ctx, GLint x, GLint y, /* create pass-through vertex shader now */ const uint semantic_names[] = { TGSI_SEMANTIC_POSITION, TGSI_SEMANTIC_COLOR, +st->needs_texcoord_semantic ? TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC }; const uint semantic_indexes[] = { 0, 0, 0 }; st->bitmap.vs = util_make_vertex_passthrough_shader(st->pipe, 3, diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index f0baa34..b25b776 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -294,6 +294,9 @@ static void * make_passthrough_vertex_shader(struct st_context *st, GLboolean passColor) { + const unsigned texcoord_semantic = st->needs_texcoord_semantic ? + TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; + if (!st->drawpix.vert_shaders[passColor]) { struct ureg_program *ureg = ureg_create( TGSI_PROCESSOR_VERTEX ); @@ -307,7 +310,7 @@ make_passthrough_vertex_shader(struct st_context *st, /* MOV result.texcoord0, vertex.attr[1]; */ ureg_MOV(ureg, - ureg_DECL_output( ureg, TGSI_SEMANTIC_GENERIC, 0 ), + ureg_DECL_output( ureg, texcoord_semantic, 0 ), ureg_DECL_vs_input( ureg, 1 )); if (passColor) { diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index a8806c9..c4efce0 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -209,7 +209,9 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, SET_ATTRIB(2, attr, s1, t1, 0.0f, 1.0f); /* upper right */ SET_ATTRIB(3, attr, s0, t1, 0.0f, 1.0f); /* upper left */ -semantic_names[attr] = TGSI_SEMANTIC_GENERIC; +semantic_names[attr] = st->needs_texcoord_semantic ? + TGSI_SEMANTIC_TEXCOORD : TGSI_SEMANTIC_GENERIC; +/* XXX: should this use semantic index i instead of 0 ? */ semantic_indexes[attr] = 0; attr++; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nouveau: accelerate buffer copies in resource_copy_region
Module: Mesa Branch: master Commit: 2a8145d36b0f04d0f26c1628222a8b5c4830f435 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2a8145d36b0f04d0f26c1628222a8b5c4830f435 Author: Christoph Bumiller Date: Sat Mar 30 15:55:20 2013 +0100 nouveau: accelerate buffer copies in resource_copy_region --- src/gallium/drivers/nouveau/nouveau_buffer.c | 34 ++ src/gallium/drivers/nouveau/nouveau_buffer.h |7 +++-- src/gallium/drivers/nv30/nv30_miptree.c |5 ++- src/gallium/drivers/nv50/nv50_surface.c |6 ++-- src/gallium/drivers/nvc0/nvc0_surface.c |6 ++-- 5 files changed, 47 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index 5c9a44e..02bc6f0 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -2,6 +2,7 @@ #include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_surface.h" #include "nouveau_screen.h" #include "nouveau_context.h" @@ -460,6 +461,39 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe, } +void +nouveau_copy_buffer(struct nouveau_context *nv, +struct nv04_resource *dst, unsigned dstx, +struct nv04_resource *src, unsigned srcx, unsigned size) +{ + assert(dst->base.target == PIPE_BUFFER && src->base.target == PIPE_BUFFER); + + if (likely(dst->domain) && likely(src->domain)) { + nv->copy_data(nv, +dst->bo, dst->offset + dstx, dst->domain, +src->bo, src->offset + srcx, src->domain, size); + + dst->status |= NOUVEAU_BUFFER_STATUS_GPU_WRITING; + nouveau_fence_ref(nv->screen->fence.current, &dst->fence); + nouveau_fence_ref(nv->screen->fence.current, &dst->fence_wr); + + src->status |= NOUVEAU_BUFFER_STATUS_GPU_READING; + nouveau_fence_ref(nv->screen->fence.current, &src->fence); + } else { + struct pipe_box src_box; + src_box.x = srcx; + src_box.y = 0; + src_box.z = 0; + src_box.width = size; + src_box.height = 1; + src_box.depth = 1; + util_resource_copy_region(&nv->pipe, +&dst->base, 0, dstx, 0, 0, +&src->base, 0, &src_box); + } +} + + void * nouveau_resource_map_offset(struct nouveau_context *nv, struct nv04_resource *res, uint32_t offset, diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.h b/src/gallium/drivers/nouveau/nouveau_buffer.h index aafc842..fd7a3f1 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.h +++ b/src/gallium/drivers/nouveau/nouveau_buffer.h @@ -49,9 +49,10 @@ struct nv04_resource { void nouveau_buffer_release_gpu_storage(struct nv04_resource *); -boolean -nouveau_buffer_download(struct nouveau_context *, struct nv04_resource *, -unsigned start, unsigned size); +void +nouveau_copy_buffer(struct nouveau_context *, +struct nv04_resource *dst, unsigned dst_pos, +struct nv04_resource *src, unsigned src_pos, unsigned size); boolean nouveau_buffer_migrate(struct nouveau_context *, diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index d4dcacb..f536287 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -130,8 +130,9 @@ nv30_resource_copy_region(struct pipe_context *pipe, struct nv30_rect src, dst; if (dstres->target == PIPE_BUFFER && srcres->target == PIPE_BUFFER) { - util_resource_copy_region(pipe, dstres, dst_level, dstx, dsty, dstz, - srcres, src_level, src_box); + nouveau_copy_buffer(&nv30->base, + nv04_resource(dstres), dstx, + nv04_resource(srcres), src_box->x, src_box->width); return; } diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index b29a736..51e702c 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -200,10 +200,10 @@ nv50_resource_copy_region(struct pipe_context *pipe, boolean m2mf; unsigned dst_layer = dstz, src_layer = src_box->z; - /* Fallback for buffers. */ if (dst->target == PIPE_BUFFER && src->target == PIPE_BUFFER) { - util_resource_copy_region(pipe, dst, dst_level, dstx, dsty, dstz, -src, src_level, src_box); + nouveau_copy_buffer(&nv50->base, + nv04_resource(dst), dstx, + nv04_resource(src), src_box->x, src_box->width); return; } diff --git a/src/gallium/drivers/nvc0/nvc0_surface.c b/src/gallium/drivers/nvc0/nvc0_surface.c index 95f3ff4..de71127 100644 --- a/src/gallium/drivers/nvc0/nvc0_surface.c +++ b/src/gallium/drivers/nvc0/nvc
Mesa (master): nvc0: demagic some of the NVE4_COMPUTE_UPLOAD methods
Module: Mesa Branch: master Commit: 3ed4bbd76904983ca4b19a58afd2187f497b4ab0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ed4bbd76904983ca4b19a58afd2187f497b4ab0 Author: Christoph Bumiller Date: Mon Apr 1 21:46:24 2013 +0200 nvc0: demagic some of the NVE4_COMPUTE_UPLOAD methods It's actually the same as P2MF. --- src/gallium/drivers/nvc0/nve4_compute.c | 58 +++--- src/gallium/drivers/nvc0/nve4_compute.h |4 - src/gallium/drivers/nvc0/nve4_compute.xml.h | 116 +++ 3 files changed, 129 insertions(+), 49 deletions(-) diff --git a/src/gallium/drivers/nvc0/nve4_compute.c b/src/gallium/drivers/nvc0/nve4_compute.c index 89da7d5..d7aa61e 100644 --- a/src/gallium/drivers/nvc0/nve4_compute.c +++ b/src/gallium/drivers/nvc0/nve4_compute.c @@ -129,14 +129,14 @@ nve4_screen_compute_setup(struct nvc0_screen *screen, IMMED_NVC0(push, SUBC_COMPUTE(0x02c4), 1); /* MS sample coordinate offsets: these do not work with _ALT modes ! */ - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_ADDRESS_HIGH), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_DST_ADDRESS_HIGH), 2); PUSH_DATAh(push, screen->parm->offset + NVE4_CP_INPUT_MS_OFFSETS); PUSH_DATA (push, screen->parm->offset + NVE4_CP_INPUT_MS_OFFSETS); - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_SIZE), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_LINE_LENGTH_IN), 2); PUSH_DATA (push, 64); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_UNK0184_UNKVAL); + PUSH_DATA (push, 1); BEGIN_1IC0(push, NVE4_COMPUTE(UPLOAD_EXEC), 17); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_UNKVAL_DATA); + PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_LINEAR | (0x20 << 1)); PUSH_DATA (push, 0); /* 0 */ PUSH_DATA (push, 0); PUSH_DATA (push, 1); /* 1 */ @@ -155,14 +155,14 @@ nve4_screen_compute_setup(struct nvc0_screen *screen, PUSH_DATA (push, 1); #ifdef DEBUG - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_ADDRESS_HIGH), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_DST_ADDRESS_HIGH), 2); PUSH_DATAh(push, screen->parm->offset + NVE4_CP_INPUT_TRAP_INFO_PTR); PUSH_DATA (push, screen->parm->offset + NVE4_CP_INPUT_TRAP_INFO_PTR); - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_SIZE), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_LINE_LENGTH_IN), 2); PUSH_DATA (push, 28); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_UNK0184_UNKVAL); + PUSH_DATA (push, 1); BEGIN_1IC0(push, NVE4_COMPUTE(UPLOAD_EXEC), 8); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_UNKVAL_DATA); + PUSH_DATA (push, 1); PUSH_DATA (push, screen->parm->offset + NVE4_CP_PARAM_TRAP_INFO); PUSH_DATAh(push, screen->parm->offset + NVE4_CP_PARAM_TRAP_INFO); PUSH_DATA (push, screen->tls->offset); @@ -199,14 +199,14 @@ nve4_compute_validate_surfaces(struct nvc0_context *nvc0) * NVE4's surface load/store instructions receive all the information * directly instead of via binding points, so we have to supply them. */ - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_ADDRESS_HIGH), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_DST_ADDRESS_HIGH), 2); PUSH_DATAh(push, screen->parm->offset + NVE4_CP_INPUT_SUF(i)); PUSH_DATA (push, screen->parm->offset + NVE4_CP_INPUT_SUF(i)); - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_SIZE), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_LINE_LENGTH_IN), 2); PUSH_DATA (push, 64); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_UNK0184_UNKVAL); + PUSH_DATA (push, 1); BEGIN_1IC0(push, NVE4_COMPUTE(UPLOAD_EXEC), 17); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_UNKVAL_DATA); + PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_LINEAR | (0x20 << 1)); nve4_set_surface_info(push, nvc0->surfaces[t][i], screen); @@ -279,14 +279,14 @@ nve4_compute_set_tex_handles(struct nvc0_context *nvc0) address = nvc0->screen->parm->offset + NVE4_CP_INPUT_TEX(i); - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_ADDRESS_HIGH), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_DST_ADDRESS_HIGH), 2); PUSH_DATAh(push, address); PUSH_DATA (push, address); - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_SIZE), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_LINE_LENGTH_IN), 2); PUSH_DATA (push, n * 4); PUSH_DATA (push, 0x1); BEGIN_1IC0(push, NVE4_COMPUTE(UPLOAD_EXEC), 1 + n); - PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_UNKVAL_DATA); + PUSH_DATA (push, NVE4_COMPUTE_UPLOAD_EXEC_LINEAR | (0x20 << 1)); PUSH_DATAp(push, &nvc0->tex_handles[s][i], n); BEGIN_NVC0(push, NVE4_COMPUTE(FLUSH), 1); @@ -365,24 +365,24 @@ nve4_compute_upload_input(struct nvc0_context *nvc0, const void *input, struct nvc0_program *cp = nvc0->compprog; if (cp->parm_size) { - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_ADDRESS_HIGH), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_DST_ADDRESS_HIGH), 2); PUSH_DATAh(push, screen->parm->offset); PUSH_DATA (push, screen->parm->offset); - BEGIN_NVC0(push, NVE4_COMPUTE(UPLOAD_SIZE), 2); + BEGIN_NVC0(push, NVE4_COMPUTE(UPLOA
Mesa (master): nvc0: read PM counters for each warp scheduler separately
Module: Mesa Branch: master Commit: fb0334adb3c9d20016c15e5706a6dfe1fc70ba88 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb0334adb3c9d20016c15e5706a6dfe1fc70ba88 Author: Christoph Bumiller Date: Tue Apr 2 18:24:45 2013 +0200 nvc0: read PM counters for each warp scheduler separately --- src/gallium/drivers/nvc0/nvc0_query.c | 184 ++- src/gallium/drivers/nvc0/nvc0_screen.h | 15 ++-- 2 files changed, 138 insertions(+), 61 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_query.c b/src/gallium/drivers/nvc0/nvc0_query.c index 0fe8ae0..35d5d46 100644 --- a/src/gallium/drivers/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nvc0/nvc0_query.c @@ -159,8 +159,33 @@ nvc0_query_create(struct pipe_context *pipe, unsigned type) nvc0->screen->base.device->drm_version >= 0x01000101) { if (type >= NVE4_PM_QUERY(0) && type <= NVE4_PM_QUERY_LAST) { -/* 8 counters per MP + clock */ -space = 12 * nvc0->screen->mp_count * sizeof(uint32_t); +/* for each MP: + * [00] = WS0.C0 + * [04] = WS0.C1 + * [08] = WS0.C2 + * [0c] = WS0.C3 + * [10] = WS0.C0 + * [14] = WS1.C1 + * [18] = WS1.C2 + * [1c] = WS1.C3 + * [20] = WS1.C0 + * [24] = WS2.C1 + * [28] = WS2.C2 + * [2c] = WS2.C3 + * [30] = WS3.C0 + * [34] = WS3.C1 + * [38] = WS3.C2 + * [3c] = WS3.C3 + * [40] = MP.C4 + * [44] = MP.C5 + * [48] = MP.C6 + * [4c] = MP.C7 + * [50] = WS0.sequence + * [54] = WS1.sequence + * [58] = WS2.sequence + * [5c] = WS3.sequence + */ +space = (4 * 4 + 4 + 4) * nvc0->screen->mp_count * sizeof(uint32_t); break; } } @@ -634,36 +659,82 @@ static const char *nvc0_drv_stat_names[] = */ static const uint64_t nve4_read_mp_pm_counters_code[] = { - 0x2042004270420047ULL, /* sched */ - 0x280040001de4ULL, /* mov b32 $r0 c0[0] (04) */ - 0x2c000c009c04ULL, /* mov b32 $r2 $physid (20) */ - 0x2800400010005de4ULL, /* mov b32 $r1 c0[4] (04) */ - 0x2c008400dc04ULL, /* mov b32 $r3 $tidx (27) */ - 0x7000c01050209c03ULL, /* ext u32 $r2 $r2 0x0414 (04) */ - 0x2c0010011c04ULL, /* mov b32 $r4 $pm0 (20) */ - 0x190efc33dc03ULL, /* set $p1 eq u32 $r3 0 (04) */ - 0x2280428042804277ULL, /* sched */ - 0x2c0014015c04ULL, /* mov b32 $r5 $pm1 (27) */ - 0x1000c0209c02ULL, /* mul $r2 u32 $r2 u32 48 (04) */ - 0x2c0018019c04ULL, /* mov b32 $r6 $pm2 (28) */ - 0x480108001c03ULL, /* add b32 ($r0 $c) $r0 $r2 (04) */ - 0x2c001c01dc04ULL, /* mov b32 $r7 $pm3 (28) */ - 0x08105c42ULL, /* add b32 $r1 $r1 0 $c (04) */ - 0x2c0140009c04ULL, /* mov b32 $r2 $clock (28) */ - 0x2042804200420047ULL, /* sched */ - 0x940107c5ULL, /* $p1 st b128 wt g[$r0d] $r4q (04) */ - 0x2c0020011c04ULL, /* mov b32 $r4 $pm4 (20) */ - 0x2c0024015c04ULL, /* mov b32 $r5 $pm5 (04) */ - 0x2c0028019c04ULL, /* mov b32 $r6 $pm6 (20) */ - 0x2c002c01dc04ULL, /* mov b32 $r7 $pm7 (04) */ - 0x2c014400dc04ULL, /* mov b32 $r3 $clockhi (28) */ - 0x9400400107c5ULL, /* $p1 st b128 wt g[$r0d+16] $r4q (04) */ - 0x22e042804207ULL, /* sched */ - 0x2800400020011de4ULL, /* mov b32 $r4 c0[8] (20) */ - 0x2c000c015c04ULL, /* mov b32 $r5 $physid (04) */ - 0x9400800087a5ULL, /* $p1 st b64 wt g[$r0d+32] $r2d (28) */ - 0x9400a00107a5ULL, /* $p1 st b64 wt g[$r0d+40] $r4d (04) */ - 0x80001de7ULL /* exit (2e) */ + /* sched 0x20 0x20 0x20 0x20 0x20 0x20 0x20 +* mov b32 $r8 $tidx +* mov b32 $r12 $physid +* mov b32 $r0 $pm0 +* mov b32 $r1 $pm1 +* mov b32 $r2 $pm2 +* mov b32 $r3 $pm3 +* mov b32 $r4 $pm4 +* sched 0x20 0x20 0x23 0x04 0x20 0x04 0x2b +* mov b32 $r5 $pm5 +* mov b32 $r6 $pm6 +* mov b32 $r7 $pm7 +* set $p0 0x1 eq u32 $r8 0x0 +* mov b32 $r10 c0[0x0] +* ext u32 $r8 $r12 0x414 +* mov b32 $r11 c0[0x4] +* sched 0x04 0x2e 0x04 0x20 0x20 0x28 0x04 +* ext u32 $r9 $r12 0x208 +* (not $p0) exit +* set $p1 0x1 eq u32 $r9 0x0 +* mul $r8 u32 $r8 u32 96 +* mul $r12 u32 $r9 u32 16 +* mul $r13 u32 $r9 u32 4 +* add b32 $r9 $r8 $r13 +* sched 0x28 0x04 0x2c 0x04 0x2c 0x04 0x2c +* add b32 $r8 $r8 $r12 +* mov b32 $r12 $r10 +* add b32 $r10 $c $r10 $r8 +* mov b32 $r13 $r11 +* add b32 $r11 $r11 0x0 $c +* add b32 $r12 $c $r12 $r9 +* st b128 wt g[$r10d] $r0q +* sched 0x4 0x2c 0x20 0x04 0x2e 0x00 0x00 +* mov b32 $r0 c0[0x8] +* add b32 $r13 $r13 0x0 $c +* $p1 st b128 wt g[$r12d+0x40] $r4q +* st b32 wt g[$r12d+0x50] $r0 +* exit */ + 0x2202020202020207ULL, + 0x2c0084021c04ULL, + 0x2c000c031
Mesa (master): nvc0: add some metrics to driver specific queries
Module: Mesa Branch: master Commit: 7bac075f25b803039fa8629028e15c5184cc8aad URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7bac075f25b803039fa8629028e15c5184cc8aad Author: Christoph Bumiller Date: Mon Apr 1 17:25:40 2013 +0200 nvc0: add some metrics to driver specific queries --- src/gallium/drivers/nvc0/nvc0_query.c | 209 +++- src/gallium/drivers/nvc0/nvc0_screen.h |9 +- 2 files changed, 160 insertions(+), 58 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_query.c b/src/gallium/drivers/nvc0/nvc0_query.c index 52fff45..0fe8ae0 100644 --- a/src/gallium/drivers/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nvc0/nvc0_query.c @@ -701,7 +701,14 @@ static const char *nve4_pm_query_names[] = "branch", "divergent_branch", "active_warps", - "active_cycles" + "active_cycles", + /* metrics, i.e. functions of the MP counters */ + "metric-ipc", /* inst_executed, clock */ + "metric-ipac", /* inst_executed, active_cycles */ + "metric-ipec", /* inst_executed, (bool)inst_executed */ + "metric-achieved_occupancy",/* active_warps, active_cycles */ + "metric-sm_efficiency", /* active_cycles, clock */ + "metric-inst_replay_overhead" /* inst_issued, inst_executed */ }; /* For simplicity, we will allocate as many group slots as we allocate counter @@ -715,59 +722,94 @@ struct nve4_mp_counter_cfg uint32_t func: 16; /* mask or 4-bit logic op (depending on mode) */ uint32_t mode: 4; /* LOGOP,B6,LOGOP_B6(_PULSE) */ uint32_t pad : 3; - uint32_t sig_dom : 1; /* if 0, MP_PM_A, if 1, MP_PM_B */ + uint32_t sig_dom : 1; /* if 0, MP_PM_A (per warp-sched), if 1, MP_PM_B */ uint32_t sig_sel : 8; /* signal group */ uint32_t src_sel : 32; /* signal selection for up to 5 sources */ }; +#define NVE4_COUNTER_OPn_SUM0 +#define NVE4_COUNTER_OPn_OR 1 +#define NVE4_COUNTER_OPn_AND2 +#define NVE4_COUNTER_OP2_REL_SUM_MM 3 /* (sum(ctr0) - sum(ctr1)) / sum(ctr0) */ +#define NVE4_COUNTER_OP2_DIV_SUM_M0 4 /* sum(ctr0) / ctr1 of MP[0]) */ +#define NVE4_COUNTER_OP2_AVG_DIV_MM 5 /* avg(ctr0 / ctr1) */ +#define NVE4_COUNTER_OP2_AVG_DIV_M0 6 /* avg(ctr0) / ctr1 of MP[0]) */ + struct nve4_mp_pm_query_cfg { struct nve4_mp_counter_cfg ctr[4]; uint8_t num_counters; - uint8_t op; /* PIPE_LOGICOP_CLEAR(for ADD),OR,AND */ + uint8_t op; + uint8_t norm[2]; /* normalization num,denom */ }; -#define _Q1A(n, f, m, g, s) [NVE4_PM_QUERY_##n] = { { { f, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m, 0, 0, NVE4_COMPUTE_MP_PM_A_SIGSEL_##g, s }, {}, {}, {} }, 1, PIPE_LOGICOP_CLEAR } -#define _Q1B(n, f, m, g, s) [NVE4_PM_QUERY_##n] = { { { f, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m, 0, 1, NVE4_COMPUTE_MP_PM_B_SIGSEL_##g, s }, {}, {}, {} }, 1, PIPE_LOGICOP_CLEAR } - +#define _Q1A(n, f, m, g, s, nu, dn) [NVE4_PM_QUERY_##n] = { { { f, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m, 0, 0, NVE4_COMPUTE_MP_PM_A_SIGSEL_##g, s }, {}, {}, {} }, 1, NVE4_COUNTER_OPn_SUM, { nu, dn } } +#define _Q1B(n, f, m, g, s, nu, dn) [NVE4_PM_QUERY_##n] = { { { f, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m, 0, 1, NVE4_COMPUTE_MP_PM_B_SIGSEL_##g, s }, {}, {}, {} }, 1, NVE4_COUNTER_OPn_SUM, { nu, dn } } +#define _M2A(n, f0, m0, g0, s0, f1, m1, g1, s1, o, nu, dn) [NVE4_PM_QUERY_METRIC_##n] = { { \ + { f0, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m0, 0, 0, NVE4_COMPUTE_MP_PM_A_SIGSEL_##g0, s0 }, \ + { f1, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m1, 0, 0, NVE4_COMPUTE_MP_PM_A_SIGSEL_##g1, s1 }, \ + {}, {}, }, 2, NVE4_COUNTER_OP2_##o, { nu, dn } } +#define _M2B(n, f0, m0, g0, s0, f1, m1, g1, s1, o, nu, dn) [NVE4_PM_QUERY_METRIC_##n] = { { \ + { f0, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m0, 0, 1, NVE4_COMPUTE_MP_PM_B_SIGSEL_##g0, s0 }, \ + { f1, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m1, 0, 1, NVE4_COMPUTE_MP_PM_B_SIGSEL_##g1, s1 }, \ + {}, {}, }, 2, NVE4_COUNTER_OP2_##o, { nu, dn } } +#define _M2AB(n, f0, m0, g0, s0, f1, m1, g1, s1, o, nu, dn) [NVE4_PM_QUERY_METRIC_##n] = { { \ + { f0, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m0, 0, 0, NVE4_COMPUTE_MP_PM_A_SIGSEL_##g0, s0 }, \ + { f1, NVE4_COMPUTE_MP_PM_FUNC_MODE_##m1, 0, 1, NVE4_COMPUTE_MP_PM_B_SIGSEL_##g1, s1 }, \ + {}, {}, }, 2, NVE4_COUNTER_OP2_##o, { nu, dn } } + +/* NOTES: + * active_warps: bit 0 alternates btw 0 and 1 for odd nr of warps + * inst_executed etc.: we only count a single warp scheduler + * metric-ipXc: we simply multiply by 4 to account for the 4 warp schedulers; + * this is inaccurate ! + */ static const struct nve4_mp_pm_query_cfg nve4_mp_pm_queries[] = { - _Q1A(PROF_TRIGGER_0, 0x0001, B6, USER, 0x), - _Q1A(PROF_TRIGGER_1, 0x0001, B6, USER, 0x0004), - _Q1A(PROF_TRIGGER_2, 0x0001, B6, USER, 0x0008), - _Q1A(PROF_TRIGGER_3, 0x0001, B6, USER, 0x000c), - _Q1A(PROF_TRIGGER_4, 0x0001, B6, USER, 0x0010), - _Q1A(PROF_TRIGGER_5, 0x0001, B6, USER, 0x0014), - _Q1A(PROF_TRIGGER_6, 0x0
Mesa (master): nvc0: add some driver statistics queries
Module: Mesa Branch: master Commit: 198f514aa6f08bc43a3002519843b0fe94f340bd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=198f514aa6f08bc43a3002519843b0fe94f340bd Author: Christoph Bumiller Date: Fri Mar 29 16:30:58 2013 +0100 nvc0: add some driver statistics queries --- src/gallium/drivers/nouveau/nouveau_buffer.c | 30 ++ src/gallium/drivers/nouveau/nouveau_fence.c|2 + src/gallium/drivers/nouveau/nouveau_screen.h | 55 ++ src/gallium/drivers/nv50/nv50_miptree.c|4 + src/gallium/drivers/nvc0/nvc0_context.c|4 + src/gallium/drivers/nvc0/nvc0_miptree.c|4 + src/gallium/drivers/nvc0/nvc0_query.c | 134 src/gallium/drivers/nvc0/nvc0_screen.h | 46 - src/gallium/drivers/nvc0/nvc0_state_validate.c |2 + src/gallium/drivers/nvc0/nvc0_surface.c|4 + src/gallium/drivers/nvc0/nvc0_tex.c|1 + src/gallium/drivers/nvc0/nvc0_transfer.c |6 + src/gallium/drivers/nvc0/nvc0_vbo.c| 10 ++ src/gallium/drivers/nvc0/nvc0_vbo_translate.c |2 + 14 files changed, 279 insertions(+), 25 deletions(-) diff --git a/src/gallium/drivers/nouveau/nouveau_buffer.c b/src/gallium/drivers/nouveau/nouveau_buffer.c index e3cbaf6..5c9a44e 100644 --- a/src/gallium/drivers/nouveau/nouveau_buffer.c +++ b/src/gallium/drivers/nouveau/nouveau_buffer.c @@ -51,12 +51,14 @@ nouveau_buffer_allocate(struct nouveau_screen *screen, &buf->bo, &buf->offset); if (!buf->bo) return nouveau_buffer_allocate(screen, buf, NOUVEAU_BO_GART); + NOUVEAU_DRV_STAT(screen, buf_obj_current_bytes_vid, buf->base.width0); } else if (domain == NOUVEAU_BO_GART) { buf->mm = nouveau_mm_allocate(screen->mm_GART, size, &buf->bo, &buf->offset); if (!buf->bo) return FALSE; + NOUVEAU_DRV_STAT(screen, buf_obj_current_bytes_sys, buf->base.width0); } else { assert(domain == 0); if (!nouveau_buffer_malloc(buf)) @@ -85,6 +87,11 @@ nouveau_buffer_release_gpu_storage(struct nv04_resource *buf) if (buf->mm) release_allocation(&buf->mm, buf->fence); + if (buf->domain == NOUVEAU_BO_VRAM) + NOUVEAU_DRV_STAT_RES(buf, buf_obj_current_bytes_vid, -(uint64_t)buf->base.width0); + if (buf->domain == NOUVEAU_BO_GART) + NOUVEAU_DRV_STAT_RES(buf, buf_obj_current_bytes_sys, -(uint64_t)buf->base.width0); + buf->domain = 0; } @@ -117,6 +124,8 @@ nouveau_buffer_destroy(struct pipe_screen *pscreen, nouveau_fence_ref(NULL, &res->fence_wr); FREE(res); + + NOUVEAU_DRV_STAT(nouveau_screen(pscreen), buf_obj_current_count, -1); } static uint8_t * @@ -153,6 +162,8 @@ nouveau_transfer_read(struct nouveau_context *nv, struct nouveau_transfer *tx) const unsigned base = tx->base.box.x; const unsigned size = tx->base.box.width; + NOUVEAU_DRV_STAT(nv->screen, buf_read_bytes_staging_vid, size); + nv->copy_data(nv, tx->bo, tx->offset, NOUVEAU_BO_GART, buf->bo, buf->offset + base, buf->domain, size); @@ -179,6 +190,11 @@ nouveau_transfer_write(struct nouveau_context *nv, struct nouveau_transfer *tx, else buf->status |= NOUVEAU_BUFFER_STATUS_DIRTY; + if (buf->domain == NOUVEAU_BO_VRAM) + NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_vid, size); + if (buf->domain == NOUVEAU_BO_GART) + NOUVEAU_DRV_STAT(nv->screen, buf_write_bytes_staging_sys, size); + if (tx->bo) nv->copy_data(nv, buf->bo, buf->offset + base, buf->domain, tx->bo, tx->offset + offset, NOUVEAU_BO_GART, size); @@ -197,11 +213,15 @@ nouveau_buffer_sync(struct nv04_resource *buf, unsigned rw) if (rw == PIPE_TRANSFER_READ) { if (!buf->fence_wr) return TRUE; + NOUVEAU_DRV_STAT_RES(buf, buf_non_kernel_fence_sync_count, + !nouveau_fence_signalled(buf->fence_wr)); if (!nouveau_fence_wait(buf->fence_wr)) return FALSE; } else { if (!buf->fence) return TRUE; + NOUVEAU_DRV_STAT_RES(buf, buf_non_kernel_fence_sync_count, + !nouveau_fence_signalled(buf->fence)); if (!nouveau_fence_wait(buf->fence)) return FALSE; @@ -320,6 +340,11 @@ nouveau_buffer_transfer_map(struct pipe_context *pipe, nouveau_buffer_transfer_init(tx, resource, box, usage); *ptransfer = &tx->base; + if (usage & PIPE_TRANSFER_READ) + NOUVEAU_DRV_STAT(nv->screen, buf_transfers_rd, 1); + if (usage & PIPE_TRANSFER_WRITE) + NOUVEAU_DRV_STAT(nv->screen, buf_transfers_wr, 1); + if (buf->domain == NOUVEAU_BO_VRAM) { if (usage & NOUVEAU_TRANSFER_DISCARD) { if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) @@ -427,6 +452,9 @@ nouveau_buffer_transfer_unmap(struct pipe_context *pipe, } } + if (!tx->bo && (tx->base.usage & PIPE_
Mesa (master): nvc0: disable compressed storage type 0xdb for now
Module: Mesa Branch: master Commit: 7628cc247feecfb31aff97f47f039ebe476f0ca8 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7628cc247feecfb31aff97f47f039ebe476f0ca8 Author: Christoph Bumiller Date: Sun Mar 31 20:10:23 2013 +0200 nvc0: disable compressed storage type 0xdb for now Single-sample color compression doesn't seem that useful anyway. --- src/gallium/drivers/nvc0/nvc0_miptree.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_miptree.c b/src/gallium/drivers/nvc0/nvc0_miptree.c index 1136804..412cca4 100644 --- a/src/gallium/drivers/nvc0/nvc0_miptree.c +++ b/src/gallium/drivers/nvc0/nvc0_miptree.c @@ -101,9 +101,11 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, boolean compressed) } break; case 32: - if (compressed) { + if (compressed && ms) { switch (ms) { + /* This one makes things blurry: case 0: tile_flags = 0xdb; break; + */ case 1: tile_flags = 0xdd; break; case 2: tile_flags = 0xdf; break; case 3: tile_flags = 0xe4; break; ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nvc0: use correct hw query for PRIMITIVES_GENERATED
Module: Mesa Branch: master Commit: ea12fc3f6c154ac32573f6c0039af21676ad1c18 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea12fc3f6c154ac32573f6c0039af21676ad1c18 Author: Christoph Bumiller Date: Fri Mar 29 15:11:16 2013 +0100 nvc0: use correct hw query for PRIMITIVES_GENERATED It was the same as SO_STATISTICS[1] before. --- src/gallium/drivers/nvc0/nvc0_query.c | 11 +++ 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_query.c b/src/gallium/drivers/nvc0/nvc0_query.c index cd0dacd..2c8fcfa 100644 --- a/src/gallium/drivers/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nvc0/nvc0_query.c @@ -129,12 +129,15 @@ nvc0_query_create(struct pipe_context *pipe, unsigned type) q->is64bit = TRUE; space = 64; break; + case PIPE_QUERY_PRIMITIVES_GENERATED: + case PIPE_QUERY_PRIMITIVES_EMITTED: + q->is64bit = TRUE; + space = 32; + break; case PIPE_QUERY_TIME_ELAPSED: case PIPE_QUERY_TIMESTAMP: case PIPE_QUERY_TIMESTAMP_DISJOINT: case PIPE_QUERY_GPU_FINISHED: - case PIPE_QUERY_PRIMITIVES_GENERATED: - case PIPE_QUERY_PRIMITIVES_EMITTED: space = 32; break; case NVC0_QUERY_TFB_BUFFER_OFFSET: @@ -234,7 +237,7 @@ nvc0_query_begin(struct pipe_context *pipe, struct pipe_query *pq) } break; case PIPE_QUERY_PRIMITIVES_GENERATED: - nvc0_query_get(push, q, 0x10, 0x06805002 | (q->index << 5)); + nvc0_query_get(push, q, 0x10, 0x09005002 | (q->index << 5)); break; case PIPE_QUERY_PRIMITIVES_EMITTED: nvc0_query_get(push, q, 0x10, 0x05805002 | (q->index << 5)); @@ -295,7 +298,7 @@ nvc0_query_end(struct pipe_context *pipe, struct pipe_query *pq) } break; case PIPE_QUERY_PRIMITIVES_GENERATED: - nvc0_query_get(push, q, 0, 0x06805002 | (q->index << 5)); + nvc0_query_get(push, q, 0, 0x09005002 | (q->index << 5)); break; case PIPE_QUERY_PRIMITIVES_EMITTED: nvc0_query_get(push, q, 0, 0x05805002 | (q->index << 5)); ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): nvc0: use fence to check state of queries that don' t write sequence
Module: Mesa Branch: master Commit: 6bca4e7085b5ce76ae065f40df39f6e3481d7475 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6bca4e7085b5ce76ae065f40df39f6e3481d7475 Author: Christoph Bumiller Date: Fri Mar 29 13:50:44 2013 +0100 nvc0: use fence to check state of queries that don't write sequence This still isn't optimal, since the fence will signal a bit late, but better than checking on the bo, which may never be ready if it is shared (which is likely). --- src/gallium/drivers/nvc0/nvc0_query.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/gallium/drivers/nvc0/nvc0_query.c b/src/gallium/drivers/nvc0/nvc0_query.c index 5c4431e..cd0dacd 100644 --- a/src/gallium/drivers/nvc0/nvc0_query.c +++ b/src/gallium/drivers/nvc0/nvc0_query.c @@ -46,6 +46,7 @@ struct nvc0_query { boolean is64bit; uint8_t rotate; int nesting; /* only used for occlusion queries */ + struct nouveau_fence *fence; struct nouveau_mm_allocation *mm; }; @@ -98,6 +99,7 @@ static void nvc0_query_destroy(struct pipe_context *pipe, struct pipe_query *pq) { nvc0_query_allocate(nvc0_context(pipe), nvc0_query(pq), 0); + nouveau_fence_ref(NULL, &nvc0_query(pq)->fence); FREE(nvc0_query(pq)); } @@ -337,13 +339,15 @@ nvc0_query_end(struct pipe_context *pipe, struct pipe_query *pq) nve4_mp_pm_query_end(nvc0, q); break; } + if (q->is64bit) + nouveau_fence_ref(nvc0->screen->base.fence.current, &q->fence); } static INLINE void nvc0_query_update(struct nouveau_client *cli, struct nvc0_query *q) { if (q->is64bit) { - if (!nouveau_bo_map(q->bo, NOUVEAU_BO_RD | NOUVEAU_BO_NOBLOCK, cli)) + if (nouveau_fence_signalled(q->fence)) q->state = NVC0_QUERY_STATE_READY; } else { if (q->data[0] == q->sequence) ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium/hud: add support for PIPE_QUERY_PIPELINE_STATISTICS
Module: Mesa Branch: master Commit: 3d2790cead7eb744341e8b1708b7a6d03524768d URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3d2790cead7eb744341e8b1708b7a6d03524768d Author: Christoph Bumiller Date: Fri Mar 29 13:56:35 2013 +0100 gallium/hud: add support for PIPE_QUERY_PIPELINE_STATISTICS Also, renamed "pixels-rendered" to "samples-passed" because the occlusion counter increments even if colour and depth writes are disabled, or (on some implementations) for killed fragments that passed the depth test when PS early_fragment_tests is set. --- src/gallium/auxiliary/hud/hud_context.c | 45 +++-- src/gallium/auxiliary/hud/hud_cpu.c |6 ++- src/gallium/auxiliary/hud/hud_driver_query.c |9 +++-- src/gallium/auxiliary/hud/hud_private.h |1 + 4 files changed, 52 insertions(+), 9 deletions(-) diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c index 9b7b63f..5511f8e 100644 --- a/src/gallium/auxiliary/hud/hud_context.c +++ b/src/gallium/auxiliary/hud/hud_context.c @@ -90,6 +90,10 @@ struct hud_context { unsigned max_num_vertices; unsigned num_vertices; } text, bg, whitelines; + + struct { + boolean query_pipeline_statistics; + } cap; }; @@ -719,15 +723,45 @@ hud_parse_env_var(struct hud_context *hud, const char *env) else if (sscanf(name, "cpu%u%s", &i, s) == 1) { hud_cpu_graph_install(pane, i); } - else if (strcmp(name, "pixels-rendered") == 0 && + else if (strcmp(name, "samples-passed") == 0 && has_occlusion_query(hud->pipe->screen)) { - hud_pipe_query_install(pane, hud->pipe, "pixels-rendered", -PIPE_QUERY_OCCLUSION_COUNTER, 0, FALSE); + hud_pipe_query_install(pane, hud->pipe, "samples-passed", +PIPE_QUERY_OCCLUSION_COUNTER, 0, 0, FALSE); } else if (strcmp(name, "primitives-generated") == 0 && has_streamout(hud->pipe->screen)) { hud_pipe_query_install(pane, hud->pipe, "primitives-generated", -PIPE_QUERY_PRIMITIVES_GENERATED, 0, FALSE); +PIPE_QUERY_PRIMITIVES_GENERATED, 0, 0, FALSE); + } + else if (strncmp(name, "pipeline-statistics-", 20) == 0) { + if (hud->cap.query_pipeline_statistics) { +static const char *pipeline_statistics_names[] = +{ + "ia-vertices", + "ia-primitives", + "vs-invocations", + "gs-invocations", + "gs-primitives", + "clipper-invocations", + "clipper-primitives-generated", + "ps-invocations", + "hs-invocations", + "ds-invocations", + "cs-invocations" +}; +for (i = 0; i < Elements(pipeline_statistics_names); ++i) + if (strcmp(&name[20], pipeline_statistics_names[i]) == 0) + break; +if (i < Elements(pipeline_statistics_names)) + hud_pipe_query_install(pane, hud->pipe, &name[20], + PIPE_QUERY_PIPELINE_STATISTICS, i, + 0, FALSE); +else + fprintf(stderr, "gallium_hud: invalid pipeline-statistics-*\n"); + } else { +fprintf(stderr, "gallium_hud: PIPE_QUERY_PIPELINE_STATISTICS " +"not supported by the driver\n"); + } } else { if (!hud_driver_query_install(pane, hud->pipe, name)){ @@ -990,6 +1024,9 @@ hud_create(struct pipe_context *pipe, struct cso_context *cso) LIST_INITHEAD(&hud->pane_list); + hud->cap.query_pipeline_statistics = + pipe->screen->get_param(pipe->screen, PIPE_CAP_QUERY_PIPELINE_STATISTICS); + hud_parse_env_var(hud, env); return hud; } diff --git a/src/gallium/auxiliary/hud/hud_cpu.c b/src/gallium/auxiliary/hud/hud_cpu.c index dfd9f68..ce98115 100644 --- a/src/gallium/auxiliary/hud/hud_cpu.c +++ b/src/gallium/auxiliary/hud/hud_cpu.c @@ -32,6 +32,7 @@ #include "os/os_time.h" #include "util/u_memory.h" #include +#include static boolean get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time) @@ -55,8 +56,9 @@ get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time) int i, num; num = sscanf(line, - "%s %llu %llu %llu %llu %llu %llu %llu %llu %llu " - "%llu %llu %llu", + "%s %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64 + " %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu64 + " %"PRIu64" %"PRIu64"", cpuname, &v[0], &v[1], &v[2], &v[3], &v[4], &v[5], &v[6], &v[7], &v[8], &v[9], &v[10], &v[11]); if (num < 5) { diff --git a/src/
Mesa (master): gallium/docs: fix definition of PIPE_QUERY_SO_STATISTICS
Module: Mesa Branch: master Commit: c620aad71c2fe147dd2435c27053b435801a5237 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c620aad71c2fe147dd2435c27053b435801a5237 Author: Christoph Bumiller Date: Fri Mar 29 14:30:49 2013 +0100 gallium/docs: fix definition of PIPE_QUERY_SO_STATISTICS Reviewed-by: Marek Olšák --- src/gallium/docs/source/context.rst |8 +--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 9e57930..2cc1848 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -335,15 +335,17 @@ The result is a 64-bit integer specifying the timer resolution in Hz, followed by a boolean value indicating whether the timer has incremented. ``PIPE_QUERY_PRIMITIVES_GENERATED`` returns a 64-bit integer indicating -the number of primitives processed by the pipeline. +the number of primitives processed by the pipeline (regardless of whether +stream output is active or not). ``PIPE_QUERY_PRIMITIVES_EMITTED`` returns a 64-bit integer indicating the number of primitives written to stream output buffers. ``PIPE_QUERY_SO_STATISTICS`` returns 2 64-bit integers corresponding to -the results of +the result of ``PIPE_QUERY_PRIMITIVES_EMITTED`` and -``PIPE_QUERY_PRIMITIVES_GENERATED``, in this order. +the number of primitives that would have been written to stream output buffers +if they had infinite space available (primitives_storage_needed), in this order. ``PIPE_QUERY_SO_OVERFLOW_PREDICATE`` returns a boolean value indicating whether the stream output targets have overflowed as a result of the ___ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit
Mesa (master): gallium: add PIPE_CAP_QUERY_PIPELINE_STATISTICS
Module: Mesa Branch: master Commit: f35e96d973d57d314620509b2350ebb2bd3b URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f35e96d973d57d314620509b2350ebb2bd3b Author: Christoph Bumiller Date: Fri Mar 29 13:02:49 2013 +0100 gallium: add PIPE_CAP_QUERY_PIPELINE_STATISTICS Reviewed-by: Marek Olšák --- src/gallium/docs/source/screen.rst |2 ++ src/gallium/drivers/freedreno/freedreno_screen.c |1 + src/gallium/drivers/i915/i915_screen.c |1 + src/gallium/drivers/llvmpipe/lp_screen.c |2 ++ src/gallium/drivers/nv30/nv30_screen.c |1 + src/gallium/drivers/nv50/nv50_screen.c |2 ++ src/gallium/drivers/nvc0/nvc0_screen.c |1 + src/gallium/drivers/r300/r300_screen.c |1 + src/gallium/drivers/r600/r600_pipe.c |1 + src/gallium/drivers/radeonsi/radeonsi_pipe.c |1 + src/gallium/drivers/softpipe/sp_screen.c |2 ++ src/gallium/include/pipe/p_defines.h |3 ++- 12 files changed, 17 insertions(+), 1 deletions(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 8c7e86e..c1a3c0b 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -149,6 +149,8 @@ The integer capabilities: to use a blit to implement a texture transfer which needs format conversions and swizzling in state trackers. Generally, all hardware drivers with dedicated memory should return 1 and all software rasterizers should return 0. +* ``PIPE_CAP_QUERY_PIPELINE_STATISTICS``: Whether PIPE_QUERY_PIPELINE_STATISTICS + is supported. .. _pipe_capf: diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 79eef5e..283d07f 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -199,6 +199,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VERTEX_COLOR_CLAMPED: case PIPE_CAP_USER_VERTEX_BUFFERS: case PIPE_CAP_USER_INDEX_BUFFERS: + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: return 0; /* Stream output. */ diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index 13aa91c..54b2154 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -210,6 +210,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap) case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION: case PIPE_CAP_START_INSTANCE: case PIPE_CAP_QUERY_TIMESTAMP: + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: case PIPE_CAP_TEXTURE_MULTISAMPLE: case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index e8c6ab1..6700887 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -130,6 +130,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) return 0; case PIPE_CAP_QUERY_TIMESTAMP: return 1; + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: + return 0; case PIPE_CAP_TEXTURE_MIRROR_CLAMP: return 1; case PIPE_CAP_TEXTURE_SHADOW_MAP: diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 4084869..e33710e 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -122,6 +122,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: return 0; case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY: case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY: diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 0a20ae3..53eeeb6 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -189,6 +189,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) return 0; case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: return 1; + case PIPE_CAP_QUERY_PIPELINE_STATISTICS: + return 0; default: NOUVEAU_ERR("unknown PIPE_CAP %d\n", param); return 0; diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c b/src/gallium/drivers/nvc0/nvc0_screen.c index 5b9385a..3a32539 100644 --- a/src/gallium/drivers/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nvc0/nvc0_screen.c @@ -136,6 +136,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_QUERY_TIME_ELAPSED: case PIPE_CAP_OCCLUSION_QUERY: case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME: + case PIPE_CAP_QUERY_PIPEL