mesa.git
9 years agoi965: Advertise 65536 for GL_MAX_UNIFORM_BLOCK_SIZE.
Kenneth Graunke [Tue, 8 Sep 2015 22:41:11 +0000 (15:41 -0700)]
i965: Advertise 65536 for GL_MAX_UNIFORM_BLOCK_SIZE.

Our old value of 16384 is the minimum value.  DirectX apparently
requires 65536 at a minimum; that's also what nVidia and the Intel
Windows driver advertise.  AMD advertises MAX_INT.

Ilia Mirkin noticed that "Shadow Warrior" uses UBOs larger than 16k
on Nouveau, which advertises 65536 bytes for this limit.  Traces
captured on Nouveau don't work on i965 because our lower limit causes
the GLSL linker to reject the captured shaders.  While this isn't
important in and of itself, it does suggest that raising the limit
would be beneficial.

We can read linear buffers up to 2^27 bytes in size, so raising this
should be safe; we could probably even go larger.  For now, matching
nVidia and Intel/Windows seems like a good plan.

We have to reinitialize MaxCombinedUniformComponents as core Mesa will
have set it based on a stale value for MaxUniformBlockSize.

According to Tapani, there's an unreleased game that asserts on this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: don't fold immediate into mad if registers are too high
Ilia Mirkin [Thu, 10 Sep 2015 09:02:26 +0000 (05:02 -0400)]
nv50/ir: don't fold immediate into mad if registers are too high

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91551
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: fix emission of 8-byte wide interp instruction
Ilia Mirkin [Thu, 10 Sep 2015 07:55:06 +0000 (03:55 -0400)]
nv50/ir: fix emission of 8-byte wide interp instruction

This can come up if the target register number is > 63, which is fairly
rare.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91551
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: r63 is only 0 if we are using less than 63 registers
Ilia Mirkin [Thu, 10 Sep 2015 07:49:36 +0000 (03:49 -0400)]
nv50/ir: r63 is only 0 if we are using less than 63 registers

It is advantageous to use r63 instead of r127 since r63 can fit into the
shorter encoding. However if we've RA'd over 63 registers, we must use
r127 as the replacement instead.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50/ir: make edge splitting fix up phi node sources
Ilia Mirkin [Thu, 10 Sep 2015 05:54:30 +0000 (01:54 -0400)]
nv50/ir: make edge splitting fix up phi node sources

Unfortunately nv50_ir phi nodes aren't directly connected to the CFG, so
the mapping between source and the actual BB is by inbound edge order.
So when manipulating edges one has to be extremely careful. We were
insufficiently careful when splitting critical edges which resulted in
the phi nodes being confused as to where their sources were coming from.

This primarily manifests itself with the TXL-lowering logic on nv50,
when it is inside of a conditional. I've been unable to trigger the
issue anywhere else so far. This resolves rendering failures
in a number of games like Two Worlds 2, Trine: Enchanted Edition, Trine 2,
XCOM:Enemy Unknown, Stacking. It also improves the situation in
Hearthstone, Sonic Generations, and The Raven: Legacy of a Master Thief.
However more work needs to be done there (splitting a lot more edges
solves it, so it's some other sort of RA-related issue).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90887
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Remove ADD_VARYING macro
Ian Romanick [Wed, 26 Aug 2015 12:45:52 +0000 (13:45 +0100)]
glsl: Remove ADD_VARYING macro

The purpose of the macro was to create the name_as_gs_input from name.
The previous commit removed the name_as_gs_input from add_varying, so
the macro is unnecessary.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Silence unused parameter warnings
Ian Romanick [Wed, 26 Aug 2015 12:38:49 +0000 (13:38 +0100)]
glsl: Silence unused parameter warnings

builtin_variables.cpp:1062:53: warning: unused parameter 'name_as_gs_input' [-Wunused-parameter]
                                         const char *name_as_gs_input)
                                                     ^
builtin_functions.cpp:4774:47: warning: unused parameter 'intrinsic_name' [-Wunused-parameter]
                                   const char *intrinsic_name,
                                               ^
builtin_functions.cpp:4907:66: warning: unused parameter 'state' [-Wunused-parameter]
 _mesa_glsl_find_builtin_function_by_name(_mesa_glsl_parse_state *state,
                                                                  ^
builtin_functions.cpp:4915:49: warning: unused parameter 'num_arguments' [-Wunused-parameter]
                                        unsigned num_arguments,
                                                 ^
builtin_functions.cpp:4916:49: warning: unused parameter 'flags' [-Wunused-parameter]
                                        unsigned flags)
                                                 ^
ir_print_visitor.cpp:589:37: warning: unused parameter 'ir' [-Wunused-parameter]
 ir_print_visitor::visit(ir_barrier *ir)
                                     ^
linker.cpp:3212:48: warning: unused parameter 'ctx' [-Wunused-parameter]
 build_program_resource_list(struct gl_context *ctx,
                                                ^
standalone_scaffolding.cpp:65:57: warning: unused parameter ‘id’ [-Wunused-parameter]
 _mesa_shader_debug(struct gl_context *, GLenum, GLuint *id,
                                                         ^

v2: Rebase on top of GL_ARB_shader_image_size work (especially
58a86897).  Silence more warnings added by that work.

v3: Remove mention of the removed parameter from comments.  Suggested by
Iago.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> [v1]
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "Martin Peres <martin.peres@linux.intel.com>"
9 years agonvc0: remove BGRA4 format support
Ilia Mirkin [Thu, 10 Sep 2015 01:50:03 +0000 (21:50 -0400)]
nvc0: remove BGRA4 format support

Something is wrong with the support somewhere. I couldn't get the blob
driver to use it either, although it happily used RGB5_A1.
teximage-colors works, but WoW seems to fail in the menus for drawing
text.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91526
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agogallium/ttn: fix cursor handling vs builder
Rob Clark [Wed, 9 Sep 2015 21:27:17 +0000 (17:27 -0400)]
gallium/ttn: fix cursor handling vs builder

After inserting instructions the cursor.option becomes _after_instr
(even if it started life as an _after_block).  So we cannot simply stash
the current cursor on the if/loop_stack.  Otherwise we end up inserting
instructions after the endif/endloop in the block preceeding the if/
loop.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonvc0: keep track of cb bindings per buffer, use for upload settings
Ilia Mirkin [Wed, 9 Sep 2015 07:17:38 +0000 (03:17 -0400)]
nvc0: keep track of cb bindings per buffer, use for upload settings

CB updates to bound buffers need to go through the CB_DATA endpoints,
otherwise the shader may not notice that the updates happened.
Furthermore, these updates have to go in to the same address as the
bound buffer, otherwise, again, the shader may not notice updates.

So we keep track of all the places where a constbuf is bound, and
iterate over all of them when updating data. If a binding is found that
encompasses the region to be updated, then we use the settings of that
binding for the upload. Otherwise we upload as a regular data update.

This fixes piglit 'arb_uniform_buffer_object-rendering offset' as well
as blurriness in Witcher2.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91890
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonir/glsl: Use lower_outputs_to_temporaries instead of relying on GLSL IR
Jason Ekstrand [Tue, 8 Sep 2015 21:31:11 +0000 (14:31 -0700)]
nir/glsl: Use lower_outputs_to_temporaries instead of relying on GLSL IR

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonir: Add a pass to lower outputs to temporary variables
Jason Ekstrand [Sat, 29 Aug 2015 00:09:02 +0000 (17:09 -0700)]
nir: Add a pass to lower outputs to temporary variables

This pass can be used as a helper for NIR producers so they don't have to
worry about creating the temporaries themselves.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonir/cursor: Add a constructor for the end of a block but before the jump
Jason Ekstrand [Sat, 29 Aug 2015 00:17:39 +0000 (17:17 -0700)]
nir/cursor: Add a constructor for the end of a block but before the jump

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonv30: Disable msaa unless requested from the env by NV30_MAX_MSAA
Hans de Goede [Wed, 9 Sep 2015 13:52:09 +0000 (15:52 +0200)]
nv30: Disable msaa unless requested from the env by NV30_MAX_MSAA

Some modern apps try to use msaa without keeping in mind the
restrictions on videomem of older cards. Resulting in dmesg saying:

 [ 1197.850642] nouveau E[soffice.bin[3785]] fail ttm_validate
 [ 1197.850648] nouveau E[soffice.bin[3785]] validating bo list
 [ 1197.850654] nouveau E[soffice.bin[3785]] validate: -12

Because we are running out of video memory, after which the program
using the msaa visual freezes, and eventually the entire system freezes.

To work around this we do not allow msaa visauls by default and allow
the user to override this via NV30_MAX_MSAA.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[imirkin: move env var lookup to screen so that it's only done once]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv30: Fix color resolving for nv3x cards
Hans de Goede [Wed, 9 Sep 2015 13:52:08 +0000 (15:52 +0200)]
nv30: Fix color resolving for nv3x cards

We do not have a generic blitter on nv3x cards, so we must use the
sifm object for color resolving.

This commit divides the sources and dest surfaces in to tiles which
match the constraints of the sifm object, so that color resolving
will work properly on nv3x cards.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agogallium/docs: clairify dmabuf fd ownership
Rob Clark [Thu, 3 Sep 2015 18:53:03 +0000 (14:53 -0400)]
gallium/docs: clairify dmabuf fd ownership

Since debugging issues w/ fd's close()d at the wrong time can be quite
fun, this should probably be made more explicit in the docs.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoandroid: radeonsi: add support for sid_tables.h generated sources
Mauro Rossi [Sun, 6 Sep 2015 12:15:38 +0000 (14:15 +0200)]
android: radeonsi: add support for sid_tables.h generated sources

This patch is necessary to avoid building error on android,
due to missing sid_tables.h generated sources

v2:[Emil Velikov] Correctly split the lists.

Fixes: fbbebeae10f(radeonsi: inline si_cmd_context_control)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoandroid: Always define __STDC_LIMIT_MACROS.
Mauro Rossi [Fri, 21 Aug 2015 21:46:29 +0000 (23:46 +0200)]
android: Always define __STDC_LIMIT_MACROS.

Analogous to commit 02a4fe22b13 (configure.ac: Always define
__STDC_LIMIT_MACROS.)

v2: [Emil Velikov] keep the LLVM specific __STDC_FORMAT_MACROS

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoandroid: rename LLVM_VERSION_PATCH to MESA_LLVM_VERSION_PATCH
Mauro Rossi [Fri, 21 Aug 2015 21:46:28 +0000 (23:46 +0200)]
android: rename LLVM_VERSION_PATCH to MESA_LLVM_VERSION_PATCH

Fixes: 797f4eacea8(configure.ac: rename LLVM_VERSION_PATCH to avoid
conflict with llvm-config.h)
Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agonouveau: android: add space before PRIx64 macro
Mauro Rossi [Fri, 21 Aug 2015 21:46:27 +0000 (23:46 +0200)]
nouveau: android: add space before PRIx64 macro

Otherwise the android build fails with

   error : unable to find string literal operator ‘operator"" PRIx64’

There are several resources referring to the problem, which is related
to c++11, in our case used when building mesa for lollipop.

http://comments.gmane.org/gmane.comp.graphics.opensg.user/5883

I've not investigated all the semantics, some people even suggested a
bug in the gcc compiler,
I just saw the building error was solved with one little space for
lollipop and no side effect when c+11 not used.

v2: [Emil Velikov] add an alternative commit message from Mauro.

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agosvga: pick all the files into the tarball
Emil Velikov [Wed, 9 Sep 2015 12:22:23 +0000 (13:22 +0100)]
svga: pick all the files into the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.co.uk>
9 years agoauxiliary: rework the python generated sources rules
Emil Velikov [Fri, 17 Jul 2015 09:52:35 +0000 (10:52 +0100)]
auxiliary: rework the python generated sources rules

There are a few bits this commit aims to resolve:

One can generalise the mkdir rule to a simple MKDIR_P $(@D) which will
expand appropriately for even if we change the subdir name, and/or add
new rules. We can also drop the explicit $(srcdir) prefix for the
dependency rules, they they are not strictly required, nor used
elsewhere in mesa.

Finally replace $< with explicit filename to be consistent through the
file, and honour PYTHON_FLAGS.

v2: Add comprehensive commit summary/message (Ian, Matt)

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglsl: build: remove bogus dependency
Emil Velikov [Wed, 9 Sep 2015 11:40:03 +0000 (12:40 +0100)]
glsl: build: remove bogus dependency

v2: rebase on top of the previous commit - don't touch the LOCAL_PATH
prefix for nir_constant_expressions.h

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: build: use makefile.sources variables when possible
Emil Velikov [Fri, 17 Jul 2015 12:30:51 +0000 (13:30 +0100)]
glsl: build: use makefile.sources variables when possible

Rather than folding one variable within the other only to unwrap them,
just use the ones we need.

v2: bring back LOCAL_PATH prefix for nir_constant_expressions,h

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
9 years agoglsl: automake: reuse $(NIR_GENERATED_FILES) where possible
Emil Velikov [Fri, 17 Jul 2015 12:28:00 +0000 (13:28 +0100)]
glsl: automake: reuse $(NIR_GENERATED_FILES) where possible

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: automake: rework the sources generation rules
Emil Velikov [Wed, 9 Sep 2015 11:28:37 +0000 (12:28 +0100)]
glsl: automake: rework the sources generation rules

The glsl equivalent of "mesa: automake: rework the source generation
rules". Plus let's make things consistent and always explicitly provide
the header name.

v2: Rebase on top of reverted "remove custom AM_V_LEX/YACC" (Matt)

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agomesa: automake: rework the source generation rules
Emil Velikov [Fri, 17 Jul 2015 09:44:30 +0000 (10:44 +0100)]
mesa: automake: rework the source generation rules

Same logic as previous commit applies.

Additionally remove the odd (set -e/mv/INDENT) from the rules.
The last one is the only one we remotely care about, if reading the
generated sources.

Upcoming work from DylanB which will replace the existing python
scripts with ones that produce more readable output anyway.

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomapi: automake: rework the source generation rules
Emil Velikov [Fri, 17 Jul 2015 09:27:29 +0000 (10:27 +0100)]
mapi: automake: rework the source generation rules

Same logic as previous commit applies. Also fix bogus MESA_MAPI_DIR -
the sources are located in the source dir (duh).

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomapi: automake: rework the *api/glapi_mapi_tmp.h rules
Emil Velikov [Wed, 9 Sep 2015 11:14:00 +0000 (12:14 +0100)]
mapi: automake: rework the *api/glapi_mapi_tmp.h rules

Same logic as previous commit applies.

v2: Merge with "inline glapi_gen_mapi define" (Matt)

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoutil: automake: rework the format_srgb.c rule
Emil Velikov [Fri, 17 Jul 2015 09:21:06 +0000 (10:21 +0100)]
util: automake: rework the format_srgb.c rule

A handful of changes/cleanups paving the way to bmake support:
 - Remove optional $(srcdir)/ prefix for files in the prereq list.
 - Drop the space after the AM_V_GEN variable.
 - Using $< in a non-suffix rule is a GNU make idiom.
 - Use $(@D) over $(dir $@). The latter is a POSIX standard.

v2: Cosmetic tweaks in the commit summary.

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
9 years agoxmlpool: 'promote' LOCALEDIR variable
Emil Velikov [Wed, 15 Jul 2015 09:28:05 +0000 (10:28 +0100)]
xmlpool: 'promote' LOCALEDIR variable

This is the only place in mesa that uses this constuct which seems
to be GNUmake-ism. Attempting to build with POSIX make implementations
(bmake) would fail as below.

--- options.h ---
LOCALEDIR := .
sh: line 2: LOCALEDIR: command not found
*** [options.h] Error code 127

So let's keep things consistent and compatible by making the variable
non target specific.

v2:
 - Bring back LOCALEDIR.
 - Reword the commit message
 - Change mesa-stable tag 10.6 > 11.0

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Cc: Jonathan Gray <jsg@jsg.id.au>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoegl_dri2: Add support for EGL_KHR_create_contest when using swrast
Boyan Ding [Tue, 21 Jul 2015 15:43:58 +0000 (23:43 +0800)]
egl_dri2: Add support for EGL_KHR_create_contest when using swrast

This requires swrast version >= 3. Also EGL_EXT_create_context_robostness
is supported if __DRI2_ROBUSTNESS extension is found.

Reference: https://bugs.freedesktop.org/show_bug.cgi?id=80821
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
9 years agoegl_dri2: Use createContextAttribs if swrast version >= 3
Boyan Ding [Tue, 21 Jul 2015 15:43:57 +0000 (23:43 +0800)]
egl_dri2: Use createContextAttribs if swrast version >= 3

v2: Change return type of the new function from int to bool

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
9 years agoegl_dri2: Move filling context_attrib array in a separate function
Boyan Ding [Tue, 21 Jul 2015 15:43:56 +0000 (23:43 +0800)]
egl_dri2: Move filling context_attrib array in a separate function

v2: Change return type of the new function from int to bool

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
9 years agomesa: Allow query of GL_VERTEX_BINDING_BUFFER
Marta Lofstedt [Mon, 31 Aug 2015 13:04:18 +0000 (15:04 +0200)]
mesa: Allow query of GL_VERTEX_BINDING_BUFFER

According to OpenGL ES 3.1 specification table : 20.2 and
OpenGL specification 4.4 table 23.4. The glGetIntegeri_v
functions should report the name  of the buffer bound
when called with GL_VERTEX_BINDING_BUFFER.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomesa/es3.1: Enable GL_MAX_VERTEX_ATTRIB enums for GLES 3.1
Marta Lofstedt [Mon, 10 Aug 2015 11:24:00 +0000 (13:24 +0200)]
mesa/es3.1: Enable GL_MAX_VERTEX_ATTRIB enums for GLES 3.1

Signed-off-by: Marta Lofstedt <marta.lofstedt@linux.intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoi965/nir: Use nir_system_value_from_intrinsic to reduce duplication.
Kenneth Graunke [Mon, 3 Aug 2015 23:10:21 +0000 (16:10 -0700)]
i965/nir: Use nir_system_value_from_intrinsic to reduce duplication.

This code is all pretty much identical.  We just needed the translation
from one enum value to the other.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agonir: Add a nir_system_value_from_intrinsic() function.
Kenneth Graunke [Mon, 3 Aug 2015 23:02:16 +0000 (16:02 -0700)]
nir: Add a nir_system_value_from_intrinsic() function.

This converts NIR intrinsics that load system values into Mesa's
SYSTEM_VALUE_* enumerations.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965: Mark topologies with adjacency information as G45+.
Kenneth Graunke [Sat, 25 Jul 2015 04:03:31 +0000 (21:03 -0700)]
i965: Mark topologies with adjacency information as G45+.

These didn't exist on the original 965.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Fix value of _3DPRIM_TRIFAN_NOSTIPPLE.
Kenneth Graunke [Sat, 25 Jul 2015 04:01:43 +0000 (21:01 -0700)]
i965: Fix value of _3DPRIM_TRIFAN_NOSTIPPLE.

TRIFAN_NOSTIPPLE has always been 0x16 - 0x15 is marked "Reserved" on all
platforms.  See the 965 PRM, Volume 2, Table 3-1, "3D Primitive Topology
Type Encoding" for a list.

We don't currently use this, and I don't expect we will, but we may as
well not leave the bogus value around.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Add 64-bit dirty flag handling to brw_upload_pull_constants
Chris Forbes [Sun, 7 Dec 2014 02:32:11 +0000 (15:32 +1300)]
i965: Add 64-bit dirty flag handling to brw_upload_pull_constants

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Add defines for all new Gen7/8 URB opcodes
Chris Forbes [Thu, 6 Nov 2014 11:04:01 +0000 (00:04 +1300)]
i965: Add defines for all new Gen7/8 URB opcodes

Tessellation needs to emit URB reads and atomics;

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/gen8+: Skip depth stalls on state change
Ben Widawsky [Wed, 26 Aug 2015 17:52:58 +0000 (10:52 -0700)]
i965/gen8+: Skip depth stalls on state change

Docs suggest this is no longer required starting with Gen8.

Perf (no regressions in n=20)
OglMultithread       0.67%
OglTerrainPanInst    0.12%
trex                 0.45%
warsow               0.64%

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
9 years agor600: don't use shader key without verifying shader type (v2)
Dave Airlie [Mon, 7 Sep 2015 22:36:32 +0000 (08:36 +1000)]
r600: don't use shader key without verifying shader type (v2)

Since 7a32652231f96eac14c4bfce02afe77b4132fb77
r600: Turn 'r600_shader_key' struct into union

we were accessing key fields that might be aliased in the union
with other fields, so we should check what shader type we are
compiling for before using key values from it.

v1.1: make it compile
v2: have caffeine, make it work - we don't set type
until later, so don't reference it until we've set it.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/skl: Use more compact hiz dimensions
Ben Widawsky [Tue, 8 Sep 2015 17:19:22 +0000 (10:19 -0700)]
i965/skl: Use more compact hiz dimensions

I meant to do this here, but it was in the wrong place:

commit c1151b18f2dce7c6f238f057e9c4fa8d912ce6b5
Author: Ben Widawsky <benjamin.widawsky@intel.com>
Date:   Wed Jun 24 20:07:54 2015 -0700

   i965/skl: Use more compact hiz dimensions

NOTE: Jordan did go back and look at the original mailing list post. I mailed
the right thing, and pushed the wrong one.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agost/mesa: increase viewport bounds limits for GL4 hw
Ilia Mirkin [Tue, 8 Sep 2015 20:58:43 +0000 (16:58 -0400)]
st/mesa: increase viewport bounds limits for GL4 hw

According to the ARB_viewport_array spec, GL4 limit is higher than the
GL3 limit. Also take this opportunity to fix the GL3 limit.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agonvc0: always emit a full shader colormask
Ilia Mirkin [Sun, 6 Sep 2015 08:51:29 +0000 (04:51 -0400)]
nvc0: always emit a full shader colormask

Indications are that if the colormask indicates a single bit set on
fermi, that value will always be read from $r0 instead of a potentially
higher register (if e.g. green is set). Not to upset the counting logic,
always set the header up with a full color mask for each RT. Such a
situation can basically only ever happen with generated blit shaders.

Fixes the following piglit on Fermi (Kepler is unaffected):
  fbo-stencil blit GL_DEPTH32F_STENCIL8

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agodocs: fix date formatting in index.html
Brian Paul [Tue, 8 Sep 2015 14:47:01 +0000 (08:47 -0600)]
docs: fix date formatting in index.html

9 years agonir: UBO loads no longer use const_index[1]
Iago Toral Quiroga [Tue, 1 Sep 2015 09:32:29 +0000 (11:32 +0200)]
nir: UBO loads no longer use const_index[1]

Commit 2126c68e5cba killed the array elements parameter on load/store
intrinsics that was stored in const_index[1]. It looks like that
patch missed to remove this assignment in the UBO path.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonv30: Fix max width / height checks in nv30 sifm code
Hans de Goede [Mon, 7 Sep 2015 19:50:48 +0000 (21:50 +0200)]
nv30: Fix max width / height checks in nv30 sifm code

The sifm object has a limit of 1024x1024 for its input size and 2048x2048
for its output. The code checking this was trying to be clever resulting
in it seeing a surface of e.g 1024x256 being outside of the input size
limit.

This commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoi965: Disallow fast blit paths for CopyTexImage with PixelTransfer ops
Chris Wilson [Sat, 5 Sep 2015 18:19:33 +0000 (19:19 +0100)]
i965: Disallow fast blit paths for CopyTexImage with PixelTransfer ops

glCopyTexImage behaves similarly to glReadPixels with respect to the
pixel transfer operations. Therefore if any are set we cannot use the
simple blit-only fast paths.

(Though if would be possible to relax the blorp path to handle
pixel zoom, or we can just enhance meta.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviwewed-by: Iago Toral <itoral@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
9 years agomesa/tests: Remove unneeded X11_CFLAGS
Jon TURNEY [Fri, 4 Sep 2015 11:43:06 +0000 (12:43 +0100)]
mesa/tests: Remove unneeded X11_CFLAGS

X11_CFLAGS is never defined.  Path to X11 headers is not needed here, so
just remove.

Future work: Using AM_CFLAGS here looks wrong, as this Makefile only builds
C++ files

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoglxl/tests: Use X11_INCLUDES instead of X11_CFLAGS
Jon TURNEY [Fri, 4 Sep 2015 11:43:05 +0000 (12:43 +0100)]
glxl/tests: Use X11_INCLUDES instead of X11_CFLAGS

X11_CFLAGS is undefined, so these tests will fail to build if x11proto is
installed in a non-standard location.

(See also commits 35189d76bc93c379854b028bad901d7e08, etc.)

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agosvga: Fix surface view error handling
Thomas Hellstrom [Fri, 4 Sep 2015 10:26:05 +0000 (03:26 -0700)]
svga: Fix surface view error handling

Make sure errors are correcly propagated.
Also don't flush during state emission if emission fails.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoxa: add xa_surface_from_handle2 v2
Rob Clark [Thu, 3 Sep 2015 06:13:33 +0000 (23:13 -0700)]
xa: add xa_surface_from_handle2 v2

Like xa_surface_from_handle(), but takes a handle type, rather than
hard-coding 'shared' handle.  This is needed to fix bugs seen with
xf86-video-freedreno with xrandr rotation, for example.  The root issue
is that doing a GEM_OPEN ioctl on a bo that already has a GEM handle
associated with the drm_file will result in two unique handles for the
same bo.  Which causes all sorts of follow-on fail.

v2:
- Add support for for fd handles.
- Avoid duplicating code.
- Bump xa version minor.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
9 years agoi965/nir/vec4: removed unneeded tex src swizzle set
Alejandro Piñeiro [Sat, 5 Sep 2015 13:26:59 +0000 (15:26 +0200)]
i965/nir/vec4: removed unneeded tex src swizzle set

At that point the swizzle should be correct.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoutil: make mesa-sha1.c completely empty when there are no SHA1 impls
Ilia Mirkin [Mon, 7 Sep 2015 04:06:51 +0000 (00:06 -0400)]
util: make mesa-sha1.c completely empty when there are no SHA1 impls

My earlier attempt to fix this missed the fact that there was a #else
clause that assumes that you have openssh. This moves the whole thing
under #ifdef HAVE_SHA1 which should avoid this issue.

Fixes: 13bfa5201 (util: always include sha1 into the build)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91898
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@gmail.com>
9 years agoutil: always include sha1 into the build
Ilia Mirkin [Fri, 4 Sep 2015 20:43:22 +0000 (16:43 -0400)]
util: always include sha1 into the build

SHA1 is now used in all builds when HAVE_SHA1 is defined. Adjust src to
do the same thing, rather than predicating on shader cache.

Fixes: 04e201d0c02 ("mesa: change 'SHADER_SUBST' facility to work with env variables")
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@gmail.com>
9 years agost/mesa: don't fall back to 16F when 32F is requested
Ilia Mirkin [Sun, 6 Sep 2015 15:29:00 +0000 (11:29 -0400)]
st/mesa: don't fall back to 16F when 32F is requested

Nothing in the spec allows for the reduced precision, and this also
fixes st_QuerySamplesForFormat for nv50, which does not allow MS8 on
RGBA32F. Now this will be respected instead of reporting MS8 as
supported with an assumption that the format used will be RGBA16F.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: properly handle u_upload_alloc failure
Ilia Mirkin [Sat, 5 Sep 2015 17:11:27 +0000 (13:11 -0400)]
st/mesa: properly handle u_upload_alloc failure

vbuf is never null. We want to make sure that a resource was allocated
for the vbuf, which is *vbuf.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agonouveau: don't mark full range as used on unmap with explicit flush
Ilia Mirkin [Thu, 2 Jul 2015 22:44:18 +0000 (18:44 -0400)]
nouveau: don't mark full range as used on unmap with explicit flush

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonv50: avoid using inline vertex data submit when gl_VertexID is used
Ilia Mirkin [Mon, 24 Aug 2015 15:49:05 +0000 (11:49 -0400)]
nv50: avoid using inline vertex data submit when gl_VertexID is used

The hardware only generates vertexid when vertices come from a VBO. This
fixes:

  vertexid-drawelements
  vertexid-drawarrays

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonv50: don't flush vertex arrays when index buffer changes
Ilia Mirkin [Sat, 4 Jul 2015 00:32:53 +0000 (20:32 -0400)]
nv50: don't flush vertex arrays when index buffer changes

The index buffer is fed in inline over a pushbuf. It's not related to
vertices or any caching that might be done on them.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonv50: rebind bo to bufctx when invalidating idxbuf storage
Ilia Mirkin [Sat, 4 Jul 2015 00:16:48 +0000 (20:16 -0400)]
nv50: rebind bo to bufctx when invalidating idxbuf storage

There is nothing to be done on a dirty idxbuf, but the bo may have
changed, so we have to rebind it to the bufctx.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonv50: clear buffer status on all vertex bufs, not just the first one
Ilia Mirkin [Fri, 3 Jul 2015 23:21:21 +0000 (19:21 -0400)]
nv50: clear buffer status on all vertex bufs, not just the first one

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonv50: fix drawing from tfb, direct-to-pushbuf submits
Ilia Mirkin [Thu, 1 Jan 2015 11:09:59 +0000 (06:09 -0500)]
nv50: fix drawing from tfb, direct-to-pushbuf submits

The stride was being set to 0, which is illegal (and also non-sensical).
Also we must wait for the buffer to become available for reading as
otherwise a wrong value may be prefetched. Since we must wait for the
buffer anyways, and it's mapped and in GART, we may as well avoid the
annoyance of the indirect pushbuf submit.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agoi965: Remove base miplevel from sampler state.
Ben Widawsky [Fri, 4 Sep 2015 17:42:33 +0000 (10:42 -0700)]
i965: Remove base miplevel from sampler state.

Gen9 changes the meaning of this to coarse LOD quality mode. Although that's a
desirable thing to be setting, it doesn't match the gen8 behavior and this was
unintentional. More importantly, we don't ever use this field. So instead of
getting it "wrong" drop it entirely.

This is a respin of a patch which only [incorrectly] tried to address gen9.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agodocs: add news item and link release notes for 10.6.6
Emil Velikov [Fri, 4 Sep 2015 22:11:40 +0000 (23:11 +0100)]
docs: add news item and link release notes for 10.6.6

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: add sha256 checksums for 10.6.6
Emil Velikov [Fri, 4 Sep 2015 22:05:47 +0000 (23:05 +0100)]
docs: add sha256 checksums for 10.6.6

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

9 years agodocs: add release notes for 10.6.6
Emil Velikov [Fri, 4 Sep 2015 21:16:07 +0000 (22:16 +0100)]
docs: add release notes for 10.6.6

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 4b05739e9d718a48415270b95c0a73b56666c364)

9 years agollvmpipe: convert double to long long instead of unsigned long long
Oded Gabbay [Thu, 3 Sep 2015 16:00:26 +0000 (19:00 +0300)]
llvmpipe: convert double to long long instead of unsigned long long

round(val*dscale) produces a double result, as val and dscale are double.
However, LLVMConstInt receives unsigned long long, so there is an
implicit conversion from double to unsigned long long.
This is an undefined behavior. Therefore, we need to first explicitly
convert the round result to long long, and then let the compiler handle
conversion from that to unsigned long long.

This bug manifests itself in POWER, where all IMM values of -1 are being
converted to 0 implicitly, causing a wrong LLVM IR output.

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agonv30: Implement color resolve for msaa
Hans de Goede [Thu, 3 Sep 2015 10:38:01 +0000 (12:38 +0200)]
nv30: Implement color resolve for msaa

Note this is not ideal. Since the sifm can only do source sizes upto
1024x1024 we end up using the blitter on nv4x, which is not that fast.

And on nv3x we end up using the cpu which is really slow.

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonv30: Fix creation of scanout buffers
Hans de Goede [Wed, 12 Aug 2015 11:39:42 +0000 (13:39 +0200)]
nv30: Fix creation of scanout buffers

Scanout buffers on nv30 must always be non-swizzled and have special
width alignment constraints.

These constrains have been taken from the xf86-video-nouveau
src/nv_accel_common.c: nouveau_allocate_surface() function.

nouveau_allocate_surface() applies these width constraints only when a
tiled attribute is set, which it sets for all surfaces allocated via
dri, and this "tiling" is not the same as swizzling, scanout surfaces
must be linear / have a uniform_pitch or only complete garbage is shown.

This commit fixes dri3 on nv30 showing a garbled display, with dri3 the
scanout buffers are allocated by mesa, rather then by the ddx, and the
wrong stride of these buffers was causing the garbled display.

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agovc4: Initialize pack field of qreg to 0 in qir_get_temp
Boyan Ding [Wed, 26 Aug 2015 11:52:50 +0000 (19:52 +0800)]
vc4: Initialize pack field of qreg to 0 in qir_get_temp

This avoids generation of undefined packing in qir and qpu instructions,
fixing a lot of rendering errors.

Fixes 8b36d107fdd (vc4: Pack the unorm-packing bits into a src MUL
instruction when possible.)

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: Disallow PixelTransfer operations for tiled-memcpy TexImage/ReadPixels
Chris Wilson [Fri, 4 Sep 2015 18:02:28 +0000 (19:02 +0100)]
i965: Disallow PixelTransfer operations for tiled-memcpy TexImage/ReadPixels

The tiled memcpy fast paths perform a simple blit (with only a couple of
trivial pixel conversion routines) and do not accommodate PixelTransfer
operations. Therefore if any are set, fallback to the regular routines.
Note that PixelTransfer only applies to TexImage and ReadPixels, not to
GetTexImage.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
9 years agoi965/vec4: Don't unspill the same register in consecutive instructions
Iago Toral Quiroga [Fri, 4 Sep 2015 11:23:20 +0000 (13:23 +0200)]
i965/vec4: Don't unspill the same register in consecutive instructions

If we have spilled/unspilled a register in the current instruction, avoid
emitting unspills for the same register in the same instruction or consecutive
instructions following the current one as long as they keep reading the spilled
register. This should allow us to avoid emitting costy unspills that come with
little benefit to register allocation.

v2:
  - Apply the same logic when evaluating spilling costs (Curro).

v3:
  - Abstract the logic that decides if a register can be reused in a function.
    that can be used from both spill_reg and evaluate_spill_costs (Curro).

v4:
  - Do not disallow reusing scratch_reg in predicated reads (Curro).
  - Track if previous sources in the same instruction read scratch_reg (Curro).
  - Return prev_inst_read_scratch_reg at the end (Curro).
  - No need to explicitily skip scratch read/write opcodes in spill_reg (Curro).
  - Fix the comments explaining what happens when we hit an instruction that
    does not read or write scratch_reg (Curro)
  - Return true early when the current or previous instructions read
    scratch_reg with a compatible mask.

v5:
  - Do not return true early, the loop should not be expensive anyway
    and this adds more complexity (Curro).

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965: Add a debug option for spilling everything in vec4 code
Iago Toral Quiroga [Thu, 23 Jul 2015 09:11:53 +0000 (11:11 +0200)]
i965: Add a debug option for spilling everything in vec4 code

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agodri/common: Tokenize driParseDebugString() argument before matching debug flags.
Francisco Jerez [Thu, 3 Sep 2015 12:20:04 +0000 (15:20 +0300)]
dri/common: Tokenize driParseDebugString() argument before matching debug flags.

Fixes debug string parsing when one of the supported flags is a
substring of another.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agodri/common: Fix codestyle of driParseDebugString().
Francisco Jerez [Thu, 3 Sep 2015 11:50:12 +0000 (14:50 +0300)]
dri/common: Fix codestyle of driParseDebugString().

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoglsl: error out on ES 3.1 if VS or FS present but not both
Tapani Pälli [Thu, 3 Sep 2015 11:26:48 +0000 (14:26 +0300)]
glsl: error out on ES 3.1 if VS or FS present but not both

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: error on linking if no shaders are attached to program
Tapani Pälli [Thu, 3 Sep 2015 11:20:46 +0000 (14:20 +0300)]
glsl: error on linking if no shaders are attached to program

This applies to OpenGL Core >= 4.5 and OpenGL ES >= 3.1.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi965: Improve disassembly of data port read messages.
Kenneth Graunke [Thu, 13 Aug 2015 21:52:55 +0000 (14:52 -0700)]
i965: Improve disassembly of data port read messages.

We now print out the name of the message instead of its numerical
value, and label the message control and surface numbers.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Optimize VUE map comparisons.
Kenneth Graunke [Fri, 15 May 2015 17:08:19 +0000 (10:08 -0700)]
i965: Optimize VUE map comparisons.

The entire VUE map is computed based on the slots_valid bitfield;
calling brw_compute_vue_map on the same bitfield will return the
same result.  So we can simply compare those.

struct brw_vue_map is 136 bytes; doing a single 8-byte comparison is
much cheaper and should work just as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965/gs: Don't reserve space for clip plane uniforms.
Kenneth Graunke [Sat, 29 Aug 2015 06:47:25 +0000 (23:47 -0700)]
i965/gs: Don't reserve space for clip plane uniforms.

These were only for legacy userclipping, which we no longer support
in geometry shaders.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Don't do legacy userclipping in non-compatibility contexts.
Kenneth Graunke [Fri, 28 Aug 2015 08:43:23 +0000 (01:43 -0700)]
i965: Don't do legacy userclipping in non-compatibility contexts.

According to the GLSL 1.50 specification, page 76:
"The shader must also set all values in gl_ClipDistance that have been
 enabled via the OpenGL API, or results are undefined."

With this patch, we only enable clip distance writes when the shader
actually writes them.  We no longer force a value to be written when
clip planes are enabled in the API.  This could mean the first varying
slot would be used as clip distances - I believe it should be the safe
kind of undefined behavior.

Empirically, it doesn't seem to cause a problem.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Remove the brw_vue_prog_key base class.
Kenneth Graunke [Fri, 28 Aug 2015 01:24:39 +0000 (18:24 -0700)]
i965: Remove the brw_vue_prog_key base class.

The legacy userclip fields are only used for the vertex shader, and at
that point there's only program_string_id and the tex struct, which are
common to all keys.  So there's no need for a "VUE" key base class.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Virtualize vec4_visitor::emit_urb_slot().
Kenneth Graunke [Fri, 28 Aug 2015 07:29:05 +0000 (00:29 -0700)]
i965: Virtualize vec4_visitor::emit_urb_slot().

This avoids a downcast of key, which won't exist in the base class soon.

I'm not a huge fan of this patch, but given that we're currently using
inheritance, this seems like the "right" way to do it.  The alternative
is to make key a void pointer in the parent class and continue
downcasting.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Store a key_tex pointer in vec4_visitor.
Kenneth Graunke [Fri, 28 Aug 2015 06:55:28 +0000 (23:55 -0700)]
i965: Store a key_tex pointer in vec4_visitor.

I'm about to remove the base class for VS/GS/HS/DS program keys, at
which point we won't be able to use key->tex anymore.  Instead, we'll
need to store a direct pointer (like we do in the FS backend).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Move legacy clip plane handling to vec4_vs_visitor.
Kenneth Graunke [Fri, 28 Aug 2015 06:49:03 +0000 (23:49 -0700)]
i965: Move legacy clip plane handling to vec4_vs_visitor.

This is now only used for the vertex shader, so it makes sense to get it
out of any paths run by the geometry shader.

Instead of passing the gl_clip_plane array into the run() method (which
is shared among all subclasses), we add it as a vec4_vs_visitor
constructor parameter.  This eliminates the bogus NULL parameter in the
GS case.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Delete the brw_vue_program_key::userclip_active flag.
Kenneth Graunke [Fri, 28 Aug 2015 00:02:27 +0000 (17:02 -0700)]
i965: Delete the brw_vue_program_key::userclip_active flag.

There are two uses of this flag.

The primary use is checking whether we need to emit code to convert
legacy gl_ClipVertex/gl_Position clipping to clip distances.  In this
case, we also have to upload the clip planes as uniforms, which means
setting nr_userclip_plane_consts to a positive value.  Checking if it's
> 0 works for detecting this case.

Gen4-5 also wants to know whether we're doing clipping at all, so it can
emit user clip flags.  Checking if output_reg[VARYING_SLOT_CLIP_DIST0]
is set to a real register suffices for this.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Remove legacy clip plane handling from geometry shaders.
Kenneth Graunke [Thu, 27 Aug 2015 21:04:40 +0000 (14:04 -0700)]
i965: Remove legacy clip plane handling from geometry shaders.

We only support geometry shaders in core profiles, where gl_ClipVertex
doesn't exist.  Presumably the even older behavior of clipping to
gl_Position isn't supported either.  In fact, GLSL 1.50 page 76 claims:

"The shader must also set all values in gl_ClipDistance that have been
 enabled via the OpenGL API, or results are undefined."

So we don't need to handle legacy clipping in geometry shaders.  I think
Paul added this back when we were considering supporting the old
GL_ARB_geometry_shader4 extension.

This removes a non-orthagonal state dependency on GS compilation.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoi965: Move brw_setup_tex_for_precompile to brw_program.[ch].
Kenneth Graunke [Fri, 28 Aug 2015 01:27:20 +0000 (18:27 -0700)]
i965: Move brw_setup_tex_for_precompile to brw_program.[ch].

This living in brw_fs.{h,cpp} is a historical artifact of us supporting
texturing for fragment shaders before any other stages.  It's kind of
awkward given that we use it for all stages.

This avoids having to include brw_fs.h in geometry shader code in order
to access this function.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agomesa: change 'SHADER_SUBST' facility to work with env variables
Tapani Pälli [Mon, 31 Aug 2015 06:54:23 +0000 (09:54 +0300)]
mesa: change 'SHADER_SUBST' facility to work with env variables

Patch modifies existing shader source and replace functionality to work
with environment variables rather than enable dumping on compile time.
Also instead of _mesa_str_checksum, _mesa_sha1_compute is used to avoid
collisions.

Functionality is controlled via two environment variables:

MESA_SHADER_DUMP_PATH - path where shader sources are dumped
MESA_SHADER_READ_PATH - path where replacement shaders are read

v2: cleanups, add strerror if fopen fails, put all functionality
    inside HAVE_SHA1 since sha1 is required

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Suggested-by: Eero Tamminen <eero.t.tamminen@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agobuild: add HAVE_SHA1 define when using --with-sha1 option
Tapani Pälli [Thu, 3 Sep 2015 05:34:42 +0000 (08:34 +0300)]
build: add HAVE_SHA1 define when using --with-sha1 option

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Brian Paul <brianp@vmware.com>
9 years agoi965: Fix copy propagation type changes.
Kenneth Graunke [Wed, 2 Sep 2015 23:39:27 +0000 (16:39 -0700)]
i965: Fix copy propagation type changes.

commit 472ef9a02f2e5c5d0caa2809cb736a0f4f0d4693 introduced code to
change the types of SEL and MOV instructions for moves that simply
"copy bits around".  It didn't account for type conversion moves,
however.  So it would happily turn this:

   mov(8) vgrf6:D, -vgrf5:D
   mov(8) vgrf7:F, vgrf6:UD

into this:

   mov(8) vgrf6:D, -vgrf5:D
   mov(8) vgrf7:D, -vgrf5:D

which erroneously drops the conversion to float.

Cc: "11.0 10.6" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agor600: fix loop overrun in cayman_mul_double_instr
Dave Airlie [Thu, 3 Sep 2015 22:02:14 +0000 (08:02 +1000)]
r600: fix loop overrun in cayman_mul_double_instr

Coverity warned about this. Ilia pointed it out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/gen9: Annotate input coverage mask change
Ben Widawsky [Wed, 26 Aug 2015 23:35:40 +0000 (16:35 -0700)]
i965/gen9: Annotate input coverage mask change

As far as I can tell, the behavior is preserved from the previous generations.
Before we set a single bit to tell the FS whether or not we'll be using an input
coverage mask. Now we have some options which are implementing various
extensions. These bits are used for the various conservative rasterization
mechanisms (for collision detection, binning, and whatever else).

I believe that the behavior is preserved because the problem which conservative
rasterization is attempting to fix would go away with the "NORMAL" mode (at the
cost of performance, I believe).

This patch serves as documentation of the change by creating the enums, as well
as giving some of the history with the links here so that the next person who
comes along and looks at it doesn't spend as long as I had to in order to
determine if there is an issue or not.

Previously, this algorithm had been done in software, and this can still be used
as long as we don't export an extension stating otherwise.

References: https://www.opengl.org/registry/specs/NV/conservative_raster.txt
References: https://http.developer.nvidia.com/GPUGems2/gpugems2_chapter42.html
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agosvga: update call to u_upload_alloc()
Brian Paul [Thu, 3 Sep 2015 17:23:36 +0000 (11:23 -0600)]
svga: update call to u_upload_alloc()

u_upload_alloc() no longer returns a return value.

Trivial.

9 years agowinsys/radeon: remove exported buffers from the cache
Marek Olšák [Tue, 1 Sep 2015 02:14:43 +0000 (04:14 +0200)]
winsys/radeon: remove exported buffers from the cache

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agowinsys/amdgpu: remove exported buffers from the cache
Marek Olšák [Tue, 1 Sep 2015 02:14:33 +0000 (04:14 +0200)]
winsys/amdgpu: remove exported buffers from the cache

Cc: 11.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>