mesa.git
8 years agottn: Whitelist from -Werror=declaration-after-statement.
Jose Fonseca [Wed, 2 Dec 2015 17:54:45 +0000 (17:54 +0000)]
ttn: Whitelist from -Werror=declaration-after-statement.

nir is the exception among gallium/auxiliary -- we don't need to compile
it with MSVC2008 yet.  And this enables us to use
-Werror=declaration-after-statement in the next commit as we should,
without complicated fixes to tgsi_to_nir module.

Trvial.  Tested with GCC and Clang.

8 years agomesa: rework the meaning of gl_debug_message::length
Emil Velikov [Thu, 26 Nov 2015 00:36:17 +0000 (00:36 +0000)]
mesa: rework the meaning of gl_debug_message::length

Currently it stores strlen(buf) whenever the user originally provided a
negative value for length.

Although I've not seen any explicit text in the spec, CTS requires that
the very same length (be that negative value or not) is returned back on
Pop.

So let's push down the length < 0 checks, tweak the meaning of
gl_debug_message::length and fix GetDebugMessageLog to add and count the
null terminators, as required by the spec.

v2: return correct total length in GetDebugMessageLog
v3: rebase (drop _mesa_shader_debug hunk).

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: errors: validate the length of null terminated string
Emil Velikov [Thu, 26 Nov 2015 00:36:16 +0000 (00:36 +0000)]
mesa: errors: validate the length of null terminated string

We're about to rework the meaning of gl_debug_message::length to only
store the user provided data. Thus we should add an explicit validation
for null terminated strings.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: accept TYPE_PUSH/POP_GROUP with glDebugMessageInsert
Emil Velikov [Thu, 26 Nov 2015 00:36:15 +0000 (00:36 +0000)]
mesa: accept TYPE_PUSH/POP_GROUP with glDebugMessageInsert

These new (relative to ARB_debug_output) tokens, have been explicitly
separated from the existing ones in the spec text. With the reference
to glDebugMessageInsert was dropped.

At the same time, further down the spec says:
   "The value of <type> must be one of the values from Table 5.4"

... and these two are listed in Table 5.4.

The GL 4.3 and GLES 3.2 do not give any hints on the former
'definition', plus CTS requires that the tokens are valid values for
glDebugMessageInsert.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: add SEVERITY_NOTIFICATION to default state
Emil Velikov [Thu, 26 Nov 2015 00:36:14 +0000 (00:36 +0000)]
mesa: add SEVERITY_NOTIFICATION to default state

As per the spec quote:

    "All messages are initially enabled unless their assigned severity
    is DEBUG_SEVERITY_LOW"

We already had MEDIUM and HIGH set, let's toggle NOTIFICATION as well.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: return the correct value for GroupStackDepth
Emil Velikov [Thu, 26 Nov 2015 00:36:13 +0000 (00:36 +0000)]
mesa: return the correct value for GroupStackDepth

We already have one group (the default) as specified in the spec. So
lets return its size, rather than the index of the current group.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: rename GroupStackDepth to CurrentGroup
Emil Velikov [Thu, 26 Nov 2015 00:36:12 +0000 (00:36 +0000)]
mesa: rename GroupStackDepth to CurrentGroup

The variable is used as the actual index, rather than the size of the
group stack - rename it to reflect that.

Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa: do not enable KHR_debug for ES 1.0
Emil Velikov [Thu, 26 Nov 2015 00:36:11 +0000 (00:36 +0000)]
mesa: do not enable KHR_debug for ES 1.0

The extension requires (cough implements) GetPointervKHR (alias of
GetPointerv) which in itself is available for ES 1.1 enabled mesa.

Anyone willing to fish around and implement it for ES 1.0 is more than
welcome to revert this commit. Until then lets restrict things.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93048
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoglapi: add GetPointervKHR to the ES dispatch
Emil Velikov [Thu, 26 Nov 2015 00:36:10 +0000 (00:36 +0000)]
glapi: add GetPointervKHR to the ES dispatch

The KHR_debug extension implements this.

Strictly speaking it could be used with ES 1.0, although as the original
function is available on ES 1.1, I'm inclined to lift the KHR_debug
requirement to ES 1.1.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93048
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agomesa/version: Update gl_extensions::Version during version override
Nanley Chery [Tue, 1 Dec 2015 18:42:21 +0000 (10:42 -0800)]
mesa/version: Update gl_extensions::Version during version override

Commit a16ffb743ced9fde80b2485dfc2d86ae74e86f25, which introduced
gl_extensions::Version, updates the field when the context version
is computed and when entering/exiting meta. Update this field when
the version is overridden as well.

Cc: "11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agomesa: print enum names rather than hexadecimal values in error messages
Brian Paul [Thu, 3 Dec 2015 16:40:38 +0000 (09:40 -0700)]
mesa: print enum names rather than hexadecimal values in error messages

Trivial.

8 years agost/wgl: add new stw_ext_rendertexture.c file
Brian Paul [Thu, 3 Dec 2015 16:32:53 +0000 (09:32 -0700)]
st/wgl: add new stw_ext_rendertexture.c file

This should have been included in the previous commit.

Signed-off-by: Brian Paul <brianp@vmware.com>
8 years agost/wgl: add support for WGL_ARB_render_texture
Brian Paul [Thu, 3 Dec 2015 16:12:20 +0000 (09:12 -0700)]
st/wgl: add support for WGL_ARB_render_texture

There are a few legacy OpenGL apps on Windows which need this extension.
We basically use glCopyTex[Sub]Image to implement wglBindTexImageARB (see
the implementation notes for details).

v2: refactor code to use st_copy_framebuffer_to_texture() helper function.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agost/mesa: add new st_copy_framebuffer_to_texture() function
Brian Paul [Thu, 3 Dec 2015 00:29:27 +0000 (17:29 -0700)]
st/mesa: add new st_copy_framebuffer_to_texture() function

This helper is used by the WGL state tracker to implement the
wglBindTexImageARB() function.

This is basically a new "meta" function.  However, we're not putting
it in the src/mesa/drivers/common/ directory because that code is not
linked with gallium-based drivers.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agoglsl: remove useless null checks and make match_explicit_outputs_to_inputs() static
Juha-Pekka Heikkila [Wed, 2 Dec 2015 09:48:46 +0000 (11:48 +0200)]
glsl: remove useless null checks and make match_explicit_outputs_to_inputs() static

match_explicit_outputs_to_inputs() cannot get null inputs and if it ever did
triggering first null check would later in the function cause segfault.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
CC: timothy.arceri@collabora.com
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agoi965: use _Shader to get fragment program when updating surface state
Tapani Pälli [Wed, 2 Dec 2015 11:21:37 +0000 (13:21 +0200)]
i965: use _Shader to get fragment program when updating surface state

Atomic counters and Images were using ctx::Shader that does not take in
to account program pipeline changes, ctx::_Shader must be used for SSO to
work. Commit c0347705 already changed ubo's to use this.

Fixes failures seen with following Piglit test:
arb_separate_shader_object-atomic-counter

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: fix moves to/from flags
Ilia Mirkin [Thu, 26 Nov 2015 04:36:23 +0000 (23:36 -0500)]
nv50/ir: fix moves to/from flags

Noticed this when looking at a trace that caused flags to spill to/from
registers. The flags source/destination wasn't encoded correctly
according to both envydis and nvdisasm.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: don't forget to mark flagsDef on cvt in txb lowering
Ilia Mirkin [Thu, 3 Dec 2015 01:02:12 +0000 (20:02 -0500)]
nv50/ir: don't forget to mark flagsDef on cvt in txb lowering

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: fix instruction permutation logic
Ilia Mirkin [Thu, 3 Dec 2015 01:24:33 +0000 (20:24 -0500)]
nv50/ir: fix instruction permutation logic

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: the mad source might not have a defining instruction
Ilia Mirkin [Thu, 3 Dec 2015 01:10:54 +0000 (20:10 -0500)]
nv50/ir: the mad source might not have a defining instruction

For example if it's $r63 (aka 0), there won't be a definition.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: make sure entire graph is reachable
Ilia Mirkin [Wed, 2 Dec 2015 05:38:22 +0000 (00:38 -0500)]
nv50/ir: make sure entire graph is reachable

The algorithm expects the entire CFG to be reachable, so make sure that
we hit every node. Otherwise we will end up with uninitialized data,
memory corruption, etc.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: deal with loops with no breaks
Ilia Mirkin [Wed, 2 Dec 2015 05:38:21 +0000 (00:38 -0500)]
nv50/ir: deal with loops with no breaks

For example if there are only returns, the break bb will not end up part
of the CFG. However there will have been a prebreak already emitted for
it, and when hitting the RET that comes after, we will try to insert the
current (i.e. break) BB into the graph even though it will be
unreachable. This makes the SSA code sad.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonvc0/ir: fold postfactor into immediate
Ilia Mirkin [Wed, 2 Dec 2015 01:35:19 +0000 (20:35 -0500)]
nvc0/ir: fold postfactor into immediate

SM20-SM50 can't emit a post-factor in the presence of a long immediate.
Make sure to fold it in.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50/ir: allow immediate 0 to be loaded anywhere
Ilia Mirkin [Tue, 1 Dec 2015 20:01:11 +0000 (15:01 -0500)]
nv50/ir: allow immediate 0 to be loaded anywhere

There's a post-RA fixup to replace 0's with $r63 (or $r127 if too many
regs are used), so just as nvc0, let an immediate 0 be loaded anywhere.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: Add INTEL_DEBUG=perf information for GS recompiles.
Kenneth Graunke [Wed, 2 Dec 2015 05:27:38 +0000 (21:27 -0800)]
i965: Add INTEL_DEBUG=perf information for GS recompiles.

Surprisingly, this didn't exist at all.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965: De-duplicate key_debug() function.
Kenneth Graunke [Wed, 2 Dec 2015 05:09:40 +0000 (21:09 -0800)]
i965: De-duplicate key_debug() function.

This appeared in brw_vs.c and brw_wm.c, should have appeared in
brw_gs.c, and was soon going to have to be in brw_tcs.c and brw_tes.c as
well.

So, instead, move it to a central location (which has to know about both
struct brw_context and perf_debug()).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agonv50/ir/gk110: add memory barriers support for GK110
Samuel Pitoiset [Wed, 2 Dec 2015 21:05:17 +0000 (22:05 +0100)]
nv50/ir/gk110: add memory barriers support for GK110

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonv50/ir: do not call textureMask() for surface ops
Samuel Pitoiset [Sun, 29 Nov 2015 14:50:09 +0000 (15:50 +0100)]
nv50/ir: do not call textureMask() for surface ops

That texture mask thing doesn't seem to be needed for surface ops, so
just as nve4+, let do that only for texture ops.

This fixes a segfault with 'test_surface_st' from
gallium/tests/trivial/compute.c on Fermi because this test uses sustp.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoappveyor: Initial integration.
Jose Fonseca [Thu, 26 Nov 2015 10:39:41 +0000 (10:39 +0000)]
appveyor: Initial integration.

AppVeyor doesn't require an appveyor.yml in the repos (in fact it has
some limitations as noted in comments below), but doing so has two great
advantages over the web UI:

- appveyor.yml can be revisioned together with the code, so instructions
  should always be in synch with the code

- appveyor.yml can be reused for people's private repositories (be on
  fdo or GitHub, etc.)

Acked-by: Roland Scheidegger <sroland@vmware.com>
8 years agoutil/blitter: Fix "SO C90 forbids mixed declarations and code".
Jose Fonseca [Wed, 2 Dec 2015 17:48:29 +0000 (17:48 +0000)]
util/blitter: Fix "SO C90 forbids mixed declarations and code".

Trivial.

8 years agomesa: print enum string in compressed_subtexture_error_check() error msg
Brian Paul [Tue, 1 Dec 2015 21:35:14 +0000 (14:35 -0700)]
mesa: print enum string in compressed_subtexture_error_check() error msg

Trivial.

8 years agogallium/util: Fix util_blitter_clear_depth_stencil() for num_layers>1
Edward O'Callaghan [Thu, 26 Nov 2015 05:55:01 +0000 (16:55 +1100)]
gallium/util: Fix util_blitter_clear_depth_stencil() for num_layers>1

Previously util_blitter_clear_depth_stencil() could not clear more
than the first layer. We need to generalise this as we did for
util_blitter_clear_render_target().

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/util: Fix util_blitter_clear_render_target() for num_layers>1
Edward O'Callaghan [Thu, 26 Nov 2015 05:55:00 +0000 (16:55 +1100)]
gallium/util: Fix util_blitter_clear_render_target() for num_layers>1

Previously util_blitter_clear_render_target() could not clear more
than the first layer. We need to generalise this so that
ARB_clear_texture can pass the 3d piglit test.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agomesa: fix VIEWPORT_INDEX_PROVOKING_VERTEX and LAYER_PROVOKING_VERTEX queries
Roland Scheidegger [Tue, 1 Dec 2015 19:06:59 +0000 (20:06 +0100)]
mesa: fix VIEWPORT_INDEX_PROVOKING_VERTEX and LAYER_PROVOKING_VERTEX queries

These are implementation-dependent queries, but so far we just returned the
value of whatever the current provoking vertex convention was set to, which
was clearly wrong.
Just make this a variable in the context constants like for other things
which are implementation dependent (I assume all drivers will want to set
this to the same value for both queries), and set it to GL_UNDEFINED_VERTEX
which is correct for everybody (and drivers can override it).

Reviewed-by: Brian Paul <brianp@vmware.com>
CC: <mesa-stable@lists.freedesktop.org>
8 years agoRemove Sun CC specific code.
Jose Fonseca [Tue, 1 Dec 2015 23:07:08 +0000 (23:07 +0000)]
Remove Sun CC specific code.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
8 years agoconfigure.ac: Refuse to build with Sun C compiler.
Jose Fonseca [Tue, 1 Dec 2015 22:43:46 +0000 (22:43 +0000)]
configure.ac: Refuse to build with Sun C compiler.

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

Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
8 years agotravis: Add a test build with scons.
Eric Anholt [Tue, 1 Dec 2015 19:57:49 +0000 (11:57 -0800)]
travis: Add a test build with scons.

Since I just broke the scons build, I figured I'd make Travis test that I
don't break it again in the future.  The script runs the builds in
parallel across VMs, so it still takes just 5 minutes to turn around
results.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agoi965: Increase BRW_MAX_UBO to 14.
Kenneth Graunke [Mon, 30 Nov 2015 09:54:42 +0000 (01:54 -0800)]
i965: Increase BRW_MAX_UBO to 14.

The NVIDIA binary driver and Intel's closed source driver both expose
14 here, rather than the GL minimum of 12.  Let's follow suit.

Without this, Shadow of Mordor fails to render correctly and triggers
OpenGL errors:

Mesa: User error: GL_INVALID_VALUE in glBindBufferBase(index=68)
Mesa: User error: GL_INVALID_VALUE in glUniformBlockBinding(block binding 68 >= 60)

There are 5 stages (VS, TCS, TES, GS, FS), and 12 * 5 = 60 is too small.
14 * 5 = 70 will work just fine.

Tapani believes this will also help Alien Isolation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Do dead-code elimination in a single pass.
Matt Turner [Mon, 30 Nov 2015 17:25:19 +0000 (09:25 -0800)]
i965: Do dead-code elimination in a single pass.

The first pass marked dead instructions as opcode = NOP, and a second
pass deleted those instructions so that the live ranges used in the
first pass wouldn't change.

But since we're walking the instructions in reverse order, we can just
do everything in one pass. The only thing we have to do is walk the
blocks in reverse as well.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoglsl: Rename safe_reverse -> reverse_safe.
Matt Turner [Mon, 30 Nov 2015 17:24:23 +0000 (09:24 -0800)]
glsl: Rename safe_reverse -> reverse_safe.

To match existing foreach_in_list_reverse_safe.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Don't mark dead instructions' sources live.
Matt Turner [Thu, 26 Nov 2015 00:19:06 +0000 (16:19 -0800)]
i965: Don't mark dead instructions' sources live.

Removes dead code from glsl-mat-from-int-ctor-03.shader_test.

Reported-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agor600: set mega fetch count to 16 for gs copy shader
Dave Airlie [Tue, 24 Feb 2015 06:07:23 +0000 (16:07 +1000)]
r600: set mega fetch count to 16 for gs copy shader

Seems like MFC should be set for this shader.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: increment ring index after emit vertex not before.
Dave Airlie [Tue, 24 Feb 2015 05:58:33 +0000 (15:58 +1000)]
r600: increment ring index after emit vertex not before.

The docs say we should send the emit after the ring writes,
so lets do that and not have an ALU in between.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: add alu + cf nop to copy shader on r600
Dave Airlie [Tue, 24 Feb 2015 05:57:49 +0000 (15:57 +1000)]
r600: add alu + cf nop to copy shader on r600

SB suggests we do this for r600, so lets do it,
for the copy shader.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: SMX returns CONTEXT_DONE early workaround
Dave Airlie [Tue, 24 Feb 2015 04:10:20 +0000 (14:10 +1000)]
r600: SMX returns CONTEXT_DONE early workaround

streamout, gs rings bug on certain r600s, requires a wait idle
before each surface sync.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: do SQ flush ES ring rolling workaround
Dave Airlie [Mon, 23 Feb 2015 20:14:31 +0000 (20:14 +0000)]
r600: do SQ flush ES ring rolling workaround

Need to insert a SQ_NON_EVENT when ever geometry
shaders are enabled.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonv50,nvc0: allow to create resources other than buffers
Samuel Pitoiset [Tue, 1 Dec 2015 21:40:45 +0000 (22:40 +0100)]
nv50,nvc0: allow to create resources other than buffers

For the compute support, we might stick buffers as surfaces. This fixes
an assertion when executing src/gallium/tests/trivial/compute.

To avoid using these "restricted" surfaces as render targets, these
assertions have been moved. Note that it's already handled for the
framebuffer thing on nvc0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoglapi: work-around MSVC 65K string length limitation for enums.c
Brian Paul [Tue, 1 Dec 2015 20:02:05 +0000 (13:02 -0700)]
glapi: work-around MSVC 65K string length limitation for enums.c

String literals cannot exceed 65535 characters for MSVC.  Instead of
emiting a string, emit an array of characters.

v2: fix indentation and add comment in the gl_enums.py file about this
ugliness.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomapi: Fix enums.c build with other build systems.
Eric Anholt [Tue, 1 Dec 2015 20:01:53 +0000 (12:01 -0800)]
mapi: Fix enums.c build with other build systems.

Tested with scons (by both myself and Mark Janes), Android is just copy
and paste.

8 years agotravis: Initial import of travis instructions.
Eric Anholt [Tue, 24 Nov 2015 00:25:29 +0000 (16:25 -0800)]
travis: Initial import of travis instructions.

This just builds/installs our dependencies, and runs "make check".  I'm
interested in integrating more tests into it, but this seems like a pretty
easy first start.

If your personal branches of Mesa are on github, you can enable it on your
account and the repository (see
https://docs.travis-ci.com/user/for-beginners), then any pushes you do
will get their HEAD commit tested, and any pull requests to your tree will
get their merge commits tested.

8 years agomesa: Drop the blacklisting of new GL enums.
Eric Anholt [Sat, 19 Sep 2015 16:35:15 +0000 (12:35 -0400)]
mesa: Drop the blacklisting of new GL enums.

Now when people need new extensions, they can skip the entire
enum-definition process, and we can stop reviewing new extension XML for
its enum content.

This also brings in a new enum that I wanted to use in enum_strings.cpp
for testing the code generator.

v2: Drop comment about disabled GL_1PASS_EXT test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Use a 32-bit offset for the enums.c string offset table.
Eric Anholt [Sat, 19 Sep 2015 16:57:22 +0000 (12:57 -0400)]
mesa: Use a 32-bit offset for the enums.c string offset table.

With GLES 3.1, GL 4.5, and many new vendor extensions about to get their
enums added, we jump up to 85k of table.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Prefer newer names to older ones among names present in core.
Eric Anholt [Thu, 26 Nov 2015 01:04:21 +0000 (17:04 -0800)]
mesa: Prefer newer names to older ones among names present in core.

Sometimes GL likes to rename an old enum when it grows a more general
purpose, and we should prefer the new name.  Changes from this:

GL_POINT/LINE_SIZE_* (1.1) -> GL_SMOOTH_POINT/LINE_SIZE_* (1.2)
GL_FOG_COORDINATE_* (1.4) -> GL_FOG_COORD_* (1.5)
GL_SOURCE[012]_RGB/ALPHA (1.3) -> GL_SRC0_RGB (1.5)
GL_COPY_READ/WRITE_BUFFER (3.1) -> GL_COPY_READ_BUFFER_BINDING (4.2)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Drop bitfield "enums" from the enum-to-string table.
Eric Anholt [Thu, 26 Nov 2015 01:00:00 +0000 (17:00 -0800)]
mesa: Drop bitfield "enums" from the enum-to-string table.

Asking the table for bitfield names doesn't make any sense.  For 0x10, do
you want GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV or
GL_COLOR_BUFFER_BIT4_QCOM or GL_POLYGON_STIPPLE_BIT or
GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV?  Giving a useful answer would
depend on a whole lot of context.

This also fixes a bad enum table entry, where we chose GL_HINT_BIT instead
of GL_ABGR_EXT for 0x8000, so we can now fix its entry in the enum_strings
test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Switch to using the Khronos registry for generating enums.
Eric Anholt [Thu, 17 Sep 2015 23:10:28 +0000 (19:10 -0400)]
mesa: Switch to using the Khronos registry for generating enums.

I've used a bunch of python code to cut out new enums so that the two
generated files can be diffed.  I'll remove all that hardcoding in the
following commits.  All remaining differences between the generated code:

- GL_TEXTURE_BUFFER_FORMAT didn't appear in GL3 when TBOs got merged to
  core, so it now gets an _ARB suffix instead.

- Blacklisting can't keep EXT_sso's GL_ACTIVE_PROGRAM_EXT from becoming
  GL_ACTIVE_PROGRAM -- in our hash table, GL_ACTIVE_PROGRAM_EXT points at
  the GLES2 enum's value (aka GL_CURRENT_PROGRAM).  By not blacklisting
  the core name, we get both enums translated.

- GL_DRAW_FRAMEBUFFER_BINDING and GL_FRAMEBUFFER_BINDING both appeared in
  GL3 as synonyms, and the new code happens to choose
  GL_FRAMEBUFFER_BINDING instead.

- GL_TEXTURE_COMPONENTS and GL_TEXTURE_INTERNAL_FORMAT both appear in 1.1,
  and the new code chooses GL_TEXTURE_INTERNAL_FORMAT instead (which seems
  better, to me)

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Remove the python mode bits from gl_enums.py.
Eric Anholt [Wed, 25 Nov 2015 23:38:55 +0000 (15:38 -0800)]
mesa: Remove the python mode bits from gl_enums.py.

emacs whines at me every time I open the file about these unsafe
variables, and the file was reformatted from 8 space to 4 space long ago.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Drop apparently typoed GL_ALL_CLIENT_ATTRIB_BITS.
Eric Anholt [Thu, 26 Nov 2015 00:29:10 +0000 (16:29 -0800)]
mesa: Drop apparently typoed GL_ALL_CLIENT_ATTRIB_BITS.

GL_ALL_ATTRIB_BITS is a thing, and GL_CLIENT_ALL_ATTRIB_BITS, but I don't
see GL_ALL_CLIENT_ATTRIB_BITS in my grepping of khronos XML, GL extension
specs, GL 1.1, GL 2.2, and GL 4.4.

Reviewed-by: Brian Paul <brianp@vmware.com>
8 years agomesa: Drop enums that had been removed in later revs of specs.
Eric Anholt [Sat, 19 Sep 2015 15:28:46 +0000 (11:28 -0400)]
mesa: Drop enums that had been removed in later revs of specs.

Mesa hasn't been using these enums and the finalized specs don't reference
them, so losing them from our generated enum-to-string code should be
fine.  Reduces diffs to generating from Khronos XML, which has these enums
noted defined but commented out from any consumers.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Fix a typo in AMD_performance_monitor enum.
Eric Anholt [Fri, 18 Sep 2015 19:02:07 +0000 (15:02 -0400)]
mesa: Fix a typo in AMD_performance_monitor enum.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Fix enum definition of CULL_VERTEX_EYE/OBJECT_POSITION
Eric Anholt [Fri, 18 Sep 2015 18:55:41 +0000 (14:55 -0400)]
mesa: Fix enum definition of CULL_VERTEX_EYE/OBJECT_POSITION

In converting to using the Khronos XML, I found that our XML had these two
swapped, and the text spec agreed.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Add a copy of the Khronos gl.xml (SVN #31705).
Eric Anholt [Thu, 17 Sep 2015 21:39:52 +0000 (17:39 -0400)]
mesa: Add a copy of the Khronos gl.xml (SVN #31705).

The intention here is to keep a pristine copy of the upstream gl.xml that
can be updated at any time with a new version, and use that to generate
Mesa code from instead of our private XML.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agomesa: Cut enum_strings.cpp test down to a few hand-chosen enums.
Eric Anholt [Wed, 25 Nov 2015 06:11:41 +0000 (22:11 -0800)]
mesa: Cut enum_strings.cpp test down to a few hand-chosen enums.

The previous contents appeared to be the output of some form of code
generation for all enums, with a few entries hand-edited to deal with
oddness.  The downside to this was that when an enum gets promoted from
vendor to _EXT or _EXT to _ARB or _ARB to core, make check starts failing
even when the commiter has done nothing wrong.  Instead of black-box
testing the code generation, pick a few enums that intentionally poke the
interesting cases of code generation.

People editing the code generator should be diffing the generated code
anyway.  This should catch when they fail to do so, without throwing false
negatives when people update the GL XML.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoclover: Handle NULL devices returned by pipe_loader_probe() v2
Tom Stellard [Sat, 28 Nov 2015 02:40:24 +0000 (02:40 +0000)]
clover: Handle NULL devices returned by pipe_loader_probe() v2

When probing for devices, clover will call pipe_loader_probe() twice.
The first time to retrieve the number of devices, and then second time
to retrieve the device structures.

We currently assume that the return value of both calls will be the
same, but this will not be the case if a device happens to disappear
between the two calls.

When a device disappears, the pipe_loader_probe() will add a NULL
device to the device list, so we need to handle this.

v2:
  - Keep range for loop

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
CC: <mesa-stable@lists.freedesktop.org>
8 years agoautomake: fix some occurrences of hardcoded -ldl and -lpthread
Jonathan Gray [Mon, 23 Nov 2015 03:22:24 +0000 (14:22 +1100)]
automake: fix some occurrences of hardcoded -ldl and -lpthread

Correct some occurrences of -ldl and -lpthread to use
$(DLOPEN_LIBS) and $(PTHREAD_LIBS) respectively.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoglsl/lower_ubo_reference: split struct copies into element copies
Iago Toral Quiroga [Mon, 23 Nov 2015 12:53:09 +0000 (13:53 +0100)]
glsl/lower_ubo_reference: split struct copies into element copies

Improves register pressure, since otherwise we end up emitting
loads for all the elements in the RHS and them emitting
stores for all elements in the LHS.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoglsl/lower_ubo_reference: split array copies into element copies
Iago Toral Quiroga [Mon, 23 Nov 2015 12:53:08 +0000 (13:53 +0100)]
glsl/lower_ubo_reference: split array copies into element copies

Improves register pressure, since otherwise we end up emitting
loads for all the elements in the RHS and them emitting
stores for all elements in the LHS.

v2:
  - Mark progress properly. This also fixes some instances where the added
    nodes with individual element copies where not being lowered, which is
    expected behavior as explained in the documentation for
    visit_list_elements.
  - Only need to do this if the RHS is a buffer-backed variable.
  - We can also have arrays inside structs. A later patch will make it so
    we also split struct copies and end up with multiple
    ir_dereference_record assignments, so make sure that if any of these
    is an array copy, we also split it.

Fixes the following piglit tests:
tests/spec/arb_shader_storage_buffer_object/execution/large-field-copy.shader_test
tests/spec/arb_shader_storage_buffer_object/linker/copy-large-array.shader_test

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agost/va: also retrieve reference frames info for h264
Julien Isorce [Thu, 26 Nov 2015 08:30:30 +0000 (08:30 +0000)]
st/va: also retrieve reference frames info for h264

Other hardwares than AMD require to parse:
VAPictureParameterBufferH264.ReferenceFrames[16]

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
8 years agost/va: delay decoder creation until max_references is known
Julien Isorce [Thu, 26 Nov 2015 08:29:54 +0000 (08:29 +0000)]
st/va: delay decoder creation until max_references is known

In general max_references cannot be based on num_render_targets.

This patch allows to allocate buffers with an accurate size.
I.e. no more than necessary. For other codecs it is a fixed
value 2.

This is similar behaviour as vaapi/vdpau-driver.

For now HEVC case defaults to num_render_targets as before.
But it could also benefits this change by setting a more
accurate max_references number in handlePictureParameterBuffer.

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoglsl/dead_builin_varyings: Fix gl_FragData array lowering
Iago Toral Quiroga [Fri, 27 Nov 2015 11:46:20 +0000 (12:46 +0100)]
glsl/dead_builin_varyings: Fix gl_FragData array lowering

The current implementation looks for array dereferences on gl_FragData and
immediately proceeds to lower them, however this is not enough because we
can have array access on vector variables too, like in this code:

out vec4 color;
void main()
{
   int i;
   for (i = 0; i < 4; i++)
      color[i] = 1.0;
}

Fix it by making sure that the actual variable being dereferenced is an array.

Fixes a crash in:
spec/arb_gpu_shader_fp64/execution/built-in-functions/fs-ldexp-dvec4.shader_test

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agor600: workaround empty geom shader.
Dave Airlie [Tue, 24 Feb 2015 04:09:40 +0000 (14:09 +1000)]
r600: workaround empty geom shader.

We need to emit at least one cut/emit in every
geometry shader, the easiest workaround it to
stick a single CUT at the top of each geom shader.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: rv670 use at least 16es/gs threads
Dave Airlie [Tue, 24 Feb 2015 06:30:05 +0000 (16:30 +1000)]
r600: rv670 use at least 16es/gs threads

This is specified in the docs for rv670 to work properly.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: geometry shader gsvs itemsize workaround
Dave Airlie [Wed, 18 Feb 2015 23:51:19 +0000 (23:51 +0000)]
r600: geometry shader gsvs itemsize workaround

On some chips the GSVS itemsize needs to be aligned to a cacheline size.

This only applies to some of the r600 family chips.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoglsl: don't sort varying in separate shader mode
Gregory Hainaut [Sun, 25 Oct 2015 14:01:37 +0000 (15:01 +0100)]
glsl: don't sort varying in separate shader mode

This fixes an issue where the addition of the FLAT qualifier in
varying_matches::record() can break the expected varying order.

It also avoids a future issue with the relaxing of interpolation
qualifier matching constraints in GLSL 4.50.

V2: (by Timothy Arceri)
* reworked comment slightly

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: don't dead code remove SSO varyings marked as active
Gregory Hainaut [Sun, 25 Oct 2015 14:01:35 +0000 (15:01 +0100)]
glsl: don't dead code remove SSO varyings marked as active

GL_ARB_separate_shader_objects allow matching by name variable or block
interface. Input varyings can't be removed because it is will impact the
location assignment.

This fixes the bug 79783 and likely any application that uses
GL_ARB_separate_shader_objects extension.

V2 (by Timothy Arceri):
* simplify now that builtins are not set as always active

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
https://bugs.freedesktop.org/show_bug.cgi?id=79783

8 years agoglsl: add always_active_io attribute to ir_variable
Gregory Hainaut [Sun, 25 Oct 2015 14:01:34 +0000 (15:01 +0100)]
glsl: add always_active_io attribute to ir_variable

The value will be set in separate-shader program when an input/output
must remains active. e.g. when deadcode removal isn't allowed because
it will create interface location/name-matching mismatch.

v3:
* Rename the attribute
* Use ir_variable directly instead of ir_variable_refcount_visitor
* Move the foreach IR code in the linker file

v4:
* Fix variable name in assert

v5 (by Timothy Arceri):
* Rename functions and reword comments
* Don't set always active on builtins

Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: copy how_declared when lowering interface blocks
Timothy Arceri [Sat, 21 Nov 2015 00:08:36 +0000 (11:08 +1100)]
glsl: copy how_declared when lowering interface blocks

Cc: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agoglsl: optimise inputs/outputs with explicit locations
Timothy Arceri [Sat, 21 Nov 2015 01:47:25 +0000 (12:47 +1100)]
glsl: optimise inputs/outputs with explicit locations

This change allows used defined inputs/outputs with explicit locations
to be removed if they are detected to not be used between shaders
at link time.

To enable this we change the is_unmatched_generic_inout field to be
flagged when we have a user defined varying. Previously
explicit_location was assumed to be set only in builtins however SSO
allows the user to set an explicit location.

We then add a function to match explicit locations between shaders.

V2: call match_explicit_outputs_to_inputs() after
is_unmatched_generic_inout has been initialised.

Cc: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
8 years agor600/shader: split address get out to a function.
Dave Airlie [Mon, 30 Nov 2015 04:23:00 +0000 (14:23 +1000)]
r600/shader: split address get out to a function.

This will be used in the tess shaders.

Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agodoc: Set GL_OES_geometry_shader as started
Marta Lofstedt [Fri, 27 Nov 2015 14:31:10 +0000 (15:31 +0100)]
doc: Set GL_OES_geometry_shader as started

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agogles2: Update gl2ext.h to revision: 32120
Marta Lofstedt [Fri, 27 Nov 2015 14:31:05 +0000 (15:31 +0100)]
gles2: Update gl2ext.h to revision: 32120

This is needed to be able to implement the accepted OES
extensions.

Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agovl/buffers: fixes vl_video_buffer_formats for RGBX
Julien Isorce [Fri, 27 Nov 2015 08:55:55 +0000 (08:55 +0000)]
vl/buffers: fixes vl_video_buffer_formats for RGBX

Fixes: 42a5e143a8d "vl/buffers: add RGBX and BGRX to the supported formats"
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoi965/fs: remove unused fs_reg offset
Samuel Iglesias Gonsálvez [Mon, 30 Nov 2015 08:28:42 +0000 (09:28 +0100)]
i965/fs: remove unused fs_reg offset

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
8 years agoi965: Add src/dst interference for certain instructions with hazards.
Kenneth Graunke [Fri, 20 Nov 2015 00:00:18 +0000 (16:00 -0800)]
i965: Add src/dst interference for certain instructions with hazards.

When working on tessellation shaders, I created some vec4 virtual
opcodes for creating message headers through a sequence like:

   mov(8) g7<1>UD      0x00000000UD    { align1 WE_all 1Q compacted };
   mov(1) g7.5<1>UD    0x00000100UD    { align1 WE_all };
   mov(1) g7<1>UD      g0<0,1,0>UD     { align1 WE_all compacted };
   mov(1) g7.3<1>UD    g8<0,1,0>UD     { align1 WE_all };

This is done in the generator since the vec4 backend can't handle align1
regioning.  From the visitor's point of view, this is a single opcode:

   hs_set_output_urb_offsets vgrf7.0:UD, 1U, vgrf8.xxxx:UD

Normally, there's no hazard between sources and destinations - an
instruction (naturally) reads its sources, then writes the result to the
destination.  However, when the virtual instruction generates multiple
hardware instructions, we can get into trouble.

In the above example, if the register allocator assigned vgrf7 and vgrf8
to the same hardware register, then we'd clobber the source with 0 in
the first instruction, and read back the wrong value in the last one.

It occured to me that this is exactly the same problem we have with
SIMD16 instructions that use W/UW or B/UB types with 0 stride.  The
hardware implicitly decodes them as two SIMD8 instructions, and with
the overlapping regions, the first would clobber the second.

Previously, we handled that by incrementing the live range end IP by 1,
which works, but is excessive: the next instruction doesn't actually
care about that.  It might also be the end of control flow.  This might
keep values alive too long.  What we really want is to say "my source
and destinations interfere".

This patch creates new infrastructure for doing just that, and teaches
the register allocator to add interference when there's a hazard.  For
my vec4 case, we can determine this by switching on opcodes.  For the
SIMD16 case, we just move the existing code there.

I audited our existing virtual opcodes that generate multiple
instructions; I believe FS_OPCODE_PACK_HALF_2x16_SPLIT needs this
treatment as well, but no others.

v2: Rebased by mattst88.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Fix JIP to properly skip over unrelated control flow.
Kenneth Graunke [Wed, 18 Nov 2015 02:24:11 +0000 (18:24 -0800)]
i965: Fix JIP to properly skip over unrelated control flow.

We've apparently always been botching JIP for sequences such as:

   do
       cmp.f0.0 ...
       (+f0.0) break
       ...
       if
          ...
       else
          ...
       endif
       ...
   while

Normally, UIP is supposed to point to the final destination of the jump,
while in nested control flow, JIP is supposed to point to the end of the
current nesting level.  It essentially bounces out of the current nested
control flow, to an instruction that has a JIP which bounces out another
level, and so on.

In the above example, when setting JIP for the BREAK, we call
brw_find_next_block_end(), which begins a search after the BREAK for the
next ENDIF, ELSE, WHILE, or HALT.  It ignores the IF and finds the ELSE,
setting JIP there.

This makes no sense at all.  The break is supposed to skip over the
whole if/else/endif block entirely.  They have a sibling relationship,
not a nesting relationship.

This patch fixes brw_find_next_block_end() to track depth as it does
its search, and ignore anything not at depth 0.  So when it sees the
IF, it ignores everything until after the ENDIF.  That way, it finds
the end of the right block.

I noticed this while reading some assembly code.  We believe jumping
earlier is harmless, but makes the EU walk through a bunch of disabled
instructions for no reason.  I noticed that GLBenchmark Manhattan had
a shader that contained a BREAK with a bogus JIP, but didn't measure
any performance improvement (it's likely miniscule, if there is any).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agor600: move per-type settings into a switch statement
Dave Airlie [Mon, 30 Nov 2015 00:37:21 +0000 (10:37 +1000)]
r600: move per-type settings into a switch statement

This will allow adding tess stuff much cleaner later.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: split out common alu_writes pattern.
Dave Airlie [Mon, 30 Nov 2015 00:17:34 +0000 (10:17 +1000)]
r600: split out common alu_writes pattern.

This just splits out a common pattern into an inline function
to make things cleaner to read.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600/llvm: fix r600/llvm build
Dave Airlie [Mon, 30 Nov 2015 01:05:42 +0000 (11:05 +1000)]
r600/llvm: fix r600/llvm build

Reported on irc by gryffus

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: fixes for register definitions.
Dave Airlie [Sun, 29 Nov 2015 23:35:37 +0000 (09:35 +1000)]
r600: fixes for register definitions.

Forgot to add these.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: add missing register to initial state
Dave Airlie [Mon, 23 Nov 2015 22:44:13 +0000 (08:44 +1000)]
r600: add missing register to initial state

We really should initialise HS/LS_2 and SQ_LDS_ALLOC exists
on all evergreen not just cayman, so we should initialise
it as well.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: define registers required for tessellation
Dave Airlie [Mon, 23 Nov 2015 22:39:25 +0000 (08:39 +1000)]
r600: define registers required for tessellation

This adds the defines for a bunch of registers and shader
values that are required to implement tessellation.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agor600: consolidate clip state updates
Dave Airlie [Mon, 23 Nov 2015 20:48:20 +0000 (06:48 +1000)]
r600: consolidate clip state updates

Move some common code into one place, tess will also need
to use this function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonv50/ir: always display the opcode number for unknown instructions
Samuel Pitoiset [Sun, 29 Nov 2015 15:04:11 +0000 (16:04 +0100)]
nv50/ir: always display the opcode number for unknown instructions

This helps in debugging unknown instructions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agomesa: remove len argument from _mesa_shader_debug()
Emil Velikov [Fri, 27 Nov 2015 13:12:59 +0000 (13:12 +0000)]
mesa: remove len argument from _mesa_shader_debug()

There was only a single user which was using strlen(buf).
As this function is not user facing (i.e. we don't need to feed back
original length via a callback), we can simplify things.

Suggested-by: Timothy Arceri <timothy.arceri@collabora.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agodrivers/x11: scons: partially revert b9b40ef9b76
Emil Velikov [Wed, 25 Nov 2015 21:31:57 +0000 (21:31 +0000)]
drivers/x11: scons: partially revert b9b40ef9b76

As glsl_types.{cpp,h} were  moved out of the sconscript (commit
b23a4859f4d "scons: Build nir/glsl_types.cpp once.") remove the dangling
includes.

Cc: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
8 years agonir: remove recursive inclusion in builtin_type_macros.h
Emil Velikov [Wed, 25 Nov 2015 21:31:56 +0000 (21:31 +0000)]
nir: remove recursive inclusion in builtin_type_macros.h

The header is already included by glsl_types.{cpp,h}.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir: remove unneeded include
Emil Velikov [Wed, 25 Nov 2015 21:31:55 +0000 (21:31 +0000)]
nir: remove unneeded include

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
8 years agomesa/program: remove dead function declarations
Emil Velikov [Wed, 25 Nov 2015 20:17:06 +0000 (20:17 +0000)]
mesa/program: remove dead function declarations

Dead since

 5e9aa9926b9 (2011) - _mesa_ir_compile_shader
 69e07bdeb42 (2009) - _mesa_get_program_register

Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Brian Paul <brianp@vmware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoauxiliary/vl/dri: fd management cleanups
Emil Velikov [Mon, 23 Nov 2015 20:26:59 +0000 (20:26 +0000)]
auxiliary/vl/dri: fd management cleanups

Analogous to previous commit, minus the extra dup. We are the one
opening the device thus we can directly use the fd.

Spotted by Coverity (CID 13398671339877)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agoauxiliary/vl/drm: fd management cleanups
Emil Velikov [Mon, 23 Nov 2015 20:26:58 +0000 (20:26 +0000)]
auxiliary/vl/drm: fd management cleanups

Analogous to previous commit.

Spotted by Coverity (CID 1339868)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
8 years agost/xa: fd management cleanups
Emil Velikov [Mon, 23 Nov 2015 20:26:57 +0000 (20:26 +0000)]
st/xa: fd management cleanups

Analogous to previous commit.

Spotted by Coverity (CID 1339866)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>