mesa.git
9 years agoi965/vec4: check swizzle before discarding a uniform on a 3src operand
Alejandro Piñeiro [Wed, 23 Sep 2015 17:22:17 +0000 (19:22 +0200)]
i965/vec4: check swizzle before discarding a uniform on a 3src operand

Without this commit, copy propagation is discarded if it involves
a uniform with an instruction that has 3 sources. But 3 sourced
instructions can access scalar values.

For example, this is what vec4_visitor::fix_3src_operand() is already
doing:

   if (src.file == UNIFORM && brw_is_single_value_swizzle(src.swizzle))
      return src;

Shader-db results (unfiltered) on NIR:
total instructions in shared programs: 6259650 -> 6241985 (-0.28%)
instructions in affected programs:     812755 -> 795090 (-2.17%)
helped:                                7930
HURT:                                  0

Shader-db results (unfiltered) on IR:
total instructions in shared programs: 6445822 -> 6441788 (-0.06%)
instructions in affected programs:     296630 -> 292596 (-1.36%)
helped:                                2533
HURT:                                  0

v2:
- Updated commit message, using Matt Turner suggestions
- Move the check after we've created the final value, as Jason
  Ekstrand suggested
- Clean up the condition

v3:
- Move the check back to the original place, to keep things
  tidy, as suggested by Jason Ekstrand

v4:
- Fixed missing is_single_value_swizzle() as pointed by Jason Ekstrand

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoandroid: radeonsi: fix sid_tables.h missing LOCAL_MODULE_CLASS
Mauro Rossi [Wed, 23 Sep 2015 20:30:55 +0000 (22:30 +0200)]
android: radeonsi: fix sid_tables.h missing LOCAL_MODULE_CLASS

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
9 years agogallium/radeon: remove the percentage symbol from HUD temperature
Benjamin Bellec [Fri, 4 Sep 2015 18:27:22 +0000 (20:27 +0200)]
gallium/radeon: remove the percentage symbol from HUD temperature

The HUD adds '%' if max == 100.

Signed-off-by: Benjamin Bellec <b.bellec@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
9 years agogallium/u_blitter: handle allocation failures
Marek Olšák [Thu, 10 Sep 2015 16:48:12 +0000 (18:48 +0200)]
gallium/u_blitter: handle allocation failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: handle dummy constant buffer allocation failure
Marek Olšák [Thu, 10 Sep 2015 17:25:14 +0000 (19:25 +0200)]
radeonsi: handle dummy constant buffer allocation failure

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: don't forget to update scratch relocations for LS, HS, ES shaders
Marek Olšák [Thu, 10 Sep 2015 16:42:22 +0000 (18:42 +0200)]
radeonsi: don't forget to update scratch relocations for LS, HS, ES shaders

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: skip drawing if updating the scratch buffer fails
Marek Olšák [Thu, 10 Sep 2015 16:40:51 +0000 (18:40 +0200)]
radeonsi: skip drawing if updating the scratch buffer fails

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: skip drawing if PS fails to compile or upload
Marek Olšák [Thu, 10 Sep 2015 16:33:10 +0000 (18:33 +0200)]
radeonsi: skip drawing if PS fails to compile or upload

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: skip drawing if VS, TCS, TES, GS fail to compile or upload
Marek Olšák [Thu, 10 Sep 2015 16:32:22 +0000 (18:32 +0200)]
radeonsi: skip drawing if VS, TCS, TES, GS fail to compile or upload

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: handle fixed-func TCS shader create failure
Marek Olšák [Thu, 10 Sep 2015 16:31:33 +0000 (18:31 +0200)]
radeonsi: handle fixed-func TCS shader create failure

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: handle shader precompile failures
Marek Olšák [Thu, 10 Sep 2015 16:30:41 +0000 (18:30 +0200)]
radeonsi: handle shader precompile failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: skip drawing if GS ring allocations fail
Marek Olšák [Thu, 10 Sep 2015 16:27:53 +0000 (18:27 +0200)]
radeonsi: skip drawing if GS ring allocations fail

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: skip drawing if the tess factor ring allocation fails
Marek Olšák [Thu, 10 Sep 2015 16:27:53 +0000 (18:27 +0200)]
radeonsi: skip drawing if the tess factor ring allocation fails

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: add malloc fail paths to si_create_shader_state
Marek Olšák [Thu, 10 Sep 2015 16:16:26 +0000 (18:16 +0200)]
radeonsi: add malloc fail paths to si_create_shader_state

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: report alloc failure from si_shader_binary_read
Marek Olšák [Thu, 10 Sep 2015 16:15:40 +0000 (18:15 +0200)]
radeonsi: report alloc failure from si_shader_binary_read

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallium/radeon: add a fail path for depth MSAA texture readback
Marek Olšák [Thu, 10 Sep 2015 16:14:36 +0000 (18:14 +0200)]
gallium/radeon: add a fail path for depth MSAA texture readback

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallium/radeon: handle buffer alloc failures in r600_draw_rectangle
Marek Olšák [Thu, 10 Sep 2015 15:54:41 +0000 (17:54 +0200)]
gallium/radeon: handle buffer alloc failures in r600_draw_rectangle

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallium/radeon: handle buffer_map staging buffer failures better
Marek Olšák [Thu, 10 Sep 2015 15:53:28 +0000 (17:53 +0200)]
gallium/radeon: handle buffer_map staging buffer failures better

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: handle constant buffer alloc failures
Marek Olšák [Thu, 10 Sep 2015 15:42:31 +0000 (17:42 +0200)]
radeonsi: handle constant buffer alloc failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: handle index buffer alloc failures
Marek Olšák [Thu, 10 Sep 2015 15:42:31 +0000 (17:42 +0200)]
radeonsi: handle index buffer alloc failures

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agost/mesa: fix front buffer regression after dropping st_validate_state in Blit
Marek Olšák [Wed, 23 Sep 2015 00:33:24 +0000 (02:33 +0200)]
st/mesa: fix front buffer regression after dropping st_validate_state in Blit

Broken by: d082c5324914212f76e45be497229c7a0681f706
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92072

Cc: 10.6 11.0 <mesa-stable@lists.freedesktop.org>
Tested-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agowayland: Add copyright notice for wayland-egl.c
Kristian Høgsberg Kristensen [Thu, 24 Sep 2015 17:51:10 +0000 (10:51 -0700)]
wayland: Add copyright notice for wayland-egl.c

Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Respect stride and subreg_offset for ATTR registers
Kristian Høgsberg Kristensen [Wed, 23 Sep 2015 23:57:47 +0000 (16:57 -0700)]
i965: Respect stride and subreg_offset for ATTR registers

When we assign hw regs to attributes, we don't incorporate the stride
and subreg_offset from the fs_reg. It's rarely used, but the integer
multiplication lowering uses unusual stride and subreg_offset
combination breaks when one source is an attribute.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91970
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: rework Driver.CopyImageSubData() and related code
Brian Paul [Fri, 28 Aug 2015 06:42:00 +0000 (00:42 -0600)]
mesa: rework Driver.CopyImageSubData() and related code

Previously, core Mesa's _mesa_CopyImageSubData() created temporary textures
to wrap renderbuffer sources/destinations.  This caused a bit of a mess in
the Mesa/gallium state tracker because we had to basically undo that
wrapping.

Instead, change ctx->Driver.CopyImageSubData() to take both gl_renderbuffer
and gl_texture_image src/dst pointers (one being null, the other non-null)
so the driver can handle renderbuffer vs. texture as needed.

For the i965 driver, we basically moved the code that wrapped textures
around renderbuffers from copyimage.c down into the met and driver code.

The old code in copyimage.c also made some questionable calls to
_mesa_BindTexture(), etc. which weren't undone at the end.

v2 (Jason Ekstrand): Rework the intel bits
v3 (Brian Paul): Update the temporary st_CopyImageSubData() function.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Tested-by: Nick Sarnie <commendsarnex@gmail.com>
9 years agost/xa: Fixups for PIPE_FORMAT_R8_UNORM A8 usage v2.
Thomas Hellstrom [Thu, 17 Sep 2015 10:22:53 +0000 (03:22 -0700)]
st/xa: Fixups for PIPE_FORMAT_R8_UNORM A8 usage v2.

Check for PIPE_FORMAT_R8_UNORM when setting up the copy shader.
Also re-enable the dest alpha blending with A8 destination that
actually turned out to be correct.

Verified using rendercheck that the composite operators
overreverse, in, out, atop, atopreverse and xor seem to work fine
with a8 destiation.

v2: Fix a copy-paste error.

Reported-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agost/mesa: keep track of saturated writes when eliminating dead code
Ilia Mirkin [Wed, 23 Sep 2015 04:30:23 +0000 (00:30 -0400)]
st/mesa: keep track of saturated writes when eliminating dead code

It doesn't matter whether a write is saturated or not, in another
implementation it might even have been a separate opcode. This code was
most likely copied from the copy-propagation pass (where one does have
to distinguish saturation).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoglsl: correctly detect inactive UBO arrays
Timothy Arceri [Wed, 23 Sep 2015 01:12:57 +0000 (11:12 +1000)]
glsl: correctly detect inactive UBO arrays

Previously the code was trying to get the packing type from the array not the
interface.

Cc: Ian Romanick <ian.d.romanick@intel.com>
Cc: Antia Puentes <apuentes@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoi965: add ARB_texture_barrier support
Ilia Mirkin [Thu, 13 Aug 2015 19:39:40 +0000 (15:39 -0400)]
i965: add ARB_texture_barrier support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/gs: Fix extra level of indentation left by the previous commit.
Kenneth Graunke [Thu, 3 Sep 2015 08:01:29 +0000 (01:01 -0700)]
i965/gs: Fix extra level of indentation left by the previous commit.

I left a bunch of code indented a level in the previous patch to make
the diff easier to read.  But now we should fix that.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/gs: Use new NIR intrinsics.
Kenneth Graunke [Wed, 5 Aug 2015 16:16:59 +0000 (09:16 -0700)]
i965/gs: Use new NIR intrinsics.

By performing the vertex counting in NIR, we're able to elide a ton of
useless safety checks around every EmitVertex() call:

total instructions in shared programs: 3952 -> 3720 (-5.87%)
instructions in affected programs:     3491 -> 3259 (-6.65%)
helped:                                11
HURT:                                  0

Improves performance in Gl32GSCloth by 0.671742% +/- 0.142202% (n=621)
on Haswell GT3e at 1024x768.

This should also make it easier to implement Broadwell's "Static Vertex
Count" feature someday.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Add new GS intrinsics that maintain a count of emitted vertices.
Kenneth Graunke [Tue, 12 May 2015 08:05:29 +0000 (01:05 -0700)]
nir: Add new GS intrinsics that maintain a count of emitted vertices.

This patch also introduces a lowering pass to convert the simple GS
intrinsics to the new ones.  See the comments above that for the
rationale behind the new intrinsics.

This should be useful for i965; it's a generic enough mechanism that I
could see other drivers potentially using it as well, so I don't feel
too bad about putting it in the generic code.

v2:
- Use nir_after_block_before_jump for the cursor (caught by Jason
  Ekstrand - I'd mistakenly used nir_after_block when rebasing this
  code onto the new NIR control flow API).
- Remove the old emit_vertex intrinsic at the end, rather than in
  the middle (requested by Jason).
- Use state->... directly rather than locals (requested by Jason).
- Report progress from nir_lower_gs_intrinsics() (requested by me).
- Remove "Authors:" section from file comment (requested by
  Michael Schellenberger Costa).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Add unit tests for control flow graphs.
Kenneth Graunke [Mon, 21 Sep 2015 20:21:10 +0000 (13:21 -0700)]
nir: Add unit tests for control flow graphs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
Acked-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/cf: Fix dominance metadata in the dead control flow pass.
Kenneth Graunke [Sat, 19 Sep 2015 11:40:07 +0000 (04:40 -0700)]
nir/cf: Fix dominance metadata in the dead control flow pass.

The NIR control flow modification API churns the block structure,
splitting blocks, stitching them back together, and so on.  Preserving
information about block dominance is hard (and probably not worthwhile).

This patch makes nir_cf_extract() throw away all metadata, like we do
when adding/removing jumps.

We then make the dead control flow pass compute dominance information
right before it uses it.  This is necessary because earlier work by the
pass may have invalidated it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/cf: Fix unlink_block_successors to actually unlink the second one.
Kenneth Graunke [Wed, 2 Sep 2015 05:56:29 +0000 (22:56 -0700)]
nir/cf: Fix unlink_block_successors to actually unlink the second one.

Calling unlink_blocks(block, block->successors[0]) will successfully
unlink the first successor, but then will shift block->successors[1]
down to block->successor[0].  So the successors[1] != NULL check will
always fail.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/cf: Alter block successors before adding a fake link.
Kenneth Graunke [Fri, 18 Sep 2015 20:11:56 +0000 (13:11 -0700)]
nir/cf: Alter block successors before adding a fake link.

Consider the case of "while (...) { break }".  Or in NIR:

        block block_0 (0x7ab640):
        ...
        /* succs: block_1 */
        loop {
                block block_1:
                /* preds: block_0 */
                break
                /* succs: block_2 */
        }
        block block_2:

Calling nir_handle_remove_jump(block_1, nir_jump_break) will remove the break.
Unfortunately, it would mangle the predecessors and successors.

Here, block_2->predecessors->entries == 1, so we would create a fake
link, setting block_1->successors[1] = block_2, and adding block_1 to
block_2's predecessor set.  This is illegal: a block cannot specify the
same successor twice.  In particular, adding the predecessor would have
no effect, as it was already present in the set.

