Re: [Mesa-dev] [PATCH] mesa: Silence unused parameter warning in check_context_limits in non-debug builds
On Monday, November 03, 2014 03:43:40 PM Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com ../../src/mesa/main/context.c: In function 'check_context_limits': ../../src/mesa/main/context.c:733:41: warning: unused parameter 'ctx' [- Wunused-parameter] Signed-off-by: Ian Romanick ian.d.roman...@intel.com --- src/mesa/main/context.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 7c62dbc..400c158 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -732,6 +732,8 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) static void check_context_limits(struct gl_context *ctx) { + (void) ctx; + /* check that we don't exceed the size of various bitfields */ assert(VARYING_SLOT_MAX = (8 * sizeof(ctx-VertexProgram._Current-Base.OutputsWritten))); Reviewed-by: Kenneth Graunke kenn...@whitecape.org signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3][RFC v2] mesa/main: Clamp rgba with streamed sse
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/main/pixeltransfer.c | 62 ++- 1 file changed, 43 insertions(+), 19 deletions(-) diff --git a/src/mesa/main/pixeltransfer.c b/src/mesa/main/pixeltransfer.c index 8bbeeb8..99eed38 100644 --- a/src/mesa/main/pixeltransfer.c +++ b/src/mesa/main/pixeltransfer.c @@ -35,7 +35,8 @@ #include pixeltransfer.h #include imports.h #include mtypes.h - +#include x86/common_x86_asm.h +#include main/x86/sse2_clamping.h /* * Apply scale and bias factors to an array of RGBA pixels. @@ -80,25 +81,39 @@ _mesa_scale_and_bias_rgba(GLuint n, GLfloat rgba[][4], void _mesa_map_rgba( const struct gl_context *ctx, GLuint n, GLfloat rgba[][4] ) { - const GLfloat rscale = (GLfloat) (ctx-PixelMaps.RtoR.Size - 1); - const GLfloat gscale = (GLfloat) (ctx-PixelMaps.GtoG.Size - 1); - const GLfloat bscale = (GLfloat) (ctx-PixelMaps.BtoB.Size - 1); - const GLfloat ascale = (GLfloat) (ctx-PixelMaps.AtoA.Size - 1); const GLfloat *rMap = ctx-PixelMaps.RtoR.Map; const GLfloat *gMap = ctx-PixelMaps.GtoG.Map; const GLfloat *bMap = ctx-PixelMaps.BtoB.Map; const GLfloat *aMap = ctx-PixelMaps.AtoA.Map; GLuint i; - for (i=0;in;i++) { - GLfloat r = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); - GLfloat g = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); - GLfloat b = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); - GLfloat a = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); - rgba[i][RCOMP] = rMap[F_TO_I(r * rscale)]; - rgba[i][GCOMP] = gMap[F_TO_I(g * gscale)]; - rgba[i][BCOMP] = bMap[F_TO_I(b * bscale)]; - rgba[i][ACOMP] = aMap[F_TO_I(a * ascale)]; + GLfloat scale[4]; + + scale[RCOMP] = (GLfloat) (ctx-PixelMaps.RtoR.Size - 1); + scale[GCOMP] = (GLfloat) (ctx-PixelMaps.GtoG.Size - 1); + scale[BCOMP] = (GLfloat) (ctx-PixelMaps.BtoB.Size - 1); + scale[ACOMP] = (GLfloat) (ctx-PixelMaps.AtoA.Size - 1); + +#if defined(USE_SSE2) + if (cpu_has_xmm2) { + _mesa_clamp_float_rgba_scale_and_map(n, rgba, rgba, 0.0F, 1.0F, scale, + rMap, gMap, bMap, aMap); } + else { +#endif + for (i=0;in;i++) { + GLfloat rgba_temp[4]; + rgba_temp[RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + rgba_temp[GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); + rgba_temp[BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); + rgba_temp[ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); + rgba[i][RCOMP] = rMap[F_TO_I(rgba_temp[RCOMP] * scale[RCOMP])]; + rgba[i][GCOMP] = gMap[F_TO_I(rgba_temp[GCOMP] * scale[GCOMP])]; + rgba[i][BCOMP] = bMap[F_TO_I(rgba_temp[BCOMP] * scale[BCOMP])]; + rgba[i][ACOMP] = aMap[F_TO_I(rgba_temp[ACOMP] * scale[ACOMP])]; + } +#if defined(USE_SSE2) + } +#endif } /* @@ -179,12 +194,21 @@ _mesa_apply_rgba_transfer_ops(struct gl_context *ctx, GLbitfield transferOps, /* clamping to [0,1] */ if (transferOps IMAGE_CLAMP_BIT) { GLuint i; - for (i = 0; i n; i++) { - rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); - rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); - rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); - rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); +#if defined(USE_SSE2) + if (cpu_has_xmm2) { + _mesa_streaming_clamp_float_rgba(n, rgba, rgba, 0.0F, 1.0F); + } + else { +#endif + for (i = 0; i n; i++) { +rgba[i][RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); +rgba[i][GCOMP] = CLAMP(rgba[i][GCOMP], 0.0F, 1.0F); +rgba[i][BCOMP] = CLAMP(rgba[i][BCOMP], 0.0F, 1.0F); +rgba[i][ACOMP] = CLAMP(rgba[i][ACOMP], 0.0F, 1.0F); + } +#if defined(USE_SSE2) } +#endif } } -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3][RFC v2] mesa/main/x86: Add sse2 streaming clamping
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/Makefile.am | 8 +++ src/mesa/main/x86/sse2_clamping.c | 103 ++ src/mesa/main/x86/sse2_clamping.h | 49 ++ 3 files changed, 160 insertions(+) create mode 100644 src/mesa/main/x86/sse2_clamping.c create mode 100644 src/mesa/main/x86/sse2_clamping.h diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am index e71bccb..5d3c6f5 100644 --- a/src/mesa/Makefile.am +++ b/src/mesa/Makefile.am @@ -111,6 +111,10 @@ if SSE41_SUPPORTED ARCH_LIBS += libmesa_sse41.la endif +if SSE2_SUPPORTED +ARCH_LIBS += libmesa_sse2.la +endif + MESA_ASM_FILES_FOR_ARCH = if HAVE_X86_ASM @@ -154,6 +158,10 @@ libmesa_sse41_la_SOURCES = \ main/streaming-load-memcpy.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 +libmesa_sse2_la_SOURCES = \ + main/x86/sse2_clamping.c +libmesa_sse2_la_CFLAGS = $(AM_CFLAGS) -msse2 + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc diff --git a/src/mesa/main/x86/sse2_clamping.c b/src/mesa/main/x86/sse2_clamping.c new file mode 100644 index 000..7df1c85 --- /dev/null +++ b/src/mesa/main/x86/sse2_clamping.c @@ -0,0 +1,103 @@ +/* + * Copyright © 2014 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Juha-Pekka Heikkila juhapekka.heikk...@gmail.com + * + */ + +#ifdef __SSE2__ +#include main/macros.h +#include main/x86/sse2_clamping.h +#include emmintrin.h + +/** + * Clamp four float values to [min,max] + */ +static inline void +_mesa_clamp_float_rgba(GLfloat src[4], GLfloat result[4], const float min, + const float max) +{ + __m128 operand, minval, maxval; + + operand = _mm_loadu_ps(src); + minval = _mm_set1_ps(min); + maxval = _mm_set1_ps(max); + operand = _mm_max_ps(operand, minval); + operand = _mm_min_ps(operand, maxval); + _mm_storeu_ps(result, operand); +} + + +/* Clamp n amount float rgba pixels to [min,max] using SSE2 + */ +void +_mesa_streaming_clamp_float_rgba(const GLuint n, GLfloat rgba_src[][4], + GLfloat rgba_dst[][4], const GLfloat min, + const GLfloat max) +{ + int i; + + for (i = 0; i n; i++) { + _mesa_clamp_float_rgba(rgba_src[i], rgba_dst[i], min, max); + } +} + + +/* Clamp n amount float rgba pixels to [min,max] using SSE2 and apply + * scaling and mapping to components. + * + * this replace handling of [RGBA] channels: + * rgba_temp[RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + * rgba[i][RCOMP] = rMap[F_TO_I(rgba_temp[RCOMP] * scale[RCOMP])]; + */ +void +_mesa_clamp_float_rgba_scale_and_map(const GLuint n, GLfloat rgba_src[][4], + GLfloat rgba_dst[][4], const GLfloat min, + const GLfloat max, + const GLfloat scale[4], + const GLfloat* rMap, const GLfloat* gMap, + const GLfloat* bMap, const GLfloat* aMap) +{ + int i; + GLfloat __attribute__((aligned(16))) temp[4]; + __m128 *operand = (__m128*) temp, multiplier, mmove; + __m128i truncated_integers; + + const unsigned int* map_p = (const unsigned int*) truncated_integers; + + multiplier = _mm_loadu_ps(scale); + + for(i = 0; i n; i++) { + _mesa_clamp_float_rgba(rgba_src[i], temp, min, max); + + *operand = _mm_mul_ps(multiplier, *operand); + truncated_integers = _mm_cvttps_epi32(*operand); + mmove = _mm_set_ps(aMap[map_p[ACOMP]], bMap[map_p[BCOMP]], + gMap[map_p[GCOMP]], rMap[map_p[RCOMP]] ); + + _mm_storeu_ps(rgba_dst[i], mmove); + } +} + + +#endif /* __SSE2__ */ diff --git a/src/mesa/main/x86/sse2_clamping.h b/src/mesa/main/x86/sse2_clamping.h new file mode 100644 index 000..688fab7 --- /dev/null
[Mesa-dev] [PATCH 0/3][RFC v2] Clamp rgba floats with sse
Here is new version of sse2 clamping, one patch grew into small set. Now sse2 stuff is separated into its own object which will get -msse2 compile flag. I did sse'ize also rest of _mesa_map_rgba function. As previously there are ifdefs which I don't think look nice but I tried to keep looks of the code (new versus old) similar. What is now the biggest 'rfc' part here is where should all this sse2 stuff really exist in. This patch set show my suggestion, I made 'x86' folder under src/mesa/main. The idea here being if there is optimization targeting architecture it'd exist directly under the place where it was used, in its own subdirectly indicating targeted architecture. I don't think majority of such code would be generic code thus this approach. /Juha-Pekka Juha-Pekka Heikkila (3): configure.ac: Add detection for sse2 compilation support mesa/main/x86: Add sse2 streaming clamping mesa/main: Clamp rgba with streamed sse configure.ac | 7 +++ src/mesa/Makefile.am | 8 +++ src/mesa/main/pixeltransfer.c | 62 --- src/mesa/main/x86/sse2_clamping.c | 103 ++ src/mesa/main/x86/sse2_clamping.h | 49 ++ 5 files changed, 210 insertions(+), 19 deletions(-) create mode 100644 src/mesa/main/x86/sse2_clamping.c create mode 100644 src/mesa/main/x86/sse2_clamping.h -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3][RFC v2] configure.ac: Add detection for sse2 compilation support
Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- configure.ac | 7 +++ 1 file changed, 7 insertions(+) diff --git a/configure.ac b/configure.ac index fc7d372..a01e605 100644 --- a/configure.ac +++ b/configure.ac @@ -258,6 +258,13 @@ if test x$SSE41_SUPPORTED = x1; then fi AM_CONDITIONAL([SSE41_SUPPORTED], [test x$SSE41_SUPPORTED = x1]) +AX_CHECK_COMPILE_FLAG([-msse2], [SSE2_SUPPORTED=1], [SSE2_SUPPORTED=0]) +if test x$SSE2_SUPPORTED = x1; then +DEFINES=$DEFINES -DUSE_SSE2 +fi +AM_CONDITIONAL([SSE2_SUPPORTED], [test x$SSE2_SUPPORTED = x1]) + + dnl Can't have static and shared libraries, default to static if user dnl explicitly requested. If both disabled, set to static since shared dnl was explicitly requested. -- 1.8.5.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: throw error when using invariant(all) in a fragment shader
Note that some of the GLSL specifications explicitly state this as compile error, some simply state that 'it is an error'. Signed-off-by: Tapani Pälli tapani.pa...@intel.com --- src/glsl/glsl_parser.yy | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy index 6160e26..6a55a4e 100644 --- a/src/glsl/glsl_parser.yy +++ b/src/glsl/glsl_parser.yy @@ -331,7 +331,18 @@ pragma_statement: | PRAGMA_OPTIMIZE_OFF EOL | PRAGMA_INVARIANT_ALL EOL { - if (!state-is_version(120, 100)) { + /* Pragma invariant(all) cannot be used in a fragment shader. + * + * Page 27 of the GLSL 1.20 spec, Page 53 of the GLSL ES 3.00 spec: + * + * It is an error to use this pragma in a fragment shader. + */ + if (state-is_version(120, 300) + state-stage == MESA_SHADER_FRAGMENT) { + _mesa_glsl_error( @1, state, + pragma `invariant(all)' cannot be used + in a fragment shader.); + } else if (!state-is_version(120, 100)) { _mesa_glsl_warning( @1, state, pragma `invariant(all)' not supported in %s (GLSL ES 1.00 or GLSL 1.20 required), -- 1.9.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 00/10] glUniform* micro-optimizations, part 1
Reviewed-by: Tapani Pälli tapani.pa...@intel.com On 11/04/2014 02:22 AM, Ian Romanick wrote: This is the first, and more minor, batch of micro-optimizations for the glUniform* paths. Other than patch 8, these probably aren't going to make a lot of difference, even on CPU limited applications. The next batch, which needs a bit more time to finish baking, should have some more substantial improvements. src/glsl/glsl_types.h | 18 +-- src/mesa/main/uniform_query.cpp | 260 +++- src/mesa/main/uniforms.c| 96 +++ src/mesa/main/uniforms.h| 4 +- 4 files changed, 157 insertions(+), 221 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] util: Implement unreachable for MSVC using __assume
On 11/03/2014 04:43 PM, Ian Romanick wrote: From: Ian Romanick ian.d.roman...@intel.com Based on the description of __assume at: http://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx Signed-off-by: Ian Romanick ian.d.roman...@intel.com Cc: Brian Paul bri...@vmware.com --- src/util/macros.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/util/macros.h b/src/util/macros.h index ff37a7d..da5daff 100644 --- a/src/util/macros.h +++ b/src/util/macros.h @@ -69,6 +69,12 @@ do {\ assert(!str);\ __builtin_unreachable(); \ } while (0) +#elif _MSC_VER = 1200 +#define unreachable(str)\ +do {\ + assert(!str);\ + __assume(0); \ +} while (0) #endif #ifndef unreachable Compiles here. Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 85608] Account request for David Heidelberg
https://bugs.freedesktop.org/show_bug.cgi?id=85608 Brian Paul bri...@vmware.com changed: What|Removed |Added Component|Other |New Accounts Assignee|mesa-dev@lists.freedesktop. |sitewranglers@lists.freedes |org |ktop.org Product|Mesa|freedesktop.org --- Comment #3 from Brian Paul bri...@vmware.com --- Re-assigning to the admins... -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-announce] Mesa 10.3 release candidate 1
On Mon, Nov 3, 2014 at 8:12 PM, Matt Turner matts...@gmail.com wrote: On Mon, Nov 3, 2014 at 7:35 PM, Ausmus, James james.aus...@intel.com wrote: I am able to reproduce this consistently with -j40 - it bisects to: Thanks. Maybe you could give a little more information, like an error message or something? Same error as Thierry reported in this thread in August: make[4]: Entering directory `/build/x86-alex/tmp/portage/media-libs/mesa-/work/Mesa-/src/mapi' CC glapi_libglapi_la-glapi_gentable.lo CC glapi_libglapi_la-glapi_dispatch.lo CC glapi_libglapi_la-glapi_entrypoint.lo CC glapi_libglapi_la-glapi_getproc.lo CC glapi_libglapi_la-glapi_nop.lo CC glapi_libglapi_la-glapi.lo CC glapi_libglapi_la-u_current.lo CC glapi_libglapi_la-u_execmem.lo GEN.libs/install-mesa-links touch: cannot touch '.libs/install-mesa-links': No such file or directory make[4]: *** [.libs/install-mesa-links] Error 1 make[4]: *** Waiting for unfinished jobs make[4]: Leaving directory `/build/x86-alex/tmp/portage/media-libs/mesa-/work/Mesa-/src/mapi' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/build/x86-alex/tmp/portage/media-libs/mesa-/work/Mesa-/src/mapi' make[2]: *** [all] Error 2 make[2]: Leaving directory `/build/x86-alex/tmp/portage/media-libs/mesa-/work/Mesa-/src/mapi' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/build/x86-alex/tmp/portage/media-libs/mesa-/work/Mesa-/src' make: *** [all-recursive] Error 1 -- James Ausmus Sr. Software Engineer SSG-OTC ChromeOS Integration ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965/blorp: Fix hiz ops on MSAA surfaces
Two things were broken here: - The depth/stencil surface dimensions were broken for MSAA. - Sample count was programmed incorrectly. Result was the depth resolve didn't work correctly on MSAA surfaces, and so sampling the surface later produced garbage. Fixes the new piglit test arb_texture_multisample-sample-depth, and various artifacts in 'tesseract' with msaa=4 glineardepth=0. Not observed any piglit regressions on Haswell. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/mesa/drivers/dri/i965/brw_blorp.h| 4 src/mesa/drivers/dri/i965/gen7_blorp.cpp | 24 +--- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_blorp.h b/src/mesa/drivers/dri/i965/brw_blorp.h index ff68000..c4ff0f7 100644 --- a/src/mesa/drivers/dri/i965/brw_blorp.h +++ b/src/mesa/drivers/dri/i965/brw_blorp.h @@ -236,6 +236,10 @@ public: bool use_wm_prog; brw_blorp_wm_push_constants wm_push_consts; bool color_write_disable[4]; + + unsigned num_samples() const { + return dst.mt ? dst.num_samples : depth.mt-num_samples; + } }; diff --git a/src/mesa/drivers/dri/i965/gen7_blorp.cpp b/src/mesa/drivers/dri/i965/gen7_blorp.cpp index 206a6ff..cc57ffe 100644 --- a/src/mesa/drivers/dri/i965/gen7_blorp.cpp +++ b/src/mesa/drivers/dri/i965/gen7_blorp.cpp @@ -415,7 +415,7 @@ gen7_blorp_emit_sf_config(struct brw_context *brw, OUT_BATCH(_3DSTATE_SF 16 | (7 - 2)); OUT_BATCH(params-depth_format GEN7_SF_DEPTH_BUFFER_SURFACE_FORMAT_SHIFT); - OUT_BATCH(params-dst.num_samples 1 ? GEN6_SF_MSRAST_ON_PATTERN : 0); + OUT_BATCH(params-num_samples() 1 ? GEN6_SF_MSRAST_ON_PATTERN : 0); OUT_BATCH(0); OUT_BATCH(0); OUT_BATCH(0); @@ -470,7 +470,7 @@ gen7_blorp_emit_wm_config(struct brw_context *brw, dw1 |= GEN7_WM_DISPATCH_ENABLE; /* We are rendering */ } - if (params-dst.num_samples 1) { + if (params-num_samples() 1) { dw1 |= GEN7_WM_MSRAST_ON_PATTERN; if (prog_data prog_data-persample_msaa_dispatch) dw2 |= GEN7_WM_MSDISPMODE_PERSAMPLE; @@ -661,8 +661,17 @@ gen7_blorp_emit_depth_stencil_config(struct brw_context *brw, * larger to allow the fast depth clear to fit the hardware * alignment requirements. (8x4) */ - surfwidth = params-depth.width; - surfheight = params-depth.height; + + if (params-num_samples() 1) { + /* If this is an MSAA + HIZ op, we need to program the + * aligned logical size of the depth surface. + */ + surfwidth = ALIGN(params-depth.mt-logical_width0, 8); + surfheight = ALIGN(params-depth.mt-logical_height0, 4); + } else { + surfwidth = params-depth.width; + surfheight = params-depth.height; + } } else { surfwidth = params-depth.mt-logical_width0; surfheight = params-depth.mt-logical_height0; @@ -805,10 +814,11 @@ gen7_blorp_exec(struct brw_context *brw, uint32_t sampler_offset = 0; uint32_t prog_offset = params-get_wm_prog(brw, prog_data); - gen6_emit_3dstate_multisample(brw, params-dst.num_samples); + unsigned num_samples = params-num_samples(); + gen6_emit_3dstate_multisample(brw, num_samples); gen6_emit_3dstate_sample_mask(brw, - params-dst.num_samples 1 ? - (1 params-dst.num_samples) - 1 : 1); + num_samples 1 ? + (1 num_samples) - 1 : 1); gen6_blorp_emit_state_base_address(brw, params); gen6_blorp_emit_vertices(brw, params); gen7_blorp_emit_urb_config(brw, params); -- 2.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] Conditional rendering on i965
Hi, I was thinking of taking a look at implementing proper conditional rendering for i965. Currently it looks like we cheat to implement this and just stall the GPU to wait for the result before deciding whether to issue the 3DPRIMITIVE command. I think Gen7+ can support it in hardware with the MI_PREDICATE command and the predicate enable bit in the 3DPRIMITIVE command. Would this be a good thing to work on or has someone already done it? If no-one objects I'll just get cracking on that. - Neil ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 85869] Offscreen rendering to pixmap EGLSurface is odd
https://bugs.freedesktop.org/show_bug.cgi?id=85869 Bug ID: 85869 Summary: Offscreen rendering to pixmap EGLSurface is odd Product: Mesa Version: unspecified Hardware: x86-64 (AMD64) OS: Linux (All) Status: NEW Severity: normal Priority: medium Component: EGL Assignee: mesa-dev@lists.freedesktop.org Reporter: ibragimovri...@mail.ru When I render to a EGLSurface bound to an offscreen pixmap, then copy pixmap content to a window using XCopyArea, behaviour is odd. Sample program below calls glClear() twice. First time it should make all pixmap red, second time — green. But when I run it on the integrated Intel adapter, it renders only red box. It seems all drawing commands after first glClear() are ignored. My research have stopped at fb-_NumColorDrawBuffers becoming 0 in _mesa_drawbuffers(). Probably that was the immediate reason second glClear() was ignored. #include X11/Xlib.h #include unistd.h #include stdio.h #include stdlib.h #include EGL/egl.h #include GLES2/gl2.h Window wnd; Window root_wnd; Display*dpy; Pixmap pixmap; EGLDisplay egl_dpy; EGLContext glc; EGLSurface egl_surf; void handle_graphics_expose(XEvent *ev) { EGLBoolean ret; ret = eglMakeCurrent(egl_dpy, egl_surf, egl_surf, glc); if (!ret) { printf(eglMakeCurrent failed\n); exit(1); } printf(eglMakeCurrent ok\n); glClearColor(1, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT); glClearColor(0, 1, 0, 1); glClear(GL_COLOR_BUFFER_BIT); glFinish(); eglWaitGL(); XCopyArea(dpy, pixmap, wnd, DefaultGC(dpy, 0), 0, 0, 400, 300, 10, 10); XSync(dpy, False); } int main(void) { dpy = XOpenDisplay(NULL); root_wnd = DefaultRootWindow(dpy); wnd = XCreateSimpleWindow(dpy, root_wnd, 0, 0, 400+20, 300+20, 0, 0, 0xa0a0f0); printf(root_wnd = %p\n, (void *)root_wnd); XSelectInput(dpy, wnd, ExposureMask); XMapWindow(dpy, wnd); XSync(dpy, False); printf(wnd = %p\n, (void *)wnd); egl_dpy = eglGetDisplay(dpy); eglInitialize(egl_dpy, NULL, NULL); int nconfigs = -1; EGLConfig egl_config; EGLint cfg_attrs[] = { EGL_ALPHA_SIZE, 0, EGL_BLUE_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_RED_SIZE, 8, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_SURFACE_TYPE, EGL_PIXMAP_BIT, EGL_NONE }; eglChooseConfig(egl_dpy, cfg_attrs, egl_config, 1, nconfigs); printf(nconfigs = %d\n, nconfigs); printf(egl_config = %p\n, egl_config); EGLint ctx_attrs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; glc = eglCreateContext(egl_dpy, egl_config, EGL_NO_CONTEXT, ctx_attrs); if (glc == EGL_NO_CONTEXT) { printf(eglCreateContext returned EGL_NO_CONTEXT\n); exit(1); } printf(context ok\n); pixmap = XCreatePixmap(dpy, wnd, 400, 300, DefaultDepth(dpy, 0)); egl_surf = eglCreatePixmapSurface(egl_dpy, egl_config, pixmap, NULL); if (egl_surf == EGL_NO_SURFACE) { printf(eglCreatePixmapSurface returned EGL_NO_SURFACE\n); exit(1); } printf(pixmap and surface ok\n); // message loop while (1) { XEvent ev; XNextEvent(dpy, ev); switch (ev.type) { case GraphicsExpose: case Expose: handle_graphics_expose(ev); break; default: // do nothing break; } } eglTerminate(egl_dpy); XFreePixmap(dpy, pixmap); XDestroyWindow(dpy, wnd); XCloseDisplay(dpy); return 0; } -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 85869] Offscreen rendering to pixmap EGLSurface is odd
https://bugs.freedesktop.org/show_bug.cgi?id=85869 Rinat ibragimovri...@mail.ru changed: What|Removed |Added CC||ibragimovri...@mail.ru -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] i965: Fix sampler state pointer adjustment for nonconst samplers
This started hitting an assertion recently. Only affects Haswell (Ivybridge doesn't support this meddling with the sampler state pointer, and ARB_gpu_shader5 is not enabled yet on Broadwell) 14 Piglits crash-pass. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index bb6334b..bb12a26 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -2409,7 +2409,7 @@ void brw_adjust_sampler_state_pointer(struct brw_compile *p, struct brw_reg temp = vec1(retype(scratch, BRW_REGISTER_TYPE_UD)); - brw_AND(p, temp, sampler_index, brw_imm_ud(0x0f0)); + brw_AND(p, temp, get_element_ud(sampler_index, 0), brw_imm_ud(0x0f0)); brw_SHL(p, temp, temp, brw_imm_ud(4)); brw_ADD(p, get_element_ud(header, 3), -- 2.1.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] i965: Fix sampler state pointer adjustment for nonconst samplers
On Wednesday, November 05, 2014 06:41:13 AM Chris Forbes wrote: This started hitting an assertion recently. Only affects Haswell (Ivybridge doesn't support this meddling with the sampler state pointer, and ARB_gpu_shader5 is not enabled yet on Broadwell) 14 Piglits crash-pass. Signed-off-by: Chris Forbes chr...@ijw.co.nz --- src/mesa/drivers/dri/i965/brw_eu_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index bb6334b..bb12a26 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -2409,7 +2409,7 @@ void brw_adjust_sampler_state_pointer(struct brw_compile *p, struct brw_reg temp = vec1(retype(scratch, BRW_REGISTER_TYPE_UD)); - brw_AND(p, temp, sampler_index, brw_imm_ud(0x0f0)); + brw_AND(p, temp, get_element_ud(sampler_index, 0), brw_imm_ud(0x0f0)); brw_SHL(p, temp, temp, brw_imm_ud(4)); brw_ADD(p, get_element_ud(header, 3), Seems like a reasonable thing to do, though I'd be curious to know why it broke... Notably, most of the other header accesses already explicitly do a get_element_ud. Reviewed-by: Kenneth Graunke kenn...@whitecape.org signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] Conditional rendering on i965
On Tuesday, November 04, 2014 05:31:55 PM Neil Roberts wrote: Hi, I was thinking of taking a look at implementing proper conditional rendering for i965. Currently it looks like we cheat to implement this and just stall the GPU to wait for the result before deciding whether to issue the 3DPRIMITIVE command. I think Gen7+ can support it in hardware with the MI_PREDICATE command and the predicate enable bit in the 3DPRIMITIVE command. Would this be a good thing to work on or has someone already done it? If no-one objects I'll just get cracking on that. - Neil That would be fantastic - thanks Neil! I don't think it should be terribly hard; it just hasn't gotten done. --Ken signature.asc Description: This is a digitally signed message part. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 84566] Unify the format conversion code
https://bugs.freedesktop.org/show_bug.cgi?id=84566 --- Comment #48 from Samuel Iglesias sigles...@igalia.com --- (In reply to Jason Ekstrand from comment #34) (In reply to Samuel Iglesias from comment #33) Jason, I would like to know your opinion about the integer RGBA clamping done in pack.c (_mesa_pack_rgba_span_from_ints()). glReadPixels() and glGetTexImage() specs said (for example, in OpenGL 3.3. core specification) that for an integer RGBA color, each component is clamped to the representable range of type. Those GL functions end up calling pack.c's functions for performing the conversion (mesa_pack_rgba_span_from_ints() and others). It's possible to replace some of those pack.c's conversion functions by the master conversion but the problem is in the clamping operation. I would like to add a boolean argument called clamp to the master conversion function which is passed to _mesa_swizzle_and_convert() where each of its convert_{uint,int,byte,ubyte,short,ushort}() do the right thing when clamp is true. This clamp parameter would be false for every call to either master conversion function or _mesa_swizzle_and_convert() except when they are being called from pack.c. What do you think? Supporting clamping is probably fine. I think we determined we needed a clamp parameter anyway for some of the float conversions. I guess it makes sense for integers too. Let's watch out for performance when we implement it though. Changing the loop inside mesa_swizzle_and_convert without hurting performance can be tricky. The teximage-colors test in Piglit has a -benchmark flag that can be used for testing that. In the end, we did not make that change in pack.c as we could just use the autogenerated format pack/unpack functions. However I am retaking this topic again because we found another issue which would require a similar solution: The convert_*() functions in format_utils.c convert between source and destination data and are used by _mesa_swizzle_and_convert. We found that these were not good enough for various conversions that involved non-normalized types of different sizes: INT to SHORT, INT to BYTE, etc. Because of that, several piglit tests related to glGetTexImage() and others failed, like for example bin/ext_texture_integer-getteximage-clamping. In order to fix that we added the clamp expressions for these cases [1] and with that we achieved no regressions when executing a full piglit run on i965 driver. Unfortunately, when testing our patches on a couple of Gallium drivers, we found a regression that we tracked down back to that patch: bin/arb_clear_buffer_object-formats. Reverting the patch makes fixes the problem with these Gallium drivers but then, bin/ext_texture_integer-getteximage-clamping fails again on i965. We wonder if there could be more cases like this that piglit is not covering, since it looks weird that this affects just this one test. So, we wonder if that patch for _mesa_swizzle_and_convert is correct and we should fix the failed gallium cases elsewhere, or if we should revert that patch and fix the cases it fixed in a different way. What do you think? Was _mesa_swizzle_and_convert implemented like that on purpose or are these real bugs? If we decide to revert our clamp patch, then a solution could be to have a separate implementation of _mesa_swizzle_and_convert() and its convert_*() functions that clamps. We would have to use that version in glGetTexImage() (maybe in glReadPIxels too) and use the normal version for texture uploads (texstore). If we do this, then we would have to add a clamp flag to _mesa_format_convert, the same flag to _mesa_swizzle_and_convert and the have a new collection of convert_*_clamp() functions for the sake of performance (so we don't have to check whether we have to clamp or not for each pixel we process). We have tested this already and it works fine (no regressions) for i965. We also repeated the full piglit run on Gallium 0.4 on AMD RV710 and it showed zero regressions. And the benchmark you mention in the previous comment showed that there weren't significative differences in the total time of both runs (with and without the patch). What do you think? Should we keep the clamp patch? Would you suggest a different approach? [1] http://pastebin.com/CPYbCU8e -- You are receiving this mail because: You are the QA Contact for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/4] i965: Totally legit line width patches
On Mon, Nov 3, 2014 at 6:42 PM, Kenneth Graunke kenn...@whitecape.org wrote: Here are some totally legit line width patches. I noticed that Cherryview was setting line width in DW2 of 3DSTATE_SF, when it actually moved to DW1 at a different bit location. While fixing that, I figured I should update the clamp value to reflect the new hardware limit...which led me to want to use ctx-Const.MaxLineWidth as the clamp value. (There's actually a TODO comment about this in the original Gen4 code.) This then led me to advertise a larger value for line widths. No Piglit regressions on Gen4-7.5. Which sounds comforting, except I think we actually fail most of our line rendering tests anyway, so they wouldn't have regressed. Plus, Piglit doesn't seem to test large line widths in the first place. Did it fix any piglit errors on CHV? I guess not since the DW2 bits we were writing before are now just reserved MBZ, so we weren't overwriting anything. Test coverage or not, I don't see anything in these patches that shouldn't be applied, and piglit at least makes sure they don't regress other things. For the series, Reviewed-by: Kristian Høgsberg k...@bitplanet.net I ran some oglconform tests which at least drew things with larger line widths, but I'm not sure how to view the output, and they didn't appear to actually probe values and fail the test when wrong. Also untested on Broadwell, Cherryview, or Skylake, which is kind of the point of the series. This is high quality stuff, folks! Suggestions of please write Piglit tests will be tacitly ignored/filed away in the when I get to it (but I'll probably forget first) file. :) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3][RFC v2] mesa/main/x86: Add sse2 streaming clamping
Hello. I'd get rid of _mm_set1_ps inside _mesa_clamp_float_rgba by passing _m128 version of min/max directly, so _mm_set1_ps will be moved out of the for loop. I'd also unroll the _mesa_streaming_clamp_float_rgba loop to minimize the loop overhead (and utilize out of order execution as a bonus), because nothing compute intensive is happening there. You can also use prefetching (_mm_prefetch) there to improve performance by reading data ahead from memory. Best regards, Siavash Eliasi. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3][RFC v2] mesa/main/x86: Add sse2 streaming clamping
On Tue, Nov 4, 2014 at 6:05 AM, Juha-Pekka Heikkila juhapekka.heikk...@gmail.com wrote: Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/Makefile.am | 8 +++ src/mesa/main/x86/sse2_clamping.c | 103 ++ src/mesa/main/x86/sse2_clamping.h | 49 ++ 3 files changed, 160 insertions(+) create mode 100644 src/mesa/main/x86/sse2_clamping.c create mode 100644 src/mesa/main/x86/sse2_clamping.h diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am index e71bccb..5d3c6f5 100644 --- a/src/mesa/Makefile.am +++ b/src/mesa/Makefile.am @@ -111,6 +111,10 @@ if SSE41_SUPPORTED ARCH_LIBS += libmesa_sse41.la endif +if SSE2_SUPPORTED +ARCH_LIBS += libmesa_sse2.la +endif + MESA_ASM_FILES_FOR_ARCH = if HAVE_X86_ASM @@ -154,6 +158,10 @@ libmesa_sse41_la_SOURCES = \ main/streaming-load-memcpy.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 +libmesa_sse2_la_SOURCES = \ + main/x86/sse2_clamping.c +libmesa_sse2_la_CFLAGS = $(AM_CFLAGS) -msse2 + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc diff --git a/src/mesa/main/x86/sse2_clamping.c b/src/mesa/main/x86/sse2_clamping.c new file mode 100644 index 000..7df1c85 --- /dev/null +++ b/src/mesa/main/x86/sse2_clamping.c @@ -0,0 +1,103 @@ +/* + * Copyright © 2014 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Juha-Pekka Heikkila juhapekka.heikk...@gmail.com + * + */ + +#ifdef __SSE2__ +#include main/macros.h +#include main/x86/sse2_clamping.h +#include emmintrin.h + +/** + * Clamp four float values to [min,max] + */ +static inline void +_mesa_clamp_float_rgba(GLfloat src[4], GLfloat result[4], const float min, + const float max) +{ + __m128 operand, minval, maxval; + + operand = _mm_loadu_ps(src); + minval = _mm_set1_ps(min); + maxval = _mm_set1_ps(max); + operand = _mm_max_ps(operand, minval); + operand = _mm_min_ps(operand, maxval); + _mm_storeu_ps(result, operand); +} + + +/* Clamp n amount float rgba pixels to [min,max] using SSE2 Conceptually, _mesa_streaming_clamp_float_rgba() is clamping a contiguous array of floats to some min/max value. The fact that they are pixels is somewhat incidental when looking at it from a stream perspective. It looks like the code is more or less just operating on n*4 floats. Given that, a more efficient implementation would check alignment and then use aligned loads and streaming stores. It doesn't really matter if you straddle pixel boundaries as long as each float is operated on. I'm not sure how much effort you want to put into this though. :) + */ +void +_mesa_streaming_clamp_float_rgba(const GLuint n, GLfloat rgba_src[][4], + GLfloat rgba_dst[][4], const GLfloat min, + const GLfloat max) +{ + int i; + + for (i = 0; i n; i++) { + _mesa_clamp_float_rgba(rgba_src[i], rgba_dst[i], min, max); + } +} + + +/* Clamp n amount float rgba pixels to [min,max] using SSE2 and apply + * scaling and mapping to components. + * + * this replace handling of [RGBA] channels: + * rgba_temp[RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + * rgba[i][RCOMP] = rMap[F_TO_I(rgba_temp[RCOMP] * scale[RCOMP])]; + */ +void +_mesa_clamp_float_rgba_scale_and_map(const GLuint n, GLfloat rgba_src[][4], + GLfloat rgba_dst[][4], const GLfloat min, + const GLfloat max, + const GLfloat scale[4], + const GLfloat* rMap, const GLfloat* gMap, + const GLfloat* bMap, const GLfloat* aMap) +{ + int i; + GLfloat
Re: [Mesa-dev] [PATCH 2/3][RFC v2] mesa/main/x86: Add sse2 streaming clamping
Am 04.11.2014 um 13:05 schrieb Juha-Pekka Heikkila: Signed-off-by: Juha-Pekka Heikkila juhapekka.heikk...@gmail.com --- src/mesa/Makefile.am | 8 +++ src/mesa/main/x86/sse2_clamping.c | 103 ++ src/mesa/main/x86/sse2_clamping.h | 49 ++ 3 files changed, 160 insertions(+) create mode 100644 src/mesa/main/x86/sse2_clamping.c create mode 100644 src/mesa/main/x86/sse2_clamping.h diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am index e71bccb..5d3c6f5 100644 --- a/src/mesa/Makefile.am +++ b/src/mesa/Makefile.am @@ -111,6 +111,10 @@ if SSE41_SUPPORTED ARCH_LIBS += libmesa_sse41.la endif +if SSE2_SUPPORTED +ARCH_LIBS += libmesa_sse2.la +endif + MESA_ASM_FILES_FOR_ARCH = if HAVE_X86_ASM @@ -154,6 +158,10 @@ libmesa_sse41_la_SOURCES = \ main/streaming-load-memcpy.c libmesa_sse41_la_CFLAGS = $(AM_CFLAGS) -msse4.1 +libmesa_sse2_la_SOURCES = \ + main/x86/sse2_clamping.c +libmesa_sse2_la_CFLAGS = $(AM_CFLAGS) -msse2 + pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gl.pc diff --git a/src/mesa/main/x86/sse2_clamping.c b/src/mesa/main/x86/sse2_clamping.c new file mode 100644 index 000..7df1c85 --- /dev/null +++ b/src/mesa/main/x86/sse2_clamping.c @@ -0,0 +1,103 @@ +/* + * Copyright © 2014 Intel Corporation + * + * 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, sublicense, + * 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 NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS 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. + * + * Authors: + *Juha-Pekka Heikkila juhapekka.heikk...@gmail.com + * + */ + +#ifdef __SSE2__ +#include main/macros.h +#include main/x86/sse2_clamping.h +#include emmintrin.h + +/** + * Clamp four float values to [min,max] + */ +static inline void +_mesa_clamp_float_rgba(GLfloat src[4], GLfloat result[4], const float min, + const float max) +{ + __m128 operand, minval, maxval; + + operand = _mm_loadu_ps(src); + minval = _mm_set1_ps(min); + maxval = _mm_set1_ps(max); + operand = _mm_max_ps(operand, minval); + operand = _mm_min_ps(operand, maxval); + _mm_storeu_ps(result, operand); +} + + +/* Clamp n amount float rgba pixels to [min,max] using SSE2 + */ +void +_mesa_streaming_clamp_float_rgba(const GLuint n, GLfloat rgba_src[][4], + GLfloat rgba_dst[][4], const GLfloat min, + const GLfloat max) +{ + int i; + + for (i = 0; i n; i++) { + _mesa_clamp_float_rgba(rgba_src[i], rgba_dst[i], min, max); + } +} + + +/* Clamp n amount float rgba pixels to [min,max] using SSE2 and apply + * scaling and mapping to components. + * + * this replace handling of [RGBA] channels: + * rgba_temp[RCOMP] = CLAMP(rgba[i][RCOMP], 0.0F, 1.0F); + * rgba[i][RCOMP] = rMap[F_TO_I(rgba_temp[RCOMP] * scale[RCOMP])]; + */ +void +_mesa_clamp_float_rgba_scale_and_map(const GLuint n, GLfloat rgba_src[][4], + GLfloat rgba_dst[][4], const GLfloat min, + const GLfloat max, + const GLfloat scale[4], + const GLfloat* rMap, const GLfloat* gMap, + const GLfloat* bMap, const GLfloat* aMap) +{ + int i; + GLfloat __attribute__((aligned(16))) temp[4]; + __m128 *operand = (__m128*) temp, multiplier, mmove; + __m128i truncated_integers; + + const unsigned int* map_p = (const unsigned int*) truncated_integers; + + multiplier = _mm_loadu_ps(scale); + + for(i = 0; i n; i++) { + _mesa_clamp_float_rgba(rgba_src[i], temp, min, max); + + *operand = _mm_mul_ps(multiplier, *operand); + truncated_integers = _mm_cvttps_epi32(*operand); + mmove = _mm_set_ps(aMap[map_p[ACOMP]], bMap[map_p[BCOMP]], + gMap[map_p[GCOMP]], rMap[map_p[RCOMP]] ); + +
[Mesa-dev] [PATCH 2/2] egl: remove egl_gallium from the loader
From: Marek Olšák marek.ol...@amd.com --- src/egl/main/egldriver.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 78d8130..8cf777d 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -518,19 +518,6 @@ _eglAddUserDriver(void) /** - * Add egl_gallium to the module array. - */ -static void -_eglAddGalliumDriver(void) -{ -#ifndef _EGL_BUILT_IN_DRIVER_GALLIUM - void *external = (void *) egl_gallium; - _eglPreloadForEach(_eglGetSearchPath(), _eglLoaderFile, external); -#endif -} - - -/** * Add built-in drivers to the module array. */ static void @@ -562,7 +549,6 @@ _eglAddDrivers(void) * Add other drivers only when EGL_DRIVER is not set. The order here * decides the priorities. */ - _eglAddGalliumDriver(); _eglAddBuiltInDrivers(); } -- 2.1.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 0/2] Disable the EGL state tracker for Linux/DRI builds
Hi everybody, I'm about to address this long-standing issue: The EGL state tracker is redundant. It duplicates what st/dri does and it also duplicates what the common loader egl_dri2 does, which is used by all classic drivers and even works better with gallium drivers. Let's compare EGL extensions for both backends: st/egl: EGL version string: 1.4 (Gallium) EGL client APIs: OpenGL OpenGL_ES OpenGL_ES2 OpenVG EGL extensions string: EGL_WL_bind_wayland_display EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_image EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_surfaceless_context EGL_NOK_swap_region EGL_NV_post_sub_buffer egl_dri2: EGL version string: 1.4 (DRI2) EGL client APIs: OpenGL OpenGL_ES OpenGL_ES2 OpenGL_ES3 EGL extensions string: EGL_MESA_drm_image EGL_MESA_configless_context EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_surfaceless_context EGL_KHR_create_context EGL_NOK_swap_region EGL_NOK_texture_from_pixmap EGL_CHROMIUM_sync_control EGL_EXT_image_dma_buf_import EGL_NV_post_sub_buffer egl_dri2 also supports MSAA on the window framebuffer (through st/dri). It's really obvious which one is better. I'm aware of 2 features that we will lose: - swrast on Wayland - I'm not sure about this. Perhaps kms-swrast has addressed this already. - OpenVG - It has never taken off. If people want this on Linux, it should use egl_dri2 and st/dri, like OpenGL does. This series removes st/egl and st/gbm support from the autoconf build (the latter depends on the former and is probably just as redundant). The next step is to remove all Linux-specific backends from st/egl. Windows, Android, and other platform backends will be kept intact, therefore st/egl won't be removed completely. Please comment. Thanks, Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] configure.ac: remove enable flags for EGL and GBM Gallium state trackers
From: Marek Olšák marek.ol...@amd.com --- configure.ac| 74 +++-- docs/egl.html | 7 - src/gallium/Makefile.am | 8 -- 3 files changed, 4 insertions(+), 85 deletions(-) diff --git a/configure.ac b/configure.ac index fc7d372..91e111b 100644 --- a/configure.ac +++ b/configure.ac @@ -697,20 +697,6 @@ AC_ARG_ENABLE([xlib-glx], [make GLX library Xlib-based instead of DRI-based @:@default=disabled@:@])], [enable_xlib_glx=$enableval], [enable_xlib_glx=no]) -AC_ARG_ENABLE([gallium-egl], -[AS_HELP_STRING([--enable-gallium-egl], -[enable optional EGL state tracker (not required - for EGL support in Gallium with OpenGL and OpenGL ES) - @:@default=disabled@:@])], -[enable_gallium_egl=$enableval], -[enable_gallium_egl=no]) -AC_ARG_ENABLE([gallium-gbm], -[AS_HELP_STRING([--enable-gallium-gbm], -[enable optional gbm state tracker (not required for - gbm support in Gallium) - @:@default=auto@:@])], -[enable_gallium_gbm=$enableval], -[enable_gallium_gbm=auto]) AC_ARG_ENABLE([r600-llvm-compiler], [AS_HELP_STRING([--enable-r600-llvm-compiler], @@ -1314,51 +1300,6 @@ AM_CONDITIONAL(HAVE_EGL, test x$enable_egl = xyes) AC_SUBST([EGL_LIB_DEPS]) dnl -dnl EGL Gallium configuration -dnl -if test x$enable_gallium_egl = xyes; then -if test -z $with_gallium_drivers; then -AC_MSG_ERROR([cannot enable egl_gallium without Gallium]) -fi -if test x$enable_egl = xno; then -AC_MSG_ERROR([cannot enable egl_gallium without EGL]) -fi -if test x$have_libdrm != xyes; then -AC_MSG_ERROR([egl_gallium requires libdrm = $LIBDRM_REQUIRED]) -fi -# XXX: Uncomment once converted to use static/shared pipe-drivers -#enable_gallium_loader=$enable_shared_pipe_drivers -fi -AM_CONDITIONAL(HAVE_GALLIUM_EGL, test x$enable_gallium_egl = xyes) - -dnl -dnl gbm Gallium configuration -dnl -if test x$enable_gallium_gbm = xauto; then -case $enable_gbm$enable_gallium_egl$enable_dri$with_egl_platforms in -yesyesyes*drm*) -enable_gallium_gbm=yes ;; - *) -enable_gallium_gbm=no ;; -esac -fi -if test x$enable_gallium_gbm = xyes; then -if test -z $with_gallium_drivers; then -AC_MSG_ERROR([cannot enable gbm_gallium without Gallium]) -fi -if test x$enable_gbm = xno; then -AC_MSG_ERROR([cannot enable gbm_gallium without gbm]) -fi - -if test x$enable_gallium_egl != xyes; then -AC_MSG_ERROR([gbm_gallium is only used by egl_gallium]) -fi - -enable_gallium_loader=$enable_shared_pipe_drivers -fi -AM_CONDITIONAL(HAVE_GALLIUM_GBM, test x$enable_gallium_gbm = xyes) - -dnl dnl XA configuration dnl if test x$enable_xa = xyes; then @@ -1386,9 +1327,9 @@ if test x$enable_openvg = xyes; then if test -z $with_gallium_drivers; then AC_MSG_ERROR([cannot enable OpenVG without Gallium]) fi -if test x$enable_gallium_egl = xno; then -AC_MSG_ERROR([cannot enable OpenVG without egl_gallium]) -fi + +AC_MSG_ERROR([Cannot enable OpenVG, because egl_gallium has been removed and + OpenVG hasn't been integrated into standard libEGL yet]) EGL_CLIENT_APIS=$EGL_CLIENT_APIS '$(VG_LIB)' VG_LIB_DEPS=$VG_LIB_DEPS $SELINUX_LIBS $PTHREAD_LIBS @@ -2170,8 +2111,6 @@ AC_CONFIG_FILES([Makefile src/gallium/drivers/vc4/kernel/Makefile src/gallium/state_trackers/clover/Makefile src/gallium/state_trackers/dri/Makefile - src/gallium/state_trackers/egl/Makefile - src/gallium/state_trackers/gbm/Makefile src/gallium/state_trackers/glx/xlib/Makefile src/gallium/state_trackers/omx/Makefile src/gallium/state_trackers/osmesa/Makefile @@ -2307,12 +2246,7 @@ if test $enable_egl = yes; then egl_drivers=$egl_drivers builtin:egl_dri2 fi -if test x$enable_gallium_egl = xyes; then -echo EGL drivers:${egl_drivers} egl_gallium -echo EGL Gallium STs:$EGL_CLIENT_APIS -else -echo EGL drivers:$egl_drivers -fi +echo EGL drivers:$egl_drivers fi echo diff --git a/docs/egl.html b/docs/egl.html index eebb8c7..e77c235 100644 --- a/docs/egl.html +++ b/docs/egl.html @@ -77,13 +77,6 @@ drivers will be installed to code${libdir}/egl/code./p /dd -dtcode--enable-gallium-egl/code/dt -dd - -pEnable the optional codeegl_gallium/code driver./p - -/dd - dtcode--with-egl-platforms/code/dt dd diff --git a/src/gallium/Makefile.am b/src/gallium/Makefile.am index 21595a1..ca10c0e 100644 --- a/src/gallium/Makefile.am +++ b/src/gallium/Makefile.am @@ -138,14 +138,6 @@ if HAVE_OPENVG SUBDIRS += state_trackers/vega endif -if HAVE_GALLIUM_EGL -SUBDIRS += state_trackers/egl targets/egl-static -endif - -if HAVE_GALLIUM_GBM -SUBDIRS +=
Re: [Mesa-dev] [PATCH 00/10] glUniform* micro-optimizations, part 1
On 11/03/2014 04:36 PM, Brian Paul wrote: On 11/03/2014 05:22 PM, Ian Romanick wrote: This is the first, and more minor, batch of micro-optimizations for the glUniform* paths. Other than patch 8, these probably aren't going to make a lot of difference, even on CPU limited applications. The next batch, which needs a bit more time to finish baking, should have some more substantial improvements. src/glsl/glsl_types.h | 18 +-- src/mesa/main/uniform_query.cpp | 260 +++- src/mesa/main/uniforms.c| 96 +++ src/mesa/main/uniforms.h| 4 +- 4 files changed, 157 insertions(+), 221 deletions(-) ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddevd=AAIGaQc=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEsr=T0t4QG7chq2ZwJo6wilkFznRSFy-8uDKartPGbomVj8m=5QAghgTf_gj0id9SlxNAbec1i9mOp1WieQvnUV_AVJUs=XN6_VuComU2g5HPG-z2STToQO5WoLmqWCV1gNGMuUGce= Looks good to me. Reviewed-by: Brian Paul bri...@vmware.com BTW, in _mesa_uniform() we have two instances of: if (uni-type-is_sampler()) { ... } if (uni-type-is_image()) { ... I believe the second 'if' could be 'else if' Probably no real savings, but it would read better. One of them goes away (is replace with a switch-statement) in the remainder of the series, and I'll go ahead a fuse the other. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 0/2] Disable the EGL state tracker for Linux/DRI builds
On 04/11/14 22:42, Marek Olšák wrote: Hi everybody, I'm about to address this long-standing issue: The EGL state tracker is redundant. It duplicates what st/dri does and it also duplicates what the common loader egl_dri2 does, which is used by all classic drivers and even works better with gallium drivers. Let's compare EGL extensions for both backends: st/egl: EGL version string: 1.4 (Gallium) EGL client APIs: OpenGL OpenGL_ES OpenGL_ES2 OpenVG EGL extensions string: EGL_WL_bind_wayland_display EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_image EGL_KHR_reusable_sync EGL_KHR_fence_sync EGL_KHR_surfaceless_context EGL_NOK_swap_region EGL_NV_post_sub_buffer egl_dri2: EGL version string: 1.4 (DRI2) EGL client APIs: OpenGL OpenGL_ES OpenGL_ES2 OpenGL_ES3 EGL extensions string: EGL_MESA_drm_image EGL_MESA_configless_context EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_gl_renderbuffer_image EGL_KHR_surfaceless_context EGL_KHR_create_context EGL_NOK_swap_region EGL_NOK_texture_from_pixmap EGL_CHROMIUM_sync_control EGL_EXT_image_dma_buf_import EGL_NV_post_sub_buffer egl_dri2 also supports MSAA on the window framebuffer (through st/dri). It's really obvious which one is better. I'm aware of 2 features that we will lose: - swrast on Wayland - I'm not sure about this. Perhaps kms-swrast has addressed this already. - OpenVG - It has never taken off. If people want this on Linux, it should use egl_dri2 and st/dri, like OpenGL does. This series removes st/egl and st/gbm support from the autoconf build (the latter depends on the former and is probably just as redundant). The next step is to remove all Linux-specific backends from st/egl. Windows, Android, and other platform backends will be kept intact, therefore st/egl won't be removed completely. Please comment. A few thoughts: - Iirc Eric is using st/egl as the dri2 backend seems to be causing problems :( - Android supports dri modules, but st/dri/Android.mk is missing. Should be trivial to add. - Windows - might be a pain in the a** to get it working. Then again does Windows have EGL ? - fbdev, OpenVG - the etnaviv project was using the former, currently moving to full-blown drm :) If one is to nuking the three st we can remove - the libEGL symbol export mayhem - gallium's st_api, and flatten things a bit - a bit of duplication :) In summary: With a bit of work we can remove Linux and Android from the equation. How many people/companies use EGL for Windows/fbdev, how about OpenVG on any platform ? Cheers, Emil Thanks, Marek ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [Mesa-announce] Mesa 10.3 release candidate 1
On Tue, Nov 4, 2014 at 8:35 AM, Ausmus, James james.aus...@intel.com wrote: On Mon, Nov 3, 2014 at 8:12 PM, Matt Turner matts...@gmail.com wrote: On Mon, Nov 3, 2014 at 7:35 PM, Ausmus, James james.aus...@intel.com wrote: I am able to reproduce this consistently with -j40 - it bisects to: Thanks. Maybe you could give a little more information, like an error message or something? Same error as Thierry reported in this thread in August: Unfortunately Thierry's was from a re-run of make, so it wasn't useful. make[4]: Entering directory `/build/x86-alex/tmp/portage/media-libs/mesa-/work/Mesa-/src/mapi' CC glapi_libglapi_la-glapi_gentable.lo CC glapi_libglapi_la-glapi_dispatch.lo CC glapi_libglapi_la-glapi_entrypoint.lo CC glapi_libglapi_la-glapi_getproc.lo CC glapi_libglapi_la-glapi_nop.lo CC glapi_libglapi_la-glapi.lo CC glapi_libglapi_la-u_current.lo CC glapi_libglapi_la-u_execmem.lo GEN.libs/install-mesa-links touch: cannot touch '.libs/install-mesa-links': No such file or directory make[4]: *** [.libs/install-mesa-links] Error 1 Thanks, this is perfect. I think I see what's going on now. I think the problem is related to the fact that these .la files are put into subdirectories' .libs directories, rather than into src/mapi/.libs, which we try to create a file in. The .o files are put into src/mapi/.libs, so I suspect that it's a race between writing the first one of those, and touching .libs/install-mesa-links. In install-lib-links.mk we specify the dependency of all-local : .libs/install-mesa-links to prevent us from recreating the links, and while all-local must run after all, I guess there's nothing preventing its dependencies from running before all has completed. But we do specify the dependency .libs/install-mesa-links : $(lib_LTLIBRARIES), and since those require the .lo files which must have created .libs -- it's not clear why it's not working out. It seems like this dependency isn't working. On my system, lib_LTLIBRARIES are always built before .libs/install-mesa-links, so it appears to work locally. I've gone over this all and can't spot the problem. The dependencies look fine. I tried automake-1.13 and 1.14, and make-3.82 and 4.0. Maybe I'll have more luck on a 40 core system. It's probably simple enough to put the 'install-mesa-links' file in the current directory, rather than in .libs since we're relying on libtool to create that. But I would like to understand what the heck is going on. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev