Re: [Mesa-dev] [PATCH] AMDGPU: Match AMDGPU.cube intrinsic for SI.
On 04.12.2012 19:03, Michel Dänzer wrote: From: Michel Dänzer michel.daen...@amd.com Signed-off-by: Michel Dänzer michel.daen...@amd.com Reviewed by: Christian König christian.koe...@amd.com --- lib/Target/AMDGPU/SIInstructions.td | 21 + 1 file changed, 21 insertions(+) diff --git a/lib/Target/AMDGPU/SIInstructions.td b/lib/Target/AMDGPU/SIInstructions.td index d6f71f6..ecb874a 100644 --- a/lib/Target/AMDGPU/SIInstructions.td +++ b/lib/Target/AMDGPU/SIInstructions.td @@ -1269,6 +1269,27 @@ def : Pat (SI_KIL (V_MOV_IMM_I32 0xbf80)) ; +def : Pat + (int_AMDGPU_cube VReg_128:$src), + (INSERT_SUBREG (INSERT_SUBREG (INSERT_SUBREG (INSERT_SUBREG (v4f32 (IMPLICIT_DEF)), +(V_CUBETC_F32 (EXTRACT_SUBREG VReg_128:$src, sel_x), + (EXTRACT_SUBREG VReg_128:$src, sel_y), + (EXTRACT_SUBREG VReg_128:$src, sel_z), + 0, 0, 0, 0), sel_x), +(V_CUBESC_F32 (EXTRACT_SUBREG VReg_128:$src, sel_x), + (EXTRACT_SUBREG VReg_128:$src, sel_y), + (EXTRACT_SUBREG VReg_128:$src, sel_z), + 0, 0, 0, 0), sel_y), +(V_CUBEMA_F32 (EXTRACT_SUBREG VReg_128:$src, sel_x), + (EXTRACT_SUBREG VReg_128:$src, sel_y), + (EXTRACT_SUBREG VReg_128:$src, sel_z), + 0, 0, 0, 0), sel_z), +(V_CUBEID_F32 (EXTRACT_SUBREG VReg_128:$src, sel_x), + (EXTRACT_SUBREG VReg_128:$src, sel_y), + (EXTRACT_SUBREG VReg_128:$src, sel_z), + 0, 0, 0, 0), sel_w) +; + /** == **/ /** VOP3 Patterns**/ /** == **/ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/2] meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER
From b882d9e08932198e243b9cbb534d01d547661f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= stefandoesin...@gmx.at Date: Mon, 3 Dec 2012 11:03:26 +0100 Subject: [PATCH 1/4] meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER Fixes clears in Wine on r200. --- src/mesa/drivers/common/meta.c | 11 +++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index d5e8af3..ad21fa8 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -133,6 +133,7 @@ struct save_state struct gl_vertex_program *VertexProgram; GLboolean FragmentProgramEnabled; struct gl_fragment_program *FragmentProgram; + GLboolean ATIFragmentShaderEnabled; struct gl_shader_program *VertexShader; struct gl_shader_program *GeometryShader; struct gl_shader_program *FragmentShader; @@ -594,6 +595,11 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_set_enable(ctx, GL_FRAGMENT_PROGRAM_ARB, GL_FALSE); } + if (ctx-API == API_OPENGL_COMPAT ctx-Extensions.ATI_fragment_shader) { + save-ATIFragmentShaderEnabled = ctx-ATIFragmentShader.Enabled; + _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, GL_FALSE); + } + if (ctx-Extensions.ARB_shader_objects) { _mesa_reference_shader_program(ctx, save-VertexShader, ctx-Shader.CurrentVertexProgram); @@ -914,6 +920,11 @@ _mesa_meta_end(struct gl_context *ctx) _mesa_reference_fragprog(ctx, save-FragmentProgram, NULL); } + if (ctx-API == API_OPENGL_COMPAT ctx-Extensions.ATI_fragment_shader) { + _mesa_set_enable(ctx, GL_FRAGMENT_SHADER_ATI, + save-ATIFragmentShaderEnabled); + } + if (ctx-Extensions.ARB_vertex_shader) _mesa_use_shader_program(ctx, GL_VERTEX_SHADER, save-VertexShader); -- 1.7.8.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/2] r200: Initialize swrast before setting limits
From f572545ee0e2e17322554f03409237e40c732d1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= stefandoesin...@gmx.at Date: Mon, 3 Dec 2012 14:31:23 +0100 Subject: [PATCH 2/4] r200: Initialize swrast before setting limits Otherwise the driver announces 4096 vertex shader constants and other way too high limits. --- src/mesa/drivers/dri/r200/r200_context.c | 19 +-- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 360ba72..54cf33e 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -289,13 +289,20 @@ GLboolean r200CreateContext( gl_api api, rmesa-radeon.swtcl.RenderIndex = ~0; rmesa-radeon.hw.all_dirty = 1; + ctx = rmesa-radeon.glCtx; + /* Initialize the software rasterizer and helper modules. +*/ + _swrast_CreateContext( ctx ); + _vbo_CreateContext( ctx ); + _tnl_CreateContext( ctx ); + _swsetup_CreateContext( ctx ); + _ae_create_context( ctx ); + /* Set the maximum texture size small enough that we can guarentee that * all texture units can bind a maximal texture and have all of them in * texturable memory at once. Depending on the allow_large_textures driconf * setting allow larger textures. */ - - ctx = rmesa-radeon.glCtx; ctx-Const.MaxTextureUnits = driQueryOptioni (rmesa-radeon.optionCache, texture_units); ctx-Const.MaxTextureImageUnits = ctx-Const.MaxTextureUnits; @@ -345,14 +352,6 @@ GLboolean r200CreateContext( gl_api api, _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); - /* Initialize the software rasterizer and helper modules. -*/ - _swrast_CreateContext( ctx ); - _vbo_CreateContext( ctx ); - _tnl_CreateContext( ctx ); - _swsetup_CreateContext( ctx ); - _ae_create_context( ctx ); - /* Install the customized pipeline: */ _tnl_destroy_pipeline( ctx ); -- 1.7.8.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] [rfc] llvmpipe: EXT_transform_feedback support (v1)
115/130 sounds great. Just one minor comment. Otherwise looks good Reviewed-by: Jose Fonseca jfons...@vmware.com Jose - Original Message - I'd written most of this ages ago, but never finished it off. This passes 115/130 piglit tests so far. I'll look into the others as time permits. Signed-off-by: Dave Airlie airl...@redhat.com --- src/gallium/drivers/llvmpipe/lp_context.h | 11 +- src/gallium/drivers/llvmpipe/lp_draw_arrays.c | 9 ++ src/gallium/drivers/llvmpipe/lp_query.c| 24 src/gallium/drivers/llvmpipe/lp_query.h| 2 + src/gallium/drivers/llvmpipe/lp_rast.c | 8 +- src/gallium/drivers/llvmpipe/lp_scene.c| 3 +- src/gallium/drivers/llvmpipe/lp_scene.h| 5 +- src/gallium/drivers/llvmpipe/lp_screen.c | 3 +- src/gallium/drivers/llvmpipe/lp_setup.c| 12 +- src/gallium/drivers/llvmpipe/lp_setup.h| 4 + src/gallium/drivers/llvmpipe/lp_setup_context.h| 1 + src/gallium/drivers/llvmpipe/lp_setup_vbuf.c | 14 +++ src/gallium/drivers/llvmpipe/lp_state_rasterizer.c | 2 + src/gallium/drivers/llvmpipe/lp_state_so.c | 121 ++--- src/gallium/drivers/llvmpipe/lp_surface.c | 4 +- 15 files changed, 122 insertions(+), 101 deletions(-) diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index fe6fa3f..25cdff9 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -81,12 +81,6 @@ struct llvmpipe_context { struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_index_buffer index_buffer; - struct { - struct llvmpipe_resource *buffer[PIPE_MAX_SO_BUFFERS]; - int offset[PIPE_MAX_SO_BUFFERS]; - int so_count[PIPE_MAX_SO_BUFFERS]; - int num_buffers; - } so_target; struct pipe_resource *mapped_vs_tex[PIPE_MAX_SAMPLERS]; unsigned num_samplers[PIPE_SHADER_TYPES]; @@ -94,6 +88,11 @@ struct llvmpipe_context { unsigned num_vertex_buffers; + struct draw_so_target *so_targets[PIPE_MAX_SO_BUFFERS]; + int num_so_targets; + struct pipe_query_data_so_statistics so_stats; + unsigned num_primitives_generated; + unsigned dirty; /** Mask of LP_NEW_x flags */ unsigned active_occlusion_query; diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c index 3497edf..eaa9ba3 100644 --- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c +++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c @@ -88,6 +88,13 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) lp-index_buffer.index_size); } + for (i = 0; i lp-num_so_targets; i++) { + void *buf = llvmpipe_resource(lp-so_targets[i]-target.buffer)-data; + lp-so_targets[i]-mapping = buf; + } + draw_set_mapped_so_targets(draw, lp-num_so_targets, + lp-so_targets); + llvmpipe_prepare_vertex_sampling(lp, lp-num_sampler_views[PIPE_SHADER_VERTEX], lp-sampler_views[PIPE_SHADER_VERTEX]); @@ -104,6 +111,8 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info) if (mapped_indices) { draw_set_indexes(draw, NULL, 0); } + draw_set_mapped_so_targets(draw, 0, NULL); + llvmpipe_cleanup_vertex_sampling(lp); /* diff --git a/src/gallium/drivers/llvmpipe/lp_query.c b/src/gallium/drivers/llvmpipe/lp_query.c index e302197..7a62a80 100644 --- a/src/gallium/drivers/llvmpipe/lp_query.c +++ b/src/gallium/drivers/llvmpipe/lp_query.c @@ -138,6 +138,12 @@ llvmpipe_get_query_result(struct pipe_context *pipe, *result = os_time_get_nano(); } break; + case PIPE_QUERY_PRIMITIVES_GENERATED: + *result = pq-num_primitives_generated; + break; + case PIPE_QUERY_PRIMITIVES_EMITTED: + *result = pq-num_primitives_written; + break; default: assert(0); break; @@ -165,6 +171,16 @@ llvmpipe_begin_query(struct pipe_context *pipe, struct pipe_query *q) memset(pq-count, 0, sizeof(pq-count)); lp_setup_begin_query(llvmpipe-setup, pq); + if (pq-type == PIPE_QUERY_PRIMITIVES_EMITTED) { + pq-num_primitives_written = 0; + llvmpipe-so_stats.num_primitives_written = 0; + } + + if (pq-type == PIPE_QUERY_PRIMITIVES_GENERATED) { + pq-num_primitives_generated = 0; + llvmpipe-num_primitives_generated = 0; + } + if (pq-type == PIPE_QUERY_OCCLUSION_COUNTER) { llvmpipe-active_occlusion_query = TRUE; llvmpipe-dirty |= LP_NEW_OCCLUSION_QUERY; @@ -180,6 +196,14 @@ llvmpipe_end_query(struct pipe_context *pipe, struct pipe_query *q)
Re: [Mesa-dev] [PATCH] draw: set precalc_flat flag for AA lines too
Reviewed-by: Jose Fonseca jfons...@vmware.com - Original Message - Fixes flat shading for AA lines. demos/src/trivial/line-smooth is a test case which hits this. Note: This is a candidate for the stable branches. --- src/gallium/auxiliary/draw/draw_pipe_validate.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/gallium/auxiliary/draw/draw_pipe_validate.c b/src/gallium/auxiliary/draw/draw_pipe_validate.c index 27afba5..4b0ed14 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_validate.c +++ b/src/gallium/auxiliary/draw/draw_pipe_validate.c @@ -195,6 +195,7 @@ static struct draw_stage *validate_pipeline( struct draw_stage *stage ) if (rast-line_smooth draw-pipeline.aaline) { draw-pipeline.aaline-next = next; next = draw-pipeline.aaline; + precalc_flat = TRUE; } if (rast-point_smooth draw-pipeline.aapoint) { -- 1.7.3.4 ___ 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
[Mesa-dev] [PATCH automake] pipe-loader: Install pipe_* to $(libdir)/gallium-pipe.
--- This patch is necessary because gbm and clover use same pipe_*. In current automake they are installed only in $(libdir)/gbm and clover searches in $(libdir)/opencl and of course this cannot work. The build is triggered by src/gallium/targets/gbm/Makefile.am:23 or src/gallium/targets/opencl/Makefile.am:12. Successfully tested with clover. Should also work with gbm. --- src/gallium/state_trackers/clover/Makefile.am |6 -- src/gallium/targets/gbm/Makefile.am |2 +- src/gallium/targets/pipe-loader/Makefile.am | 20 ++-- 3 Dateien geändert, 15 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-) diff --git a/src/gallium/state_trackers/clover/Makefile.am b/src/gallium/state_trackers/clover/Makefile.am index f068164..7cfccf6 100644 --- a/src/gallium/state_trackers/clover/Makefile.am +++ b/src/gallium/state_trackers/clover/Makefile.am @@ -3,7 +3,7 @@ AUTOMAKE_OPTIONS = subdir-objects AM_CPPFLAGS = \ $(GALLIUM_PIPE_LOADER_DEFINES) \ -DMESA_VERSION=\$(MESA_VERSION)\ \ - -DPIPE_SEARCH_DIR=\$(OPENCL_LIB_INSTALL_DIR)\ \ + -DPIPE_SEARCH_DIR=\$(libdir)/gallium-pipe\ \ -I$(top_srcdir)/include \ -I$(top_srcdir)/src/gallium/include \ -I$(top_srcdir)/src/gallium/drivers \ diff --git a/src/gallium/targets/gbm/Makefile.am b/src/gallium/targets/gbm/Makefile.am index 28cf455..cd860d7 100644 --- a/src/gallium/targets/gbm/Makefile.am +++ b/src/gallium/targets/gbm/Makefile.am @@ -8,7 +8,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/gbm/main \ -I$(top_srcdir)/src/gallium/winsys \ $(GALLIUM_PIPE_LOADER_DEFINES) \ - -DPIPE_SEARCH_DIR=\$(gbmdir)\ + -DPIPE_SEARCH_DIR=\$(libdir)/gallium-pipe\ AM_CFLAGS = \ $(GALLIUM_CFLAGS) \ diff --git a/src/gallium/targets/pipe-loader/Makefile.am b/src/gallium/targets/pipe-loader/Makefile.am index d02d1ae..bff92a0 100644 --- a/src/gallium/targets/pipe-loader/Makefile.am +++ b/src/gallium/targets/pipe-loader/Makefile.am @@ -10,8 +10,8 @@ AM_CPPFLAGS = \ -DGALLIUM_TRACE \ -DGALLIUM_GALAHAD -gbmdir = $(libdir)/gbm -gbm_LTLIBRARIES = +pipedir = $(libdir)/gallium-pipe +pipe_LTLIBRARIES = PIPE_LIBS = \ $(top_builddir)/src/gallium/auxiliary/libgallium.la \ @@ -27,7 +27,7 @@ endif if HAVE_GALLIUM_I915 -gbm_LTLIBRARIES += pipe_i915.la +pipe_LTLIBRARIES += pipe_i915.la pipe_i915_la_SOURCES = pipe_i915.c pipe_i915_la_LIBADD = \ $(PIPE_LIBS) \ @@ -44,7 +44,7 @@ endif endif if HAVE_GALLIUM_NOUVEAU -gbm_LTLIBRARIES += pipe_nouveau.la +pipe_LTLIBRARIES += pipe_nouveau.la pipe_nouveau_la_SOURCES = pipe_nouveau.c nodist_EXTRA_pipe_nouveau_la_SOURCES = dummy.cpp pipe_nouveau_la_LIBADD = \ @@ -63,7 +63,7 @@ endif endif if HAVE_GALLIUM_R300 -gbm_LTLIBRARIES += pipe_r300.la +pipe_LTLIBRARIES += pipe_r300.la pipe_r300_la_SOURCES = pipe_r300.c nodist_EXTRA_pipe_r300_la_SOURCES = dummy.cpp pipe_r300_la_LIBADD = \ @@ -81,7 +81,7 @@ endif endif if HAVE_GALLIUM_R600 -gbm_LTLIBRARIES += pipe_r600.la +pipe_LTLIBRARIES += pipe_r600.la pipe_r600_la_SOURCES = pipe_r600.c pipe_r600_la_LIBADD = \ $(PIPE_LIBS) \ @@ -98,7 +98,7 @@ endif endif if HAVE_GALLIUM_RADEONSI -gbm_LTLIBRARIES += pipe_radeonsi.la +pipe_LTLIBRARIES += pipe_radeonsi.la pipe_radeonsi_la_SOURCES = pipe_radeonsi.c nodist_EXTRA_pipe_radeonsi_la_SOURCES = dummy.cpp pipe_radeonsi_la_LIBADD = \ @@ -115,7 +115,7 @@ endif endif if HAVE_GALLIUM_SVGA -gbm_LTLIBRARIES += pipe_vmwgfx.la +pipe_LTLIBRARIES += pipe_vmwgfx.la pipe_vmwgfx_la_SOURCES = pipe_vmwgfx.c pipe_vmwgfx_la_LIBADD = \ $(PIPE_LIBS) \ @@ -131,7 +131,7 @@ endif endif if HAVE_GALLIUM_LLVMPIPE -gbm_LTLIBRARIES += pipe_swrast.la +pipe_LTLIBRARIES += pipe_swrast.la pipe_swrast_la_SOURCES = pipe_swrast.c nodist_EXTRA_pipe_swrast_la_SOURCES = dummy.cpp pipe_swrast_la_LIBADD = \ @@ -141,7 +141,7 @@ pipe_swrast_la_LIBADD = \ pipe_swrast_la_LDFLAGS = -no-undefined -avoid-version -module $(LLVM_LDFLAGS) else if HAVE_GALLIUM_SOFTPIPE -gbm_LTLIBRARIES += pipe_swrast.la +pipe_LTLIBRARIES += pipe_swrast.la pipe_swrast_la_SOURCES = pipe_swrast.c pipe_swrast_la_LIBADD = \ $(PIPE_LIBS) \ ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] r200: Initialize swrast before setting limits
Reviewed-by: Alex Deucher alexander.deuc...@amd.com Also, should probably also make a note to apply this to the stable branches. While you are at it can you also check and see if radeon needs a similar fix? Alex ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] st/egl/drm: only unref the udev device if needed
On Tue, Dec 4, 2012 at 12:50 PM, Tobias Droste tdro...@gmx.de wrote: Anyone interested? ;-) I would just push it, but I don't have the rights to do so. Looks reasonable to me. Reviewed-by: Alex Deucher alexander.deuc...@amd.com Am Do, 29. November 2012, 17:02:28 schrieben Sie: Fixes compiler warning: drm/native_drm.c: In function ‘native_create_display’: drm/native_drm.c:180:21: warning: ‘device’ may be used uninitialized in this function [-Wmaybe-uninitialized] drm/native_drm.c:157:24: note: ‘device’ was declared here Signed-off-by: Tobias Droste tdro...@gmx.de --- src/gallium/state_trackers/egl/drm/native_drm.c |9 + 1 Datei geändert, 5 Zeilen hinzugefügt(+), 4 Zeilen entfernt(-) diff --git a/src/gallium/state_trackers/egl/drm/native_drm.c b/src/gallium/state_trackers/egl/drm/native_drm.c index 23fc137..f0c0f54 100644 --- a/src/gallium/state_trackers/egl/drm/native_drm.c +++ b/src/gallium/state_trackers/egl/drm/native_drm.c @@ -161,23 +161,24 @@ drm_get_device_name(int fd) udev = udev_new(); if (fstat(fd, buf) 0) { _eglLog(_EGL_WARNING, failed to stat fd %d, fd); - goto out; + goto outudev; } device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev); if (device == NULL) { _eglLog(_EGL_WARNING, could not create udev device for fd %d, fd); - goto out; + goto outdevice; } tmp = udev_device_get_devnode(device); if (!tmp) - goto out; + goto outdevice; device_name = strdup(tmp); -out: +outdevice: udev_device_unref(device); +outudev: udev_unref(udev); #endif ___ 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 1/3] mesa: add set support (stores a set of pointers)
On 12/04/2012 04:55 PM, Jordan Justen wrote: From: Eric Anholte...@anholt.net From: git://people.freedesktop.org/~anholt/hash_table Reviewed-by: Jordan Justenjordan.l.jus...@intel.com [jordan.l.jus...@intel.com: minor rework for mesa] Signed-off-by: Jordan Justenjordan.l.jus...@intel.com --- src/mesa/SConscript |1 + src/mesa/main/set.c | 349 ++ src/mesa/main/set.h | 94 ++ src/mesa/sources.mak |1 + 4 files changed, 445 insertions(+) create mode 100644 src/mesa/main/set.c create mode 100644 src/mesa/main/set.h diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 1afa412..a2492f7 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -107,6 +107,7 @@ main_sources = [ 'main/renderbuffer.c', 'main/samplerobj.c', 'main/scissor.c', +'main/set.c', 'main/shaderapi.c', 'main/shaderobj.c', 'main/shader_query.cpp', diff --git a/src/mesa/main/set.c b/src/mesa/main/set.c new file mode 100644 index 000..c530c40 --- /dev/null +++ b/src/mesa/main/set.c @@ -0,0 +1,349 @@ +/* + * Copyright © 2009-2012 Intel Corporation + * Copyright © 1988-2004 Keith Packard and Bart Massey. + * + * 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. + * + * Except as contained in this notice, the names of the authors + * or their institutions shall not be used in advertising or + * otherwise to promote the sale, use or other dealings in this + * Software without prior written authorization from the + * authors. + * + * Authors: + *Eric Anholte...@anholt.net + *Keith Packardkei...@keithp.com + */ + +#includestdlib.h + +#include set.h +#include ralloc.h + +#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) + +/* + * From Knuth -- a good choice for hash/rehash values is p, p-2 where + * p and p-2 are both prime. These tables are sized to have an extra 10% + * free to avoid exponential performance degradation as the hash table fills + */ + +uint32_t deleted_key_value; +const void *deleted_key =deleted_key_value; + +static const struct { + uint32_t max_entries, size, rehash; +} hash_sizes[] = { + { 2,5,3}, + { 4,7,5}, + { 8,13, 11 }, + { 16, 19, 17 }, + { 32, 43, 41 }, + { 64, 73, 71 }, + { 128, 151, 149 }, + { 256, 283, 281 }, + { 512, 571, 569 }, + { 1024, 1153, 1151 }, + { 2048, 2269, 2267 }, + { 4096, 4519, 4517 }, + { 8192, 9013, 9011 }, + { 16384,18043,18041}, + { 32768,36109,36107}, + { 65536,72091,72089}, + { 131072, 144409, 144407 }, + { 262144, 288361, 288359 }, + { 524288, 576883, 576881 }, + { 1048576, 1153459, 1153457 }, + { 2097152, 2307163, 2307161 }, + { 4194304, 4613893, 4613891 }, + { 8388608, 9227641, 9227639 }, + { 16777216, 18455029, 18455027 }, + { 33554432, 36911011, 36911009 }, + { 67108864, 73819861, 73819859 }, + { 134217728,147639589,147639587}, + { 268435456,295279081,295279079}, + { 536870912,590559793,590559791}, + { 1073741824, 1181116273, 1181116271 }, + { 2147483648ul, 2362232233ul, 2362232231ul } +}; + +static int +entry_is_free(struct set_entry *entry) +{ + return entry-key == NULL; +} + +static int +entry_is_deleted(struct set_entry *entry) +{ + return entry-key == deleted_key; +} + +static int
Re: [Mesa-dev] [PATCH 2/3] main/syncobj: return GL_INVALID_VALUE for invalid sync objects
On 12/04/2012 04:55 PM, Jordan Justen wrote: Note: The GL/GLES3 web man pages don't seem to properly document glWaitSync's error when the sync object is invalid. Signed-off-by: Jordan Justenjordan.l.jus...@intel.com --- src/mesa/main/syncobj.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 745e982..a2d3137 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -235,7 +235,7 @@ _mesa_DeleteSync(GLsync sync) } if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, glDeleteSync); + _mesa_error(ctx, GL_INVALID_VALUE, glDeleteSync (not a valid sync object)); return; } @@ -303,7 +303,7 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_WAIT_FAILED); if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, glClientWaitSync); + _mesa_error(ctx, GL_INVALID_VALUE, glClientWaitSync (not a valid sync object)); return GL_WAIT_FAILED; } @@ -347,7 +347,7 @@ _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) ASSERT_OUTSIDE_BEGIN_END(ctx); if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, glWaitSync); + _mesa_error(ctx, GL_INVALID_VALUE, glWaitSync (not a valid sync object)); return; } @@ -376,7 +376,7 @@ _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, ASSERT_OUTSIDE_BEGIN_END(ctx); if (!_mesa_validate_sync(syncObj)) { - _mesa_error(ctx, GL_INVALID_OPERATION, glGetSynciv); + _mesa_error(ctx, GL_INVALID_VALUE, glGetSynciv (not a valid sync object)); return; } Reviewed-by: Brian Paul bri...@vmware.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 3/3] mesa: validate that sync objects were created by mesa
On 12/04/2012 04:55 PM, Jordan Justen wrote: Previously, the user could send in a pointer that was not created by mesa. When we dereferenced that pointer, there would be an exception. Now we keep a set of pointers and verify that the pointer exists in that set before dereferencing it. Note: This fixes several crashing gles3conform tests. Signed-off-by: Jordan Justenjordan.l.jus...@intel.com --- src/mesa/main/mtypes.h |6 -- src/mesa/main/shared.c | 12 +++- src/mesa/main/syncobj.c | 23 +++ 3 files changed, 26 insertions(+), 15 deletions(-) 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] [PATCH] silence unused code warnings
diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp index ded4f61..ea81e53 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp @@ -67,26 +67,6 @@ static void init_colours() colour = _colour; } -static const char *OpClassStr[OPCLASS_OTHER + 1] = -{ - MOVE, - LOAD, - STORE, - ARITH, - SHIFT, - SFU, - LOGIC, - COMPARE, - CONVERT, - ATOMIC, - TEXTURE, - SURFACE, - FLOW, - (INVALID), - PSEUDO, - OTHER -}; - const char *operationStr[OP_LAST + 1] = { nop, diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index 0f92614..80a8c01 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -3,6 +3,7 @@ #include nvc0_context.h +#if 0 static void nvc0_validate_zcull(struct nvc0_context *nvc0) { @@ -51,6 +52,7 @@ nvc0_validate_zcull(struct nvc0_context *nvc0) BEGIN_NVC0(push, NVC0_3D(ZCULL_INVALIDATE), 1); PUSH_DATA (push, 0); } +#endif static void nvc0_validate_fb(struct nvc0_context *nvc0) diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c index 43755f4..31ec719 100644 --- a/src/gallium/state_trackers/vega/path.c +++ b/src/gallium/state_trackers/vega/path.c @@ -1085,10 +1085,8 @@ static INLINE VGubyte normalize_coords(struct path_iter_data *pd, } break; case VG_SCUBIC_TO: { - VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + VGfloat x1, y1, x2, y2, x3, y3; data_at(pd-coords, pd-path, 0, 4, data); - x0 = pd-ox; - y0 = pd-oy; x1 = 2*pd-ox-pd-px; y1 = 2*pd-oy-pd-py; x2 = data[0]; diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c index 7b3df27..6c1e354 100644 --- a/src/gallium/state_trackers/vega/vg_translate.c +++ b/src/gallium/state_trackers/vega/vg_translate.c @@ -201,8 +201,7 @@ void _vega_pack_rgba_span_float(struct vg_context *ctx, case VG_BW_1: { VGshort *dst = (VGshort *)dstAddr; for (i = 0; i n; ++i) { - VGubyte r, g, b, a; - VGubyte res; + VGubyte r, g, b, a, res; r = float_to_ubyte(rgba[i][0]); g = float_to_ubyte(rgba[i][1]); b = float_to_ubyte(rgba[i][2]); @@ -229,8 +228,7 @@ void _vega_pack_rgba_span_float(struct vg_context *ctx, case VG_A_4: { VGshort *dst = (VGshort *)dstAddr; for (i = 0; i n; ++i) { - VGubyte a; - VGubyte res; + VGubyte a, res; a = float_to_ubyte(rgba[i][3]); res = a/4; ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] silence unused code warnings
Comments below. On 12/05/2012 07:02 AM, Fabio Pedretti wrote: diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp index ded4f61..ea81e53 100644 --- a/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp +++ b/src/gallium/drivers/nv50/codegen/nv50_ir_print.cpp @@ -67,26 +67,6 @@ static void init_colours() colour = _colour; } -static const char *OpClassStr[OPCLASS_OTHER + 1] = -{ - MOVE, - LOAD, - STORE, - ARITH, - SHIFT, - SFU, - LOGIC, - COMPARE, - CONVERT, - ATOMIC, - TEXTURE, - SURFACE, - FLOW, - (INVALID), - PSEUDO, - OTHER -}; - const char *operationStr[OP_LAST + 1] = { nop, I'd call that nv50: remove unused OpClassStr array diff --git a/src/gallium/drivers/nvc0/nvc0_state_validate.c b/src/gallium/drivers/nvc0/nvc0_state_validate.c index 0f92614..80a8c01 100644 --- a/src/gallium/drivers/nvc0/nvc0_state_validate.c +++ b/src/gallium/drivers/nvc0/nvc0_state_validate.c @@ -3,6 +3,7 @@ #include nvc0_context.h +#if 0 static void nvc0_validate_zcull(struct nvc0_context *nvc0) { @@ -51,6 +52,7 @@ nvc0_validate_zcull(struct nvc0_context *nvc0) BEGIN_NVC0(push, NVC0_3D(ZCULL_INVALIDATE), 1); PUSH_DATA (push, 0); } +#endif static void nvc0_validate_fb(struct nvc0_context *nvc0) This doesn't appear to apply to the master branch. diff --git a/src/gallium/state_trackers/vega/path.c b/src/gallium/state_trackers/vega/path.c index 43755f4..31ec719 100644 --- a/src/gallium/state_trackers/vega/path.c +++ b/src/gallium/state_trackers/vega/path.c @@ -1085,10 +1085,8 @@ static INLINE VGubyte normalize_coords(struct path_iter_data *pd, } break; case VG_SCUBIC_TO: { - VGfloat x0, y0, x1, y1, x2, y2, x3, y3; + VGfloat x1, y1, x2, y2, x3, y3; data_at(pd-coords, pd-path, 0, 4, data); - x0 = pd-ox; - y0 = pd-oy; x1 = 2*pd-ox-pd-px; y1 = 2*pd-oy-pd-py; x2 = data[0]; That patch is fine. I'd suggest vega: remove unused variables as the name. diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c index 7b3df27..6c1e354 100644 --- a/src/gallium/state_trackers/vega/vg_translate.c +++ b/src/gallium/state_trackers/vega/vg_translate.c @@ -201,8 +201,7 @@ void _vega_pack_rgba_span_float(struct vg_context *ctx, case VG_BW_1: { VGshort *dst = (VGshort *)dstAddr; for (i = 0; i n; ++i) { - VGubyte r, g, b, a; - VGubyte res; + VGubyte r, g, b, a, res; r = float_to_ubyte(rgba[i][0]); g = float_to_ubyte(rgba[i][1]); b = float_to_ubyte(rgba[i][2]); @@ -229,8 +228,7 @@ void _vega_pack_rgba_span_float(struct vg_context *ctx, case VG_A_4: { VGshort *dst = (VGshort *)dstAddr; for (i = 0; i n; ++i) { - VGubyte a; - VGubyte res; + VGubyte a, res; a = float_to_ubyte(rgba[i][3]); res = a/4; I don't really see the need for these cosmetic changes. -Brian ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] radeon/llvm: add a pattern for min/max
--- lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 53 lib/Target/AMDGPU/AMDGPUISelLowering.h | 1 + lib/Target/AMDGPU/R600ISelLowering.cpp | 5 +++ lib/Target/AMDGPU/SIISelLowering.cpp | 6 4 files changed, 65 insertions(+) diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 5bde9db..4c1a070 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -172,7 +172,60 @@ SDValue AMDGPUTargetLowering::LowerIntrinsicLRP(SDValue Op, OneSubAC); } +/// Generate Min/Max pattern +SDValue AMDGPUTargetLowering::LowerMinMax(SDValue Op, +SelectionDAG DAG) const +{ + DebugLoc DL = Op.getDebugLoc(); + EVT VT = Op.getValueType(); + SDValue LHS = Op.getOperand(0); + SDValue RHS = Op.getOperand(1); + SDValue True = Op.getOperand(2); + SDValue CC = Op.getOperand(4); + + ISD::CondCode CCOpcode = castCondCodeSDNode(CC)-get(); + switch (CCOpcode) { + case ISD::SETOEQ: + case ISD::SETONE: + case ISD::SETUNE: + case ISD::SETNE: + case ISD::SETUEQ: + case ISD::SETEQ: + case ISD::SETFALSE: + case ISD::SETFALSE2: + case ISD::SETTRUE: + case ISD::SETTRUE2: + case ISD::SETUO: + case ISD::SETO: +assert(0 Operation should already be optimised !); + case ISD::SETULE: + case ISD::SETULT: + case ISD::SETOLE: + case ISD::SETOLT: + case ISD::SETLE: + case ISD::SETLT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); + } + case ISD::SETGT: + case ISD::SETGE: + case ISD::SETUGE: + case ISD::SETOGE: + case ISD::SETUGT: + case ISD::SETOGT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); + } + case ISD::SETCC_INVALID: +assert(0 Invalid setcc condcode !); + } + return Op; +} SDValue AMDGPUTargetLowering::LowerUDIVREM(SDValue Op, SelectionDAG DAG) const diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.h b/lib/Target/AMDGPU/AMDGPUISelLowering.h index 60de190..3b60ae1 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -56,6 +56,7 @@ public: virtual SDValue LowerOperation(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicIABS(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicLRP(SDValue Op, SelectionDAG DAG) const; + SDValue LowerMinMax(SDValue Op, SelectionDAG DAG) const; virtual const char* getTargetNodeName(unsigned Opcode) const; // Functions defined in AMDILISelLowering.cpp diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 6f1c1d7..374fbfc 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -764,6 +764,11 @@ SDValue R600TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const } } + if (CompareVT == VT == MVT::f32 + ((LHS == True RHS == False) || (LHS == False RHS == True))) { +return LowerMinMax(Op, DAG); + } + // If we make it this for it means we have no native instructions to handle // this SELECT_CC, so we must lower it. SDValue HWTrue, HWFalse; diff --git a/lib/Target/AMDGPU/SIISelLowering.cpp b/lib/Target/AMDGPU/SIISelLowering.cpp index 45f180f..98a7376 100644 --- a/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/lib/Target/AMDGPU/SIISelLowering.cpp @@ -383,6 +383,12 @@ SDValue SITargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const EVT VT = Op.getValueType(); DebugLoc DL = Op.getDebugLoc(); + EVT CompareVT = LHS.getValueType(); + if (CompareVT == VT == MVT::f32 + ((LHS == True RHS == False) || (LHS == False RHS == True))) { +return LowerMinMax(Op, DAG); + } + SDValue Cond = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, CC); return DAG.getNode(ISD::SELECT, DL, VT, Cond, True, False); } -- 1.8.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeon/llvm: add a pattern for min/max
On Wed, Dec 05, 2012 at 04:58:21PM +0100, Vincent Lejeune wrote: --- lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 53 lib/Target/AMDGPU/AMDGPUISelLowering.h | 1 + lib/Target/AMDGPU/R600ISelLowering.cpp | 5 +++ lib/Target/AMDGPU/SIISelLowering.cpp | 6 4 files changed, 65 insertions(+) Hi Vincent, This looks much better, thanks. Just a few minor issues, but with those fixed, this patch is: Reviewed-by: Tom Stellard thomas.stell...@amd.com diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 5bde9db..4c1a070 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -172,7 +172,60 @@ SDValue AMDGPUTargetLowering::LowerIntrinsicLRP(SDValue Op, OneSubAC); } +/// Generate Min/Max pattern +SDValue AMDGPUTargetLowering::LowerMinMax(SDValue Op, +SelectionDAG DAG) const +{ Brace needs to be on the same line as the function here + DebugLoc DL = Op.getDebugLoc(); + EVT VT = Op.getValueType(); + SDValue LHS = Op.getOperand(0); + SDValue RHS = Op.getOperand(1); + SDValue True = Op.getOperand(2); + SDValue CC = Op.getOperand(4); You should move this check into the function: EVT CompareVT = LHS.getValueType(); if (CompareVT != VT || VT != MVT::f32 || (LHS != True LHS != False) || (RHS != True RHS != False)) { return SDValue(); } Make sure to double check my logic here. + ISD::CondCode CCOpcode = castCondCodeSDNode(CC)-get(); + switch (CCOpcode) { + case ISD::SETOEQ: + case ISD::SETONE: + case ISD::SETUNE: + case ISD::SETNE: + case ISD::SETUEQ: + case ISD::SETEQ: + case ISD::SETFALSE: + case ISD::SETFALSE2: + case ISD::SETTRUE: + case ISD::SETTRUE2: + case ISD::SETUO: + case ISD::SETO: +assert(0 Operation should already be optimised !); + case ISD::SETULE: + case ISD::SETULT: + case ISD::SETOLE: + case ISD::SETOLT: + case ISD::SETLE: + case ISD::SETLT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); + } + case ISD::SETGT: + case ISD::SETGE: + case ISD::SETUGE: + case ISD::SETOGE: + case ISD::SETUGT: + case ISD::SETOGT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); + } + case ISD::SETCC_INVALID: +assert(0 Invalid setcc condcode !); + } + return Op; +} SDValue AMDGPUTargetLowering::LowerUDIVREM(SDValue Op, SelectionDAG DAG) const diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.h b/lib/Target/AMDGPU/AMDGPUISelLowering.h index 60de190..3b60ae1 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -56,6 +56,7 @@ public: virtual SDValue LowerOperation(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicIABS(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicLRP(SDValue Op, SelectionDAG DAG) const; + SDValue LowerMinMax(SDValue Op, SelectionDAG DAG) const; virtual const char* getTargetNodeName(unsigned Opcode) const; // Functions defined in AMDILISelLowering.cpp diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 6f1c1d7..374fbfc 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -764,6 +764,11 @@ SDValue R600TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const } } + if (CompareVT == VT == MVT::f32 + ((LHS == True RHS == False) || (LHS == False RHS == True))) { +return LowerMinMax(Op, DAG); + } + With this check in the common function, replace the above code with: SDValue MinMax = LowerMinMax(Op, DAG) if (MinMax.getNode()) { return MinMax; } // If we make it this for it means we have no native instructions to handle // this SELECT_CC, so we must lower it. SDValue HWTrue, HWFalse; diff --git a/lib/Target/AMDGPU/SIISelLowering.cpp b/lib/Target/AMDGPU/SIISelLowering.cpp index 45f180f..98a7376 100644 --- a/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/lib/Target/AMDGPU/SIISelLowering.cpp @@ -383,6 +383,12 @@ SDValue SITargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const EVT VT = Op.getValueType(); DebugLoc DL = Op.getDebugLoc(); + EVT CompareVT = LHS.getValueType(); + if (CompareVT == VT == MVT::f32 + ((LHS == True RHS == False) || (LHS == False RHS == True))) { +return LowerMinMax(Op, DAG); + } + You can do the same replacement here too. SDValue Cond = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, CC); return DAG.getNode(ISD::SELECT, DL, VT, Cond, True, False); } -- 1.8.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org
[Mesa-dev] [PATCH] radeon/llvm: add a pattern for min/max
--- lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 58 lib/Target/AMDGPU/AMDGPUISelLowering.h | 1 + lib/Target/AMDGPU/R600ISelLowering.cpp | 6 lib/Target/AMDGPU/SIISelLowering.cpp | 6 4 files changed, 71 insertions(+) diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 5bde9db..41e8f44 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -172,7 +172,65 @@ SDValue AMDGPUTargetLowering::LowerIntrinsicLRP(SDValue Op, OneSubAC); } +/// Generate Min/Max pattern +SDValue AMDGPUTargetLowering::LowerMinMax(SDValue Op, +SelectionDAG DAG) const { + DebugLoc DL = Op.getDebugLoc(); + EVT VT = Op.getValueType(); + + SDValue LHS = Op.getOperand(0); + SDValue RHS = Op.getOperand(1); + SDValue True = Op.getOperand(2); + SDValue False = Op.getOperand(3); + SDValue CC = Op.getOperand(4); + + if (VT != MVT::f32 || + !((LHS == True RHS == False) || (LHS == False RHS == True))) { +return SDValue(); + } + ISD::CondCode CCOpcode = castCondCodeSDNode(CC)-get(); + switch (CCOpcode) { + case ISD::SETOEQ: + case ISD::SETONE: + case ISD::SETUNE: + case ISD::SETNE: + case ISD::SETUEQ: + case ISD::SETEQ: + case ISD::SETFALSE: + case ISD::SETFALSE2: + case ISD::SETTRUE: + case ISD::SETTRUE2: + case ISD::SETUO: + case ISD::SETO: +assert(0 Operation should already be optimised !); + case ISD::SETULE: + case ISD::SETULT: + case ISD::SETOLE: + case ISD::SETOLT: + case ISD::SETLE: + case ISD::SETLT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); + } + case ISD::SETGT: + case ISD::SETGE: + case ISD::SETUGE: + case ISD::SETOGE: + case ISD::SETUGT: + case ISD::SETOGT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); + } + case ISD::SETCC_INVALID: +assert(0 Invalid setcc condcode !); + } + return Op; +} SDValue AMDGPUTargetLowering::LowerUDIVREM(SDValue Op, SelectionDAG DAG) const diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.h b/lib/Target/AMDGPU/AMDGPUISelLowering.h index 60de190..3b60ae1 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -56,6 +56,7 @@ public: virtual SDValue LowerOperation(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicIABS(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicLRP(SDValue Op, SelectionDAG DAG) const; + SDValue LowerMinMax(SDValue Op, SelectionDAG DAG) const; virtual const char* getTargetNodeName(unsigned Opcode) const; // Functions defined in AMDILISelLowering.cpp diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 6f1c1d7..dff29f6 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -764,6 +764,12 @@ SDValue R600TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const } } + // Possible Min/Max pattern + SDValue MinMax = LowerMinMax(Op, DAG); + if (MinMax.getNode()) { +return MinMax; + } + // If we make it this for it means we have no native instructions to handle // this SELECT_CC, so we must lower it. SDValue HWTrue, HWFalse; diff --git a/lib/Target/AMDGPU/SIISelLowering.cpp b/lib/Target/AMDGPU/SIISelLowering.cpp index 45f180f..2eb1fcc 100644 --- a/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/lib/Target/AMDGPU/SIISelLowering.cpp @@ -383,6 +383,12 @@ SDValue SITargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const EVT VT = Op.getValueType(); DebugLoc DL = Op.getDebugLoc(); + // Possible Min/Max pattern + SDValue MinMax = LowerMinMax(Op, DAG); + if (MinMax.getNode()) { +return MinMax; + } + SDValue Cond = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, CC); return DAG.getNode(ISD::SELECT, DL, VT, Cond, True, False); } -- 1.8.0.1 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] radeon/llvm: add a pattern for min/max
On Wed, Dec 05, 2012 at 06:09:46PM +0100, Vincent Lejeune wrote: --- lib/Target/AMDGPU/AMDGPUISelLowering.cpp | 58 lib/Target/AMDGPU/AMDGPUISelLowering.h | 1 + lib/Target/AMDGPU/R600ISelLowering.cpp | 6 lib/Target/AMDGPU/SIISelLowering.cpp | 6 4 files changed, 71 insertions(+) Looks great, thanks. Reveiwed-by: Tom Stellard thomas.stell...@amd.com diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp index 5bde9db..41e8f44 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.cpp +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.cpp @@ -172,7 +172,65 @@ SDValue AMDGPUTargetLowering::LowerIntrinsicLRP(SDValue Op, OneSubAC); } +/// Generate Min/Max pattern +SDValue AMDGPUTargetLowering::LowerMinMax(SDValue Op, +SelectionDAG DAG) const { + DebugLoc DL = Op.getDebugLoc(); + EVT VT = Op.getValueType(); + + SDValue LHS = Op.getOperand(0); + SDValue RHS = Op.getOperand(1); + SDValue True = Op.getOperand(2); + SDValue False = Op.getOperand(3); + SDValue CC = Op.getOperand(4); + + if (VT != MVT::f32 || + !((LHS == True RHS == False) || (LHS == False RHS == True))) { +return SDValue(); + } + ISD::CondCode CCOpcode = castCondCodeSDNode(CC)-get(); + switch (CCOpcode) { + case ISD::SETOEQ: + case ISD::SETONE: + case ISD::SETUNE: + case ISD::SETNE: + case ISD::SETUEQ: + case ISD::SETEQ: + case ISD::SETFALSE: + case ISD::SETFALSE2: + case ISD::SETTRUE: + case ISD::SETTRUE2: + case ISD::SETUO: + case ISD::SETO: +assert(0 Operation should already be optimised !); + case ISD::SETULE: + case ISD::SETULT: + case ISD::SETOLE: + case ISD::SETOLT: + case ISD::SETLE: + case ISD::SETLT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); + } + case ISD::SETGT: + case ISD::SETGE: + case ISD::SETUGE: + case ISD::SETOGE: + case ISD::SETUGT: + case ISD::SETOGT: { +if (LHS == True) + return DAG.getNode(AMDGPUISD::FMAX, DL, VT, LHS, RHS); +else + return DAG.getNode(AMDGPUISD::FMIN, DL, VT, LHS, RHS); + } + case ISD::SETCC_INVALID: +assert(0 Invalid setcc condcode !); + } + return Op; +} SDValue AMDGPUTargetLowering::LowerUDIVREM(SDValue Op, SelectionDAG DAG) const diff --git a/lib/Target/AMDGPU/AMDGPUISelLowering.h b/lib/Target/AMDGPU/AMDGPUISelLowering.h index 60de190..3b60ae1 100644 --- a/lib/Target/AMDGPU/AMDGPUISelLowering.h +++ b/lib/Target/AMDGPU/AMDGPUISelLowering.h @@ -56,6 +56,7 @@ public: virtual SDValue LowerOperation(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicIABS(SDValue Op, SelectionDAG DAG) const; SDValue LowerIntrinsicLRP(SDValue Op, SelectionDAG DAG) const; + SDValue LowerMinMax(SDValue Op, SelectionDAG DAG) const; virtual const char* getTargetNodeName(unsigned Opcode) const; // Functions defined in AMDILISelLowering.cpp diff --git a/lib/Target/AMDGPU/R600ISelLowering.cpp b/lib/Target/AMDGPU/R600ISelLowering.cpp index 6f1c1d7..dff29f6 100644 --- a/lib/Target/AMDGPU/R600ISelLowering.cpp +++ b/lib/Target/AMDGPU/R600ISelLowering.cpp @@ -764,6 +764,12 @@ SDValue R600TargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const } } + // Possible Min/Max pattern + SDValue MinMax = LowerMinMax(Op, DAG); + if (MinMax.getNode()) { +return MinMax; + } + // If we make it this for it means we have no native instructions to handle // this SELECT_CC, so we must lower it. SDValue HWTrue, HWFalse; diff --git a/lib/Target/AMDGPU/SIISelLowering.cpp b/lib/Target/AMDGPU/SIISelLowering.cpp index 45f180f..2eb1fcc 100644 --- a/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/lib/Target/AMDGPU/SIISelLowering.cpp @@ -383,6 +383,12 @@ SDValue SITargetLowering::LowerSELECT_CC(SDValue Op, SelectionDAG DAG) const EVT VT = Op.getValueType(); DebugLoc DL = Op.getDebugLoc(); + // Possible Min/Max pattern + SDValue MinMax = LowerMinMax(Op, DAG); + if (MinMax.getNode()) { +return MinMax; + } + SDValue Cond = DAG.getNode(ISD::SETCC, DL, MVT::i1, LHS, RHS, CC); return DAG.getNode(ISD::SELECT, DL, VT, Cond, True, False); } -- 1.8.0.1 ___ 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/2] r200: Initialize swrast before setting limits
On 12/05/12 15:23, Alex Deucher wrote: Also, should probably also make a note to apply this to the stable branches. While you are at it can you also check and see if radeon needs a similar fix? From the code it looks like it needs a similar fix. I don't have a pre-r250 card though so I can't test to be sure. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/3] meta: Don't use GL_TEXTURE_RECTANGLE as texture target in GLES
On Tue, Dec 4, 2012 at 11:17 AM, Eric Anholt e...@anholt.net wrote: Anuj Phogat anuj.pho...@gmail.com writes: Makes framebuffer_blit_coverage_mismatched_buffer_formats.test in gles3 conformance pass. Signed-off-by: Anuj Phogat anuj.pho...@gmail.com --- src/mesa/drivers/common/meta.c | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 978eeb5..02e64ff 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c - _mesa_set_enable(ctx, tex-Target, GL_TRUE); + /* glEnable() in gles2 and gles3 doesn't allow GL_TEXTURE_{1D, 2D, etc.} +* tokens. +*/ + if (ctx-API == API_OPENGL ctx-API == API_OPENGLES) + _mesa_set_enable(ctx, tex-Target, GL_TRUE); if (mask GL_COLOR_BUFFER_BIT) { setup_copypix_texture(tex, newTex, srcX, srcY, srcW, srcH, @@ -1679,7 +1683,8 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx, /* XXX can't easily do stencil */ } - _mesa_set_enable(ctx, tex-Target, GL_FALSE); + if (ctx-API == API_OPENGL ctx-API == API_OPENGLES) + _mesa_set_enable(ctx, tex-Target, GL_FALSE); If BlitFramebuffer is doing fixed function, then it needs _mesa_set_enable() to work to enable the texture it's reading from. For GLES3, it sounds like we need to either make blorp handle all BlitFramebuffer, or make a BlitFramebuffer path using GLSL instead. I don't think this halfway point of a BlitFramebuffer implementation that doesn't successfully blit makes sense. Yeah. I realized it after posting this patch. I'm working on GLSL implementation of BlitFrameBuffer. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/5] driconf: Add translation-generation to build system, don't track generated files
On 12/04/2012 03:53 PM, Carl Worth wrote: Another approach, (and something we did for the cairo project), would be to put things like lists of filenames needed for the build into a simple file that could be included by either Makefile.am or Android.mk. That would at least eliminate one source of duplication. For example, see this Makefile.sources in the cairo tree: http://cgit.freedesktop.org/cairo/tree/src/Makefile.sources We already do this in Mesa. In some places, the file is named Makefile.sourcce; in other places, sources.mak. Of course, this doesn't help for generated files. With both Android and automake targeting a common make tool, there should be an opportunity to do even more sharing than cairo is able to do, (where the Makefile.win32 is aimed at a fairly-incompatible make tool on Windows). Chad, you and I should probably talk more in person the next time we're in the office together. It may be possible to share rules for the generated files, but, based on experience in maintaining the Android makefiles, I expect such sharing to make the situation worse due to heightened complexity. Or, it may not be possible at all. Beware of the uncanny valley: the Android build systems looks deceptively like simple Makefiles until you dig further in. I really think the best option is to generate the Android makefiles with a tool. Despite my skepticism, we should still plan to talk in person over this. Together, we may be able to arrive at a feasible solution. Let's plan to do that shortly after we ship the next Mesa release. In the meantime, the patch series that initiated this conversation adds a Makefile.am to the src/mesa/drivers/dri/common/xmlpool to generate an options.h file, (one of those complex case you mentioned of using a local python program to generate some code). Can you contribute whatever changes are necessary to Android.mk files so that I could push this series? I'll push a branch today that adds the necessary Android changes to your series, and inform you when I do. -Chad ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] r200: Initialize swrast before setting limits
On Wed, Dec 5, 2012 at 12:22 PM, Stefan Dösinger stefandoesin...@gmx.at wrote: On 12/05/12 15:23, Alex Deucher wrote: Also, should probably also make a note to apply this to the stable branches. While you are at it can you also check and see if radeon needs a similar fix? From the code it looks like it needs a similar fix. I don't have a pre-r250 card though so I can't test to be sure. It should be ok. If you make the patches, I'll apply them unless you have mesa commit access and want do it yourself. Alex ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [Bug 57903] [llvmpipe] piglit fbo-blending-formats regression
https://bugs.freedesktop.org/show_bug.cgi?id=57903 José Fonseca jfons...@vmware.com changed: What|Removed |Added Assignee|mesa-dev@lists.freedesktop. |jfons...@vmware.com |org | -- You are receiving this mail because: You are the assignee for the bug. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/2] meta: Disable GL_FRAGMENT_SHADER_ATI in MESA_META_SHADER
On 12/05/2012 01:49 AM, Stefan Dösinger wrote: In the future, please send patches using git-send-mail. It makes it easier for people to reply with comments in-line with the patch. In spite of that, this patch looks good. Does it fix any known bugzilla entries? If so, those should be mentioned in the commit message like: Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=# I also think this should get cherry-picked back to stable branches, so you should add the following text to the commit message: NOTE: This is a candidate for stable release branches. Other than that, Reviewed-by: Ian Romanick ian.d.roman...@intel.com ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 4/5] driconf: Add translation-generation to build system, don't track generated files
On Wed, Dec 5, 2012 at 12:36 AM, Chad Versace chad.vers...@linux.intel.com wrote: Taking the Android.mk's out of Mesa without replacing them with an Androgenizer-like tool would impose that insufferable situation on the Android developers. Is maintaining Sconscripts as the only build system an option ? It's easy to extend(it's written in python) and adding an Android.mk generator would be easier than what androgenizer does(also, androgenizer is unmaintained IIRC) Thanks, /me runs back in the cave :D ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev