mesa.git
11 years agoglsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f
Matt Turner [Sat, 16 Feb 2013 01:51:46 +0000 (17:51 -0800)]
glsl: Optimize ir_triop_lrp(x, y, a) with a = 0.0f or 1.0f

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Convert mix() to use a new ir_triop_lrp opcode.
Kenneth Graunke [Sun, 2 Dec 2012 07:49:26 +0000 (23:49 -0800)]
glsl: Convert mix() to use a new ir_triop_lrp opcode.

Many GPUs have an instruction to do linear interpolation which is more
efficient than simply performing the algebra necessary (two multiplies,
an add, and a subtract).

Pattern matching or peepholing this is more desirable, but can be
tricky.  By using an opcode, we can at least make shaders which use the
mix() built-in get the more efficient behavior.

Currently, all consumers lower ir_triop_lrp.  Subsequent patches will
actually generate different code.

v2 [mattst88]:
   - Add LRP_TO_ARITH flag to ir_to_mesa.cpp. Will be removed in a
     subsequent patch and ir_triop_lrp translated directly.
v3 [mattst88]:
   - Move changes from the next patch to opt_algebraic.cpp to accept
     3-src operations.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Rework ir_reader to handle expressions with three operands.
Kenneth Graunke [Sun, 2 Dec 2012 07:49:19 +0000 (23:49 -0800)]
glsl: Rework ir_reader to handle expressions with three operands.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoglsl: Consolidate ir_expression constructors that use explicit types.
Kenneth Graunke [Sun, 2 Dec 2012 07:40:42 +0000 (23:40 -0800)]
glsl: Consolidate ir_expression constructors that use explicit types.

Previously, we had separate constructors for one, two, and four operand
expressions.  This patch consolidates them into a single constructor
which uses NULL default parameters.

The unary and binary operator constructors had assertions to verify that
the caller supplied the correct number of operands for the expression,
but the four-operand version did not.  Since get_num_operands for
ir_quadop_vector returns the number of vector_elements, we can safely
add that without breaking the semantics of ir_quadop_vector.

This also paves the way for expressions with three operands.  Currently,
none can be constructed since get_num_operands() never returns 3.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/vs/gen7: Allow MATH instructions to have MRF as a destination
Matt Turner [Tue, 12 Feb 2013 23:50:43 +0000 (15:50 -0800)]
i965/vs/gen7: Allow MATH instructions to have MRF as a destination

total instructions in shared programs: 346873 -> 346847 (-0.01%)
instructions in affected programs:     364 -> 338 (-7.14%)

(All affected shaders are from Lightsmark)

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/fs/gen7: Allow MATH instructions to have MRF as a destination
Matt Turner [Tue, 12 Feb 2013 21:59:37 +0000 (13:59 -0800)]
i965/fs/gen7: Allow MATH instructions to have MRF as a destination

total instructions in shared programs: 1376297 -> 1375626 (-0.05%)
instructions in affected programs:     35977 -> 35306 (-1.87%)

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/gen7: Relax restrictions on fake MRFs
Matt Turner [Mon, 11 Feb 2013 19:06:13 +0000 (11:06 -0800)]
i965/gen7: Relax restrictions on fake MRFs

Gen6 has write-only MRF registers, and for ease of implementation we
paritition off 16 general purposes registers to act as MRFs on Gen7.

Knowing that our Gen7 MRFs are actually GRFs, we can do things we can't
do with real MRFs:
   - read from them;
   - return values directly to them from a send instruction; and
   - compute directly to them with math instructions.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoi965/fs: Remove duplicate scan_inst->mlen check
Matt Turner [Mon, 11 Feb 2013 19:24:48 +0000 (11:24 -0800)]
i965/fs: Remove duplicate scan_inst->mlen check

Is already checked 20 lines below.

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agoclover: Fix build with LLVM 3.3 v2
Tom Stellard [Fri, 22 Feb 2013 18:19:14 +0000 (19:19 +0100)]
clover: Fix build with LLVM 3.3 v2

v2:
  - Fix order that the clang libraries are passed to the linker to avoid
    missing symbol errors.

Acked-by: Francisco Jerez <currojerez@riseup.net>
11 years agoattrib: push/pop FRAGMENT_PROGRAM_ARB state
Jordan Justen [Thu, 28 Feb 2013 07:19:55 +0000 (23:19 -0800)]
attrib: push/pop FRAGMENT_PROGRAM_ARB state

This requirement was added by ARB_fragment_program

When the Steam overlay is enabled, this fixes:
* Menu corruption with the Puddle game
* The screen going black on Rochard when
  the Steam overlay is accessed

NOTE: This is a candidate for the 9.0 and 9.1 branches.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoscons: Fix Windows build with LLVM 3.2
Keith Kriewall [Thu, 28 Feb 2013 15:40:02 +0000 (15:40 +0000)]
scons: Fix Windows build with LLVM 3.2

Fixes fdo bug 61299

NOTE: This is a candidate for the stable branches.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agoautotools: oprofilejit should be included in the list of LLVM components required
Adam Sampson [Thu, 28 Feb 2013 15:35:11 +0000 (15:35 +0000)]
autotools: oprofilejit should be included in the list of LLVM components required

NOTE: This is a candidate for the stable branch.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agor600g: workaround hyperz lockup on evergreen
Jerome Glisse [Wed, 20 Feb 2013 21:20:17 +0000 (16:20 -0500)]
r600g: workaround hyperz lockup on evergreen

This work around disable hyperz if write to zbuffer is disabled. Somehow
using hyperz when not writting to the zbuffer trigger GPU lockup. See :

https://bugs.freedesktop.org/show_bug.cgi?id=60848

Candidate for 9.1

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
11 years agotexobj: add verbose api trace messages to several routines
Jordan Justen [Mon, 25 Feb 2013 21:56:20 +0000 (13:56 -0800)]
texobj: add verbose api trace messages to several routines

Motivated by wanting to see if GenTextures was called by an
application while debugging another Steam overlay issue.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agollvmpipe: check buffers in llvmpipe_is_resource_referenced.
Roland Scheidegger [Thu, 28 Feb 2013 00:25:24 +0000 (01:25 +0100)]
llvmpipe: check buffers in llvmpipe_is_resource_referenced.

Now that buffers can be used as textures or render targets
make sure they aren't skipped.

Fix suggested by Jose Fonseca.

v2: added a couple of assertions so we can actually guarantee
we check the resources and don't skip them. Also added some comments
that this is actually a lie due to the way the opengl buffer api works.

11 years agollvmpipe: support rendering to buffer render targets.
Roland Scheidegger [Wed, 27 Feb 2013 18:26:01 +0000 (19:26 +0100)]
llvmpipe: support rendering to buffer render targets.

Unfortunately not usable from OpenGL, and no cap bit.
Pretty similar to a 1d texture, though allows specifying a start element.

v2: also fix up renderbuffer width (which will get promoted to fb width)
to be the number of elements

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoutil: fix issues with util_clear_render_target.
Roland Scheidegger [Wed, 27 Feb 2013 18:25:48 +0000 (19:25 +0100)]
util: fix issues with util_clear_render_target.

For PIPE_BUFFER we need coord adjustments for the transfer.
And for pure integer formats util_pack_color just crashes,
need to handle that differently due to clear colors being ints/uints.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agosoftpipe/draw/tgsi: simplify driver/tgsi sampler interface
Roland Scheidegger [Wed, 27 Feb 2013 18:07:18 +0000 (19:07 +0100)]
softpipe/draw/tgsi: simplify driver/tgsi sampler interface

Use a single sampler adapter instead of per-sampler-unit samplers,
and just pass along texture unit and sampler unit in the calls.
The reason is that for dx10-style sample opcodes pre-wired
samplers including all the texture state aren't really feasible (and for
sample_i/sviewinfo we don't even have samplers).
Of course right now softpipe doesn't actually do anything more than
just look up all its pre-wired per-texunit/per-samplerunit sampler as
it did before so this doesn't really achieve much except one more
function call, however this is now all softpipe's fault (fixing that in
a way which doesn't suck is still an unsolved problem).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallivm: fix mis-matching AOS instruction emission
Maxence Le Doré [Wed, 27 Feb 2013 19:56:58 +0000 (20:56 +0100)]
gallivm: fix mis-matching AOS instruction emission

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agoglx: Fix glXCreateWindow() when GLX_DIRECT_RENDERING is undefined
Jon TURNEY [Tue, 26 Feb 2013 15:47:44 +0000 (15:47 +0000)]
glx: Fix glXCreateWindow() when GLX_DIRECT_RENDERING is undefined

glXCreateWindow() and glXCreatePbuffer() always fail when built without
GLX_DIRECT_RENDERING defined since commit 48331047.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
11 years agoconfigure.ac: Clarify the description of the --with-opencl-libdir parameter a little.
Francisco Jerez [Wed, 27 Feb 2013 11:26:13 +0000 (12:26 +0100)]
configure.ac: Clarify the description of the --with-opencl-libdir parameter a little.

https://bugs.freedesktop.org/show_bug.cgi?id=61415

Signed-off-by: Francisco Jerez <currojerez@riseup.net>
11 years agoradeonsi: Fix memory leak in si_set_constant_buffer.
Vinson Lee [Sun, 24 Feb 2013 01:19:24 +0000 (17:19 -0800)]
radeonsi: Fix memory leak in si_set_constant_buffer.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
11 years agost/vega: Fix memory leak in combine_shaders.
Vinson Lee [Sun, 24 Feb 2013 00:49:37 +0000 (16:49 -0800)]
st/vega: Fix memory leak in combine_shaders.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoegl/wayland: Don't block on EGL_DEFAULT_DISPAY under wayland
Kristian Høgsberg [Tue, 26 Feb 2013 17:49:40 +0000 (12:49 -0500)]
egl/wayland: Don't block on EGL_DEFAULT_DISPAY under wayland

Normally the application will own the main event queue and be responsible
for moving events.  In case of EGL_DEFAULT_DISPLAY, EGL opens the display
and has to own the main queue so it can move the events itself.
Call wl_display_dispatch_pending() to take ownership.

11 years agoegl: Allow 24-bit visuals for 32-bit RGBA8888 configs
Ian Romanick [Sat, 23 Feb 2013 03:01:40 +0000 (19:01 -0800)]
egl: Allow 24-bit visuals for 32-bit RGBA8888 configs

Previously only the 32-bit X visual would match the 32-bit RGBA8888
configs.  This resulted in every config with alpha getting the "magic"
visual whose alpha is used by the compositor.  This also resulted in no
multisample visuals being advertised.  How many ways could we lose?

This patch inverts the problem... now you can't get the visual with
alpha used by the compositor even if you want it.  I think we need to
invent a new value for EGL_TRANSPARENT_TYPE that apps can use to get
this.  I'm surprised that there isn't already a choice for
EGL_TRANSPARENT_ALPHA.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Tian Ye <yex.tian@intel.com>
Acked-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59783

11 years agost/mesa: remove some conditionals in update_raster_state()
Brian Paul [Tue, 26 Feb 2013 15:20:38 +0000 (08:20 -0700)]
st/mesa: remove some conditionals in update_raster_state()

Just use simple assignments.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g: add missing emit_flush for R600_CONTEXT_FLUSH_AND_INV case
Alex Deucher [Fri, 22 Feb 2013 14:21:30 +0000 (09:21 -0500)]
r600g: add missing emit_flush for R600_CONTEXT_FLUSH_AND_INV case

We set the cp_coher_cntl bits but never emit them.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor600g: synchronize streamout buffers on r6xx too (v3)
Alex Deucher [Thu, 21 Feb 2013 23:43:46 +0000 (18:43 -0500)]
r600g: synchronize streamout buffers on r6xx too (v3)

Streamout buffers need to be synchronized on r6xx as
well.

v2: Add DEST flush as well.
v3: drop DEST flush

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agowinsys/null: fix var typo templet->templat
Brian Paul [Tue, 26 Feb 2013 01:00:09 +0000 (18:00 -0700)]
winsys/null: fix var typo templet->templat

11 years agosvga: fix comment typos
Brian Paul [Sat, 23 Feb 2013 13:59:39 +0000 (06:59 -0700)]
svga: fix comment typos

11 years agor300g: implement 3D transfers
Marek Olšák [Wed, 2 Jan 2013 20:05:02 +0000 (21:05 +0100)]
r300g: implement 3D transfers

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=61351
11 years agogallium/util: add helper util_max_layer from r600g
Marek Olšák [Wed, 2 Jan 2013 19:40:24 +0000 (20:40 +0100)]
gallium/util: add helper util_max_layer from r600g

11 years agollvmpipe: (trivial) get rid of old function prototypes.
Roland Scheidegger [Mon, 25 Feb 2013 19:37:46 +0000 (20:37 +0100)]
llvmpipe: (trivial) get rid of old function prototypes.

llvmpipe_init_screen/context_texture_funcs have long been replaced
with the respective "resource" funcs.

11 years agodraw: make sure pipeline is revalidated when sampler views or samplers change.
Roland Scheidegger [Sat, 23 Feb 2013 00:16:54 +0000 (01:16 +0100)]
draw: make sure pipeline is revalidated when sampler views or samplers change.

Since with llvm execution parts of sampler view and sampler state is baked into
the shader, we need to revalidate otherwise the wrong shader might get used.
(Not completely sure but I think this would not be required for non-llvm case,
along with everything else in these functions.)
This caused bugs in piglit arb_texture_buffer_object-formats, because we never
noticed that the view format changed.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: support GL_ARB_texture_buffer_object/GL_ARB_texture_buffer_range
Roland Scheidegger [Mon, 25 Feb 2013 19:23:18 +0000 (20:23 +0100)]
llvmpipe: support GL_ARB_texture_buffer_object/GL_ARB_texture_buffer_range

This also fixes not honoring first/last_layer view parameters for array
textures, plus not honoring last_level view parameter for all textures
(neither is really used by OpenGL).
This mostly passes piglit arb_texture_buffer_object tests (it needs, however,
glsl 140 version override, plus GL 3.1 override, the latter only because
mesa does not allow ARB_tbo in non-core contexts).
Most arb_texture_buffer_object tests pass, with the exception of
arb_texture_buffer_object-formats. With "arb" parameter it passes most weirdo
formats before it segfaults in the state tracker, this looks to be some issue
with using legacy formats in core context (fails the same in softpipe).
With "core" parameter it passes with "fs", however fails with "vs" (for most
formats). This will be fixed later (debugging shows we're completely missing
the shader recompile depending on format).

v2: based on Jose's feedback, fix comments, variable/function names.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agoi965: Fix the W value of deprecated pointcoords on pre-gen6.
Eric Anholt [Wed, 20 Feb 2013 22:00:47 +0000 (14:00 -0800)]
i965: Fix the W value of deprecated pointcoords on pre-gen6.

When you didn't have a texcoord array bound (or a non-1 current w
attrib), we were telling the fragment shader that it could just use "1"
instead of doing expensive pre-gen6 math to invert it.  If you drew the
point with a non-1 W value, then you'd get the right size (since all the
vertex computations worked), but we'd mis-interpolate the coordinate
across the face.

Fixes the mesa pointsprite demo on GM45.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=30232
Reviewed-and-tested-by: Ian Romanick <ian.d.romanick@intel.com>
Note: This is a candidate for the stable branches.

11 years agomesa/es: NULL check in EGLImageTargetTexture2DOES
Tapani Pälli [Wed, 20 Feb 2013 11:00:08 +0000 (13:00 +0200)]
mesa/es: NULL check in EGLImageTargetTexture2DOES

check that pointer passed is valid and return error if not.

Note: This is a candidate for the stable branches.
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agomesa: add missing case in _mesa_GetTexParameterfv()
Tapani Pälli [Wed, 20 Feb 2013 11:00:07 +0000 (13:00 +0200)]
mesa: add missing case in _mesa_GetTexParameterfv()

missing case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES is required
by OES_EGL_image_external extension.

Note: This is a candidate for the stable branches.
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agodocs: add news item for mesa-demos 8.1.0 release
Andreas Boll [Mon, 25 Feb 2013 10:31:01 +0000 (11:31 +0100)]
docs: add news item for mesa-demos 8.1.0 release

11 years agodocs: import release notes for 9.1, add news item
Andreas Boll [Mon, 25 Feb 2013 09:47:02 +0000 (10:47 +0100)]
docs: import release notes for 9.1, add news item

11 years agoglsl: Remove VS output varyings which are optimized out of the FS
Jordan Justen [Wed, 13 Feb 2013 00:12:31 +0000 (16:12 -0800)]
glsl: Remove VS output varyings which are optimized out of the FS

Previously when an input varying was optimized out of the
FS we would still retain it as an output of the VS.

We now build a hash of live FS input varyings rather
than looking in the FS symbol table. (The FS symbol table
will still contain the optimized out varyings.)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agovl: Fix off-by-one error in device_name_length allocation.
Vinson Lee [Sat, 23 Feb 2013 04:33:54 +0000 (20:33 -0800)]
vl: Fix off-by-one error in device_name_length allocation.

Fixes out-of-bounds write reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel@daenzer.net>
11 years agollvmpipe: Fix creation of shared and scanout textures.
John Kåre Alsaker [Wed, 12 Dec 2012 20:00:58 +0000 (21:00 +0100)]
llvmpipe: Fix creation of shared and scanout textures.

NOTE: This is a candidate for the stable branches.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agoutil/u_blitter: Set pipe_sampler_state::normalized_coords correctly.
José Fonseca [Sat, 23 Feb 2013 13:49:00 +0000 (13:49 +0000)]
util/u_blitter: Set pipe_sampler_state::normalized_coords correctly.

We might want to revisit the normalized_coords semantics, but this is
the current expected behavior.

Fixes fdo bug 61091.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agosvga: remove some extraneous whitespace
Brian Paul [Tue, 5 Feb 2013 00:26:45 +0000 (17:26 -0700)]
svga: remove some extraneous whitespace

11 years agost/mesa: fix debug_printf() format string warning
Brian Paul [Mon, 4 Feb 2013 22:53:07 +0000 (15:53 -0700)]
st/mesa: fix debug_printf() format string warning

Use %td for ptrdiff_t (aka GLsizeiptrARB).

11 years agoutil/dump: Use static assertion to detect string table size mismatches.
José Fonseca [Sat, 23 Feb 2013 10:50:14 +0000 (10:50 +0000)]
util/dump: Use static assertion to detect string table size mismatches.

Suggested by Brian Paul.

Could probably be extended to other enums.

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agost/xvmc/tests: Ensure colorkey is initialized.
Vinson Lee [Fri, 22 Feb 2013 06:00:44 +0000 (22:00 -0800)]
st/xvmc/tests: Ensure colorkey is initialized.

Fixes uninitialized scalar variable defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: Fix memory leak in vlVdpBitmapSurfaceCreate.
Vinson Lee [Fri, 22 Feb 2013 06:15:13 +0000 (22:15 -0800)]
st/vdpau: Fix memory leak in vlVdpBitmapSurfaceCreate.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agost/vdpau: Fix memory leak in vlVdpOutputSurfaceCreate.
Vinson Lee [Fri, 22 Feb 2013 06:13:06 +0000 (22:13 -0800)]
st/vdpau: Fix memory leak in vlVdpOutputSurfaceCreate.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
11 years agoglapi: mark static_dispatch false for DiscardFramebufferEXT
Tapani Pälli [Thu, 21 Feb 2013 07:51:40 +0000 (09:51 +0200)]
glapi: mark static_dispatch false for DiscardFramebufferEXT

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61199
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
Tested-by: Brad King <brad.king@kitware.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
11 years agollvmpipe: rename polygon offset fields to something more specific
Brian Paul [Thu, 21 Feb 2013 15:29:56 +0000 (08:29 -0700)]
llvmpipe: rename polygon offset fields to something more specific

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: add missing checks for polygon offset point/line modes
Brian Paul [Thu, 21 Feb 2013 15:22:10 +0000 (08:22 -0700)]
llvmpipe: add missing checks for polygon offset point/line modes

The llvm pipeline handles regular filled triangle offsets, but it
doesn't handle offsets for triangles drawn in point or line mode.

Fixes failures found with new piglit polygon-mode-offset test.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: fix broken polygon offset stage
Brian Paul [Thu, 21 Feb 2013 15:18:02 +0000 (08:18 -0700)]
draw: fix broken polygon offset stage

There were several issues.  We weren't handling different front/back
polygon fill modes.  We weren't checking whether the offset applied to
fill mode vs. line mode vs. point mode.

Fixes problems found with the Visualization Toolkit (VTK) test suite.

Note: This is a candidate for the stable branches.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agost/mesa: fix polygon offset state translation logic
Brian Paul [Thu, 21 Feb 2013 15:16:16 +0000 (08:16 -0700)]
st/mesa: fix polygon offset state translation logic

The old logic was kind of twisted, but seemed to work in practice.

Note: This is a candidate for the stable branches.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agost/mesa: check for dummy programs in destroy_program_variants()
Brian Paul [Wed, 20 Feb 2013 14:39:04 +0000 (07:39 -0700)]
st/mesa: check for dummy programs in destroy_program_variants()

When we destroy an ARB vp/fp whose ID was gen'd but not otherwise used we
get a pointer to the dummy/placeholder program.  We can't destroy that one
so just skip it.  This only failed during context tear-down because
glDeleteProgramsARB() was already aware of dummy programs.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=38086

Note: This is a candidate for the stable branches.

Tested-by: Andreas Boll <andreas.boll.dev@gmail.com>
11 years agost/mesa: fix trimming of GL_QUAD_STRIP
Brian Paul [Tue, 19 Feb 2013 19:24:32 +0000 (12:24 -0700)]
st/mesa: fix trimming of GL_QUAD_STRIP

We sometimes convert GL_QUAD_STRIP prims into GL_TRIANGLE_STRIP, but
that changes the results of the u_trim_pipe_prim() call.  We need to
pass the original primitive type to the trim function.

Note that OpenGL's GL_x prim type values match Gallium's PIPE_PRIM_x values.

Fixes a failure in the new piglit degenerate-prims test.

Note: This is a candidate for the stable branches.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
11 years agor600g: fixup PS_PARTIAL_FLUSH flag handling for cayman
Alex Deucher [Fri, 22 Feb 2013 23:42:33 +0000 (18:42 -0500)]
r600g: fixup PS_PARTIAL_FLUSH flag handling for cayman

So we don't emit it twice if we ever use the flag on
cayman.

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g: r6xx deadlock workaround (v6)
Alex Deucher [Fri, 22 Feb 2013 22:04:43 +0000 (17:04 -0500)]
r600g: r6xx deadlock workaround (v6)

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=50655
https://bugs.freedesktop.org/show_bug.cgi?id=47116

v2: flush along with workaround.
v3: just need a flush
v4: try WAIT_UNTIL
v5: switch to PS partial flush
v6: rework patch

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agor600g: add PS_PARTIAL_FLUSH flag
Alex Deucher [Fri, 22 Feb 2013 22:02:54 +0000 (17:02 -0500)]
r600g: add PS_PARTIAL_FLUSH flag

PS_PARTIAL flushes seems to be required in certain
cases to prevent hangs, especially on r6xx.

Note: this is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 years agoi965: Enable OpenGL ES 3.0 on Sandy Bridge
Ian Romanick [Fri, 22 Feb 2013 21:55:44 +0000 (13:55 -0800)]
i965: Enable OpenGL ES 3.0 on Sandy Bridge

Regardless of what we put in the screen structure, all of the extensions
that compute_version_es2 checks are present and 3.0 will be exposed
anyway.

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
11 years agoconfigure: Fix build with automake < 1.11
Lauri Kasanen [Fri, 22 Feb 2013 20:25:58 +0000 (22:25 +0200)]
configure: Fix build with automake < 1.11

Commit 86d30dea3c13d29ef8d39bc18db63a0441051975 broke building with older
automake versions with this error:

Makefile:769: *** Recursive variable am__v_YACC_ references itself (eventually).  Stop.

This patch fixes it. Fix stolen from xorg-macros.

Signed-off-by: Lauri Kasanen <cand@gmx.com>
11 years agometa: Allocate texture before initializing texture coordinates
Anuj Phogat [Fri, 15 Feb 2013 19:03:08 +0000 (11:03 -0800)]
meta: Allocate texture before initializing texture coordinates

tex->Sright and tex->Ttop are initialized during texture allocation.
This fixes depth buffer blitting failures in khronos conformance tests
when run on desktop GL 3.0.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=59495

Note: This is a candidate for stable branches.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
11 years agomesa: Fix setup of ctx->Point.PointSprite for GLES2.
Eric Anholt [Wed, 20 Feb 2013 20:58:47 +0000 (12:58 -0800)]
mesa: Fix setup of ctx->Point.PointSprite for GLES2.

The recent change for GL core broke the older setup, which broke
gl_PointCoord on pre-gen6 (where gl_PointCoord is undefined if point
sprites are disabled).  Fixes the new piglit GLES-2.0/glsl-fs-pointcoord
test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32429
Note: This is a candidate for the stable branches.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agoi965/fs: Fix broken math on values loaded from uniform buffers on gen6.
Eric Anholt [Thu, 21 Feb 2013 02:00:47 +0000 (18:00 -0800)]
i965/fs: Fix broken math on values loaded from uniform buffers on gen6.

In a debug build this led to assertion failures, but on a non-debug
build the hardware would just reference the whole vec8 instead of the
same channel 8 times.

Fixes the new piglit glsl-1.40/uniform-buffer/fs-exp2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=57121
Note: This is a candidate for the stable branches
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agotgsi: Improve execution debugging.
José Fonseca [Fri, 22 Feb 2013 15:34:30 +0000 (15:34 +0000)]
tgsi: Improve execution debugging.

- zero temps/outputs instead of copying (otherwise we won't be able to see
  the temps/outputs assignments for small shaders where nothing changes
  across big areas

- also show the inputs (as it's often impossible to infer from the rest)

Reviewed-by: Brian Paul <brianp@vmware.com>
11 years agoutil/u_dump: Update texture target strings.
José Fonseca [Fri, 22 Feb 2013 12:17:30 +0000 (12:17 +0000)]
util/u_dump: Update texture target strings.

11 years agoutil/debug: Always use __builtin_frame_address on gcc.
Sergey Matyukevich [Fri, 22 Feb 2013 11:00:31 +0000 (11:00 +0000)]
util/debug: Always use __builtin_frame_address on gcc.

Should workaround fdo bug 57563.

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agoradeon/llvm: Remove stale comment about radeon_llvm_emit_prepare_cube_coords
Michel Dänzer [Fri, 22 Feb 2013 12:04:32 +0000 (13:04 +0100)]
radeon/llvm: Remove stale comment about radeon_llvm_emit_prepare_cube_coords

11 years agor600g: fix random corruption with CP DMA in TF2
Marek Olšák [Thu, 21 Feb 2013 15:53:32 +0000 (16:53 +0100)]
r600g: fix random corruption with CP DMA in TF2

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Don't pretend there is any R8G8B8 support
Michel Dänzer [Mon, 18 Feb 2013 15:39:28 +0000 (16:39 +0100)]
radeonsi: Don't pretend there is any R8G8B8 support

The hardware can't do it.

11 years agollvmpipe/build: add DLOPEN_LIBS and PTHREAD_LIBS to the lp_test_* targets
Andreas Boll [Thu, 21 Feb 2013 18:31:40 +0000 (19:31 +0100)]
llvmpipe/build: add DLOPEN_LIBS and PTHREAD_LIBS to the lp_test_* targets

Fixes undefined symbols.

NOTE: This is a candidate for the 9.1 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61052
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agotargets/xa-vmwgfx: Force c++ linker to fix undefined symbols
Andreas Boll [Thu, 21 Feb 2013 08:17:56 +0000 (09:17 +0100)]
targets/xa-vmwgfx: Force c++ linker to fix undefined symbols

NOTE: This is a candidate for the 9.1 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61200
Reviewed-by: Matt Turner <mattst88@gmail.com>
11 years agollvmpipe: Fix rendering into PIPE_FORMAT_X8*_UNORM.
Roland Scheidegger [Fri, 22 Feb 2013 08:53:22 +0000 (08:53 +0000)]
llvmpipe: Fix rendering into PIPE_FORMAT_X8*_UNORM.

Mesa state tracker recently started using PIPE_FORMAT_X8B8G8R8_UNORM,
causing segfaults in texture-packed-formats, because swizze[chan] was
0xff for padding channel (X).

Signed-off-by: José Fonseca <jfonseca@vmware.com>
11 years agotrace: Never close stdout/stderr.
José Fonseca [Fri, 22 Feb 2013 08:45:07 +0000 (08:45 +0000)]
trace: Never close stdout/stderr.

This could happen, when a trace screen was destroyed and then recreated.

11 years agotrace: Fix set_constant_buffer dumping.
José Fonseca [Thu, 21 Feb 2013 19:54:55 +0000 (19:54 +0000)]
trace: Fix set_constant_buffer dumping.

We were dumping the trace driver pointer, instead of the pointer from the
underlying pipe driver.

11 years agor600g: Fix memory leak in r600_shader_select.
Vinson Lee [Thu, 21 Feb 2013 07:32:20 +0000 (23:32 -0800)]
r600g: Fix memory leak in r600_shader_select.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reported-by: Michel Dänzer <michel@daenzer.net>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agollvmpipe: simplify buffer allocation logic.
Roland Scheidegger [Thu, 21 Feb 2013 16:13:34 +0000 (17:13 +0100)]
llvmpipe: simplify buffer allocation logic.

Now with buffer formats clarification don't need all that logic any longer.
(Note that it never would have worked in any case, because blockwidth and
blockheight were swapped any allocation with multi-byte format would have
had zero size.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogallium/docs: improve text about resources a bit.
Roland Scheidegger [Thu, 21 Feb 2013 16:08:34 +0000 (17:08 +0100)]
gallium/docs: improve text about resources a bit.

This clarifies some things and gets rid of some old stuff.
The most significant one is probably that buffers cannot have formats
(nearly all drivers completely ignored format and used width0 as byte size
already in any case). There seems to be no use case for "structured" buffers.
(Note while d3d11 has new Structured Buffers, these still aren't associated
with a format, rather a byte stride, which we can't do yet either way.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agodraw: make sure key size is calculated consistently.
Roland Scheidegger [Tue, 19 Feb 2013 18:47:08 +0000 (19:47 +0100)]
draw: make sure key size is calculated consistently.

Some parts calculated key size by using shader information, others by using
the pipe_vertex_element information. Since it is perfectly valid to have more
vertex_elements set than the vertex shader is using those may not be the same,
so we weren't copying over all vertex_element state - this caused the tgsi dump
to assert (iterates over all vertex elements). More importantly in this
situation it would also break vertex texturing completely (since the sampler
state derived from the key is at a different position than expected).
Fix thix by deriving key->nr_vertex_elements from the shader information
instead of the pipe_vertex_element state (unlike dx10, we can't have "holes"
in pipe_vertex_element state, so this should be safe).
(Note that actual llvm shader generation does not use the pipe_vertex_element
state from the key itself in any case (althogh I guess it could) but uses
the one from draw.pt (which should be the same though contains all elements)
instead.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agor300g/compiler: Fix bug in OMOD folding
Tom Stellard [Sun, 10 Feb 2013 05:15:12 +0000 (00:15 -0500)]
r300g/compiler: Fix bug in OMOD folding

The OMOD value was only being folded to one instruction in cases where
the MUL instruction was reading a value written by more than one
instruction.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor300g/tests: Add helper functions for creating a full program
Tom Stellard [Sun, 10 Feb 2013 05:15:11 +0000 (00:15 -0500)]
r300g/tests: Add helper functions for creating a full program

Now you can convert assembly strings into a full struct radeon_compiler
object and use it to test individual compiler pases.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor300g/tests: Exit test runner with a valid status code
Tom Stellard [Sun, 10 Feb 2013 05:15:10 +0000 (00:15 -0500)]
r300g/tests: Exit test runner with a valid status code

This way make check can report whether or not the tests pass.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor300g/complier: Make r300_vertprog_swizzle_caps visible in other files
Tom Stellard [Sun, 10 Feb 2013 05:15:09 +0000 (00:15 -0500)]
r300g/complier: Make r300_vertprog_swizzle_caps visible in other files

This will be used by the test suite in later commits.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor300g/compiler: Fix typo in comment
Tom Stellard [Sun, 10 Feb 2013 05:15:08 +0000 (00:15 -0500)]
r300g/compiler: Fix typo in comment

Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agor300g/compiler: Add missing license headers
Tom Stellard [Sun, 10 Feb 2013 05:15:07 +0000 (00:15 -0500)]
r300g/compiler: Add missing license headers

These are all files that I authored, but forgot to add the license
headers.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agoi965: Avoid segfault in gen6_upload_state
Carl Worth [Wed, 20 Feb 2013 00:27:16 +0000 (16:27 -0800)]
i965: Avoid segfault in gen6_upload_state

This fixes a bug introduced in commit 258453716f001eab1288d99765213 and
triggered whenever "rb" is NULL.

Fixes at least one cause bug #59445:

[SNB/IVB/HSW Bisected]Oglc draw-buffers2(advanced.blending.none) segfault
https://bugs.freedesktop.org/show_bug.cgi?id=59445

(Though segfaults are still possible in that test case, but they have been
present since before commit 258453716f which is what's being fixed here.)

Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agor600g: don't enable ReZ mode on evergreen
Alex Deucher [Wed, 20 Feb 2013 21:11:52 +0000 (16:11 -0500)]
r600g: don't enable ReZ mode on evergreen

Can cause lockups in certain cases when
zfunc/zenable/zwrite change without a flush
in between.

Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=60969
and lockups on Civ4 with wine.

This is a candidate for the 9.1 branch.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
11 years agodocs: import release notes for 9.0.3, add news item
Andreas Boll [Thu, 21 Feb 2013 16:31:42 +0000 (17:31 +0100)]
docs: import release notes for 9.0.3, add news item

11 years agoradeonsi: Don't match TGSI_SEMANTIC_POSITION fs inputs to vs outputs
Michel Dänzer [Wed, 13 Feb 2013 15:07:15 +0000 (16:07 +0100)]
radeonsi: Don't match TGSI_SEMANTIC_POSITION fs inputs to vs outputs

11 years agoradeonsi: Fix w component of TGSI_SEMANTIC_POSITION fragment shader inputs.
Michel Dänzer [Wed, 13 Feb 2013 14:57:23 +0000 (15:57 +0100)]
radeonsi: Fix w component of TGSI_SEMANTIC_POSITION fragment shader inputs.

It's the reciprocal of the register value.

Fixes piglit fragcoord_w and glsl-fs-fragcoord-zw-perspective.

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Fix up and enable flat shading.
Michel Dänzer [Wed, 13 Feb 2013 11:54:13 +0000 (12:54 +0100)]
radeonsi: Fix up and enable flat shading.

Requires corresponding LLVM R600 backend fix to work correctly, but even
without that it doesn't hang anymore.

13 more little piglits.

Depends on LLVM: r175193, r175733

NOTE: This is a candidate for the 9.1 branch.

11 years agoradeonsi: Fix memory leak in si_shader_select.
Vinson Lee [Wed, 20 Feb 2013 07:16:14 +0000 (23:16 -0800)]
radeonsi: Fix memory leak in si_shader_select.

Fixes resource leak defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
11 years agoi965: Consign COORD_REPLACE VS hacks to Pre-Gen6.
Paul Berry [Sat, 16 Feb 2013 13:59:34 +0000 (05:59 -0800)]
i965: Consign COORD_REPLACE VS hacks to Pre-Gen6.

Pre-Gen6, the SF thread requires exact matching between VS output
slots (aka VUE slots) and FS input slots, even when the corresponding
VS output slot is unused due to being overwritten by point coordinate
replacement (glTexEnvi(GL_POINT_SPRITE, GL_COORD_REPLACE, GL_TRUE)).
As a result, we have a special hack in the VS to ensure when any
texture coordinate is subject to point coordinate replacement, it is
always allocated space in the VUE, even if it isn't written to by the
VS.

This hack isn't needed from Gen6 onwards, since SF (Gen7: SBE)
swizzling has the ability to insert the point coordinate into
gl_TexCoord[] without needing a corresponding unused VUE slot.

Note that no modification of SF setup code is required for this
patch--get_attr_override() already does the right thing.  However, we
make a slight comment change to clarify why this works.

In addition to eliminating unnecessary VS recompiles and saving
precious URB space on Gen6+, this will save us the trouble of having
to adjust this hack when we implement geometry shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
11 years agomesa: Don't install glEvalMesh in the beginend dispatch table
Ian Romanick [Tue, 19 Feb 2013 23:23:57 +0000 (15:23 -0800)]
mesa: Don't install glEvalMesh in the beginend dispatch table

NOTE: This is a candidate for the 9.1 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=59740
Reviewed-by: Eric Anholt <eric@anholt.net>
11 years agogallivm: fix indirect src register fetches requiring bitcast
Roland Scheidegger [Tue, 19 Feb 2013 20:28:25 +0000 (21:28 +0100)]
gallivm: fix indirect src register fetches requiring bitcast

For constant and temporary register fetches, the bitcasts weren't done
correctly for the indirect case, leading to crashes due to type mismatches.
Simply do the bitcasts after fetching (much simpler than fixing up the load
pointer for the various cases).

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=61036

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: lp_resource_copy cleanup
Roland Scheidegger [Tue, 19 Feb 2013 20:18:29 +0000 (21:18 +0100)]
llvmpipe: lp_resource_copy cleanup

We don't need to flush resources for each layer, and since we don't actually
care about layer at all in the flush function just drop the parameter.
Also we can use util_copy_box instead of repeated util_copy_rect.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agollvmpipe: fix lp_resource_copy using more than one 3d slice
Roland Scheidegger [Tue, 19 Feb 2013 03:19:07 +0000 (04:19 +0100)]
llvmpipe: fix lp_resource_copy using more than one 3d slice

These used to be illegal a very long time ago, then for some more time
nothing really emitted these so this code path wasn't hit.
Just trivially iterate over box->depth.
(Might be worth refactoring at some point since nowadays all the code
doesn't really do much except for depth textures.)

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=61093

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
11 years agogles2: a stub implementation for GL_EXT_discard_framebuffer
Tapani Pälli [Mon, 18 Feb 2013 07:12:27 +0000 (09:12 +0200)]
gles2: a stub implementation for GL_EXT_discard_framebuffer

This patch implements a stub for GL_EXT_discard_framebuffer with
required checks listed by the extension specification. This extension
is required by GLBenchmark 2.5 when compiled with OpenGL ES 2.0
as the rendering backend.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-and-tested-by: Chad Versace <chad.versace@linux.intel.com>
11 years agor600g/Cayman: Fix blending using destination alpha factor but non-alpha dest
Michel Dänzer [Wed, 20 Feb 2013 12:06:18 +0000 (13:06 +0100)]
r600g/Cayman: Fix blending using destination alpha factor but non-alpha dest

Only compile tested, but should fix at least some piglit fbo-blending tests.

NOTE: This is a candidate for the stable branches.

Reviewed-by: Marek Olšák <maraeo@gmail.com>