mesa.git
8 years agoi965/vec4/tcs: Return NULL instead of false in brw_compile_tcs()
Eduardo Lima Mitev [Thu, 21 Jan 2016 16:45:18 +0000 (17:45 +0100)]
i965/vec4/tcs: Return NULL instead of false in brw_compile_tcs()

brw_compile_tcs() is expected to return 'const unsigned *', so the compiler
complains.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agofreedreno/a4xx: Add support for adreno 430
cstout [Sat, 12 Dec 2015 00:58:45 +0000 (16:58 -0800)]
freedreno/a4xx: Add support for adreno 430

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: make opc array static const
Christian Gmeiner [Wed, 20 Jan 2016 21:11:52 +0000 (22:11 +0100)]
freedreno: make opc array static const

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: implement emit_string_marker
Rob Clark [Mon, 10 Aug 2015 16:11:13 +0000 (12:11 -0400)]
freedreno: implement emit_string_marker

Writes string to cmdstream in payload of a no-op packet.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium: add GREMEDY_string_marker
Rob Clark [Mon, 10 Aug 2015 15:41:29 +0000 (11:41 -0400)]
gallium: add GREMEDY_string_marker

Since the GREMEDY extensions are normally only exposed by the gremedy
debugger (and could possibly trigger debug paths in the app), we don't
expose the extension by default, but instead only with
ST_DEBUG=gremedy.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: wire up EmitStringMarker for KHR_debug
Rob Clark [Sat, 5 Dec 2015 16:32:25 +0000 (11:32 -0500)]
mesa: wire up EmitStringMarker for KHR_debug

The extension spec[1] describes DEBUG_TYPE_MARKER as "Annotation of the
command stream".  So for DEBUG_TYPE_MARKER, also pass the buf to the
driver's EmitStringMarker() to be inserted in the command stream.

[1] https://www.opengl.org/registry/specs/KHR/debug.txt

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: add GREMEDY_string_marker
Rob Clark [Mon, 10 Aug 2015 14:37:53 +0000 (10:37 -0400)]
mesa: add GREMEDY_string_marker

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agotexobj: Remove redundant checks that the texture cube faces match size
Neil Roberts [Thu, 21 Jan 2016 17:28:07 +0000 (17:28 +0000)]
texobj: Remove redundant checks that the texture cube faces match size

The texture mipmap completeness checking code was checking whether all
of the faces have the same size. However this is pointless because the
code just above it checks whether the face has the expected size
calculated for the mipmap level anyway so the error condition could
never be reached. This patch just removes it.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agotexobj: Fix the completeness checks for cube textures
Neil Roberts [Thu, 21 Jan 2016 17:12:29 +0000 (17:12 +0000)]
texobj: Fix the completeness checks for cube textures

According to the GL 1.4 spec section 3.8.10, a cubemap texture is only
complete if:

• The level base arrays of each of the six texture images making up
  the cube map have identical, positive, and square dimensions.
• The level base arrays were each specified with the same internal
  format.
• The level base arrays each have the same border width.

Previously the texture completeness code was only checking the first
point. This patch makes it additionally check the other two.

This fixes the following two dEQP tests:

deqp-gles2.functional.texture.completeness.cube.format_mismatch_rgba_rgb_level_0_neg_z
deqp-gles2.functional.texture.completeness.cube.format_mismatch_rgb_rgba_level_0_pos_z

And also this Piglit test:

spec/!opengl 2.0/incomplete-cubemap-format

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93792
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agor600g: don't leak driver const buffers
Grazvydas Ignotas [Wed, 20 Jan 2016 23:52:24 +0000 (01:52 +0200)]
r600g: don't leak driver const buffers

The buffers are referenced from r600_update_driver_const_buffers()
 -> r600_set_constant_buffer() -> u_upload_data(), but nothing
ever releases the reference. Similar case with driver_consts.
Found using valgrind.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB
Jeremy Huddleston Sequoia [Thu, 21 Jan 2016 01:10:54 +0000 (17:10 -0800)]
mesa: Deal with size differences between GLuint and GLhandleARB in GetAttachedObjectsARB

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Nicolai Hähnle <nhaehnle@gmail.com>
8 years agomesa: Fix format warnings
Jeremy Huddleston Sequoia [Thu, 21 Jan 2016 01:03:26 +0000 (17:03 -0800)]
mesa: Fix format warnings

main/shaderapi.c:1318:51: warning: format specifies type 'unsigned int' but the argument has type 'GLhandleARB' (aka 'unsigned long') [-Wformat]
      _mesa_debug(ctx, "glDeleteObjectARB(%u)\n", obj);
                                          ~~      ^~~
                                          %lu

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: Fix some function prototype mismatching
Jeremy Huddleston Sequoia [Thu, 21 Jan 2016 00:59:45 +0000 (16:59 -0800)]
mesa: Fix some function prototype mismatching

main/api_exec.c:543:36: warning: incompatible pointer types passing 'void (GLhandleARB, GLuint, const GLcharARB *)' (aka 'void (unsigned long, unsigned int, const char *)') to
parameter of
      type 'void (*)(GLuint, GLuint, const GLchar *)' (aka 'void (*)(unsigned int, unsigned int, const char *)') [-Wincompatible-pointer-types]
      SET_BindAttribLocation(exec, _mesa_BindAttribLocation);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~
./main/dispatch.h:7590:88: note: passing argument to parameter 'fn' here
static inline void SET_BindAttribLocation(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, const GLchar *)) {
                                                                                       ^
main/api_exec.c:547:31: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned
int)')
      [-Wincompatible-pointer-types]
      SET_CompileShader(exec, _mesa_CompileShader);
                              ^~~~~~~~~~~~~~~~~~~
./main/dispatch.h:7612:83: note: passing argument to parameter 'fn' here
static inline void SET_CompileShader(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
                                                                                  ^
main/api_exec.c:568:33: warning: incompatible pointer types passing 'void (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)' (aka 'void (unsigned long,
unsigned int,
      int, int *, int *, unsigned int *, char *)') to parameter of type 'void (*)(GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *)' (aka 'void (*)(unsigned int,
unsigned int,
      int, int *, int *, unsigned int *, char *)') [-Wincompatible-pointer-types]
      SET_GetActiveAttrib(exec, _mesa_GetActiveAttrib);
                                ^~~~~~~~~~~~~~~~~~~~~
./main/dispatch.h:7711:85: note: passing argument to parameter 'fn' here
static inline void SET_GetActiveAttrib(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLuint, GLsizei , GLsizei *, GLint *, GLenum *, GLchar *)) {
                                                                                    ^
main/api_exec.c:571:35: warning: incompatible pointer types passing 'GLint (GLhandleARB, const GLcharARB *)' (aka 'int (unsigned long, const char *)') to parameter of type
      'GLint (*)(GLuint, const GLchar *)' (aka 'int (*)(unsigned int, const char *)') [-Wincompatible-pointer-types]
      SET_GetAttribLocation(exec, _mesa_GetAttribLocation);
                                  ^~~~~~~~~~~~~~~~~~~~~~~
./main/dispatch.h:7744:88: note: passing argument to parameter 'fn' here
static inline void SET_GetAttribLocation(struct _glapi_table *disp, GLint (GLAPIENTRYP fn)(GLuint, const GLchar *)) {
                                                                                       ^
main/api_exec.c:585:33: warning: incompatible pointer types passing 'void (GLhandleARB, GLsizei, GLsizei *, GLcharARB *)' (aka 'void (unsigned long, int, int *, char *)') to
parameter of
      type 'void (*)(GLuint, GLsizei, GLsizei *, GLchar *)' (aka 'void (*)(unsigned int, int, int *, char *)') [-Wincompatible-pointer-types]
      SET_GetShaderSource(exec, _mesa_GetShaderSource);
                                ^~~~~~~~~~~~~~~~~~~~~
./main/dispatch.h:7788:85: note: passing argument to parameter 'fn' here
static inline void SET_GetShaderSource(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, GLsizei *, GLchar *)) {
                                                                                    ^
main/api_exec.c:597:29: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned
int)')
      [-Wincompatible-pointer-types]
      SET_LinkProgram(exec, _mesa_LinkProgram);
                            ^~~~~~~~~~~~~~~~~
./main/dispatch.h:7909:81: note: passing argument to parameter 'fn' here
static inline void SET_LinkProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
                                                                                ^
main/api_exec.c:628:30: warning: incompatible pointer types passing 'void (GLhandleARB, GLsizei, const GLcharARB *const *, const GLint *)' (aka
      'void (unsigned long, int, const char *const *, const int *)') to parameter of type 'void (*)(GLuint, GLsizei, const GLchar *const *, const GLint *)' (aka 'void (*)(unsigned
int, int,
      const char *const *, const int *)') [-Wincompatible-pointer-types]
      SET_ShaderSource(exec, _mesa_ShaderSource);
                             ^~~~~~~~~~~~~~~~~~
./main/dispatch.h:7920:82: note: passing argument to parameter 'fn' here
static inline void SET_ShaderSource(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint, GLsizei, const GLchar * const *, const GLint *)) {
                                                                                 ^
main/api_exec.c:653:28: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned
int)')
      [-Wincompatible-pointer-types]
      SET_UseProgram(exec, _mesa_UseProgram);
                           ^~~~~~~~~~~~~~~~
./main/dispatch.h:8173:80: note: passing argument to parameter 'fn' here
static inline void SET_UseProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
                                                                               ^
main/api_exec.c:655:33: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned
int)')
      [-Wincompatible-pointer-types]
      SET_ValidateProgram(exec, _mesa_ValidateProgram);
                                ^~~~~~~~~~~~~~~~~~~~~
./main/dispatch.h:8184:85: note: passing argument to parameter 'fn' here
static inline void SET_ValidateProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {

main/dlist.c:9457:26: warning: incompatible pointer types passing 'void (GLhandleARB)' (aka 'void (unsigned long)') to parameter of type 'void (*)(GLuint)' (aka 'void (*)(unsigned
int)')
      [-Wincompatible-pointer-types]
   SET_UseProgram(table, save_UseProgramObjectARB);
                         ^~~~~~~~~~~~~~~~~~~~~~~~
./main/dispatch.h:8173:80: note: passing argument to parameter 'fn' here
static inline void SET_UseProgram(struct _glapi_table *disp, void (GLAPIENTRYP fn)(GLuint)) {
                                                                               ^
1 warning generated.

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoglapi: Build glapi_gentable.c only on Darwin
Andreas Boll [Wed, 9 Dec 2015 12:41:22 +0000 (13:41 +0100)]
glapi: Build glapi_gentable.c only on Darwin

Removes the public symbol _glapi_create_table_from_handle from
libGL.so.1.2.0 on all platforms except Darwin.

Since the symbol is not used on other platforms it makes sense to
build glapi_gentable.c only on Darwin.

As a side effect it accelerates the build a bit and reduces the size
of libGL.so.1.2.0 as follows:

size lib/libGL.so.1.2.0 on my system shows
   text    data     bss     dec     hex filename
 469211   21848    2720  493779   788d3 lib/libGL.so.1.2.0 before
 420988   11240    2720  434948   6a304 lib/libGL.so.1.2.0 after

A little bit of history:

_glapi_create_table_from_handle was introduced in

commit 85937f4c0d4a78d3a11e3c1fa6148640f2a9ad7b
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Thu Jun 9 16:59:49 2011 -0700

    glapi: Add API that can create a _glapi_table from a dlfcn handle

    Example usage:

    void *handle = dlopen(opengl_library_path, RTLD_LOCAL);
    struct _glapi_table *disp = _glapi_create_table_from_handle(handle,
"gl");

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
and the only user in mesa was added in

commit f35913b96e743c5014e99220b1a1c5532a894d69
Author: Jeremy Huddleston <jeremyhu@apple.com>
Date:   Thu Jun 9 17:29:51 2011 -0700

    apple: Use _glapi_create_table_from_handle to initialize our
dispatch table

Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
gl_gentable.py was also used for XQuartz in xserver 1.11 - 1.14.

v2: Fix typos in commit message
    Add missing XORG_GLAPI_OUTPUTS += \ into src/mapi/glapi/gen/Makefile.am
    Add glapi_gentable.c to EXTRA_DIST for inclusion in the release
    tarball

v3: Fix commit message: s/gl_gentable.c/glapi_gentable.c/

Reported-by: Arlie Davis <arlied@google.com>
Cc: Jeremy Huddleston <jeremyhu@apple.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: Reduce libGL.so binary size by about 15%
Arlie Davis [Thu, 17 Sep 2015 22:19:24 +0000 (15:19 -0700)]
mesa: Reduce libGL.so binary size by about 15%

This patch significantly reduces the size of the libGL.so binary. It does
not change the (externally visible) behavior of libGL.so at all.

gl_gentable.py generates a function, _glapi_create_table_from_handle.
This function allocates a large dispatch table, consisting of 1300 or so
function pointers, and fills this dispatch table by doing symbol lookups
on a given shared library.  Previously, gl_gentable.py would generate a
single, very large _glapi_create_table_from_handle function, with a short
cluster of lines for each entry point (function).  The idiom it generates
was a NULL check, a call to snprintf, a call to dlsym / GetProcAddress,
and then a store into the dispatch table.  Since this function processes
a large number of entry points, this code is duplicated many times over.

We can encode the same information much more compactly, by using a lookup
table.  The previous total size of _glapi_create_table_from_handle on x64
was 125848 bytes.  By using a lookup table, the size of
_glapi_create_table_from_handle (and the related lookup tables) is reduced
to 10840 bytes.  In other words, this enormous function is reduced by 91%.
The size of the entire libGL.so binary (measured when stripped) itself drops
by 15%.

So the purpose of this change is to reduce the binary size, which frees up
disk space, memory, etc.

size lib/libGL.so.1.2.0 on my system shows (Andreas)
   text    data     bss     dec     hex filename
 565947   11256    2720  579923   8d953 lib/libGL.so.1.2.0 before
 469211   21848    2720  493779   788d3 lib/libGL.so.1.2.0 after

v2: Incorporate Matt's feedback.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Tested-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
8 years agonv50/ir: 64-bit splitting fixes
Ilia Mirkin [Tue, 19 Jan 2016 10:37:24 +0000 (05:37 -0500)]
nv50/ir: 64-bit splitting fixes

Take reading shader outputs into account, and use setFlagsDef for the
carry since we rely on having i->flagsDef being set.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogk110/ir: allow carry to be set/read by imad
Ilia Mirkin [Tue, 19 Jan 2016 10:30:56 +0000 (05:30 -0500)]
gk110/ir: allow carry to be set/read by imad

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogm107/ir: add carry emission to LOP and IADD
Ilia Mirkin [Tue, 19 Jan 2016 04:55:19 +0000 (23:55 -0500)]
gm107/ir: add carry emission to LOP and IADD

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogm107/ir: add ATOM and CCTL support
Ilia Mirkin [Sun, 3 Jan 2016 07:11:51 +0000 (02:11 -0500)]
gm107/ir: add ATOM and CCTL support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogm107/ir: set LD/ST address width bit
Ilia Mirkin [Sat, 7 Nov 2015 08:30:26 +0000 (03:30 -0500)]
gm107/ir: set LD/ST address width bit

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogk110/ir: fix double-wide vm address
Ilia Mirkin [Mon, 28 Dec 2015 20:59:03 +0000 (15:59 -0500)]
gk110/ir: fix double-wide vm address

8 years agogk110/ir: add OP_CCTL handling
Ilia Mirkin [Tue, 22 Sep 2015 23:13:14 +0000 (19:13 -0400)]
gk110/ir: add OP_CCTL handling

8 years agogk110/ir: add atomic op emission, fix gmem loads
Ilia Mirkin [Tue, 22 Sep 2015 00:00:36 +0000 (20:00 -0400)]
gk110/ir: add atomic op emission, fix gmem loads

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agollvmpipe: warn about illegal use of objects in different contexts
Roland Scheidegger [Tue, 19 Jan 2016 23:48:07 +0000 (00:48 +0100)]
llvmpipe: warn about illegal use of objects in different contexts

Doing that is clearly a bug. We can't quite assert as st/mesa may hit this,
but increase at least visibility of it a bit.
(For the non-refcounted objects it would be illegal too, but we can't detect
that unless we'd store the context ourselves. Plus, those don't tend to cause
random crashes at context or object destruction time... So just sampler views,
surfaces and so targets for now.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agollvmpipe,i915: add back NEW_RASTERIZER dependency when computing vertex info
Roland Scheidegger [Wed, 20 Jan 2016 23:04:56 +0000 (00:04 +0100)]
llvmpipe,i915: add back NEW_RASTERIZER dependency when computing vertex info

I removed this mistakenly in 2dbc20e45689e09766552517a74e2270e49817b5. I
actually thought it should not be necessary and a piglit run didn't show
any differences, but this shouldn't have been in there.
draw_prepare_shader_outputs() is in fact dependent on NEW_RASTERIZER.
The new polygon-mode-facing test indeed shows why this is necessary, there's
lots of invalid reads and writes with valgrind (also crashes without
valgrind), because the pre-pipeline vertex size doesn't match the
post-pipeline vertex size (note this won't help much with stages which don't
have the prepare hook which can grow the vertex size, in particular the wide
point stage, but this isn't used by llvmpipe). The test still won't pass, of
course, but it is only usage of uninitialized values now, which is much
less dangerous...
(Albeit I'm pretty sure for i915 it really is not needed anymore as it
doesn't care about the extra outputs and doesn't call
draw_prepare_shader_outputs().)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonv50/ir: don't flip SHL(ADD) into ADD(SHL) if ADD sources have modifiers
Ilia Mirkin [Wed, 20 Jan 2016 22:59:34 +0000 (17:59 -0500)]
nv50/ir: don't flip SHL(ADD) into ADD(SHL) if ADD sources have modifiers

Fixes: 31fde8fa (nv50/ir: flip shl(add, imm) into add(shl, imm))
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogk110/ir: fix load from shared memory
Ilia Mirkin [Wed, 20 Jan 2016 22:15:27 +0000 (17:15 -0500)]
gk110/ir: fix load from shared memory

It was accidentally using the store opcode.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogk110/ir: add partial BAR support
Ilia Mirkin [Wed, 20 Jan 2016 22:12:59 +0000 (17:12 -0500)]
gk110/ir: add partial BAR support

This is enough for the plain TGSI BARRIER implementation.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoRevert "glsl: move uniform calculation to link_uniforms"
Tapani Pälli [Wed, 20 Jan 2016 20:02:22 +0000 (22:02 +0200)]
Revert "glsl: move uniform calculation to link_uniforms"

This reverts commit 4475d8f9169195baefa893b9b147fe20414cda7c.

8 years agoglsl: move uniform calculation to link_uniforms
Tapani Pälli [Fri, 15 Jan 2016 11:11:20 +0000 (13:11 +0200)]
glsl: move uniform calculation to link_uniforms

Patch moves uniform calculation to happen during link_uniforms, this
is possible with help of UniformRemapTable that has all the reserved
locations.

Location assignment for implicit locations is changed so that we
utilize also the 'holes' that explicit uniform location assignment
might have left in UniformRemapTable, this makes it possible to fit
more uniforms as previously we were lazy here and wasting space.

Fixes following CTS tests:
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
   ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

v2: code cleanups, increment NumUniformRemapTable correctly, fix
    find_empty_block to work properly and add some more comments.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoglsl: add missing explicit_image_format flag to has_layout()
Timothy Arceri [Tue, 19 Jan 2016 23:49:54 +0000 (10:49 +1100)]
glsl: add missing explicit_image_format flag to has_layout()

Fixes piglit regression after fixes to duplicate layout rules.

Previously catching multiple layouts was relying on the code
meant to catch duplicates within a single layout(...), this
change triggers the rules for multiple layouts.

Cc: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agollvmpipe: turn depth clears into full depth/stencil clears for d24x8 formats
Roland Scheidegger [Mon, 18 Jan 2016 03:29:22 +0000 (04:29 +0100)]
llvmpipe: turn depth clears into full depth/stencil clears for d24x8 formats

If we have a d24x8 format, there is no stencil. Therefore, we can always
clear these bits too, which means this will be some kind of memset rather
than read-modify-write.
This is good for some 7% increase or so in gears with huge window size -
seems to have a bigger effect if things aren't in caches. Of course, any
real app won't spend nearly as much time comparatively in clearing
depth buffer in the first place, so the speedup will be much lower.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoi965: Implement compute sampler state atom.
Francisco Jerez [Sat, 16 Jan 2016 23:11:03 +0000 (15:11 -0800)]
i965: Implement compute sampler state atom.

Fixes a number of GLES31 CTS failures and hangs on various hardware:

 ES31-CTS.texture_gather.plain-gather-depth-2d
 ES31-CTS.texture_gather.plain-gather-depth-2darray
 ES31-CTS.texture_gather.plain-gather-depth-cube
 ES31-CTS.texture_gather.offset-gather-depth-2d
 ES31-CTS.texture_gather.offset-gather-depth-2darray
 ES31-CTS.layout_binding.sampler2D_layout_binding_texture_ComputeShader
 ES31-CTS.layout_binding.sampler2DArray_layout_binding_texture_ComputeShader
 ES31-CTS.explicit_uniform_location.uniform-loc-types-samplers
 ES31-CTS.compute_shader.resources-texture

Some of them were actually passing by luck on some generations even
though we weren't uploading sampler state tables explicitly for the
compute stage, most likely because they relied on the cached sampler
state left from previous rendering to be close enough.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92589
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93312
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93325
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93407
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93725
Reported-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Trigger CS state reemission when new sampler state is uploaded.
Francisco Jerez [Sat, 16 Jan 2016 23:05:51 +0000 (15:05 -0800)]
i965: Trigger CS state reemission when new sampler state is uploaded.

This reuses the NEW_SAMPLER_STATE_TABLE state bit (currently only used
on pre-Gen7 hardware) to signal that the sampler state tables have
changed in order to make sure that the GPGPU interface descriptor is
updated.

Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoglsl: Don't abbreviate tessellation shader stage names.
Kenneth Graunke [Fri, 1 Jan 2016 00:28:08 +0000 (16:28 -0800)]
glsl: Don't abbreviate tessellation shader stage names.

I have a patch that writes shaders as .shader_test files, and it uses
this function to create the headers (i.e. [vertex shader]).

[tess ctrl shader] isn't a valid shader_runner header - it's spelled
out as [tessellation control shader].

There's no real reason to abbreviate it, so spell it out.

v2: Rebase on Rob's patches to move the code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agomesa: remove link validation that should be done elsewhere
Timothy Arceri [Wed, 6 Jan 2016 01:40:12 +0000 (12:40 +1100)]
mesa: remove link validation that should be done elsewhere

Even if re-linking fails rendering shouldn't fail as the previous
succesfully linked program will still be available. It also shouldn't
be possible to have an unlinked program as part of the current rendering
state.

This fixes a subtest in:
ES31-CTS.sepshaderobjs.StateInteraction

This change should improve performance on CPU limited benchmarks as noted
in commit d6c6b186cf308f.

>From Section 7.3 (Program Objects) of the OpenGL 4.5 spec:

   "If a program object that is active for any shader stage is re-linked
    unsuccessfully, the link status will be set to FALSE, but any existing
    executables and associated state will remain part of the current rendering
    state until a subsequent call to UseProgram, UseProgramStages, or
    BindProgramPipeline removes them from use. If such a program is attached to
    any program pipeline object, the existing executables and associated state
    will remain part of the program pipeline object until a subsequent call to
    UseProgramStages removes them from use. An unsuccessfully linked program may
    not be made part of the current rendering state by UseProgram or added to
    program pipeline objects by UseProgramStages until it is successfully
    re-linked."

   "void UseProgram(uint program);

   ...

   An INVALID_OPERATION error is generated if program has not been linked, or
   was last linked unsuccessfully.  The current rendering state is not modified."

V2: apply the rule to both core and compat.

Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoglsl: allow multiple layout qualifiers for a single declaration
Timothy Arceri [Fri, 15 Jan 2016 01:43:10 +0000 (12:43 +1100)]
glsl: allow multiple layout qualifiers for a single declaration

From the ARB_shading_language_420pack spec:

   "More than one layout qualifier may appear in a single
   declaration. If the same layout-qualifier-name occurs in
   multiple layout qualifiers for the same declaration, the
   last one overrides the former ones."

The parser was already failing correctly when the extension is
not available but testing for duplicates within a single layout
qualifier was still causing this to fail when available as both
cases share the same function for merging.

Here we add a parameter to differentiate between the two uses
and apply it to the duplicate test.

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoglsl: update parser to allow duplicate default layout qualifiers
Timothy Arceri [Mon, 18 Jan 2016 06:06:57 +0000 (17:06 +1100)]
glsl: update parser to allow duplicate default layout qualifiers

In order to only create a single node for each default declaration
we add a new boolean parameter to the in/out merge function to
only create one once we reach the rightmost layout qualifier.

From the ARB_shading_language_420pack spec:

   "More than one layout qualifier may appear in a single
   declaration. If the same layout-qualifier-name occurs in
   multiple layout qualifiers for the same declaration, the
   last one overrides the former ones."

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoglsl: move default layout qualifier rules out of the parser
Timothy Arceri [Mon, 18 Jan 2016 08:13:03 +0000 (19:13 +1100)]
glsl: move default layout qualifier rules out of the parser

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoglsl: split layout_defaults into specific types
Timothy Arceri [Mon, 18 Jan 2016 05:09:06 +0000 (16:09 +1100)]
glsl: split layout_defaults into specific types

This will allow merging of duplicate layout qualifiers as allowed
by ARB_shading_language_420pack

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoglsl: allow duplicate layout-qualifier-names
Timothy Arceri [Fri, 15 Jan 2016 00:01:25 +0000 (11:01 +1100)]
glsl: allow duplicate layout-qualifier-names

This is added by ARB_enhanced_layouts although it doesn't fit
into any of the six main changes so we enable this independently.

From the ARB_enhanced_layouts spec:

   "More than one layout qualifier may appear in a single
   declaration. Additionally, the same layout-qualifier-name
   can occur multiple times within a layout qualifier or across
   multiple layout qualifiers in the  same declaration"

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
8 years agoi965/vec4: Spaces around operators.
Matt Turner [Tue, 19 Jan 2016 20:12:38 +0000 (12:12 -0800)]
i965/vec4: Spaces around operators.

8 years agoi965: Inform compiler of variable range to silence warning.
Matt Turner [Fri, 15 Jan 2016 21:38:46 +0000 (13:38 -0800)]
i965: Inform compiler of variable range to silence warning.

Extends commit 6531ccb70 to silence the warning in release builds as
well.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglsl: Restore Mesa-style to shader_enums.c/h.
Matt Turner [Fri, 15 Jan 2016 21:31:34 +0000 (13:31 -0800)]
glsl: Restore Mesa-style to shader_enums.c/h.

8 years agost/va: fix motion adaptive deinterlacing
Christian König [Mon, 18 Jan 2016 19:56:06 +0000 (20:56 +0100)]
st/va: fix motion adaptive deinterlacing

Signed-off-by: Christian König <christian.koenig@amd.com>
8 years agoutil/u_pstipple.c: copy immediates during transformation
Nicolai Hähnle [Fri, 15 Jan 2016 21:56:15 +0000 (16:56 -0500)]
util/u_pstipple.c: copy immediates during transformation

Apparently, nobody has combined stippling with a fragment shader
containing immediates in almost five years...

Fixes a bug in Kodi with radeonsi reported by Christian König.

Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Tested-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: Move sanity check of BindVertexBuffer for OpenGL ES 3.1
Marta Lofstedt [Fri, 8 Jan 2016 13:55:55 +0000 (14:55 +0100)]
mesa: Move sanity check of BindVertexBuffer for OpenGL ES 3.1

Sanity check of BindVertexBuffer for OpenGL ES in
_mesa_handle_bind_buffer_gen breaks OpenGL ES 2 conformance.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93426
Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: fix interface block error message
Timothy Arceri [Tue, 19 Jan 2016 03:35:50 +0000 (14:35 +1100)]
glsl: fix interface block error message

Print the stream value not the pointer to the expression,
also use the unsigned format specifier.

Cc: 11.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: swap the least-ref'd source into src1 when both const/imm
Ilia Mirkin [Mon, 18 Jan 2016 03:28:19 +0000 (22:28 -0500)]
nv50/ir: swap the least-ref'd source into src1 when both const/imm

The whole point of inlining sources is to reduce loads. We can end up in
a situation where one value is used a lot of times, and one value is
used only once per instruction. The once-per-instruction one is the one
that should get inlined, but with the previous algorithm, it was given
no preference.

This flips things around to preferring putting less-referenced values
into src1 which increases the likelihood of them being inlined.

While we're at it, adjust the heuristic to not treat 0 as an immediate,
as well as (effectively) check for situations where LIMMs can't be
loaded. All this yields improvements on nvc0:

total instructions in shared programs : 6261157 -> 6255985 (-0.08%)
total gprs used in shared programs    : 945082 -> 943417 (-0.18%)
total local used in shared programs   : 30372 -> 30288 (-0.28%)
total bytes used in shared programs   : 50089256 -> 50047880 (-0.08%)

                local        gpr       inst      bytes
    helped          21         822        3332        3332
      hurt           0         278         565         565

And more importantly avoids generating really bad code with SSBOs, where
we end up checking a lot of different values (usually immediates) against
the length.

On nv50 we get comparable results, and even improve packing (bytes went
down more than instructions):

total instructions in shared programs : 6346564 -> 6341277 (-0.08%)
total gprs used in shared programs    : 728719 -> 725131 (-0.49%)
total local used in shared programs   : 3552 -> 3552 (0.00%)
total bytes used in shared programs   : 43995688 -> 43932928 (-0.14%)

                local        gpr       inst      bytes
    helped           0        1380        3252        3774
      hurt           0         287        1710        1365

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: restore the stObj's size if it was cleared out
Ilia Mirkin [Sun, 17 Jan 2016 21:25:00 +0000 (16:25 -0500)]
st/mesa: restore the stObj's size if it was cleared out

An issue could still occur if the base level is set, but fixing that
would require a lot more logic.

This fixes the recently-failing texelFetch 3D tests because the mipmaps
were no longer being generated, which in turn caused the copying logic
to be hit, which in turn didn't work because of the broken
width/height/depth.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agofreedreno/a4xx: use smaller threadsize for more registers
Rob Clark [Mon, 18 Jan 2016 20:30:53 +0000 (15:30 -0500)]
freedreno/a4xx: use smaller threadsize for more registers

Once we go past half of the "GPR" register file, it seems like we need
to run frag shader with smaller threadsize.  (The vertex shader already
runs at TWO_QUADS, which is the minimum.)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno: per-generation OUT_IB packet
Rob Clark [Mon, 18 Jan 2016 20:22:27 +0000 (15:22 -0500)]
freedreno: per-generation OUT_IB packet

Some a4xx firmware doesn't implement the "PFD" (prefetch-disabled)
version of the CP_INDIRECT_BUFFER packet.  So allow for PFD vs PFE per
generation.  Switch a3xx and a4xx over to using prefetch-enabled version
(which is also what blob does.. it seems only on a2xx we cannot use
PFE).

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium: bundle the compat header u_pwr8.h in the tarball
Emil Velikov [Mon, 18 Jan 2016 11:34:14 +0000 (13:34 +0200)]
gallium: bundle the compat header u_pwr8.h in the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agomapi: include gl.xml in the tarball
Emil Velikov [Mon, 18 Jan 2016 11:06:28 +0000 (13:06 +0200)]
mapi: include gl.xml in the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agoi965: adding missing headers to the dist tarball
Emil Velikov [Thu, 14 Jan 2016 07:28:21 +0000 (09:28 +0200)]
i965: adding missing headers to the dist tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
8 years agost/va: add motion adaptive deinterlacing v2
Christian König [Sun, 13 Dec 2015 10:44:13 +0000 (11:44 +0100)]
st/va: add motion adaptive deinterlacing v2

v2: minor cleanup

Signed-off-by: Christian König <christian.koenig@amd.com>
8 years agogallium/radeon: Rename do_invalidate_resource to invalidate_buffer
Michel Dänzer [Fri, 15 Jan 2016 07:02:22 +0000 (16:02 +0900)]
gallium/radeon: Rename do_invalidate_resource to invalidate_buffer

And only call it from r600_invalidate_resource for buffer resources.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agost/dri: Don't call invalidate_resource for NULL depth/stencil buffers
Michel Dänzer [Fri, 15 Jan 2016 06:46:31 +0000 (15:46 +0900)]
st/dri: Don't call invalidate_resource for NULL depth/stencil buffers

Fixes crash in 4 EGL piglit tests with radeonsi.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: Avoid warning about LLVM generating R_0286D0_SPI_PS_INPUT_ADDR
Michel Dänzer [Fri, 15 Jan 2016 03:18:29 +0000 (12:18 +0900)]
radeonsi: Avoid warning about LLVM generating R_0286D0_SPI_PS_INPUT_ADDR

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: Print "LLVM emitted unknown config register" warning only once
Michel Dänzer [Fri, 15 Jan 2016 03:13:15 +0000 (12:13 +0900)]
radeonsi: Print "LLVM emitted unknown config register" warning only once

Say "LLVM" instead of "Compiler" for clarity.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agollvmpipe: use vpkswss when dst is signed
Oded Gabbay [Sun, 17 Jan 2016 20:15:40 +0000 (22:15 +0200)]
llvmpipe: use vpkswss when dst is signed

This patch fixes a bug when building a pack instruction.

For POWER (altivec), in case the destination is signed and the
src width is 32, we need to use vpkswss. The original code used vpkuwus,
which emits an unsigned result.

This fixes the following piglit tests on ppc64le:
- spec@arb_color_buffer_float@gl_rgba8-drawpixels
- shaders@glsl-fs-fogscale

I've also corrected some coding style issues in the function.

v2: Returned else statements to vmware style

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoglsl: fix subroutine lowering reusing actual parmaters
Dave Airlie [Sun, 17 Jan 2016 04:23:35 +0000 (14:23 +1000)]
glsl: fix subroutine lowering reusing actual parmaters

One of the oglconform tests was crashing here, and it was
due to not cloning the actual parameters before creating the
new call. This makes a call clone function that does the right
things to make sure we clone all the needed info, and points
the callee at it. (It differs from ->clone due to this).

this may fix https://bugs.freedesktop.org/show_bug.cgi?id=93722, I had this
patch in my cts fixes tree, but hadn't had time to make sure I liked it.

Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglsl: remove special case for detecting stream duplicates
Timothy Arceri [Fri, 15 Jan 2016 02:45:49 +0000 (13:45 +1100)]
glsl: remove special case for detecting stream duplicates

Any duplicates in a single declaration will already fail the
generic duplicates test due to the explicit_stream flag being set.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoglsl: add missing explicit_stream flag to has_layout()
Timothy Arceri [Fri, 15 Jan 2016 02:45:48 +0000 (13:45 +1100)]
glsl: add missing explicit_stream flag to has_layout()

This will allow the ARB_shading_language_420pack rules in
glsl_parser.yy for catching duplicate layout qualifiers to be
triggered for the stream identifier rather than relying on the
code meant to catch duplicates within a single layout(...)

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agomesa: fix segfault in glUniformSubroutinesuiv()
Timothy Arceri [Sun, 17 Jan 2016 05:09:08 +0000 (16:09 +1100)]
mesa: fix segfault in glUniformSubroutinesuiv()

From Section 7.9 (SUBROUTINE UNIFORM VARIABLES) of the OpenGL
4.5 Core spec:

   "The command

       void UniformSubroutinesuiv(enum shadertype, sizei count,
                                  const uint *indices);

   will load all active subroutine uniforms for shader stage
   shadertype with subroutine indices from indices, storing
   indices[i] into the uniform at location i. The indices for
   any locations between zero and the value of
   ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS minus one which are not
   used will be ignored."

V2: simplify NULL check suggested by Jason.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "11.0 11.1" mesa-stable@lists.freedesktop.org
https://bugs.freedesktop.org/show_bug.cgi?id=93731

8 years agoglsl: fix segfault linking subroutine uniform with explicit location
Timothy Arceri [Mon, 18 Jan 2016 00:13:27 +0000 (11:13 +1100)]
glsl: fix segfault linking subroutine uniform with explicit location

Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: "11.0 11.1" mesa-stable@lists.freedesktop.org
8 years agogm107/ir: don't do indirect frag shader inputs on GM107
Ilia Mirkin [Sun, 17 Jan 2016 21:24:02 +0000 (16:24 -0500)]
gm107/ir: don't do indirect frag shader inputs on GM107

Apparently the IPA op decided to stop working with offsets. Need to
figure out if we need to do an AL2P situation or something similar. For
now just turn it back off.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agotgsi: initialize Atomic field in tgsi_default_declaration
Ilia Mirkin [Sun, 17 Jan 2016 08:44:22 +0000 (03:44 -0500)]
tgsi: initialize Atomic field in tgsi_default_declaration

Spotted by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonvc0: bsp_bo can't be null
Ilia Mirkin [Sun, 17 Jan 2016 08:41:55 +0000 (03:41 -0500)]
nvc0: bsp_bo can't be null

We already deref it earlier. And these are all allocated on load.
Spotted by Coverity.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agollvmpipe: fix arguments order given to vec_andc
Oded Gabbay [Sun, 17 Jan 2016 12:25:32 +0000 (14:25 +0200)]
llvmpipe: fix arguments order given to vec_andc

This patch fixes a classic "confuse the enemy" bug.

_mm_andnot_si128 (SSE) and vec_andc (VMX) do the same operation, but the
arguments are opposite.

_mm_andnot_si128 performs "r = (~a) & b" while
vec_andc performs "r = a & (~b)"

To make sure this error won't return in another place, I added a wrapper
function, vec_andnot_si128, in u_pwr8.h, which makes the swap inside.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agofreedreno/ir3: fix mad 3rd src delay calc
Rob Clark [Sun, 17 Jan 2016 17:21:45 +0000 (12:21 -0500)]
freedreno/ir3: fix mad 3rd src delay calc

In fad158a0 ("freedreno/ir3: array rework") the src # (n) shifted by
one, but missed updating delay-slot calc.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: better array register allocation
Rob Clark [Sat, 16 Jan 2016 00:45:51 +0000 (19:45 -0500)]
freedreno/ir3: better array register allocation

Detect arrays which don't conflict with each other and allow overlapping
register allocation.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: array offset can be negative
Rob Clark [Fri, 15 Jan 2016 23:22:40 +0000 (18:22 -0500)]
freedreno/ir3: array offset can be negative

It at least happens with some piglit tests, like
$piglit/bin/vp-address-01

  VERT
  DCL IN[0]
  DCL IN[1]
  DCL OUT[0], POSITION
  DCL OUT[1], COLOR
  DCL CONST[0..7]
  DCL ADDR[0]
    0: ARL ADDR[0].x, IN[1].xxxx
    1: MOV_SAT OUT[1], CONST[ADDR[0].x-1]
    2: DP4 OUT[0].x, CONST[4], IN[0]
    3: DP4 OUT[0].y, CONST[5], IN[0]
    4: DP4 OUT[0].z, CONST[6], IN[0]
    5: DP4 OUT[0].w, CONST[7], IN[0]
    6: END

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: workaround bug/feature
Rob Clark [Fri, 15 Jan 2016 22:07:02 +0000 (17:07 -0500)]
freedreno/ir3: workaround bug/feature

Seems like in certain cases, we cannot use c<a0.x+0> as the third src to
cat3 instructions.  This may be slightly conservative, we may only have
this restriction when the first src is also const.

This fixes, for example, +24/-0 of the variable-indexing piglit tests.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agottn: use writemask for store_var
Rob Clark [Tue, 12 Jan 2016 15:24:10 +0000 (10:24 -0500)]
ttn: use writemask for store_var

Only user is freedreno, and after array-rework it can cope.  Avoids
generating loads for a store.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: array rework
Rob Clark [Sun, 10 Jan 2016 19:10:08 +0000 (14:10 -0500)]
freedreno/ir3: array rework

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: refactor/simplify cp
Rob Clark [Sun, 10 Jan 2016 16:03:46 +0000 (11:03 -0500)]
freedreno/ir3: refactor/simplify cp

If we handle separately the special case of eliminating output mov
(which includes keeps and various other cases where we don't have a
consuming instruction's src register to collapse things into), we
can simplify the logic.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: fix incorrect decoding of mov instructions
Rob Clark [Wed, 13 Jan 2016 18:07:51 +0000 (13:07 -0500)]
freedreno/ir3: fix incorrect decoding of mov instructions

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: remove unused tgsi tokens ptr
Rob Clark [Sat, 9 Jan 2016 19:46:36 +0000 (14:46 -0500)]
freedreno/ir3: remove unused tgsi tokens ptr

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: bit of ra refactor
Rob Clark [Wed, 6 Jan 2016 19:08:34 +0000 (14:08 -0500)]
freedreno/ir3: bit of ra refactor

Shuffle things slightly, passing instr-data to ra_name() to reduce the
number of places where we need to add support for array names.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: cosmetic de-indent
Rob Clark [Wed, 6 Jan 2016 18:32:24 +0000 (13:32 -0500)]
freedreno/ir3: cosmetic de-indent

Collapse two nested if's into one to reduce indent level.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agottn: add missing writemask on store_output
Rob Clark [Wed, 13 Jan 2016 23:39:56 +0000 (18:39 -0500)]
ttn: add missing writemask on store_output

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir/print: const_index is signed
Rob Clark [Fri, 15 Jan 2016 23:24:11 +0000 (18:24 -0500)]
nir/print: const_index is signed

Noticed this with $piglit/bin/vp-address-01

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: few missing struct names
Rob Clark [Mon, 4 Jan 2016 18:24:08 +0000 (13:24 -0500)]
nir: few missing struct names

nir.h is a bit inconsistent about 'typedef struct {} nir_foo' vs
'typedef struct nir_foo {} nir_foo'.  But missing struct name tags is
inconvenient when you need a fwd declaration without pulling in all
of nir.

So add missing struct name tag for nir_variable, and a couple other
spots where it would likely be useful.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agonv50/ir: add saturate support on ex2
Ilia Mirkin [Fri, 15 Jan 2016 22:12:27 +0000 (17:12 -0500)]
nv50/ir: add saturate support on ex2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agogallivm: avoid crashing in mod by 0 with llvmpipe
Jeff Muizelaar [Sat, 16 Jan 2016 02:35:26 +0000 (03:35 +0100)]
gallivm: avoid crashing in mod by 0 with llvmpipe

This adds code that is basically the same as the code in umod, udiv and idiv.
However, unlike idiv we return -1.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoglsl: Allow implicit int -> uint conversions for bitwise operators (&, ^, |).
Kenneth Graunke [Fri, 15 Jan 2016 07:27:03 +0000 (23:27 -0800)]
glsl: Allow implicit int -> uint conversions for bitwise operators (&, ^, |).

The ARB has decided that implicit conversions should be performed for
bitwise operators in future language revisions.  Implementations of
current language revisions may or may not perform them.

This patch makes Mesa apply implicti conversions even on current
language versions.  Applications appear to expect this behavior,
and there's really no downside to doing so.

Fixes shader compilation in Shadow of Mordor.

Bugzilla: https://www.khronos.org/bugzilla/show_bug.cgi?id=1405
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoi965/fs: Always set channel 2 of texture headers in some stages
Jason Ekstrand [Fri, 15 Jan 2016 04:42:47 +0000 (20:42 -0800)]
i965/fs: Always set channel 2 of texture headers in some stages

In the vertex and fragment stages, the hardware is nice to us and leaves
g0.2 zerod out for us so we can use it for headers.  However, in compute,
geometry, and tessellation stages, the hardware is not so nice.  In
particular, for compute shaders on BDW, the hardware places some debug bits
in 23:15.  As it happens, bit 15 is interpreted by the sampler as the alpha
channel mask.  This means that if you use a texturing instruction with a
header in a compute shader, you may randomly get the alpha channel
disabled.  Since channel masks affect the return length of the sampler
message, this can lead the GPU to expect a different mlen to the one you
specified in the shader and this, in turn, hangs your GPU.

Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/fs/generator: Take an actual shader stage rather than a string
Jason Ekstrand [Fri, 15 Jan 2016 04:27:51 +0000 (20:27 -0800)]
i965/fs/generator: Take an actual shader stage rather than a string

Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965/vec4: Use UW type for multiply into accumulator on GEN8+
Jason Ekstrand [Thu, 14 Jan 2016 20:08:57 +0000 (12:08 -0800)]
i965/vec4: Use UW type for multiply into accumulator on GEN8+

BDW adds the following restriction: "When multiplying DW x DW, the dst
cannot be accumulator."

Cc: "11.1,11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agollvmpipe: ditch additional ref counting for vertex/geometry sampler views
Roland Scheidegger [Fri, 15 Jan 2016 02:10:40 +0000 (03:10 +0100)]
llvmpipe: ditch additional ref counting for vertex/geometry sampler views

The cleaning up was quite a performance hog (making pipe_resource_reference
the number two in profilers on the vertex path, and 3rd overall, with its
cousin pipe_reference_described not far behind) if there were lots
of tiny draw calls (ipers). Now the reason was really that it was blindly
calling this for all potential shader views (so 32 each for vs and gs) even
though the app never touched a single one which could have been fixed,
however I can't come up with a good reason why we refcount these. We've got
references, of course, in the sampler views, which should be quite sufficient
as we do all vertex and geometry shader execution fully synchronous.
(Calling prepare_shader_sampling for all draw calls even if there were no
changes looks quite suboptimal too, but generally we don't really expect vs/gs
shader sampling to be used much with llvmpipe, and there's even an early exit
if there aren't any views to avoid the "null loop" albeit it's now no longer
always trying to loop through all 32 slots. Maybe improve another time...).
Of course, if we manage to make vertex loads run asynchronously some day,
we need references again, but adding that back would be the least of the
problems...
Also only set LP_NEW_SAMPLER_VIEW for fragment sampler views. Nothing on the
vertex side depends on it (I suppose we'd really wanted a separate flag in
any case).
(Good for a 3% improvement or so in ipers under the right conditions.)

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agollvmpipe: fix "leaking" textures
Roland Scheidegger [Fri, 15 Jan 2016 19:12:24 +0000 (20:12 +0100)]
llvmpipe: fix "leaking" textures

This was not really a leak per se, but we were referencing the textures for
longer than intended. If textures were set via llvmpipe_set_sampler_views()
(for fs) and then picked up by lp_setup_set_fragment_sampler_views(), they
were referenced in the setup state. However, the only way to unreference them
was by replacing them with another texture, and not when the texture slot
was replaced with a NULL sampler view. (They were then further also referenced
by the scene too which might have additional minor side effects as we limit
the memory size which is allowed to be referenced by a scene in a rather crude
way.) Only setup destruction (at context destruction time) then finally would
get rid of the references.
Fix this by noting the number of textures the last time, and unreference
things if the new view is NULL (avoiding having to unreference things
always up to PIPE_MAX_SHADER_SAMPLER_VIEWS which would also have worked).
Found by code inspection, no test...

v2: rename var

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoglsl: restrict consumer stage condition to modify interpolation type
Samuel Iglesias Gonsálvez [Tue, 12 Jan 2016 14:36:56 +0000 (15:36 +0100)]
glsl: restrict consumer stage condition to modify interpolation type

Only modify interpolation type for integer-based varyings or when the
consumer is known and different than fragment shader.

If we are linking separate shader programs and the consumer is unknown,
the consumer could be added later and be a fragment shader. If we
modify the interpolation type in this case, we could read wrong
values in the fragment shader inputs, as shown in bug 93320.

Fixes the following CTS test:
   ES31-CTS.vertex_attrib_binding.advanced-bindingUpdate

Fixes the following dEQP tests:

dEQP-GLES31.functional.separate_shader.random.102
dEQP-GLES31.functional.separate_shader.random.111
dEQP-GLES31.functional.separate_shader.random.115
dEQP-GLES31.functional.separate_shader.random.17
dEQP-GLES31.functional.separate_shader.random.22
dEQP-GLES31.functional.separate_shader.random.23
dEQP-GLES31.functional.separate_shader.random.3
dEQP-GLES31.functional.separate_shader.random.32
dEQP-GLES31.functional.separate_shader.random.39
dEQP-GLES31.functional.separate_shader.random.64
dEQP-GLES31.functional.separate_shader.random.73
dEQP-GLES31.functional.separate_shader.random.91

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93320
Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoi965: Apply add_const_offset_to_base for vec4 VS inputs too.
Kenneth Graunke [Wed, 13 Jan 2016 23:07:18 +0000 (15:07 -0800)]
i965: Apply add_const_offset_to_base for vec4 VS inputs too.

This shouldn't hurt anything, and I'm about to introduce a pass that
will want it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Make add_const_offset_to_base() work at the shader level.
Kenneth Graunke [Wed, 13 Jan 2016 23:04:39 +0000 (15:04 -0800)]
i965: Make add_const_offset_to_base() work at the shader level.

This makes it a pass, hiding the parameter structs and block callbacks
so it's simpler to work with.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Make an is_scalar boolean in brw_compile_vs().
Kenneth Graunke [Wed, 13 Jan 2016 23:23:48 +0000 (15:23 -0800)]
i965: Make an is_scalar boolean in brw_compile_vs().

Shorter than compiler->scalar_stage[MESA_SHADER_VERTEX], which can
help with line-wrapping.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir/builder: Add a nir_build_ivec4() convenience helper.
Kenneth Graunke [Wed, 13 Jan 2016 21:32:44 +0000 (13:32 -0800)]
nir/builder: Add a nir_build_ivec4() convenience helper.

nir_build_ivec4 is more readable and succinct than using nir_build_imm
directly, even if you have C99.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: mark explicit uniforms as explicit in other stages too
Tapani Pälli [Thu, 14 Jan 2016 12:10:59 +0000 (14:10 +0200)]
glsl: mark explicit uniforms as explicit in other stages too

If shader declares uniform explicit location in one stage but
implicit in another, explicit location should be used. Patch marks
implicit uniforms as explicit if they were explicit in previous stage.
This makes sure that we don't treat them implicit later when assigning
locations.

Fixes following CTS test:
   ES31-CTS.explicit_uniform_location.uniform-loc-implicit-in-some-stages3

v2: move check to cross_validate_globals (Timothy)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoi965/gen7.5+: Disable resource streamer during GPGPU workloads.
Francisco Jerez [Sun, 3 Jan 2016 18:06:52 +0000 (10:06 -0800)]
i965/gen7.5+: Disable resource streamer during GPGPU workloads.

The RS and hardware binding tables are only supported on the 3D
pipeline and can lead to corruption if left enabled during a GPGPU
workload.  Disable it when switching to the GPGPU (or media) pipeline
and re-enable it when switching back to the 3D pipeline.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
8 years agoi965/gen7: Emit stall and dummy primitive draw after switching to the 3D pipeline.
Francisco Jerez [Sun, 3 Jan 2016 03:06:48 +0000 (19:06 -0800)]
i965/gen7: Emit stall and dummy primitive draw after switching to the 3D pipeline.

This hardware bug can supposedly lead to a hang on IVB and VLV.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>