We'd then call unlink_block_successors(), which would delete the fake
link and remove block_1 from block_2's predecessor set.  It would then
delete successors[0], and attempt to remove block_1 from block_2's
predecessor set a second time...except that it wouldn't be present,
triggering an assertion failure.

The fix appears to be simple: simply unlink the block's successors and
recreate them to point at the correct blocks first.  Then, add the fake
link.  In the above example, removing the break would cause block_1 to
have itself as a successor (as it becomes an infinite loop), so adding
the fake link won't cause a duplicate successor.

v2: Add comments (requested by Connor Abbott) and fix commit message.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/cf: Conditionally do block_add_normal_succs() in unlink_jump();
Kenneth Graunke [Wed, 23 Sep 2015 01:04:14 +0000 (18:04 -0700)]
nir/cf: Conditionally do block_add_normal_succs() in unlink_jump();

There is a bug where we mess up predecessors/successors due to the
ordering of unlinking/recreating edges/adding fake edges.  In order to
fix that, I need everything in one routine.

However, calling block_add_normal_succs() isn't safe from
cleanup_cf_node() - it would crash trying to insert phi undefs.
So unfortunately I need to add a parameter.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/cf: Don't break outer-block successors in split_block_beginning().
Kenneth Graunke [Thu, 3 Sep 2015 07:33:50 +0000 (00:33 -0700)]
nir/cf: Don't break outer-block successors in split_block_beginning().

Consider the following NIR:

   block block_0;
   /* succs: block_1 block_2 */
   if (...) {
      block block_1;
      ...
   } else {
      block block_2;
   }

Calling split_block_beginning() on block_1 would break block_0's
successors:  link_block() sets both successors of a block, so calling
link_block(block_0, new_block, NULL) would throw away the second
successor, leaving only /* succ: new_block */.  This is invalid: the
block before an if statement must have two successors.

Changing the call to link_block(pred, new_block, pred->successors[0])
would correctly leave both successors in place, but because unlink_block
may shift successor[1] to successor[0], it may not preserve the original
order.  NIR maintains a convention that successor[0] must point to the
"then" block, while successor[1] points to the "else" block, so we need
to take care to preserve this ordering.

This patch creates a new function that swaps out one successor for
another, preserving the ordering.  It then uses this to fix the issue.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/cf: Make a helper function for removing a predecessor.
Kenneth Graunke [Thu, 3 Sep 2015 07:31:19 +0000 (00:31 -0700)]
nir/cf: Make a helper function for removing a predecessor.

I need to do this in a second place, and I'd rather make a helper
function than cut and paste the code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Validate that a block doesn't have two identical successors.
Kenneth Graunke [Thu, 3 Sep 2015 08:29:38 +0000 (01:29 -0700)]
nir: Validate that a block doesn't have two identical successors.

This is invalid, and causes disasters if we try to unlink successors:
removing the first will work, but removing the second copy will fail
because the block isn't in the successor's predecessor set any longer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/lower_vec_to_movs: Don't emit unneeded movs
Jason Ekstrand [Wed, 23 Sep 2015 04:32:06 +0000 (21:32 -0700)]
nir/lower_vec_to_movs: Don't emit unneeded movs

It's possible that, if a vecN operation is involved in a phi node, that we
could end up moving from a register to itself.  If swizzling is involved,
we need to emit the move but.  However, if there is no swizzling, then the
mov is a no-op and we might as well not bother emitting it.

Shader-db results on Haswell:

   total instructions in shared programs: 6262536 -> 6259558 (-0.05%)
   instructions in affected programs:     184780 -> 181802 (-1.61%)
   helped:                                838
   HURT:                                  0

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/lower_vec_to_movs: Properly handle source modifiers on vecN ops
Jason Ekstrand [Wed, 23 Sep 2015 04:11:23 +0000 (21:11 -0700)]
nir/lower_vec_to_movs: Properly handle source modifiers on vecN ops

I don't know of any piglit tests that are currently broken.  However, there
is nothing stopping a vecN instruction from getting source modifiers and
lower_vec_to_movs is run after we lower to source modifiers.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi915: Make hw_prim[] const
Ville Syrjälä [Mon, 23 Mar 2015 12:47:28 +0000 (14:47 +0200)]
i915: Make hw_prim[] const

The table used to map the GL primitive to the hw primitive never
changes so make it const.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agot_dd_dmatmp: Make the render_tab[]s const
Ville Syrjälä [Mon, 23 Mar 2015 12:47:23 +0000 (14:47 +0200)]
t_dd_dmatmp: Make the render_tab[]s const

These tables hold function pointers and they never change so
make them const.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Remove unused HAVE_TRI_STRIP_1 defines
Ian Romanick [Tue, 15 Sep 2015 00:57:15 +0000 (17:57 -0700)]
mesa: Remove unused HAVE_TRI_STRIP_1 defines

Defined to 0 in a few places, but it's not used anywhere.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Constify dmasz
Ian Romanick [Tue, 15 Sep 2015 00:29:50 +0000 (17:29 -0700)]
t_dd_dmatmp: Constify dmasz

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Silence comparison between signed and unsigned integer expression warnings
Ian Romanick [Tue, 15 Sep 2015 00:26:10 +0000 (17:26 -0700)]
t_dd_dmatmp: Silence comparison between signed and unsigned integer expression warnings

../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'intel_render_line_loop_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                                                        ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'intel_render_poly_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:59: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                                                           ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                                                        ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'radeon_dma_render_line_loop_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                                                        ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'radeon_dma_render_poly_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:59: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                                                           ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                                                        ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Use stdbool.h
Ian Romanick [Tue, 15 Sep 2015 00:12:06 +0000 (17:12 -0700)]
t_dd_dmatmp: Use stdbool.h

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: General indentation and formatting fixes
Ian Romanick [Tue, 15 Sep 2015 00:10:05 +0000 (17:10 -0700)]
t_dd_dmatmp: General indentation and formatting fixes

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_ELTS change
Ian Romanick [Tue, 15 Sep 2015 00:04:33 +0000 (17:04 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_ELTS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Remove HAVE_ELTS support
Ian Romanick [Mon, 14 Sep 2015 23:57:32 +0000 (16:57 -0700)]
t_dd_dmatmp: Remove HAVE_ELTS support

Two drivers use this file, and neither supports ELTs.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_FANS change
Ian Romanick [Mon, 14 Sep 2015 21:35:51 +0000 (14:35 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_FANS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_TRI_FANS
Ian Romanick [Mon, 14 Sep 2015 21:31:09 +0000 (14:31 -0700)]
t_dd_dmatmp: Require HAVE_TRI_FANS

Two drivers use this file, and both support triangle fans.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_STRIPS change
Ian Romanick [Mon, 14 Sep 2015 21:29:31 +0000 (14:29 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_STRIPS change

v2: Fix '- nr' typo noticed by Marius.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
9 years agot_dd_dmatmp: Require HAVE_TRI_STRIPS
Ian Romanick [Mon, 14 Sep 2015 21:23:44 +0000 (14:23 -0700)]
t_dd_dmatmp: Require HAVE_TRI_STRIPS

Two drivers use this file, and both support triangle strips.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_TRIANGLES
Ian Romanick [Mon, 14 Sep 2015 21:19:44 +0000 (14:19 -0700)]
t_dd_dmatmp: Require HAVE_TRIANGLES

Two drivers use this file, and both support triangles.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_LINE_STRIPS change
Ian Romanick [Mon, 14 Sep 2015 21:14:08 +0000 (14:14 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_LINE_STRIPS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_LINE_STRIPS
Ian Romanick [Mon, 14 Sep 2015 21:08:40 +0000 (14:08 -0700)]
t_dd_dmatmp: Require HAVE_LINE_STRIPS

Two drivers use this file, and both support line strips.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_LINES change
Ian Romanick [Mon, 14 Sep 2015 21:51:46 +0000 (14:51 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_LINES change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_LINES
Ian Romanick [Mon, 14 Sep 2015 19:46:21 +0000 (12:46 -0700)]
t_dd_dmatmp: Require HAVE_LINES

Two drivers use this file, and both support lines.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_QUADS change
Ian Romanick [Mon, 14 Sep 2015 19:41:33 +0000 (12:41 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_QUADS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Remove HAVE_QUADS support
Ian Romanick [Mon, 14 Sep 2015 19:38:19 +0000 (12:38 -0700)]
t_dd_dmatmp: Remove HAVE_QUADS support

Two drivers use this file, and neither supports quads.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Remove HAVE_QUAD_STRIPS support
Ian Romanick [Mon, 14 Sep 2015 19:36:33 +0000 (12:36 -0700)]
t_dd_dmatmp: Remove HAVE_QUAD_STRIPS support

Two drivers use this file, and neither supports quad strips.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Use addition instead of subtraction in loop bounds
Ian Romanick [Mon, 14 Sep 2015 18:59:22 +0000 (11:59 -0700)]
t_dd_dmatmp: Use addition instead of subtraction in loop bounds

This is used everywhere else in this file because it avoids problems
when count is zero (due to trimming).

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: Marius Predut <marius.predut@intel.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Pull out common 'count -= count & 3' code
Ian Romanick [Mon, 14 Sep 2015 18:56:20 +0000 (11:56 -0700)]
t_dd_dmatmp: Pull out common 'count -= count & 3' code

This was missing in the HAVE_TRIANGLES path, and that could cause
incorrect rendering.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: Marius Predut <marius.predut@intel.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Use '& 3' instead of '% 4' everywhere
Ian Romanick [Mon, 14 Sep 2015 18:50:28 +0000 (11:50 -0700)]
t_dd_dmatmp: Use '& 3' instead of '% 4' everywhere

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Clean up improper code formatting from previous patch
Ian Romanick [Mon, 14 Sep 2015 18:46:50 +0000 (11:46 -0700)]
t_dd_dmatmp: Clean up improper code formatting from previous patch

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Make "count" actually be the count
Ian Romanick [Mon, 14 Sep 2015 18:37:12 +0000 (11:37 -0700)]
t_dd_dmatmp: Make "count" actually be the count

The value passed in count previously was "vertex after the last vertex
to be processed."  Calling that "count" was misleading and kind of mean.
Looking at the code, many functions immediately do "count-start" to get
back the true count.  That's just silly.

If it is better for the loops to be 'for (j = start; j < (start +
count); j++)', GCC will do that transformation.

NOTE: There is some strange formatting left by this patch.  That was
done to make it more obvious that the before and after code is
equivalent.  These will be fixed in the next patch.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

v2: Fix a remaining (count-start) in render_quad_strip_verts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoi965/vec4: Don't coalesce regs in Gen6 MATH ops if reswizzle/writemask needed
Antia Puentes [Tue, 22 Sep 2015 16:17:45 +0000 (18:17 +0200)]
i965/vec4: Don't coalesce regs in Gen6 MATH ops if reswizzle/writemask needed

Gen6 MATH instructions can not execute in align16 mode, so swizzles or
writemasking are not allowed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92033
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.
Iago Toral Quiroga [Tue, 24 Feb 2015 18:02:56 +0000 (19:02 +0100)]
mesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.

From section 9.2. Binding and Managing Framebuffer Objects:

"Upon successful return from Get*FramebufferAttachmentParameteriv, if
pname is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, then params will contain
one of NONE, FRAMEBUFFER_DEFAULT, TEXTURE, or RENDERBUFFER, identifying
the type of object which contains the attached image."

And then it clarifies further:

"If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
either no framebuffer is bound to target; or the default framebuffer is
bound, attachment is DEPTH or STENCIL, and the number of depth or stencil
bits, respectively, is zero"

Currently, if the default framebuffer is bound, we always return
GL_FRAMEBUFFER_DEFAULT for FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, but
according to the spec, when GL_DEPTH or GL_STENCIL attachments are
the ones being queried, we should return GL_NONE if they don't exist.

Fixes the following dEQP test:
dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_x_size_initial

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: bail out early in _mesa_ShaderSource if no shaderobj
Tapani Pälli [Tue, 22 Sep 2015 11:34:11 +0000 (14:34 +0300)]
glsl: bail out early in _mesa_ShaderSource if no shaderobj

Patch fixes a crash in conformance test that tries out different
invalid arguments for glShaderSource and glGetShaderSource:

   ES2-CTS.gtf.GL.glGetShaderSource.getshadersource_programhandle

This is a regression from commit:
   04e201d0c02cd30ace5c6fe80e9f021ebb733682

Additions in v2 also fix following failing deqp test:
   dEQP-GLES[2|3].functional.negative_api.shader.shader_source

v2: cleanup function, do check earlier (Iago Toral)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Detect and delete useless MOVs.
Matt Turner [Mon, 21 Sep 2015 20:58:19 +0000 (13:58 -0700)]
i965/vec4: Detect and delete useless MOVs.

With NIR:

instructions in affected programs:     111508 -> 109193 (-2.08%)
helped:                                507

Without NIR:

instructions in affected programs:     28763 -> 28474 (-1.00%)
helped:                                186

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoprog_to_nir: Use nir_op_dph
Jason Ekstrand [Tue, 22 Sep 2015 23:57:03 +0000 (16:57 -0700)]
prog_to_nir: Use nir_op_dph

Shader-db results on HSW:

   instructions in affected programs:     72 -> 56 (-22.22%)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_alu_to_scalar: Add support for nir_op_fdph
Jason Ekstrand [Wed, 23 Sep 2015 00:29:49 +0000 (17:29 -0700)]
nir/lower_alu_to_scalar: Add support for nir_op_fdph

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/vec4: Add support for fdph_replicated
Jason Ekstrand [Tue, 22 Sep 2015 23:55:42 +0000 (16:55 -0700)]
i965/vec4: Add support for fdph_replicated

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Add fdph and fdph_replicated opcodes
Jason Ekstrand [Tue, 22 Sep 2015 23:54:27 +0000 (16:54 -0700)]
nir: Add fdph and fdph_replicated opcodes

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_alu_to_scalar: Return after lower_reduction
Jason Ekstrand [Wed, 23 Sep 2015 00:16:59 +0000 (17:16 -0700)]
nir/lower_alu_to_scalar: Return after lower_reduction

We don't use any of the code after the switch anyway.  Since we check for
num_components == 1 and early-return, it doesn't get executed so
everything's ok.  However, it makes it much clearer what's going on if we
simply do an early return.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_alu_to_scalar: Use the builder
Jason Ekstrand [Wed, 23 Sep 2015 00:14:45 +0000 (17:14 -0700)]
nir/lower_alu_to_scalar: Use the builder

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Add defines for tessellation stages
Chris Forbes [Tue, 9 Sep 2014 09:15:09 +0000 (21:15 +1200)]
i965: Add defines for tessellation stages

v2 (Ken):
- Squash together commits for HS, DS, and TE, as well as fixes.
- Add INTEL_MASK variants so we can use SET_FIELD if we want.
- Rename GEN7_HS_INSTANCE_CONTROL to GEN7_HS_INSTANCE_COUNT to match
  the documentation.
- Add some more fields from the PRMs.
- Add Broadwell variants.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agor600g: update num_dw in scissor_enable workaround
Grazvydas Ignotas [Tue, 22 Sep 2015 22:50:31 +0000 (01:50 +0300)]
r600g: update num_dw in scissor_enable workaround

"r600g: apply disable workaround on all scissors" forgot to update
num_dw, fix it.

Fixes: fbb423b433 "r600g: apply disable workaround on all scissors"
Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/vec4: refactor brw_vec4_copy_propagation.
Alejandro Piñeiro [Wed, 16 Sep 2015 15:19:50 +0000 (17:19 +0200)]
i965/vec4: refactor brw_vec4_copy_propagation.

Now it is more similar to brw_fs_copy_propagation, with three
clear stages:

1) Build up the value we are propagating as if it were the source of a
single MOV:
2) Check that we can propagate that value
3) Build the final value

Previously everything was somewhat messed up, making the
implementation on some specific cases, like knowing if you can
propagate from a previous instruction even with type mismatches, even
messier (for example, with the need of maintaining more of one
has_source_modifiers). The refactoring clears stuff, and gives
support to this mentioned use case without doing anything extra
(for example, only one has_source_modifiers is used).

Shader-db results for vec4 programs on Haswell:
total instructions in shared programs: 1683842 -> 1669037 (-0.88%)
instructions in affected programs:     739837 -> 725032 (-2.00%)
helped:                                6237
HURT:                                  0

v2: using 'arg' index to get the from inst was wrong
v3: rebased against last change on the previous patch of the series
v4: don't need to track instructions on struct copy_entry, as we
    only set the source on a direct copy
v5: change the approach for a refactoring
v6: tweaked comments

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agost/mesa: remove st_bind_framebuffer()
Brian Paul [Mon, 21 Sep 2015 15:03:45 +0000 (09:03 -0600)]
st/mesa: remove st_bind_framebuffer()

The function was a no-op and if the ctx->Driver.BindFramebuffer pointer
is null, Mesa won't try to use it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: const-qualify _mesa_is_legal_tex_storage_format ctx param
Brian Paul [Thu, 17 Sep 2015 15:49:07 +0000 (09:49 -0600)]
mesa: const-qualify _mesa_is_legal_tex_storage_format ctx param

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: const-qualify _mesa_base_tex_format() ctx param
Brian Paul [Thu, 17 Sep 2015 15:47:36 +0000 (09:47 -0600)]
mesa: const-qualify _mesa_base_tex_format() ctx param

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: const-qualify buffer_object_subdata_range_good() bufObj parameter
Brian Paul [Thu, 17 Sep 2015 15:45:42 +0000 (09:45 -0600)]
mesa: const-qualify buffer_object_subdata_range_good() bufObj parameter

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: whitespace, comment fixes in texstorage.c
Brian Paul [Thu, 17 Sep 2015 15:45:20 +0000 (09:45 -0600)]
mesa: whitespace, comment fixes in texstorage.c

9 years agomesa/es3.1: Enable GL_ARB_vertex_attrib_binding functionality for GLES 3.1
Marta Lofstedt [Wed, 19 Aug 2015 18:25:24 +0000 (20:25 +0200)]
mesa/es3.1: Enable GL_ARB_vertex_attrib_binding functionality for GLES 3.1

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agomesa/es3.1: Allow query of Vertex bindings for GLES 3.1
Marta Lofstedt [Wed, 19 Aug 2015 18:25:23 +0000 (20:25 +0200)]
mesa/es3.1: Allow query of Vertex bindings for GLES 3.1

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agomesa/es3.1 : Align OpenGL ES 3.1 glBindVertexBuffer error handling with OpenGL Core
Marta Lofstedt [Wed, 19 Aug 2015 18:25:22 +0000 (20:25 +0200)]
mesa/es3.1 : Align OpenGL ES 3.1 glBindVertexBuffer error handling with OpenGL Core

According to OpenGL ES 3.1 specification 10.3.1:
"An INVALID_OPERATION error is generated if buffer is not zero
or a name returned from a previous call to GenBuffers,
or if such a name has since been deleted with DeleteBuffers."
This error check was previously limited to OpenGL Core.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agoi965: fix textureGrad for cubemaps
Tapani Pälli [Mon, 7 Sep 2015 12:08:13 +0000 (15:08 +0300)]
i965: fix textureGrad for cubemaps

Fixes bugs exposed by commit
2b1cdb0eddb73f62e4848d4b64840067f1f70865 in:
   ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_frag

No regressions observed in deqp, CTS or Piglit.

v2: address review feedback from Iago Toral:
   - move rho calculation to else branch
   - optimize dx and dy calculation
   - fix documentation inconsistensies

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91114
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agonir: Report progress from nir_normalize_cubemap_coords().
Kenneth Graunke [Thu, 17 Sep 2015 20:18:41 +0000 (13:18 -0700)]
nir: Report progress from nir_normalize_cubemap_coords().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Add braces around multi-line loop.
Kenneth Graunke [Thu, 17 Sep 2015 20:08:03 +0000 (13:08 -0700)]
nir: Add braces around multi-line loop.

This was correct but not our usual style.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_lower_system_values().
Kenneth Graunke [Thu, 17 Sep 2015 20:00:58 +0000 (13:00 -0700)]
nir: Report progress from nir_lower_system_values().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_split_var_copies().
Kenneth Graunke [Thu, 17 Sep 2015 19:33:36 +0000 (12:33 -0700)]
nir: Report progress from nir_split_var_copies().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_lower_locals_to_regs().
Kenneth Graunke [Thu, 17 Sep 2015 19:29:49 +0000 (12:29 -0700)]
nir: Report progress from nir_lower_locals_to_regs().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_remove_dead_variables().
Kenneth Graunke [Thu, 17 Sep 2015 17:57:14 +0000 (10:57 -0700)]
nir: Report progress from nir_remove_dead_variables().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from lower_vec_to_movs().
Jason Ekstrand [Thu, 10 Sep 2015 00:50:09 +0000 (17:50 -0700)]
nir: Report progress from lower_vec_to_movs().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_lower_globals_vars_to_local().
Kenneth Graunke [Thu, 17 Sep 2015 15:38:10 +0000 (08:38 -0700)]
nir: Report progress from nir_lower_globals_vars_to_local().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965: Clean up GLSL compiler option setup
Jason Ekstrand [Mon, 21 Sep 2015 18:18:23 +0000 (11:18 -0700)]
i965: Clean up GLSL compiler option setup

The only functional change here is that we now set EmitNoIndirectOutput and
EmitNoIndirectTemp for compute shaders.  Compute shaders don't have outputs
per-se and we should have been setting EmitNoIndirectTemp all along.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoconfigure.ac: Add support to enable read-only text segment on x86.
Jeremy Huddleston [Sat, 29 Aug 2015 21:51:45 +0000 (14:51 -0700)]
configure.ac: Add support to enable read-only text segment on x86.

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.gentoo.org/240956
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/skl: Use larger URB size where available.
Ben Widawsky [Thu, 10 Sep 2015 23:59:12 +0000 (16:59 -0700)]
i965/skl: Use larger URB size where available.

All SKL SKUs except the lowest one which has half the L3 size actually have 384K
of URB per slice.

For once, I can explain how this mistake was made and how it was missed in
review...  Historically when we enable a platform and put the production sizes,
you can simply look at the "smallest" SKU and see what its URB size is (and we
assumed it was the 1 slice variant). Since on newer platforms the URB sizes are
scaled automatically by HW, this was sufficient. On SKL, this is a bit different
as the lowest SKU actually has half of the L3 fused off. GT2 is the 1 slice (not
GT1) variant and it has 384K.

There are no Jenkins tests fixed (or regressions) and we don't expect any fixes
here because you can always run with less URB size.

Thanks to Sarah for bringing this to my attention.

Cc: Sarah Sharp <sarah.a.sharp@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>