mesa.git
9 years agoglsl: Allow built-in functions as constant expressions in OpenGL ES 1.00
Ian Romanick [Fri, 9 Oct 2015 21:17:32 +0000 (14:17 -0700)]
glsl: Allow built-in functions as constant expressions in OpenGL ES 1.00

In d4a24745 (August 2012), Paul made functions calls not be constant
expressions in GLSL ES 1.00.  Since this feature was added in desktop
GLSL 1.20, we believed that it was added in GLSL ES 3.00.  That turns
out to be completely wrong.  Built-in functions have always been allowed
as constant expressions in GLSL ES, and the patch adds the (many) spec
quotations to prove it.

While we never previously encountered this, a later patch enforces a GLSL
ES 1.00 rule that global variable initializers must be constant
expressions.  Without this fix, several dEQP tests fail.

Fixes:

    tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.frag
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-function.vert
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.frag
    tests/spec/glsl-es-1.00/compiler/const-initializer/from-sequence-in-function.vert

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.0 10.1 10.2 10.3 10.4 10.5 10.6 11.0" <mesa-stable@lists.freedesktop.org>
Yes, I know we don't maintain stable branches that far back, but that
*is* how far back this bug goes!

9 years agou_vbuf: fix vb slot assignment for translated buffers
Nicolai Hähnle [Sat, 3 Oct 2015 22:44:00 +0000 (00:44 +0200)]
u_vbuf: fix vb slot assignment for translated buffers

Vertex attributes of different categories (constant/per-instance/
per-vertex) go into different buffers for translation, and this is now
properly reflected in the vertex buffers passed to the driver.

Fixes e.g. piglit's point-vertex-id divisor test.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoglsl: include variable name in error messages about initializers
Iago Toral Quiroga [Wed, 7 Oct 2015 07:28:43 +0000 (09:28 +0200)]
glsl: include variable name in error messages about initializers

Also fix style / wrong indentation along the way and make the messages
more uniform.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: shader outputs cannot have initializers
Iago Toral Quiroga [Wed, 7 Oct 2015 07:21:36 +0000 (09:21 +0200)]
glsl: shader outputs cannot have initializers

GLSL Spec 4.20.8, 4.3 Storage Qualifiers:

"Initializers in global declarations may only be used in declarations of
 global variables with no storage qualifier, with a const qualifier or
 with a uniform qualifier."

We do this for input variables, but not for output variables. AMD and NVIDIA
proprietary drivers don't allow this either.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Fix unsafe pointer when dumping VS/FS IR
Iago Toral Quiroga [Fri, 9 Oct 2015 05:57:19 +0000 (07:57 +0200)]
i965: Fix unsafe pointer when dumping VS/FS IR

For the VS and FS stages that use ARB_vertex_program or
ARB_fragment_program we don't have a shader program, however,
when debuging is enabled, we call brw_dump_ir like this:

brw_dump_ir("vertex", prog, &vs->base, &vp->program.Base);

where vs will be NULL (since prog is NULL).

As pointed out by Chris, this &vs->base is not really a dereference,
it simply computes a new address that just happens to be 0x0 because
the offset of base in brw_shader is 0. Then brw_dump_ir will see a
NULL pointer and not do anything. This is why this does not crash at
the moment. However, this does not look very safe (it would crash
for any location of base that is not the first in brw_shader), so
patch it to prevent a potential (even if unlikely) problem in the
future.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agomesa/uniforms: fix get_uniform for doubles (v2)
Dave Airlie [Wed, 30 Sep 2015 07:48:38 +0000 (17:48 +1000)]
mesa/uniforms: fix get_uniform for doubles (v2)

The initial glGetUniformdv support didn't cover all the
casting cases that are apparantly legal, and cts seems to
test for them.

I've updated the piglit test to cover these cases now.

v2: fix indentation - it's all broken in this file (Ilia)
fix src/dst index tracking in light of fp64 support (Ilia)

cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoilo: improve Gen8 defines based on its PRMs
Chia-I Wu [Thu, 8 Oct 2015 08:51:50 +0000 (16:51 +0800)]
ilo: improve Gen8 defines based on its PRMs

9 years agoi965/vec4: Implement b2f and b2i using negation.
Matt Turner [Fri, 9 Oct 2015 19:27:04 +0000 (12:27 -0700)]
i965/vec4: Implement b2f and b2i using negation.

Curro added this in commit 3ee2daf23d (before the vec4/NIR backend was
added) but it was missed in the new NIR backend. Add it there as well.

instructions in affected programs:     1857 -> 1810 (-2.53%)
helped:                                15

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agonv50,nvc0: don't base decisions on available pushbuf space
Ilia Mirkin [Sat, 10 Oct 2015 08:29:39 +0000 (04:29 -0400)]
nv50,nvc0: don't base decisions on available pushbuf space

