platform/upstream/mesa.git
9 years agoi965: Add devinfo parameter to brw_compact_inst_* funcs.
Matt Turner [Mon, 19 Oct 2015 21:41:36 +0000 (14:41 -0700)]
i965: Add devinfo parameter to brw_compact_inst_* funcs.

The next commit will add assertions dependent on devinfo->gen.

Use compact()/uncompact() macros where possible, like the 3-src code
does.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Don't emit MOVs for unused URB slots.
Matt Turner [Thu, 15 Oct 2015 22:13:12 +0000 (15:13 -0700)]
i965/vec4: Don't emit MOVs for unused URB slots.

Otherwise we'd emit a MOV from the null register (which isn't allowed).

Helps 24 programs in shader-db (the geometry shaders in GSCloth):

instructions in affected programs:     302 -> 262 (-13.25%)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoosmesa: Expose GL entry points for Windows build via DEF file.
Nigel Stewart [Mon, 12 Oct 2015 11:26:37 +0000 (21:26 +1000)]
osmesa: Expose GL entry points for Windows build via DEF file.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92437
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoconfigure.ac: ensure RM is set
Jonathan Gray [Sat, 10 Oct 2015 06:42:40 +0000 (17:42 +1100)]
configure.ac: ensure RM is set

GNU make predefines RM to rm -f but this is not required by POSIX
so ensure that RM is set.  This fixes "make clean" on OpenBSD.

v2: use AC_CHECK_PROG

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965/fs: Disable opt_sampler_eot for more message types
Neil Roberts [Tue, 20 Oct 2015 09:56:15 +0000 (11:56 +0200)]
i965/fs: Disable opt_sampler_eot for more message types

In bfdae9149e0 I disabled the opt_sampler_eot optimisation for TG4
message types because I found by experimentation that it doesn't work.
I wrote in the comment that I couldn't find any documentation for this
problem. However I've now found the documentation and it has
additional restrictions on further message types so this patch updates
the comment and adds the others.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Remove block arg from foreach_inst_in_block_*_starting_from
Neil Roberts [Tue, 20 Oct 2015 09:16:00 +0000 (11:16 +0200)]
i965: Remove block arg from foreach_inst_in_block_*_starting_from

Since 49374fab5d793 these macros no longer actually use the block
argument. I think this is worth doing to make the macros easier to use
because they already have really long names and a confusing set of
arguments.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: check for arrays of arrays when assigning explicit locations
Timothy Arceri [Wed, 21 Oct 2015 02:44:10 +0000 (13:44 +1100)]
glsl: check for arrays of arrays when assigning explicit locations

This fixes assigning explicit locations in the CTS test:

ES31-CTS.explicit_uniform_location.uniform-loc-arrays-of-arrays

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: add is_array_of_arrays() helper
Timothy Arceri [Wed, 21 Oct 2015 02:37:11 +0000 (13:37 +1100)]
glsl: add is_array_of_arrays() helper

As suggested by Ian Romanick

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: Fix bad indentation in bit_logic_result_type().
Kenneth Graunke [Wed, 21 Oct 2015 02:51:56 +0000 (19:51 -0700)]
glsl: Fix bad indentation in bit_logic_result_type().

The first level of indentation was using 4 spaces.  Mesa uses 3.

Trivial.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: add AoA support to subroutines
Timothy Arceri [Wed, 5 Aug 2015 05:49:22 +0000 (15:49 +1000)]
glsl: add AoA support to subroutines

process_parameters() will now be called earlier because we need
actual_parameters processed earlier so we can use it with
match_subroutine_by_name() to get the subroutine variable, we need
to do this inside the recursive function generate_array_index() because
we can't create the ir_dereference_array() until we have gotten to the
outermost array.

For the remainder of the array dimensions the type doesn't matter so we
can just use the existing _mesa_ast_array_index_to_hir() function to
process the ast.

Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: fix record type detection in explicit location assign
Tapani Pälli [Tue, 20 Oct 2015 09:18:51 +0000 (12:18 +0300)]
glsl: fix record type detection in explicit location assign

Check current_var directly instead of using the passed in record_type.

This fixes following failing CTS test:
ES31-CTS.explicit_uniform_location.uniform-loc-types-structs

No Piglit regressions.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: do not try to reserve explicit locations for buffer variables
Tapani Pälli [Tue, 20 Oct 2015 07:24:50 +0000 (10:24 +0300)]
glsl: do not try to reserve explicit locations for buffer variables

Explicit locations are only used with uniform variables.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: skip buffer variables when filling UniformRemapTable
Tapani Pälli [Tue, 20 Oct 2015 05:32:15 +0000 (08:32 +0300)]
glsl: skip buffer variables when filling UniformRemapTable

UniformRemapTable is used only for remapping user specified uniform
locations to driver internally used ones, shader storage buffer
variables should not utilize uniform locations.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agosvga: add switch case for PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT
Brian Paul [Wed, 21 Oct 2015 00:22:43 +0000 (18:22 -0600)]
svga: add switch case for PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT

A third instance of this was needed but missed in the previous commit.
Return 32 as for the two other cases.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agodraw: fix splitting of line loops (v2)
Brian Paul [Sat, 17 Oct 2015 18:07:32 +0000 (12:07 -0600)]
draw: fix splitting of line loops (v2)

When the draw module splits long line loops, the sections are emitted
as line strips.  But the primitive type wasn't set correctly so each
section was being drawn as a loop, introducing extra line segments.

To fix this, we pass a new DRAW_LINE_LOOP_AS_STRIP flag to the run()
function.  The linear/elt_run() functions have to check for this flag
and set their primitive type accordingly.

No piglit regressions.  Fixes piglit's lineloop with -count 4097 or
higher.

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

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agoi965/gen9: Remove temporary variable 'bpp' in tr_mode_..._texture_alignment()
Anuj Phogat [Thu, 13 Aug 2015 18:19:47 +0000 (11:19 -0700)]
i965/gen9: Remove temporary variable 'bpp' in tr_mode_..._texture_alignment()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Remove temporary variable 'align_yf' in tr_mode_..._texture_alignment()
Anuj Phogat [Wed, 12 Aug 2015 23:39:05 +0000 (16:39 -0700)]
i965/gen9: Remove temporary variable 'align_yf' in tr_mode_..._texture_alignment()

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Remove parameter 'brw' from tr_mode_..._texture_alignment()
Anuj Phogat [Wed, 23 Sep 2015 23:13:00 +0000 (16:13 -0700)]
i965/gen9: Remove parameter 'brw' from tr_mode_..._texture_alignment()

V2: Rebased on master.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Reuse YF alignment tables in tr_mode_..._texture_alignment()
Anuj Phogat [Wed, 23 Sep 2015 23:12:26 +0000 (16:12 -0700)]
i965/gen9: Reuse YF alignment tables in tr_mode_..._texture_alignment()

Patch just does some refactoring to make the code look better. No
functional changes in here.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agovbo: convert display list GL_LINE_LOOP prims to GL_LINE_STRIP
Brian Paul [Fri, 16 Oct 2015 04:57:08 +0000 (22:57 -0600)]
vbo: convert display list GL_LINE_LOOP prims to GL_LINE_STRIP

When a long GL_LINE_LOOP prim was split across primitives we drew
stray lines.  See previous commit for details.

This patch converts GL_LINE_LOOP prims into GL_LINE_STRIP prims so
that drivers don't have to worry about the _mesa_prim::begin/end flags.

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

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: fix GL_LINE_LOOP stray line bug
Brian Paul [Fri, 16 Oct 2015 04:31:50 +0000 (22:31 -0600)]
vbo: fix GL_LINE_LOOP stray line bug

When long GL_LINE_LOOP primitives don't fit in one vertex buffer they
have to be split across buffers.  The code to do this was basically correct
but drivers had to pay special attention to the _mesa_prim::begin,end flags
in order to draw the sections of the line loop properly.  Apparently, the
only drivers to do this were those using the old 'tnl' module for software
vertex processing.

Now we convert the split pieces of GL_LINE_LOOP prims into GL_LINE_STRIP
primitives so that drivers don't have to worry about the special begin/end
flags.  The only time a driver will get a GL_LINE_LOOP prim is when the
whole thing fits in one vertex buffer.

Mostly fixes bug 81174, but not completely.  There's another bug somewhere
in the src/gallium/auxiliary/draw/ code.  If the piglit lineloop test is
run with -count 4096, rendering is correct, but with -count 4097 there are
stray lines.  4096 is a magic number in the draw code (search for "4096").

Also note that this does not fix long line loops in display lists.  The
next patch fixes that.

v2: fix incorrect -1 in vbo_compute_max_verts(), per Charmaine.  Remove
incorrect assertion which was added in vbo_copy_vertices().

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81174
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=49779
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=28130

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: add new vbo_compute_max_verts() helper function
Brian Paul [Fri, 16 Oct 2015 17:19:40 +0000 (11:19 -0600)]
vbo: add new vbo_compute_max_verts() helper function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: simplify some code in vbo_exec_End()
Brian Paul [Fri, 16 Oct 2015 02:33:52 +0000 (20:33 -0600)]
vbo: simplify some code in vbo_exec_End()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: simplify some code in vbo_copy_vertices()
Brian Paul [Fri, 16 Oct 2015 03:25:18 +0000 (21:25 -0600)]
vbo: simplify some code in vbo_copy_vertices()

As before, use a new 'last_prim' pointer to simplify things.  Plus, add
some const qualifiers.

v2: use 'sz' in another place, per Sinclair.  And update subject line.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: simplify some code in vbo_exec_wrap_buffers()
Brian Paul [Fri, 16 Oct 2015 02:18:32 +0000 (20:18 -0600)]
vbo: simplify some code in vbo_exec_wrap_buffers()

Use a new 'last_prim' pointer to simplify things.

v2: remove unneeded assert(exec->vtx.prim_count > 0)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: replace the comment on vbo_copy_vertices()
Brian Paul [Fri, 16 Oct 2015 03:21:56 +0000 (21:21 -0600)]
vbo: replace the comment on vbo_copy_vertices()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: make vbo_exec_vtx_wrap() static
Brian Paul [Fri, 16 Oct 2015 02:22:25 +0000 (20:22 -0600)]
vbo: make vbo_exec_vtx_wrap() static

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agovbo: remove unneeded ctx parameter for merge_prims()
Brian Paul [Thu, 15 Oct 2015 20:11:54 +0000 (14:11 -0600)]
vbo: remove unneeded ctx parameter for merge_prims()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agotnl: add some comments in render_line_loop code
Brian Paul [Fri, 16 Oct 2015 04:30:22 +0000 (22:30 -0600)]
tnl: add some comments in render_line_loop code

And remove '(void) flags' line which is not needed.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agomesa: simple whitespace fix in texstore.c
Brian Paul [Thu, 15 Oct 2015 15:52:09 +0000 (09:52 -0600)]
mesa: simple whitespace fix in texstore.c

9 years agovbo: reduce number of vertex buffer mappings for vertex attributes
Brian Paul [Thu, 15 Oct 2015 18:33:00 +0000 (12:33 -0600)]
vbo: reduce number of vertex buffer mappings for vertex attributes

Whenever we got a glColor, glNormal, glTexCoord, etc. call outside a
glBegin/End pair, we'd immediately map a vertex buffer to begin
accumulating vertex data.  In some cases, such as with display lists,
this led to excessive vertex buffer mapping.  For example, if we have
a display list such as:

glNewList(42, GL_COMPILE);
glBegin(prim);
glVertex2f();
...
glVertex2f();
glEnd();
glEndList();

Then did:

glColor3f();
glCallList(42);

We'd map a vertex buffer as soon as we saw glColor3f but we'd never
actually write anything to it.  Note that the vertex position data
was put into a vertex buffer during display list compilation.

With this change, we delay mapping the vertex buffer until we actually
have a vertex to write to it (triggered by a glVertex() call).  In the
above case, we no longer map a vertex buffer when setting the color and
calling the list.

For drivers such as VMware's, reducing buffer mappings gives improved
performance.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: optimize 4-component ubyte glDrawPixels
Brian Paul [Thu, 15 Oct 2015 17:54:06 +0000 (11:54 -0600)]
st/mesa: optimize 4-component ubyte glDrawPixels

If we didn't find a gallium surface format that exactly matched the
glDrawPixels format/type combination, we used some other 32-bit packed
RGBA format and swizzled the whole image in the mesa texstore/format code.

That slow path can be avoided in some common cases by using the
pipe_samper_view's swizzle terms to do the swizzling at texture sampling
time instead.

For now, only GL_RGBA/ubyte and GL_BGRA/ubyte combinations are supported.
In the future other formats and types like GL_UNSIGNED_INT_8_8_8_8 could
be added.

v2: fix incorrect swizzle setup (need to invert the tex format's swizzle)

Reviewed by: Jose Fonseca <jfonseca@vmware.com>

9 years agomesa: make memcpy_texture() non-static
Brian Paul [Thu, 15 Oct 2015 15:54:29 +0000 (09:54 -0600)]
mesa: make memcpy_texture() non-static

So that we can use it directly from the mesa/gallium state tracker.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
9 years agost/mesa: check for out-of-memory in st_DrawPixels()
Brian Paul [Thu, 15 Oct 2015 15:38:00 +0000 (09:38 -0600)]
st/mesa: check for out-of-memory in st_DrawPixels()

Before, if make_texture() or st_create_texture_sampler_view() failed
we silently no-op'd the glDrawPixels.  Now, set GL_OUT_OF_MEMORY.
This also allows us to un-nest a bunch of code.

v2: also check if allocation of sv[1] fails, per Jose.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: use MAX3() instead of MAX2(MAX2) in draw_textured_quad()
Brian Paul [Thu, 15 Oct 2015 15:32:50 +0000 (09:32 -0600)]
st/mesa: use MAX3() instead of MAX2(MAX2) in draw_textured_quad()

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: fix incorrect opcode in save_BlendFunci()
Brian Paul [Thu, 15 Oct 2015 14:43:02 +0000 (08:43 -0600)]
mesa: fix incorrect opcode in save_BlendFunci()

Fixes assertion failure with new piglit
arb_draw_buffers_blend-state_set_get test.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agomesa: add more cases to print_list() in dlist.c
Brian Paul [Thu, 15 Oct 2015 14:40:54 +0000 (08:40 -0600)]
mesa: add more cases to print_list() in dlist.c

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoi965: silence incompatible pointer type warning
Emil Velikov [Sat, 17 Oct 2015 22:42:13 +0000 (23:42 +0100)]
i965: silence incompatible pointer type warning

src/mesa/drivers/dri/i965/brw_program.c:94:39:
warning: passing argument 1 of ‘_mesa_init_gl_program’ from incompatible
pointer type [-Wincompatible-pointer-types]
          return _mesa_init_gl_program(&prog->program, target, id);

                                       ^

Runtime was unaffected as brw_geometry_program is subclassed from
gl_geometry_program, thus the address passed was the same.

Fixes: bcb56c2c69d (program: convert _mesa_init_gl_program() to take
struct gl_program *)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agogallium: add PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT
Marek Olšák [Tue, 20 Oct 2015 16:26:02 +0000 (18:26 +0200)]
gallium: add PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT

This avoids a serious r600g bug leading to a GPU hang.
The chances this bug will get fixed are pretty low now.

I deeply regret listening to others and not pushing this patch, leaving
other users with a GPU-crashing driver. Yes, it should be fixed
in the compiler and it's ugly, but users couldn't care less about that.

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

Cc: 11.0 10.6 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agovc4: Switch our vertex attr lowering to being NIR-based.
Eric Anholt [Sat, 1 Aug 2015 03:58:57 +0000 (20:58 -0700)]
vc4: Switch our vertex attr lowering to being NIR-based.

This exposes more information to NIR's optimization, and should be
particularly useful when we do range-based optimization.

total uniforms in shared programs: 32066 -> 32065 (-0.00%)
uniforms in affected programs:     21 -> 20 (-4.76%)
total instructions in shared programs: 93104 -> 92630 (-0.51%)
instructions in affected programs:     31901 -> 31427 (-1.49%)

9 years agovc4: Add limited support for ibfe/ubfe.
Eric Anholt [Tue, 20 Oct 2015 09:49:10 +0000 (10:49 +0100)]
vc4: Add limited support for ibfe/ubfe.

This is just enough to cover our unpack modes, which will be used by some
new NIR-based lowering in the next commit.

9 years agotgsi/scan: use properties for clip/cull distance writemasks
Marek Olšák [Sat, 17 Oct 2015 21:17:52 +0000 (23:17 +0200)]
tgsi/scan: use properties for clip/cull distance writemasks

No changes needed for drivers already relying on tgsi_shader_info.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agost/mesa: pass the clip distance array size to drivers
Marek Olšák [Sat, 17 Oct 2015 21:17:52 +0000 (23:17 +0200)]
st/mesa: pass the clip distance array size to drivers

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium: add new properties for clip and cull distance usage
Marek Olšák [Sat, 17 Oct 2015 21:15:28 +0000 (23:15 +0200)]
gallium: add new properties for clip and cull distance usage

The TGSI usage mask can't be used, because these are declared as an output
array of 2 elements.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: replace UsesClipDistance with ClipDistanceArraySize
Marek Olšák [Sat, 17 Oct 2015 20:50:11 +0000 (22:50 +0200)]
mesa: replace UsesClipDistance with ClipDistanceArraySize

This is more practical and needed by gallium.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoradeonsi: enable BC_OPTIMIZE if centroid isn't used
Marek Olšák [Sun, 18 Oct 2015 13:09:24 +0000 (15:09 +0200)]
radeonsi: enable BC_OPTIMIZE if centroid isn't used

This solution was recommended by a Catalyst developer.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: fix the export_prim_id field size in the shader key
Marek Olšák [Sat, 17 Oct 2015 21:59:52 +0000 (23:59 +0200)]
radeonsi: fix the export_prim_id field size in the shader key

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: support thread-safe shaders shared by multiple contexts
Marek Olšák [Tue, 6 Oct 2015 23:48:18 +0000 (01:48 +0200)]
radeonsi: support thread-safe shaders shared by multiple contexts

The "current" shader pointer is moved from the CSO to the context, so that
the CSO is mostly immutable.

The only drawback is that the "current" pointer isn't saved when unbinding
a shader and it must be looked up when the shader is bound again.

This is also a prerequisite for multithreaded shader compilation.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agost/mesa: create shaders which have only one variant immediatelly (v2)
Marek Olšák [Sun, 27 Sep 2015 22:04:39 +0000 (00:04 +0200)]
st/mesa: create shaders which have only one variant immediatelly (v2)

v2: fix the condition when lacking sample shading

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/mesa: negate the can_force_persample_interp flag
Marek Olšák [Mon, 19 Oct 2015 22:12:53 +0000 (00:12 +0200)]
st/mesa: negate the can_force_persample_interp flag

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/mesa: decouple shaders from contexts if they are shareable
Marek Olšák [Sun, 27 Sep 2015 21:36:59 +0000 (23:36 +0200)]
st/mesa: decouple shaders from contexts if they are shareable

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agogallium: add PIPE_CAP_SHAREABLE_SHADERS
Marek Olšák [Sun, 27 Sep 2015 19:02:15 +0000 (21:02 +0200)]
gallium: add PIPE_CAP_SHAREABLE_SHADERS

I'll let drivers figure out how to do it.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoradeonsi: add support for ARB_texture_view
Marek Olšák [Tue, 17 Mar 2015 13:46:04 +0000 (14:46 +0100)]
radeonsi: add support for ARB_texture_view

All tests pass. We don't need to do much - just set CUBE if the view
target is CUBE or CUBE_ARRAY, otherwise set the resource target.

The reason this can be so simple is that texture instructions
have a greater effect on the target than the sampler view.

Thanks Glenn for the piglit test.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agovc4: Use nir_foreach_variable
Boyan Ding [Fri, 16 Oct 2015 07:15:39 +0000 (15:15 +0800)]
vc4: Use nir_foreach_variable

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoglsl: fix stream qualifier for blocks with an instance name
Timothy Arceri [Sat, 17 Oct 2015 09:22:14 +0000 (20:22 +1100)]
glsl: fix stream qualifier for blocks with an instance name

This also removes the validation from the parser as it is not required
and once arb_enhanced_layouts comes along we wont be able to do validation
on the stream qualifier in the parser anyway as it adds constant expression
support to the stream qualifier.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: 11.0 <mesa-stable@lists.freedesktop.org>
9 years agoglsl: fix regression when building interface field name for SSBOs
Timothy Arceri [Sat, 17 Oct 2015 22:12:40 +0000 (09:12 +1100)]
glsl: fix regression when building interface field name for SSBOs

Fixes regression cased by bb5aeb854915ba67abc56257f830d002c956439e

We don't care about the swizzle when building the name so just skip over it.

Tested-by: Markus Wick <markus@selfnet.de>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agost/omx/dec/h264: fix field picture type 0 poc disorder
Leo Liu [Fri, 28 Aug 2015 12:45:11 +0000 (08:45 -0400)]
st/omx/dec/h264: fix field picture type 0 poc disorder

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoi965/gen9: Handle the GL_TEXTURE_{1D, 1D_ARRAY} targets inside switch
Anuj Phogat [Wed, 12 Aug 2015 18:34:54 +0000 (11:34 -0700)]
i965/gen9: Handle the GL_TEXTURE_{1D, 1D_ARRAY} targets inside switch

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/fs: Localize variables' scopes.
Matt Turner [Thu, 15 Oct 2015 23:01:11 +0000 (16:01 -0700)]
i965/fs: Localize variables' scopes.

9 years agoi965/fs: Consider type mismatches in saturate propagation.
Matt Turner [Wed, 14 Oct 2015 09:23:25 +0000 (02:23 -0700)]
i965/fs: Consider type mismatches in saturate propagation.

NIR considers bcsel to produce and consume unsigned types, leading to
SEL instructions operating on unsigned types when the data is really
floating-point. Previous to this patch, saturate propagation would
happily transform

   (+f0) sel      g20:UD, g30:UD, g40:UD
         mov.sat  g50:F,  g20:F

into

   (+f0) sel.sat  g20:UD, g30:UD, g40:UD
         mov      g50:F,  g20:F

But since the meaning of .sat is dependent on the type of the
destination register, this is not valid.

Instead, allow saturate propagation to change the types of dest/source
on instructions that are simply copying data in order to propagate the
saturate modifier.

Fixes bad code gen in 158 programs.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965: Extract can_change_source_types() functions.
Matt Turner [Wed, 14 Oct 2015 09:12:09 +0000 (02:12 -0700)]
i965: Extract can_change_source_types() functions.

Make them members of fs_inst/vec4_instruction for use elsewhere.

Also fix the fs version to check that dst.type == src[1].type and for
!saturate.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/vs: Move URB entry_size and read_length calculations to compile_vs
Jason Ekstrand [Thu, 15 Oct 2015 18:39:06 +0000 (11:39 -0700)]
i965/vs: Move URB entry_size and read_length calculations to compile_vs

Reviewed-By: Eduardo Lima Mitev <elima@igalia.com>
9 years agoi965: Move the entire compiler API into a single file
Jason Ekstrand [Fri, 9 Oct 2015 00:09:54 +0000 (17:09 -0700)]
i965: Move the entire compiler API into a single file

At this point, the compiler API has been substantially simplified.  In the
spirit of Kristian's making a compiler library, this commit makes a single
header file that contains, more-or-less, the entire compiler API.

There's still a bit of cleanup to do particularly in the area of geometry
shaders.  However, this gets us much closer to having a separate compiler.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Rename brw_foo_emit to brw_compile_foo
Jason Ekstrand [Thu, 8 Oct 2015 23:20:34 +0000 (16:20 -0700)]
i965: Rename brw_foo_emit to brw_compile_foo

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/fs: Move some of the prog_data setup into brw_wm_emit
Jason Ekstrand [Thu, 8 Oct 2015 23:01:44 +0000 (16:01 -0700)]
i965/fs: Move some of the prog_data setup into brw_wm_emit

This commit moves the common/modern stuff.  Some legacy stuff such as
setting use_alt_mode was left because it needs to know whether or not we're
an ARB program.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/cs: Rework cs_emit to take a nir_shader and a brw_compiler
Jason Ekstrand [Thu, 8 Oct 2015 22:28:26 +0000 (15:28 -0700)]
i965/cs: Rework cs_emit to take a nir_shader and a brw_compiler

This commit removes all dependence on GL state by getting rid of the
brw_context parameter and the GL data structures.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gs: Rework gs_emit to take a nir_shader and a brw_compiler
Jason Ekstrand [Thu, 8 Oct 2015 21:39:56 +0000 (14:39 -0700)]
i965/gs: Rework gs_emit to take a nir_shader and a brw_compiler

This commit removes all dependence on GL state by getting rid of the
brw_context parameter and the GL data structures.  Unfortunately, we still
have to pass in the gl_shader_program for gen6 because it's needed for
transform feedback.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/vs: Rework vs_emit to take a nir_shader and a brw_compiler
Jason Ekstrand [Thu, 8 Oct 2015 20:53:33 +0000 (13:53 -0700)]
i965/vs: Rework vs_emit to take a nir_shader and a brw_compiler

This commit removes all dependence on GL state by getting rid of the
brw_context parameter and the GL data structures.

v2 (Jason Ekstrand):
   - Patch use_legacy_snorm_formula through as a function argument rather
     than trying to go through the shader key.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/fs: Rework wm_fs_emit to take a nir_shader and a brw_compiler
Jason Ekstrand [Tue, 6 Oct 2015 02:27:28 +0000 (19:27 -0700)]
i965/fs: Rework wm_fs_emit to take a nir_shader and a brw_compiler

This commit removes all dependence on GL state by getting rid of the
brw_context parameter and the GL data structures.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Use a const nir_shader in backend_shader
Jason Ekstrand [Tue, 6 Oct 2015 02:26:02 +0000 (19:26 -0700)]
i965: Use a const nir_shader in backend_shader

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/vec4: Remove gl_program and gl_shader_program from the generator
Jason Ekstrand [Tue, 6 Oct 2015 00:41:46 +0000 (17:41 -0700)]
i965/vec4: Remove gl_program and gl_shader_program from the generator

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/fs: Remove the gl_program from the generator
Jason Ekstrand [Mon, 5 Oct 2015 23:01:33 +0000 (16:01 -0700)]
i965/fs: Remove the gl_program from the generator

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agonir/info: Add a few bits of info for fragment shaders
Jason Ekstrand [Thu, 8 Oct 2015 22:47:09 +0000 (15:47 -0700)]
nir/info: Add a few bits of info for fragment shaders

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agonir/info: Add compute shader local size to nir_shader_info
Jason Ekstrand [Thu, 8 Oct 2015 22:02:25 +0000 (15:02 -0700)]
nir/info: Add compute shader local size to nir_shader_info

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agonir/info: Move the GS info into a stage-specific info union
Jason Ekstrand [Thu, 8 Oct 2015 22:36:51 +0000 (15:36 -0700)]
nir/info: Move the GS info into a stage-specific info union

This way we can have other stage-specific info without consuming too much
extra space.  While we're at it, we make sure that the geometry info is
only set if we're actually a goemetry shader.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agomesa: Move gl_frag_depth_layout from mtypes.h to shader_enums.h
Jason Ekstrand [Thu, 8 Oct 2015 22:59:56 +0000 (15:59 -0700)]
mesa: Move gl_frag_depth_layout from mtypes.h to shader_enums.h

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agonir: Add a label to nir_shader_info
Jason Ekstrand [Mon, 5 Oct 2015 23:54:36 +0000 (16:54 -0700)]
nir: Add a label to nir_shader_info

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/asm: Explicitly use a nir_instr for IR annotations
Jason Ekstrand [Mon, 5 Oct 2015 22:49:34 +0000 (15:49 -0700)]
i965/asm: Explicitly use a nir_instr for IR annotations

Now that everything goes through NIR, we don't need this to be a void
pointer anymore.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoscons: Build nir/glsl_types.cpp once.
Jose Fonseca [Mon, 19 Oct 2015 13:29:28 +0000 (14:29 +0100)]
scons: Build nir/glsl_types.cpp once.

Undoes early hacks, and ensures nir/glsl_types.cpp is built once, and
only once.

The root problem is that SCons doesn't know about NIR nor any source
file in the NIR_FILES source list.

Tested with libgl-gdi and libgl-xlib scons targets.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agosvga: fix incorrect round-down arithmetic
Brian Paul [Mon, 19 Oct 2015 14:41:37 +0000 (08:41 -0600)]
svga: fix incorrect round-down arithmetic

Spotted by Roland.  Luckily, this code should never really be hit
since the const buffer size and offset should already be multiples
of 16.  I could probably add more assertions to that effect, but
let's just fix the arithmetic for now.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agoglsl: fix segfault when indirect indexing a buffer variable which is an array
Samuel Iglesias Gonsalvez [Mon, 19 Oct 2015 08:37:14 +0000 (10:37 +0200)]
glsl: fix segfault when indirect indexing a buffer variable which is an array

Fixes a regression added by bb5aeb854915ba67abc56257f830d002c956439e.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agost/va: Added support for NV12 to IYUV conversion in vlVaGetImage
Indrajit Das [Fri, 16 Oct 2015 06:48:45 +0000 (12:18 +0530)]
st/va: Added support for NV12 to IYUV conversion in vlVaGetImage

Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agost/va: Used correct parameter to derive the value of the "h" variable in vlVaCreateImage
Indrajit Das [Thu, 15 Oct 2015 10:12:43 +0000 (15:42 +0530)]
st/va: Used correct parameter to derive the value of the "h" variable in vlVaCreateImage

Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl_to_tgsi: Use {Num}UniformBlocks instead of {Num}BufferInterfaceBlocks
Iago Toral Quiroga [Fri, 16 Oct 2015 09:43:18 +0000 (11:43 +0200)]
glsl_to_tgsi: Use {Num}UniformBlocks instead of {Num}BufferInterfaceBlocks

The latter holds both UBOs and SSBOs, but here we only want UBOs.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: Use {Num}UniformBlocks instead of {Num}BufferInterfaceBlocks
Iago Toral Quiroga [Fri, 16 Oct 2015 09:40:52 +0000 (11:40 +0200)]
st/mesa: Use {Num}UniformBlocks instead of {Num}BufferInterfaceBlocks

The latter holds both UBOs and SSBOs, but here we only want UBOs.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoi965: Do not use NumBufferInterfaceBlocks
Iago Toral Quiroga [Fri, 16 Oct 2015 09:31:46 +0000 (11:31 +0200)]
i965: Do not use NumBufferInterfaceBlocks

This is the only place in the driver where we use this. Since we now work
with separate index spaces, always use NumUniformBlocks and
NumShaderStorageBlocks instead of NumBufferInterfaceBlocks to be more
consistent with the rest of the code.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomain: GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH is about UBOS, not SSBOs
Iago Toral Quiroga [Fri, 16 Oct 2015 09:27:43 +0000 (11:27 +0200)]
main: GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH is about UBOS, not SSBOs

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomain: Use NumUniformBlocks to count UBOs
Iago Toral Quiroga [Fri, 16 Oct 2015 09:16:46 +0000 (11:16 +0200)]
main: Use NumUniformBlocks to count UBOs

Now that we have separate index spaces for UBOs and SSBOs we do not need
to iterate through BufferInterfaceBlocks any more, we can just take the
UBO count directly from NumUniformBlocks.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoilo: set VME for 3DSTATE_PS
Chia-I Wu [Fri, 16 Oct 2015 14:53:05 +0000 (22:53 +0800)]
ilo: set VME for 3DSTATE_PS

When the bit is not set, we can see sampling artifacts on triangle edges when
the mip filter is not GEN6_MIPFILTER_NONE.

9 years agoilo: ignore prefer_linear_threshold when zero
Chia-I Wu [Fri, 16 Oct 2015 08:19:30 +0000 (16:19 +0800)]
ilo: ignore prefer_linear_threshold when zero

This was the intended behavior but it did not work as intended until now.

9 years agoilo: remove some unused kernel params
Chia-I Wu [Fri, 16 Oct 2015 01:50:12 +0000 (09:50 +0800)]
ilo: remove some unused kernel params

9 years agoilo: remove unused ilo_shader_get_type()
Chia-I Wu [Fri, 16 Oct 2015 01:46:25 +0000 (09:46 +0800)]
ilo: remove unused ilo_shader_get_type()

9 years agoilo: remove u_debug.h inclusion from ilo_core.h
Chia-I Wu [Tue, 13 Oct 2015 06:09:24 +0000 (14:09 +0800)]
ilo: remove u_debug.h inclusion from ilo_core.h

Move it to ilo_debug.h.

9 years agoilo: remove u_memory.h inclusion from ilo_core.h
Chia-I Wu [Tue, 13 Oct 2015 06:05:41 +0000 (14:05 +0800)]
ilo: remove u_memory.h inclusion from ilo_core.h

We do not make allocations generally in the core.

9 years agonvc0: do not bind input params at compute state init on Fermi
Samuel Pitoiset [Sat, 17 Oct 2015 15:33:14 +0000 (17:33 +0200)]
nvc0: do not bind input params at compute state init on Fermi

It looks like binding a constant buffer on compute overwrites the 3D
state. To avoid that, we already re-bind all the 3D constant buffers
after launching a compute grid but this is not enough.

Binding the constant buffer of input parameters for the compute state at
initialization corrupts the 3D constant buffers, and it's just useless
to bind it because this is not needed until we really launch a grid.

This fixes some piglit regressions related to interpolation tests
introduced in "nvc0: enable compute support by default on Fermi".

Fixes: 00d6186 (nvc0: enable compute support by default on Fermi)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi965/vs: Drop hack that created NIR for fixed function vertex programs.
Kenneth Graunke [Thu, 15 Oct 2015 22:34:06 +0000 (15:34 -0700)]
i965/vs: Drop hack that created NIR for fixed function vertex programs.

Marek made core Mesa call ProgramStringNotify(), which solves this
properly.  The hack is no longer needed.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Switch on shader stage in nir_lower_outputs().
Kenneth Graunke [Thu, 15 Oct 2015 22:17:19 +0000 (15:17 -0700)]
i965/nir: Switch on shader stage in nir_lower_outputs().

VS, GS, and FS continue doing the same thing they did before.  We can
simplify the FS code a bit because it is always scalar.

Compute shaders now assert that there are no outputs instead of doing
a loop over 0 outputs.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoradeonsi: don't use the AMDGPU intrinsic for CMP
Marek Olšák [Sat, 10 Oct 2015 20:43:19 +0000 (22:43 +0200)]
radeonsi: don't use the AMDGPU intrinsic for CMP

No difference according to shader-db.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agoradeonsi: use LRP from gallivm
Marek Olšák [Sat, 10 Oct 2015 20:19:19 +0000 (22:19 +0200)]
radeonsi: use LRP from gallivm

Totals:
SGPRS: 344552 -> 344368 (-0.05 %)
VGPRS: 197132 -> 197552 (0.21 %)
Code Size: 7375376 -> 7366304 (-0.12 %) bytes
LDS: 91 -> 91 (0.00 %) blocks
Scratch: 1679360 -> 1615872 (-3.78 %) bytes per wave

Totals from affected shaders:
SGPRS: 47736 -> 47552 (-0.39 %)
VGPRS: 27952 -> 28372 (1.50 %)
Code Size: 1392724 -> 1383652 (-0.65 %) bytes
LDS: 39 -> 39 (0.00 %) blocks
Scratch: 513024 -> 449536 (-12.38 %) bytes per wave

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: don't emit AMDGPU intrinsics for integer abs, min, max
Marek Olšák [Sat, 10 Oct 2015 19:27:24 +0000 (21:27 +0200)]
radeonsi: don't emit AMDGPU intrinsics for integer abs, min, max

No difference according to shader-db. (with the new S_ABS_I32 pattern)

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>