We still have to push everything out, might as well kick earlier and
flip pushbufs when we know we'll need it. This resolves some issues with
the new policy of making sure that we always leave a bit of room at the
end for fences.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 47d11990b (nouveau: make sure there's always room to emit a fence)
Cc: mesa-stable@lists.freedesktop.org
9 years agonouveau: avoid emitting new fences unnecessarily
Ilia Mirkin [Sat, 10 Oct 2015 05:56:09 +0000 (01:56 -0400)]
nouveau: avoid emitting new fences unnecessarily

Right now we emit on every kick, but this is only necessary if something
will ever be able to observe that the fence completed. If there are no
refs, leave the fence alone and emit it another day.

This also happens to work around an issue for the kick handler -- a kick
can be a result of e.g. nouveau_bo_wait or explicit kick, or it can be
due to lack of space in the pushbuf. We want the emit to happen in the
current batch, so we want there to always be enough space. However an
explicit kick could take the reserved space for the implicitly-triggered
kick's fence emission if it happened right after. With the new mechanism,
hopefully there's no way to cause two fences to be emitted into the same
reserved space.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 47d11990b (nouveau: make sure there's always room to emit a fence)
Cc: mesa-stable@lists.freedesktop.org
9 years agonvc0: make use of NVC0_COMPUTE_CLASS for GF110
Samuel Pitoiset [Sat, 10 Oct 2015 19:59:27 +0000 (21:59 +0200)]
nvc0: make use of NVC0_COMPUTE_CLASS for GF110

In theory, GF110+ should also support NVC8_COMPUTE_CLASS but, in practice,
a ILLEGAL_CLASS dmesg fail appears when using it.

This fixes compute support and MP performance counters on GF110.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi965/gs: Make MAX_GS_INPUT_VERTICES a #define in brw_context.h.
Kenneth Graunke [Thu, 12 Mar 2015 12:26:40 +0000 (05:26 -0700)]
i965/gs: Make MAX_GS_INPUT_VERTICES a #define in brw_context.h.

For scalar VS, I'll need this in brw_fs.cpp as well.  It seems silly to
redeclare it in three places.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vs: Map scalar VS input locations properly; avoid tons of MOVs.
Kenneth Graunke [Fri, 14 Aug 2015 22:15:11 +0000 (15:15 -0700)]
i965/vs: Map scalar VS input locations properly; avoid tons of MOVs.

Previously, we used nir_lower_io with the scalar type_size function,
which mapped VERT_ATTRIB_* locations to...some numbers.  Then, in
fs_visitor::nir_setup_inputs(), we created temporaries indexed by
those numbers, and emitted MOVs from the actual ATTR registers to
those temporaries.  Virtually all of these were copy propagated away,
but it's still ugly.

This patch reworks our input lowering to produce NIR lower_input
intrinsics that properly index into the ATTR file, so we can access
it directly.

No changes in shader-db.

v2: Fix unreachable() message (Ken), update commit message (Matt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vs: Fix a subtlety in the nr_attributes == 0 workaround.
Kenneth Graunke [Wed, 26 Aug 2015 00:09:40 +0000 (17:09 -0700)]
i965/vs: Fix a subtlety in the nr_attributes == 0 workaround.

nr_attributes is used to compute first_non_payload_grf, which is the
first register we're allowed to use for ordinary register allocation.

The hardware requires us to read at least one pair of values, but we're
completely free to overwrite that garbage register with whatever we like.

Instead of altering nr_attributes, we should alter urb_read_length, which
only affects the amount we ask the VF to read.  This should save us a
register in trivial cases (which admittedly isn't very useful).

While we're at it, improve the explanation in the comments.

v2: Actually do what I said (caught by Ilia).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vs: Unify URB entry size/read length calculations between backends.
Kenneth Graunke [Tue, 25 Aug 2015 23:59:12 +0000 (16:59 -0700)]
i965/vs: Unify URB entry size/read length calculations between backends.

Both the vec4 and scalar VS backends had virtually identical URB entry
size and read length calculations.  We can move those up a level to
backend-agnostic code and reuse it for both.

Unfortunately, the backends need to know nr_attributes to compute
first_non_payload_grf, so I had to store that in prog_data.  We could
use urb_read_length, but that's nr_attributes rounded up to a multiple
of two, so doing so would waste a register in some cases.

There's more code to be removed in the vec4 backend, but that will
come in a follow-on patch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/cfg: Fix cfg_t::dump() when a block has no immediate dominator.
Kenneth Graunke [Mon, 5 Oct 2015 23:21:10 +0000 (16:21 -0700)]
i965/cfg: Fix cfg_t::dump() when a block has no immediate dominator.

Switch statements introduce a bogus loop with an unconditional break at
the end of the loop, just before the while...so the while is unreachable
and has no immediate dominator.

v2: With less exuberance

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agodocs: add news item and link release notes for 11.0.3
Emil Velikov [Sat, 10 Oct 2015 16:09:00 +0000 (17:09 +0100)]
docs: add news item and link release notes for 11.0.3

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
9 years agodocs: add sha256 checksums for 11.0.3
Emil Velikov [Sat, 10 Oct 2015 16:02:43 +0000 (17:02 +0100)]
docs: add sha256 checksums for 11.0.3

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit b4bfea0094d0037b1f66f3437e44e333f2f0c3f6)

9 years agodocs: add release notes for 11.0.3
Emil Velikov [Sat, 10 Oct 2015 15:21:58 +0000 (16:21 +0100)]
docs: add release notes for 11.0.3

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
(cherry picked from commit 914966befcd57764941405707d8f57d3e7e7f768)

9 years agoi965/gen8: Remove gen<8 checks in gen8 code
Chad Versace [Thu, 8 Oct 2015 19:21:19 +0000 (12:21 -0700)]
i965/gen8: Remove gen<8 checks in gen8 code

Some assertions in gen8_surface_state.c checked for gen < 8.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoi965/gen9: Enable rep clears on gen9
Chad Versace [Thu, 8 Oct 2015 19:06:24 +0000 (12:06 -0700)]
i965/gen9: Enable rep clears on gen9

The (gen < 9) check in brw_clear() was too broad. It disabled all types
of fast color clears:
    a. singlesample rep clears
    b. singlesample MCS fast clears
    c. multisample MCS fast clears

The MCS clears are still buggy, but the rep clear works well. So let's
enable it.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agoi965/gen9: Disable MCS for 1x color surfaces
Chad Versace [Thu, 8 Oct 2015 18:53:08 +0000 (11:53 -0700)]
i965/gen9: Disable MCS for 1x color surfaces

Fast color clears are disabled for gen9 (see the checks in
brw_meta_fast_clear), so there is no reason to allocate the MCS and
track its clear/resolve state.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agotgsi: (trivial) kill c99-ism.
Roland Scheidegger [Fri, 9 Oct 2015 21:12:14 +0000 (23:12 +0200)]
tgsi: (trivial) kill c99-ism.

9 years agoprogram: remove _mesa_init_*_program wrappers
Marek Olšák [Mon, 5 Oct 2015 20:13:34 +0000 (22:13 +0200)]
program: remove _mesa_init_*_program wrappers

They didn't do anything useful.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoprogram: remove other unused functions
Marek Olšák [Mon, 5 Oct 2015 19:42:42 +0000 (21:42 +0200)]
program: remove other unused functions

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoprogram: remove unused cloning and combining functions
Marek Olšák [Mon, 5 Oct 2015 19:41:03 +0000 (21:41 +0200)]
program: remove unused cloning and combining functions

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoprogram: remove unused function _mesa_find_line_column
Marek Olšák [Mon, 5 Oct 2015 19:39:17 +0000 (21:39 +0200)]
program: remove unused function _mesa_find_line_column

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: release the glsl_to_tgsi visitor after translation
Marek Olšák [Mon, 5 Oct 2015 20:46:44 +0000 (22:46 +0200)]
st/mesa: release the glsl_to_tgsi visitor after translation

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: translate tessellation shaders into TGSI when we get them
Marek Olšák [Mon, 5 Oct 2015 01:47:44 +0000 (03:47 +0200)]
st/mesa: translate tessellation shaders into TGSI when we get them

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: translate geometry shaders into TGSI when we get them
Marek Olšák [Mon, 5 Oct 2015 01:26:48 +0000 (03:26 +0200)]
st/mesa: translate geometry shaders into TGSI when we get them

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: translate fragment shaders into TGSI when we get them
Marek Olšák [Mon, 5 Oct 2015 01:26:48 +0000 (03:26 +0200)]
st/mesa: translate fragment shaders into TGSI when we get them

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: translate vertex shaders into TGSI when we get them
Marek Olšák [Mon, 5 Oct 2015 00:47:37 +0000 (02:47 +0200)]
st/mesa: translate vertex shaders into TGSI when we get them

The translate functions is split into two:
- translation to TGSI
- creating the variant (TGSI transformations only)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: fix glDrawPixels with a texture
Marek Olšák [Sun, 4 Oct 2015 23:22:20 +0000 (01:22 +0200)]
st/mesa: fix glDrawPixels with a texture

The samplers for DrawPixels data and the pixel map are assigned to slots
which don't overlap with the existing sampler slots.

The texture coordinates for the user texture are uploaded as a constant.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: implement DrawPixels shader transformation using tgsi_transform_shader
Marek Olšák [Sun, 4 Oct 2015 00:38:55 +0000 (02:38 +0200)]
st/mesa: implement DrawPixels shader transformation using tgsi_transform_shader

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: make Z/S drawpix shaders independent of variants, don't use Mesa IR v2
Marek Olšák [Sun, 4 Oct 2015 16:23:33 +0000 (18:23 +0200)]
st/mesa: make Z/S drawpix shaders independent of variants, don't use Mesa IR v2

- there is no connection to user fragment shaders, so having these as
  shader variants makes no sense
- don't use Mesa IR, use TGSI
- don't create gl_fragment_program, just create the shader CSO

v2: generate exactly the same shader as before to fix llvmpipe

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: implement glBitmap shader transformation using tgsi_transform_shader
Marek Olšák [Sun, 4 Oct 2015 00:38:55 +0000 (02:38 +0200)]
st/mesa: implement glBitmap shader transformation using tgsi_transform_shader

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: remove old emulation for VS and FS variants
Marek Olšák [Sat, 3 Oct 2015 23:01:16 +0000 (01:01 +0200)]
st/mesa: remove old emulation for VS and FS variants

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: use TGSI utility to emulate features for FS variants
Marek Olšák [Sat, 3 Oct 2015 22:33:11 +0000 (00:33 +0200)]
st/mesa: use TGSI utility to emulate features for FS variants

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: use TGSI utility to emulate features for VS variants
Marek Olšák [Sat, 3 Oct 2015 22:33:11 +0000 (00:33 +0200)]
st/mesa: use TGSI utility to emulate features for VS variants

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: decrease the size of st_vertex_program
Marek Olšák [Sat, 3 Oct 2015 20:44:30 +0000 (22:44 +0200)]
st/mesa: decrease the size of st_vertex_program

The other variables can't be moved.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: inline st_prepare_vertex_program
Marek Olšák [Sat, 3 Oct 2015 20:35:22 +0000 (22:35 +0200)]
st/mesa: inline st_prepare_vertex_program

No other shader stage has a "prepare" function.
This will allow removing some variables from st_vertex_program.

Also, prepare_fragment_program was a dead prototype.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agotgsi/scan: add info about declared samplers (v2)
Marek Olšák [Sun, 4 Oct 2015 22:08:30 +0000 (00:08 +0200)]
tgsi/scan: add info about declared samplers (v2)

v2: get it from declarations, not instructions

9 years agotgsi: add a utility for emulating some GL features
Marek Olšák [Sat, 3 Oct 2015 22:02:31 +0000 (00:02 +0200)]
tgsi: add a utility for emulating some GL features

st/mesa will use this, but drivers can use it too.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agomesa: call ProgramStringNotify for fixed-function vertex programs
Marek Olšák [Mon, 5 Oct 2015 01:02:42 +0000 (03:02 +0200)]
mesa: call ProgramStringNotify for fixed-function vertex programs

Drivers weren't notified about this at all.
This allows disabling on-demand compilation in drivers.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com>
9 years agoglsl: move shader_enums into nir
Rob Clark [Thu, 8 Oct 2015 22:19:00 +0000 (18:19 -0400)]
glsl: move shader_enums into nir

First step towards inverting the dependency between glsl and nir (so nir
can be used without glsl).  Also solves this issue with 'make distclean'

  Making distclean in mesa
  make[2]: Entering directory '/mnt/sdb1/Src64/Mesa-git/mesa/src/mesa'
  Makefile:2486: ../glsl/.deps/shader_enums.Plo: No such file or directory
  make[2]: *** No rule to make target '../glsl/.deps/shader_enums.Plo'. Stop.
  make[2]: Leaving directory '/mnt/sdb1/Src64/Mesa-git/mesa/src/mesa'
  Makefile:684: recipe for target 'distclean-recursive' failed
  make[1]: *** [distclean-recursive] Error 1
  make[1]: Leaving directory '/mnt/sdb1/Src64/Mesa-git/mesa/src'
  Makefile:615: recipe for target 'distclean-recursive' failed
  make: *** [distclean-recursive] Error 1

Reported-by: Andy Furniss <adf.lists@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agomesa: Get rid of texture-dependent image unit derived state.
Francisco Jerez [Sat, 29 Aug 2015 14:03:08 +0000 (17:03 +0300)]
mesa: Get rid of texture-dependent image unit derived state.

The point is to avoid having to re-validate all image units when
_NEW_TEXTURE is flagged, which can be expensive if the driver exposes
a large number of image units.  This has been reported to fix a 36%
performance regression in the Synmark2 Multithread benchmark on the
i965 driver which exposes 192 image units.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91788
Reported-by: Wendy Wang <wendy.wang@intel.com>
Tested-by: Ye Tian <yex.tian@intel.com>
CC: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Use _mesa_is_image_unit_valid() instead of gl_image_unit::_Valid.
Francisco Jerez [Sat, 29 Aug 2015 14:01:11 +0000 (17:01 +0300)]
i965: Use _mesa_is_image_unit_valid() instead of gl_image_unit::_Valid.

gl_image_unit::_Valid will be removed in a future commit.

Tested-by: Ye Tian <yex.tian@intel.com>
CC: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Skip redundant texture completeness checking during image validation.
Francisco Jerez [Thu, 3 Sep 2015 13:12:59 +0000 (16:12 +0300)]
mesa: Skip redundant texture completeness checking during image validation.

The call to _mesa_test_texobj_completeness() is unnecessary if the
texture is already known to be complete.  If the texture object is
dirtied in the meantime _BaseComplete and _MipmapComplete will be
reset to false.  _mesa_is_image_unit_valid() will start to be called
more frequently in a future commit, so it seems desirable to avoid the
unnecessary work.

Tested-by: Ye Tian <yex.tian@intel.com>
CC: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Expose function to calculate whether a shader image unit is valid.
Francisco Jerez [Sat, 29 Aug 2015 13:34:50 +0000 (16:34 +0300)]
mesa: Expose function to calculate whether a shader image unit is valid.

A future commit will remove all texture object-dependent derived state
from the image unit struct to make validation unnecessary on texture
state changes.  Instead of checking gl_image_unit::_Valid drivers will
be required to call this function when needed to find out whether an
image unit is in a valid state and whether access from the shader is
allowed.

Tested-by: Ye Tian <yex.tian@intel.com>
CC: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Don't tell the hardware about our UAV access.
Francisco Jerez [Thu, 13 Aug 2015 12:02:05 +0000 (15:02 +0300)]
i965: Don't tell the hardware about our UAV access.

The hardware documentation relating to the UAV HW-assisted coherency
mechanism and UAV access enable bits is scarce and sometimes
contradictory, and there's quite some guesswork behind this commit, so
let me summarize the background first: HSW and later hardware have
infrastructure to support a stricter form of data coherency between
shader invocations from separate primitives.  The mechanism is
controlled by the "Accesses UAV" bits on 3DSTATE_VS, _HS, _DS, _GS and
_PS (or _PS_EXTRA on BDW+), and the "UAV Coherency Required" bit on
the 3DPRIMITIVE command.

Regardless of whether "UAV Coherency Required" is set, the hardware
fixed-function units will increment a per-stage semaphore for each
request received if "Accesses UAV" is set for the same or any lower
stage.  An implicit DC flush is emitted by the lowermost stage with
"Accesses UAV" set once it's done processing the request, this also
happens regardless of the value of "UAV Coherency Required".  The
completion of the DC flush will cause the same stage and all previous
ones to decrement the semaphore, marking the UAV accesses for the
primitive as coherent with L3.

The "UAV Coherency Required" 3DPRIMITIVE bit will cause a pipeline
stall before any threads are dispatched for the first FF stage with
"Accesses UAV" set until the semaphore is cleared for the same stage.
Effectively this guarantees that UAV memory accesses performed by
previous primitives from any stage will be strictly ordered (and
thanks to the implicit DC flush visible in memory) with UAV accesses
from the following primitives.

None of this is required by the usual image, atomic counter and SSBO
GL APIs which have very relaxed cross-primitive coherency and ordering
requirements, so we don't actually ever set the "UAV Coherency
Required" bit -- Ordering with respect to shader invocations from
previous stages on the same primitive where there is a data dependency
is of course already guaranteed as the spec requires, regardless of
this mechanism being enabled.  We do set the "Accesses UAV" bits
though since my commit ac7664e493655e290783c23a0412b9c70936da50 (which
this patch partially reverts), mainly because of comments like the
following from the BDW PRM:

> 3DSTATE_GS
>[...]
> 12 Accesses UAV
>    Format: Enable
>    This field must be set when GS has a UAV access.

There are similar comments in the documentation for the other
3DSTATE_*S commands.  The "must" part is misleading and unjustified
AFAIK.  Most of the "Accesses UAV" bits don't seem to have any side
effects other than the implicit DC flushes and the related
book-keeping in anticipation for a subsequent primitive with "UAV
Coherency Required" set, so in most cases they are unnecessary and may
incur a performance penalty.  There is an exception though.  On Gen8+
the PS_EXTRA UAV access bit influences the calculation of the PS
UAV-only and ThreadDispatchEnable signals which on previous
generations were set explicitly by the driver, so we cannot always
avoid enabling it on the PS stage.

The primary motivation for this change is that in fact the hardware
coherency mechanism is buggy and will cause a rather non-deterministic
hang on Gen8 when VS is the only stage with "Accesses UAV" set and the
processing of a request terminates immediately after the implicit DC
flush is sent for a previous primitive with no additional vertices
being emitted for the second primitive, what will cause the hardware
to skip sending a second DC flush and cause the VS to stall
indefinitely waiting for a response from the DC (BDWGFX HSD 1912017).
This hardware bug can be reproduced on current master with the
spec@arb_shader_image_load_store@host-mem-barrier@Indirect/RaW piglit
subtest (if you have the patience to run it a few dozen times).

The proposed workaround is to insert CS STALLs speculatively between
3DPRIMITIVE commands when "Accesses UAV" is enabled for the VS stage
only.  Because this would affect one of the hottest paths in the
driver and likely decrease performance even further due to the
unnecessary serialization, and because we don't actually need the
implicit DC flushes, it seems better to just disable them.

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
9 years agonir/instr_set: remove unnecessary check in nir_instrs_equal()
Connor Abbott [Thu, 24 Sep 2015 06:18:07 +0000 (02:18 -0400)]
nir/instr_set: remove unnecessary check in nir_instrs_equal()

This was originally added to nir_instrs_equal() instead of
nir_instr_can_cse() incorrectly, but this was fixed when moving to the
instruction set API (as it had to be, otherwise hashing wouldn't work).
Now, this is dead code since instr_can_rewrite() will only return true
for texture instructions that use an index, so we can turn the check into
an assert. This also means that now nir_instrs_equal(instr, instr) will
always return true unless it assert-fails.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: make nir_instrs_equal() static
Connor Abbott [Thu, 24 Sep 2015 06:10:13 +0000 (02:10 -0400)]
nir: make nir_instrs_equal() static

This was previously tied to CSE, since it would only work for
instructions where nir_can_cse() (now instr_can_rewrite()) returned
true. Now that CSE uses the instruction set abstraction which only uses
this internally, we can make it local to nir_instr_set.c.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir/cse: use the instruction set API
Connor Abbott [Fri, 22 May 2015 04:41:45 +0000 (00:41 -0400)]
nir/cse: use the instruction set API

This replaces an O(n^2) algorithm with an O(n) one, while allowing us to
import most of the infrastructure required for GVN. The idea is to walk
the dominance tree depth-first, similar when converting to SSA, and
remove the instructions from the set when we're done visiting the
sub-tree of the dominance tree so that the only instructions in the set
are the instructions that dominate the current block.

No piglit regressions. No shader-db changes.

Compilation time for full shader-db:

Difference at 95.0% confidence
        -35.826 +/- 2.16018
        -6.2852% +/- 0.378975%
        (Student's t, pooled s = 3.37504)

v2:
- rebase on start_block removal
- remove useless state struct
- change commit message

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: add an instruction set API
Connor Abbott [Thu, 24 Sep 2015 05:57:04 +0000 (01:57 -0400)]
nir: add an instruction set API

This will replace direct usage of nir_instrs_equal() in the CSE pass,
which reduces an O(n^2) algorithm with an effectively O(n) one. It'll
also be useful for implementing GVN on top of GCM.

v2:
- Add texture support.
- Add more comments.
- Rename instr_can_hash() to instr_can_rewrite() since it's really more
about whether its uses can be rewritten, and it's implicitly used by
nir_instrs_equal() as well.
- Rename nir_instr_set_add() to nir_instr_set_add_or_rewrite() (Jason).
- Make the HASH() macro less magical (Topi).
- Rewrite the commit message.

v3:
- For sorting phi sources, use a VLA, store pointers to the sources, and
compare the predecessor pointer directly (Jason).

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: constify instruction comparison functions
Connor Abbott [Thu, 24 Sep 2015 05:05:15 +0000 (01:05 -0400)]
nir: constify instruction comparison functions

v2: rebase, don't constify nir_srcs_equal() as it's pass-by-value
anyways

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: constify nir_ssa_alu_instr_src_components()
Connor Abbott [Tue, 17 Mar 2015 05:03:28 +0000 (01:03 -0400)]
nir: constify nir_ssa_alu_instr_src_components()

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: split out instruction comparison functions
Connor Abbott [Thu, 24 Sep 2015 04:54:52 +0000 (00:54 -0400)]
nir: split out instruction comparison functions

Right now nir_instrs_equal() is tied pretty tightly to CSE, but we're
going to introduce the idea of an instruction set and tie it to that
instead.  In anticipation of that, move this into its own file where
we'll add the rest of the instruction set implementation later.

v2: Rebase on texture support.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoi965/fs: Handle non-const sample number in interpolateAtSample
Neil Roberts [Fri, 17 Jul 2015 13:40:03 +0000 (14:40 +0100)]
i965/fs: Handle non-const sample number in interpolateAtSample

If a non-const sample number is given to interpolateAtSample it will
now generate an indirect send message with the sample ID similar to
how non-const sampler array indexing works. Previously non-const
values were ignored and instead it ended up using a constant 0 value.

The generator will try to determine if the sample ID is dynamically
uniform via nir_src_is_dynamically_uniform. If not it will query the
pixel interpolator in a loop, once for each different live sample
number. The next live sample number is found using emit_uniformize. If
multiple live channels have the same sample number then they will be
handled in a single iteration of the loop. The loop is necessary
because the indirect send message doesn't seem to have a way to
specify a different value for each fragment.

This fixes the following two Piglit tests:

arb_gpu_shader5-interpolateAtSample-nonconst
arb_gpu_shader5-interpolateAtSample-dynamically-nonuniform

v2: Handle dynamically non-uniform sample ids.
v3: Remove the BREAK instruction and predicate the WHILE directly.
    Make the tokens arrays const. (Matt Turner)
v4: Iterate over the live channels instead of each possible sample
    number.
v5: Don't special case immediate values in
    brw_pixel_interpolator_query. Make a better wrapper for the
    function to set up the PI send instruction. Ensure that the SHL
    instructions are scalar. (Francisco Jerez).

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965: Add a second successor to BRW_OPCODE_WHILE
Neil Roberts [Mon, 5 Oct 2015 11:50:56 +0000 (13:50 +0200)]
i965: Add a second successor to BRW_OPCODE_WHILE

It is possible to directly predicate the WHILE instruction. In this
case there will be a second successor block because the execution can
resume from the instruction after the loop. This will be used in a
subsequent patch.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Add a function to determine if a source is dynamically uniform
Neil Roberts [Thu, 30 Jul 2015 11:10:08 +0000 (12:10 +0100)]
nir: Add a function to determine if a source is dynamically uniform

Adds nir_src_is_dynamically_uniform which returns true if the source
is known to be dynamically uniform. This will be used in a later patch
to add a workaround for cases that only work with dynamically uniform
sources. Note that the function is not definitive, it can return false
negatives (but not false positives). Currently it only detects
constants and uniform accesses. It could easily be extended to include
more cases.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonvc0: move HW SM queries to nvc0_query_hw_sm.c/h files
Samuel Pitoiset [Sun, 4 Oct 2015 21:43:20 +0000 (23:43 +0200)]
nvc0: move HW SM queries to nvc0_query_hw_sm.c/h files

Global performance counters (PCOUNTER) will be added to
nvc0_query_hw_pm.c/h files.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
9 years agonvc0: move HW queries to nvc0_query_hw.c/h files
Samuel Pitoiset [Sun, 4 Oct 2015 16:28:55 +0000 (18:28 +0200)]
nvc0: move HW queries to nvc0_query_hw.c/h files

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
9 years agonvc0: move SW queries to nvc0_query_sw.c/h files
Samuel Pitoiset [Sun, 4 Oct 2015 14:01:51 +0000 (16:01 +0200)]
nvc0: move SW queries to nvc0_query_sw.c/h files

Loosely based on freedreno driver.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
9 years agonvc0: move nvc0_so_target_save_offset() to its correct location
Samuel Pitoiset [Sun, 4 Oct 2015 15:43:15 +0000 (17:43 +0200)]
nvc0: move nvc0_so_target_save_offset() to its correct location

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
9 years agonvc0: add a header file for nvc0_query
Samuel Pitoiset [Sun, 17 May 2015 14:46:54 +0000 (16:46 +0200)]
nvc0: add a header file for nvc0_query

This will allow to split SW and HW queries in an upcoming patch.

While we are at it, make use of nvc0_query struct instead of pipe_query.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
9 years agomain: fix length of values written to glGetProgramResourceiv() for ACTIVE_VARIABLES
Samuel Iglesias Gonsalvez [Mon, 5 Oct 2015 11:14:26 +0000 (13:14 +0200)]
main: fix length of values written to glGetProgramResourceiv() for ACTIVE_VARIABLES

Return the number of values written.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agomain: buffer array variables can have array size of 0 if they are unsized
Samuel Iglesias Gonsalvez [Thu, 1 Oct 2015 12:46:01 +0000 (14:46 +0200)]
main: buffer array variables can have array size of 0 if they are unsized

From ARB_program_query_interface:

  For the property ARRAY_SIZE, a single integer identifying the number of
  active array elements of an active variable is written to <params>. The
  array size returned is in units of the type associated with the property
  TYPE. For active variables not corresponding to an array of basic types,
  the value one is written to <params>. If the variable is a shader
  storage block member in an array with no declared size, the value zero
  is written to <params>.

v2:
- Unsized arrays of arrays have an array size different than zero

v3:
- Arrays and unsized arrays will have an array_stride > 0. Use it
  instead of is_unsized_array flag (Timothy).

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agomain: consider that unsized arrays have at least one active element
Samuel Iglesias Gonsalvez [Thu, 1 Oct 2015 13:05:00 +0000 (15:05 +0200)]
main: consider that unsized arrays have at least one active element

From ARB_shader_storage_buffer_object:

"When using the ARB_program_interface_query extension to enumerate the
 set of active buffer variables, only the first element of arrays (sized
 or unsized) will be enumerated"

_mesa_program_resource_array_size() is used when getting the name (and
name length) of the active variables. When it is an unsized array,
we want to indicate it has one active element so the returned name
would have "[0]" at the end.

v2:
- Use array_stride > 0 and array_elements == 0 to detect unsized
  arrays. Because of that, we don't need is_unsized_array flag
  (Timothy)

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agomain: fix TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE
Samuel Iglesias Gonsalvez [Thu, 1 Oct 2015 11:13:19 +0000 (13:13 +0200)]
main: fix TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE

When the active variable is an array which is already a top-level
shader storage block member, don't return its array size and stride
when querying TOP_LEVEL_ARRAY_SIZE and TOP_LEVEL_ARRAY_STRIDE
respectively.

Fixes the following 12 dEQP-GLES31 tests:

dEQP-GLES31.functional.ssbo.layout.single_basic_array.shared.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.shared.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.shared.column_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.packed.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.packed.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.packed.column_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std140.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std140.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std140.column_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.row_major_mat3x4
dEQP-GLES31.functional.ssbo.layout.single_basic_array.std430.column_major_mat3x4

v2:
- Fix check when the shader storage block is instanced
- Write auxiliary function to do the check.

v3:
- Check if full_instanced_name is NULL just after allocation (Ilia)
- Remove () from one strcmp() in the if statement (Ilia)

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomain: fix goto in program_resource_top_level_array_stride
Samuel Iglesias Gonsalvez [Fri, 2 Oct 2015 06:43:51 +0000 (08:43 +0200)]
main: fix goto in program_resource_top_level_array_stride

Use found_top_level_array_stride instead of found_top_level_array_size.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomesa: add GL_UNSIGNED_INT_24_8 to _mesa_pack_depth_span
Tapani Pälli [Thu, 8 Oct 2015 06:43:41 +0000 (09:43 +0300)]
mesa: add GL_UNSIGNED_INT_24_8 to _mesa_pack_depth_span

Patch adds missing type (used with NV_read_depth) so that it gets
handled correctly. This fixes errors seen with following CTS test:

   ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agomesa,meta: move gl_texture_object::TargetIndex initializations
Brian Paul [Mon, 5 Oct 2015 14:14:56 +0000 (08:14 -0600)]
mesa,meta: move gl_texture_object::TargetIndex initializations

Before, we were unconditionally assigning the TargetIndex field in
_mesa_BindTexture(), even if it was already set properly.  Now we
initialize TargetIndex wherever we initialize the Target field, in
_mesa_initialize_texture_object(), finish_texture_init(), etc.

v2: also update the meta_copy_image code.  In make_view() the
view_tex_obj->Target field was set, but not the TargetIndex field.
Also, remove a second, redundant assignment to view_tex_obj->Target.
Add sanity check assertions too.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
9 years agomesa: remove unused _mesa_create_nameless_texture()
Brian Paul [Sat, 3 Oct 2015 14:05:33 +0000 (08:05 -0600)]
mesa: remove unused _mesa_create_nameless_texture()

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
9 years agomesa: remove unneeded error check in create_textures()
Brian Paul [Sat, 3 Oct 2015 13:55:32 +0000 (07:55 -0600)]
mesa: remove unneeded error check in create_textures()

Callers of create_texture() will either pass target=0 or a validated
GL texture target enum so no need to do another error check inside
the loop.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
9 years agoi965: Link compiler unit tests to libi965_compiler.la
Kristian Høgsberg Kristensen [Wed, 7 Oct 2015 12:09:48 +0000 (05:09 -0700)]
i965: Link compiler unit tests to libi965_compiler.la

We can now link the unit tests against just libi965_compiler.la. This
lets us drop a lot of DRI driver dependencies, but we still pull in all
of libmesa and more.

This also provides a few standalone users of libi965_compiler.la, which
will help us accidentally using i965_dri.so functions from the compiler.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Break out backend compiler to its own library
Kristian Høgsberg Kristensen [Tue, 6 Oct 2015 23:54:52 +0000 (16:54 -0700)]
i965: Break out backend compiler to its own library

This introduces a new libtool helper library, libi965_compiler.la.  This
library is moderately self-contained, but still needs to link to all of
libmesa.la among other things.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965/cs: Get max_cs_threads from brw_compiler devinfo
Kristian Høgsberg Kristensen [Wed, 7 Oct 2015 12:13:50 +0000 (05:13 -0700)]
i965/cs: Get max_cs_threads from brw_compiler devinfo

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Move brw_get_shader_time_index() call out of emit functions
Kristian Høgsberg Kristensen [Wed, 7 Oct 2015 12:06:30 +0000 (05:06 -0700)]
i965: Move brw_get_shader_time_index() call out of emit functions

brw_get_shader_time_index() is all tangled up in brw_context state and
we can't call it from the compiler. Thanks the Jasons recent
refactoring, we can just get the index and pass to the emit functions
instead.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Move brw_select_clip_planes() to brw_shader.cpp
Kristian Høgsberg Kristensen [Wed, 7 Oct 2015 11:19:39 +0000 (04:19 -0700)]
i965: Move brw_select_clip_planes() to brw_shader.cpp

We call this from the compiler so move it to brw_shader.cpp.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Use util_next_power_of_two() for brw_get_scratch_size()
Kristian Høgsberg Kristensen [Mon, 5 Oct 2015 21:02:56 +0000 (14:02 -0700)]
i965: Use util_next_power_of_two() for brw_get_scratch_size()

This function computes the next power of two, but at least 1024. We can
do that by bitwise or'ing in 1023 and calling util_next_power_of_two().

We use brw_get_scratch_size() from the compiler so we need it out of
brw_program.c. We could move it to brw_shader.cpp, but let's make it a
small inline function instead.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Move brw_mark_surface_used() to brw_shader.cpp
Kristian Høgsberg Kristensen [Tue, 6 Oct 2015 23:11:08 +0000 (16:11 -0700)]
i965: Move brw_mark_surface_used() to brw_shader.cpp

brw_program.c won't be part of the compiler library, but we need
brw_mark_surface_used() in the compiler. Move to brw_shader.cpp.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965/cs: Split out helper for building local id payload
Kristian Høgsberg Kristensen [Tue, 6 Oct 2015 05:07:58 +0000 (22:07 -0700)]
i965/cs: Split out helper for building local id payload

The initial motivation for this patch was to avoid calling
brw_cs_prog_local_id_payload_dwords() in gen7_cs_state.c from the
compiler. This commit ends up refactoring things a bit more so as to
split out the logic to build the local id payload to brw_fs.cpp. This
moves the payload building closer to the compiler code that uses the
payload layout and makes it available to other users of the compiler.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Move brw_link_shader() and friends to new file brw_link.cpp
Kristian Høgsberg Kristensen [Mon, 5 Oct 2015 21:22:23 +0000 (14:22 -0700)]
i965: Move brw_link_shader() and friends to new file brw_link.cpp

We want to use the rest of brw_shader.cpp with the rest of the compiler
without pulling in the GLSL linking code.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Configure bufmgr debug options from intel_screen.c
Kristian Høgsberg Kristensen [Tue, 6 Oct 2015 23:19:04 +0000 (16:19 -0700)]
i965: Configure bufmgr debug options from intel_screen.c

We need the debug flag parsing and INTEL_DEBUG in the compiler, but we
don't want the dependency on bufmgr (libdrm_intel) in there. Move to
intel_screen.c.

There are now only two lines left in brw_process_intel_debug_variable(),
but we keep it in intel_debug.h to avoid having to expose
'debug_control' as a global variable.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoutil: Move DRI parse_debug_string() to util
Kristian Høgsberg Kristensen [Mon, 5 Oct 2015 21:13:29 +0000 (14:13 -0700)]
util: Move DRI parse_debug_string() to util

We want to use intel_debug.c in code that doesn't link to dri common.

v2: Remove unnecessary stddef.h include (Topi), use util/debug.h
    in all DRI driver and remove driParseDebugString() (Iago).

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agoi965: Move brw_dump_ir() out of brw_*_emit() functions
Kristian Høgsberg Kristensen [Mon, 5 Oct 2015 20:58:05 +0000 (13:58 -0700)]
i965: Move brw_dump_ir() out of brw_*_emit() functions

We move these calls one level up into the codegen functions.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Signed-off-by: Kristian Høgsberg Kristensen <krh@bitplanet.net>
9 years agogallium/ddebug: add missing dd_util.h to sources list
Emil Velikov [Thu, 8 Oct 2015 14:50:54 +0000 (15:50 +0100)]
gallium/ddebug: add missing dd_util.h to sources list

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
9 years agogallium/ddebug: automake: sort sources alphabetically
Emil Velikov [Thu, 8 Oct 2015 14:50:12 +0000 (15:50 +0100)]
gallium/ddebug: automake: sort sources alphabetically

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
9 years agonir/sweep: Reparent the shader name
Jason Ekstrand [Tue, 6 Oct 2015 00:16:02 +0000 (17:16 -0700)]
nir/sweep: Reparent the shader name

Previously the name of the nir shader was being freed prematurely during
nir_sweep. Since 756613ed35d the name was later being used to generate
filenames for the optimiser debug output and these would end up with
garbage from the dangling pointer.

Co-authored-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoc11/threads: initialize timeout structure
Jan Vesely [Sun, 4 Oct 2015 00:19:13 +0000 (19:19 -0500)]
c11/threads: initialize timeout structure

Signed-off-by: Jan Vesely <jano.vesely@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agodocs/relnotes: document EGL_KHR_create_context on llvmpipe and softpipe
Boyan Ding [Thu, 8 Oct 2015 07:38:15 +0000 (15:38 +0800)]
docs/relnotes: document EGL_KHR_create_context on llvmpipe and softpipe

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
9 years agoi965/gs/gen6: Maximum allowed size of SEND messages is 15 (4 bits)
Iago Toral Quiroga [Wed, 23 Sep 2015 06:52:07 +0000 (08:52 +0200)]
i965/gs/gen6: Maximum allowed size of SEND messages is 15 (4 bits)

Comit d48ac9306619 addressed this for VS, but we forgot to do the same for
URB writes generated by the gen6 GS.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Define FIRST_SPILL_MRF and FIRST_PULL_LOAD_MRF only once and in one place
Iago Toral Quiroga [Tue, 22 Sep 2015 11:14:52 +0000 (13:14 +0200)]
i965: Define FIRST_SPILL_MRF and FIRST_PULL_LOAD_MRF only once and in one place

That should make tracking where we do spills and pull loads a bit easier.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: make pull constant loads in gen6 start at MRFs 16/17
Iago Toral Quiroga [Tue, 22 Sep 2015 11:01:18 +0000 (13:01 +0200)]
i965: make pull constant loads in gen6 start at MRFs 16/17

So they do not conflict with our (un)spills (MRF 21..23) or our
URB writes (MRF 1..15)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Fix remove_duplicate_mrf_writes so it can handle 24 MRFs in gen6
Iago Toral Quiroga [Tue, 22 Sep 2015 10:53:08 +0000 (12:53 +0200)]
i965: Fix remove_duplicate_mrf_writes so it can handle 24 MRFs in gen6

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: include bad type in error string of _mesa_pack_depth_span
Tapani Pälli [Thu, 8 Oct 2015 06:25:16 +0000 (09:25 +0300)]
mesa: include bad type in error string of _mesa_pack_depth_span

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: add varyings to resource list only with SSO
Tapani Pälli [Wed, 7 Oct 2015 07:04:06 +0000 (10:04 +0300)]
glsl: add varyings to resource list only with SSO

Varyings can be considered inputs or outputs of a program only when
SSO is in use. With multi-stage programs, inputs contain only inputs
for first stage and outputs contains outputs of the final shader stage.

I've tested that fix works for Assault Android Cactus (demo version)
and does not cause Piglit or CTS regressions in glGetProgramiv tests.

Following ES 3.1 CTS separate shader tests that do query properties
of varyings in SSO shader programs pass:

   ES31-CTS.program_interface_query.separate-programs-vertex
   ES31-CTS.program_interface_query.separate-programs-fragment

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92122

9 years agomesa: Correctly handle GL_BGRA_EXT in ES3 format_and_type checks
Jason Ekstrand [Wed, 7 Oct 2015 22:52:09 +0000 (15:52 -0700)]
mesa: Correctly handle GL_BGRA_EXT in ES3 format_and_type checks

The EXT_texture_format_BGRA8888 extension (which mesa supports
unconditionally) adds a new format and internal format called GL_BGRA_EXT.
Previously, this was not really handled at all in
_mesa_ex3_error_check_format_and_type.  When the checks were tightened in
commit f15a7f3c, we accidentally tightened things too far and GL_BGRA_EXT
would always cause an error to be thrown.

There were two primary issues here.  First, is that
_mesa_es3_effective_internal_format_for_format_and_type didn't handle the
GL_BGRA_EXT format.  Second is that it blindly uses _mesa_base_tex_format
which returns GL_RGBA for GL_BGRA_EXT.  This commit fixes both of these
issues as well as adds explicit checks that GL_BGRA_EXT is only ever used
with GL_BGRA_EXT and GL_UNSIGNED_BYTE.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92265
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: enable KHR_debug for ES contexts"
Emil Velikov [Wed, 7 Oct 2015 20:23:16 +0000 (21:23 +0100)]
Revert "mesa: enable KHR_debug for ES contexts"

This reverts commit b69cfbdf18fa64606a76761b20bc268f4ac731e5.

This isn't quite baked yet. Seems that despite building the ES piglits,
none of them got executed.

9 years agoegl/dri2: Properly dereference array.
Matt Turner [Wed, 7 Oct 2015 18:43:58 +0000 (11:43 -0700)]
egl/dri2: Properly dereference array.

Fixes a regression that broke EGL since

commit 858f2f2ae6d72f338fdd6d544b0c733814e22724
Author: Emil Velikov <emil.l.velikov@gmail.com>
Date:   Sun Sep 13 12:25:27 2015 +0100

    egl/dri2: ease srgb __DRIconfig conditionals