mesa.git
8 years agomesa/main: allow delayed initialization of performance monitors
Nicolai Hähnle [Wed, 25 Nov 2015 10:59:23 +0000 (11:59 +0100)]
mesa/main: allow delayed initialization of performance monitors

Most applications never use performance counters, so allow drivers to
skip potentially expensive initialization steps.

A driver that wants to use this must enable the appropriate extension(s)
at context initialization and set the InitPerfMonitorGroups driver function
which will be called the first time information about the performance monitor
groups is actually used.

The init_groups helper is called for API functions that can be called before
a monitor object exists. Functions that require an existing monitor object
can rely on init_groups having been called before.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
8 years agoglsl: handle case where index is array deref in optimize_split_arrays
Tapani Pälli [Thu, 19 Nov 2015 11:12:13 +0000 (13:12 +0200)]
glsl: handle case where index is array deref in optimize_split_arrays

Previously pass did not traverse to those array dereferences which were
used as indices to arrays. This fixes Synmark2 Gl42CSCloth application
issues.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
8 years agonouveau: move interlaced assert down in nouveau_vp3_video_buffer_create
Julien Isorce [Wed, 25 Nov 2015 08:17:34 +0000 (08:17 +0000)]
nouveau: move interlaced assert down in nouveau_vp3_video_buffer_create

templat->interlaced is 0 if not NV12 which is the case currently
when using VPP.

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: remove trailing spaces in various files
Iago Toral Quiroga [Tue, 24 Nov 2015 11:49:55 +0000 (12:49 +0100)]
i965: remove trailing spaces in various files

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoglsl: remove trailing spaces in various files
Iago Toral Quiroga [Tue, 24 Nov 2015 11:40:53 +0000 (12:40 +0100)]
glsl: remove trailing spaces in various files

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965: Pass brw_context pointer, not gl_context pointer.
Matt Turner [Wed, 25 Nov 2015 05:25:53 +0000 (21:25 -0800)]
i965: Pass brw_context pointer, not gl_context pointer.

Fixes a warning introduced by commit dcadd855.

8 years agoglsl: only call dead code pass when new inputs/outputs demoted
Timothy Arceri [Sat, 21 Nov 2015 08:02:01 +0000 (19:02 +1100)]
glsl: only call dead code pass when new inputs/outputs demoted

This will help avoid eliminating inputs/outputs needed by SSOs.

Cc: Gregory Hainaut <gregory.hainaut@gmail.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
8 years agoglsl: move and reused code to find first and last shaders
Timothy Arceri [Sat, 21 Nov 2015 08:02:00 +0000 (19:02 +1100)]
glsl: move and reused code to find first and last shaders

Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
8 years agomesa: Use unreachable() instead of a default case.
Matt Turner [Tue, 24 Nov 2015 00:23:29 +0000 (16:23 -0800)]
mesa: Use unreachable() instead of a default case.

(And add an unreachable() in one place that didn't have a default case)

8 years agometa: Don't save or restore the active client texture
Ian Romanick [Mon, 9 Nov 2015 19:15:04 +0000 (11:15 -0800)]
meta: Don't save or restore the active client texture

This setting is only used by glTexCoordPointer and related glEnable
calls.  Since the preceeding commits removed all of those, it is not
necessary to save, reset to default, or restore this state.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Don't save or restore the VBO binding
Ian Romanick [Thu, 5 Nov 2015 22:48:58 +0000 (14:48 -0800)]
meta: Don't save or restore the VBO binding

Nothing left in meta does anything with the VBO binding, so we don't
need to save or restore it.  The VAO binding is still modified.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa/TexSubImage: Don't pollute the buffer object namespace
Ian Romanick [Mon, 9 Nov 2015 21:11:02 +0000 (13:11 -0800)]
meta/TexSubImage: Don't pollute the buffer object namespace

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Don't pollute the buffer object namespace in _mesa_meta_DrawTex
Ian Romanick [Thu, 5 Nov 2015 22:44:26 +0000 (14:44 -0800)]
meta: Don't pollute the buffer object namespace in _mesa_meta_DrawTex

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Use internal functions for buffer object and VAO access in _mesa_meta_DrawTex
Ian Romanick [Thu, 5 Nov 2015 22:42:07 +0000 (14:42 -0800)]
meta: Use internal functions for buffer object and VAO access in _mesa_meta_DrawTex

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Track VBO using gl_buffer_object instead of GL API object handle in _mesa_meta_...
Ian Romanick [Thu, 5 Nov 2015 22:31:23 +0000 (14:31 -0800)]
meta: Track VBO using gl_buffer_object instead of GL API object handle in _mesa_meta_DrawTex

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Partially convert _mesa_meta_DrawTex to DSA
Ian Romanick [Thu, 5 Nov 2015 22:16:31 +0000 (14:16 -0800)]
meta: Partially convert _mesa_meta_DrawTex to DSA

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Don't pollute the buffer object namespace in _mesa_meta_setup_vertex_objects
Ian Romanick [Wed, 4 Nov 2015 01:41:16 +0000 (17:41 -0800)]
meta: Don't pollute the buffer object namespace in _mesa_meta_setup_vertex_objects

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Use internal functions for buffer object and VAO access
Ian Romanick [Wed, 4 Nov 2015 00:47:22 +0000 (16:47 -0800)]
meta: Use internal functions for buffer object and VAO access

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Use DSA functions for VBOs in _mesa_meta_setup_vertex_objects
Ian Romanick [Tue, 3 Nov 2015 23:55:14 +0000 (15:55 -0800)]
meta: Use DSA functions for VBOs in _mesa_meta_setup_vertex_objects

The fixed-function attribute paths don't get the DSA treatment because
there are no DSA entry-points for fixed-function attributes.  These
could have been added, but this is a temporary patch intended to make
later patches easier to review.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Track VBO using gl_buffer_object instead of GL API object handle
Ian Romanick [Tue, 3 Nov 2015 23:37:40 +0000 (15:37 -0800)]
meta: Track VBO using gl_buffer_object instead of GL API object handle

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Don't leave the VBO bound after _mesa_meta_setup_vertex_objects
Ian Romanick [Tue, 3 Nov 2015 04:11:02 +0000 (20:11 -0800)]
meta: Don't leave the VBO bound after _mesa_meta_setup_vertex_objects

Meta currently does this, but future changes will make this impossible.
Explicitly do it as a step in the patch series now to catch any possible
kinks.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Use _mesa_NamedBufferSubData for users of _mesa_meta_setup_vertex_objects
Ian Romanick [Tue, 3 Nov 2015 03:10:08 +0000 (19:10 -0800)]
i965: Use _mesa_NamedBufferSubData for users of _mesa_meta_setup_vertex_objects

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Use _mesa_NamedBufferData and _mesa_NamedBufferSubData for users of _mesa_meta_...
Ian Romanick [Tue, 3 Nov 2015 02:36:34 +0000 (18:36 -0800)]
meta: Use _mesa_NamedBufferData and _mesa_NamedBufferSubData for users of _mesa_meta_setup_vertex_objects

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agometa: Use DSA functions for PBO in create_texture_for_pbo
Ian Romanick [Tue, 3 Nov 2015 02:33:54 +0000 (18:33 -0800)]
meta: Use DSA functions for PBO in create_texture_for_pbo

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Don't pollute the buffer object namespace in brw_meta_fast_clear
Ian Romanick [Tue, 3 Nov 2015 01:04:41 +0000 (17:04 -0800)]
i965: Don't pollute the buffer object namespace in brw_meta_fast_clear

tl;dr: For many types of GL object, we can *NEVER* use the Gen function.

In OpenGL ES (all versions!) and OpenGL compatibility profile,
applications don't have to call Gen functions.  The GL spec is very
clear about how you can mix-and-match generated names and non-generated
names: you can use any name you want for a particular object type until
you call the Gen function for that object type.

Here's the problem scenario:

 - Application calls a meta function that generates a name.  The first
   Gen will probably return 1.

 - Application decides to use the same name for an object of the same
   type without calling Gen.  Many demo programs use names 1, 2, 3,
   etc. without calling Gen.

 - Application calls the meta function again, and the meta function
   replaces the data.  The application's data is lost, and the app
   fails.  Have fun debugging that.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92363
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Use internal functions for buffer object access
Ian Romanick [Mon, 2 Nov 2015 22:49:03 +0000 (14:49 -0800)]
i965: Use internal functions for buffer object access

Instead of going through the GL API implementation functions, use the
lower-level functions.  This means that we have to keep track of a
pointer to the gl_buffer_object and the gl_vertex_array_object.

This has two advantages.  First, it avoids a bunch of CPU overhead in
looking up objects and validing API parameters.  Second, and much more
importantly, it will allow us to stop calling _mesa_GenBuffers /
_mesa_CreateBuffers and pollute the buffer namespace (next patch).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Use DSA functions for VBOs in brw_meta_fast_clear
Ian Romanick [Mon, 2 Nov 2015 22:31:56 +0000 (14:31 -0800)]
i965: Use DSA functions for VBOs in brw_meta_fast_clear

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoi965: Pass brw_context instead of gl_context to brw_draw_rectlist
Ian Romanick [Mon, 2 Nov 2015 20:41:28 +0000 (12:41 -0800)]
i965: Pass brw_context instead of gl_context to brw_draw_rectlist

Future patches will use the brw_context instead.  Keeping this
non-functional change separate should make the function changes easier
to review.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: Refactor enable_vertex_array_attrib to make _mesa_enable_vertex_array_attrib
Ian Romanick [Wed, 4 Nov 2015 00:16:00 +0000 (16:16 -0800)]
mesa: Refactor enable_vertex_array_attrib to make _mesa_enable_vertex_array_attrib

Pulls the parts of enable_vertex_array_attrib that aren't just parameter
validation out into a function that can be called from other parts of
Mesa (e.g., meta).

_mesa_enable_vertex_array_attrib can also be used to enable
fixed-function arrays.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: Refactor update_array_format to make _mesa_update_array_format_public
Ian Romanick [Wed, 4 Nov 2015 00:09:22 +0000 (16:09 -0800)]
mesa: Refactor update_array_format to make _mesa_update_array_format_public

Pulls the parts of update_array_format that aren't just parameter
validation out into a function that can be called from other parts of
Mesa (e.g., meta).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agomesa: Make bind_vertex_buffer avilable outside varray.c
Ian Romanick [Mon, 2 Nov 2015 20:40:32 +0000 (12:40 -0800)]
mesa: Make bind_vertex_buffer avilable outside varray.c

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
8 years agoRevert "i965: Combine assembly annotations if possible."
Kenneth Graunke [Thu, 19 Nov 2015 08:45:49 +0000 (00:45 -0800)]
Revert "i965: Combine assembly annotations if possible."

This reverts commit a280e83d71bb046098ed5380cb053318f9e8cf8e.

It breaks INTEL_DEBUG=fs output.  For example,
glsl-fs-discard-01.shader_test has 11 instructions but only prints 5.

Acked-by: Matt Turner <mattst88@gmail.com>
8 years agoglsl: Pass ast_type_qualifier by const reference.
Matt Turner [Mon, 23 Nov 2015 22:22:48 +0000 (14:22 -0800)]
glsl: Pass ast_type_qualifier by const reference.

Coverity noticed that we were passing this by value, and it's 152 bytes.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Clean up #includes in the compiler.
Matt Turner [Mon, 23 Nov 2015 02:27:42 +0000 (18:27 -0800)]
i965: Clean up #includes in the compiler.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Move brw_new_shader and brw_link_shader prototypes from brw_wm.h.
Matt Turner [Mon, 23 Nov 2015 17:31:21 +0000 (09:31 -0800)]
i965: Move brw_new_shader and brw_link_shader prototypes from brw_wm.h.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Compile brw_cs_fill_local_id_payload() as C.
Matt Turner [Mon, 23 Nov 2015 06:11:53 +0000 (22:11 -0800)]
i965: Compile brw_cs_fill_local_id_payload() as C.

It's only called from C, it compiles as C, so just compile it as C.

Notice the missing extern "C" on the definition of the function, which
would screw things up if the prototype wasn't parsed before the
definition.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Move MRF macros from brw_inst.h to brw_eu.h.
Matt Turner [Mon, 23 Nov 2015 01:58:51 +0000 (17:58 -0800)]
i965: Move MRF macros from brw_inst.h to brw_eu.h.

brw_inst.h is only for the brw_inst/brw_compact_inst functions.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Drop #include of main/glheader.h.
Matt Turner [Mon, 23 Nov 2015 01:40:26 +0000 (17:40 -0800)]
i965: Drop #include of main/glheader.h.

It's never used.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Push down inclusion of brw_program.h.
Matt Turner [Sun, 22 Nov 2015 23:30:59 +0000 (15:30 -0800)]
i965: Push down inclusion of brw_program.h.

We were including it in headers, which then caused it to be included in
tons of places it wasn't needed.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Mark functions called from C as extern "C".
Matt Turner [Mon, 23 Nov 2015 05:54:28 +0000 (21:54 -0800)]
i965: Mark functions called from C as extern "C".

These functions' prototypes are marked with extern "C", which apparently
overrides a lack of extern "C" at the definition site if the prototype
has been seen first.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Push down inclusion of vbo/vbo.h.
Matt Turner [Sun, 22 Nov 2015 23:35:07 +0000 (15:35 -0800)]
i965: Push down inclusion of vbo/vbo.h.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Remove duplicate #includes.
Matt Turner [Mon, 23 Nov 2015 00:08:23 +0000 (16:08 -0800)]
i965: Remove duplicate #includes.

Added in commits 36fd65381 and 337dad8ce even though the existing
include was in view.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Remove unneeded forward declarations.
Matt Turner [Sun, 22 Nov 2015 23:13:31 +0000 (15:13 -0800)]
i965: Remove unneeded forward declarations.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Mark count_trailing_one_bits() static.
Matt Turner [Sun, 22 Nov 2015 23:06:43 +0000 (15:06 -0800)]
i965: Mark count_trailing_one_bits() static.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoi965: Remove useless gen6_blorp.h/gen7_blorp.h headers.
Matt Turner [Sun, 22 Nov 2015 23:04:45 +0000 (15:04 -0800)]
i965: Remove useless gen6_blorp.h/gen7_blorp.h headers.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoutil: Include assert.h in macros.h.
Matt Turner [Sun, 22 Nov 2015 23:28:25 +0000 (15:28 -0800)]
util: Include assert.h in macros.h.

8 years agoutil: Include <stdbool.h> in debug.h.
Matt Turner [Tue, 24 Nov 2015 18:05:04 +0000 (10:05 -0800)]
util: Include <stdbool.h> in debug.h.

8 years agoi965: Prevent implicit upcasts to brw_reg.
Matt Turner [Fri, 20 Nov 2015 05:51:37 +0000 (21:51 -0800)]
i965: Prevent implicit upcasts to brw_reg.

Now that backend_reg inherits from brw_reg, we have to be careful to
avoid the object slicing problem.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Use scope operator to ensure brw_reg is interpreted as a type.
Matt Turner [Tue, 24 Nov 2015 00:17:28 +0000 (16:17 -0800)]
i965: Use scope operator to ensure brw_reg is interpreted as a type.

In the next patch, I make backend_reg's inheritance from brw_reg
private, which confuses clang when it sees the type "struct brw_reg" in
the derived class constructors, thinking it is referring to the
privately inherited brw_reg:

brw_fs.cpp:366:23: error: 'brw_reg' is a private member of 'brw_reg'
fs_reg::fs_reg(struct brw_reg reg) :
                      ^
brw_shader.h:39:22: note: constrained by private inheritance here
struct backend_reg : private brw_reg
                     ^~~~~~~~~~~~~~~
brw_reg.h:232:8: note: member is declared here
struct brw_reg {
       ^

Avoid this by marking brw_reg with the scope resolution operator.

8 years agoi965: Use implicit backend_reg copy-constructor.
Matt Turner [Sat, 21 Nov 2015 05:18:26 +0000 (21:18 -0800)]
i965: Use implicit backend_reg copy-constructor.

In order to do this, we have to change the signature of the
backend_reg(brw_reg) constructor to take a reference to a brw_reg in
order to avoid unresolvable ambiguity about which constructor is
actually being called in the other modifications in this patch.

As far as I understand it, the rule in C++ is that if multiple
constructors are available for parent classes, the one closest to you in
the class heirarchy is closen, but if one of them didn't take a
reference, that screws things up.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Add and use backend_reg::equals().
Matt Turner [Sun, 22 Nov 2015 21:25:05 +0000 (13:25 -0800)]
i965: Add and use backend_reg::equals().

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agosoftpipe/llvmpipe: don't advertize support for ASTC
Roland Scheidegger [Tue, 24 Nov 2015 17:25:06 +0000 (18:25 +0100)]
softpipe/llvmpipe: don't advertize support for ASTC

33339775565154040e0c4ea2e196217dccc08cdf added support for ASTC textures to
gallium. They don't have any helpers hooked up for software decoding, however,
so cannot support them in drivers relying on util code for decoding.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agollvmpipe: don't test for unsupported formats in lp_test_format
Roland Scheidegger [Tue, 24 Nov 2015 16:52:37 +0000 (17:52 +0100)]
llvmpipe: don't test for unsupported formats in lp_test_format

Removing the fake format helpers (1c7d0a6aa4f5cb38af7e281e1e5437cd1a20f781)
caused this to fail. These formats were never supported, but previously
they would have asserted in the generated jit functions (which, due to lack
of test cases for these formats, were never called) whereas we now assert when
trying to build the jit function. So, skip them completely.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=93092

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agodocs: add missed i965 feature to relnotes
Ian Romanick [Tue, 24 Nov 2015 16:58:49 +0000 (08:58 -0800)]
docs: add missed i965 feature to relnotes

Trivial.  GL_ARB_fragment_layer_viewport support was added in 8c902a58
by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
8 years agoutil: move brw_env_var_as_boolean() to util
Rob Clark [Wed, 18 Nov 2015 21:43:31 +0000 (16:43 -0500)]
util: move brw_env_var_as_boolean() to util

Kind of a handy function.  And I'll want it available outside of i965
for common nir-pass helpers.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Nicolai Hähnle <nhaehnle@gmail.com>
8 years agost/va: fix indentation
Christian König [Mon, 23 Nov 2015 14:01:46 +0000 (15:01 +0100)]
st/va: fix indentation

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/va: move MPEG4 functions into separate file
Christian König [Mon, 23 Nov 2015 13:51:26 +0000 (14:51 +0100)]
st/va: move MPEG4 functions into separate file

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/va: move VC-1 functions into separate file
Christian König [Mon, 23 Nov 2015 13:32:27 +0000 (14:32 +0100)]
st/va: move VC-1 functions into separate file

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/va: move H264 functions into separate file
Christian König [Mon, 23 Nov 2015 13:22:09 +0000 (14:22 +0100)]
st/va: move H264 functions into separate file

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/va: move MPEG12 functions into separate file
Christian König [Mon, 23 Nov 2015 13:03:52 +0000 (14:03 +0100)]
st/va: move MPEG12 functions into separate file

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/va: move post processing function into own file
Christian König [Mon, 23 Nov 2015 12:50:41 +0000 (13:50 +0100)]
st/va: move post processing function into own file

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agost/va: fix post process dirty area handling
Christian König [Mon, 23 Nov 2015 12:44:49 +0000 (13:44 +0100)]
st/va: fix post process dirty area handling

The dirty area in this call isn't related to the screen at all.

v2: set clear dirty area to false as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
8 years agoglsl: implement recent spec update to SSO validation
Timothy Arceri [Tue, 24 Nov 2015 00:44:13 +0000 (11:44 +1100)]
glsl: implement recent spec update to SSO validation

Enables 200+ dEQP SSO tests to proceed past validation,
and fixes a ES31-CTS.sepshaderobjs.PipelineApi subtest.

V2: split out change that reverts a previous patch into its own commit,
move variable declaration to top of function, and fix some formatting
all suggested by Ian.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
8 years agoRevert "mesa: return initial value for VALIDATE_STATUS if pipe not bound"
Timothy Arceri [Tue, 24 Nov 2015 00:50:22 +0000 (11:50 +1100)]
Revert "mesa: return initial value for VALIDATE_STATUS if pipe not bound"

This reverts commit ba02f7a3b6a0e4314753a8e5080db61241563f9c.

The commit checked whether the pipeline was currently bound instead
of checking whether it had ever been bound.  The previous setting
of Validated during object creation makes this unnecessary.  The
real problem was that Validated was not properly set to false
elsewhere in the code.  This is fixed by a later patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
8 years agoradeon/llvm: Use llvm.AMDIL.exp intrinsic again for now
Michel Dänzer [Thu, 19 Nov 2015 02:30:21 +0000 (11:30 +0900)]
radeon/llvm: Use llvm.AMDIL.exp intrinsic again for now

llvm.exp2.f32 doesn't work in some cases yet.

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

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeon/uvd: uv pitch separation for stoney
Boyuan Zhang [Thu, 12 Nov 2015 23:01:16 +0000 (18:01 -0500)]
radeon/uvd: uv pitch separation for stoney

v2: set the behaviour default for future ASICs.

Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agotexgetimage: consolidate 1D array handling code.
Dave Airlie [Wed, 11 Nov 2015 02:33:38 +0000 (12:33 +1000)]
texgetimage: consolidate 1D array handling code.

This should fix the getteximage-depth test that currently asserts.

I was hitting problem with virgl as well in this area.

This moves the 1D array handling code to a single place.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ben Skeggs <bskeggs@redhat.com>
Cc: "10.6 11.0 11.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agoi965: Use NIR for lowering texture swizzle
Jason Ekstrand [Thu, 12 Nov 2015 02:41:37 +0000 (18:41 -0800)]
i965: Use NIR for lowering texture swizzle

Now that nir_lower_tex can do texture swizzle lowering, we can use that
instead of repeating more-or-less the same code in both backends.  This
both allows us to share code and means that things like the tg4
work-arounds are somewhat simpler because they don't have to take the
swizzle into account.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir/lower_tex: Add support for lowering texture swizzle
Jason Ekstrand [Thu, 12 Nov 2015 02:30:31 +0000 (18:30 -0800)]
nir/lower_tex: Add support for lowering texture swizzle

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Add a tex_instr_is_query helper
Jason Ekstrand [Thu, 12 Nov 2015 02:30:09 +0000 (18:30 -0800)]
nir: Add a tex_instr_is_query helper

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Add a ssa_def_rewrite_uses_after helper
Jason Ekstrand [Thu, 12 Nov 2015 16:40:17 +0000 (08:40 -0800)]
nir: Add a ssa_def_rewrite_uses_after helper

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Use instr/if_rewrite in nir_ssa_def_rewrite_uses
Jason Ekstrand [Thu, 12 Nov 2015 05:13:26 +0000 (21:13 -0800)]
nir: Use instr/if_rewrite in nir_ssa_def_rewrite_uses

nir_ssa_def_rewrite_uses is one of the older helpers in NIR and predated
both of those.  Now it can be substantially simplified.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir/validate: Validated dests after sources
Jason Ekstrand [Thu, 12 Nov 2015 18:38:12 +0000 (10:38 -0800)]
nir/validate: Validated dests after sources

Previously, if someone accidentally made an instruction that refers to its
own SSA destination, the validator wouldn't catch it.  The reason for this
is that it validated the destination too early and, by the time it got to
the source, the destination SSA value was already added to the set of seen
SSA values so it would assume that it came from some previous instruction.
By moving destination validation to be after source validation, the SSA
value is not in the list of seen values and the validator will catch
self-referential instructions.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agoi965: Use nir_lower_tex for texture coordinate lowering
Jason Ekstrand [Wed, 11 Nov 2015 19:01:59 +0000 (11:01 -0800)]
i965: Use nir_lower_tex for texture coordinate lowering

Previously, we had a rescale_texcoords helper in the FS backend for
handling rescaling of texture coordinates.  Now that we can do variants in
NIR, we can use nir_lower_tex to do the rescaling for us.  This allows us
to delete the i965-specific code and gives us proper TEXTURE_RECTANGLE and
GL_CLAMP handling in vertex and geometry shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agoi965/fs: Stomp the texture return type to UINT32 for resinfo messages
Jason Ekstrand [Wed, 11 Nov 2015 23:46:55 +0000 (15:46 -0800)]
i965/fs: Stomp the texture return type to UINT32 for resinfo messages

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir/lower_tex: Set the dest_type for txs instructions
Jason Ekstrand [Wed, 11 Nov 2015 20:01:20 +0000 (12:01 -0800)]
nir/lower_tex: Set the dest_type for txs instructions

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/lower_tex: Report progress
Jason Ekstrand [Wed, 11 Nov 2015 18:46:09 +0000 (10:46 -0800)]
nir/lower_tex: Report progress

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Move postprocess_nir to codegen time
Jason Ekstrand [Wed, 11 Nov 2015 18:04:43 +0000 (10:04 -0800)]
i965: Move postprocess_nir to codegen time

This allows us to insert NIR passes between initial NIR compilation and
optimization (link time) and actual backend code-gen.  In particular, it
will allow us to do shader variants in NIR and share some of that shader
variant code between backends.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965/nir: Split shader optimization and lowering into three stages
Jason Ekstrand [Wed, 11 Nov 2015 17:40:51 +0000 (09:40 -0800)]
i965/nir: Split shader optimization and lowering into three stages

At the moment, brw_create_nir just calls the three stages in sequence so
there's not much difference.  Soon, however, we will want to start doing
variants in NIR at which point the postprocessing step will have to move
from shader create time to codegen time.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoi965: Use ull immediates in brw_inst_bits
Jason Ekstrand [Mon, 23 Nov 2015 18:53:01 +0000 (10:53 -0800)]
i965: Use ull immediates in brw_inst_bits

This fixes a regression introduced in b1a83b5d1 that caused basically all
shaders to fail to compile on 32-bit platforms.

Reported-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agodocs: add missed freedreno features to relnotes
Ilia Mirkin [Mon, 23 Nov 2015 17:31:59 +0000 (12:31 -0500)]
docs: add missed freedreno features to relnotes

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.1" <mesa-stable@lists.freedesktop.org>
8 years agodocs: update relnotes with new freedreno/a4xx support
Ilia Mirkin [Mon, 23 Nov 2015 17:04:50 +0000 (12:04 -0500)]
docs: update relnotes with new freedreno/a4xx support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agosvga: Add ASTC formats to format table.
Jose Fonseca [Mon, 23 Nov 2015 16:45:28 +0000 (16:45 +0000)]
svga: Add ASTC formats to format table.

Fixes build.  Otherwise untested.

Trivial.

8 years agofreedreno/ir3: add support for a few gs5 ops
Ilia Mirkin [Sun, 22 Nov 2015 22:46:13 +0000 (17:46 -0500)]
freedreno/ir3: add support for a few gs5 ops

Tested on a4xx. This is part of the builtins added by ARB_gpu_shader5
and GLSL ES 3.10.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agottn: fix UMSB conversion
Ilia Mirkin [Sun, 22 Nov 2015 22:37:47 +0000 (17:37 -0500)]
ttn: fix UMSB conversion

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add ARB_texture_query_lod support
Ilia Mirkin [Sun, 22 Nov 2015 21:47:25 +0000 (16:47 -0500)]
freedreno/a4xx: add ARB_texture_query_lod support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agottn: add LODQ support
Ilia Mirkin [Sun, 22 Nov 2015 21:41:16 +0000 (16:41 -0500)]
ttn: add LODQ support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: re-emit program on dirty framebuffer
Ilia Mirkin [Sun, 22 Nov 2015 19:06:26 +0000 (14:06 -0500)]
freedreno/a4xx: re-emit program on dirty framebuffer

The program emit depends on certain fb details. Make sure those get
updated when the fb changes.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: use a factor of 32767 for snorm8 blending
Ilia Mirkin [Sun, 22 Nov 2015 19:03:29 +0000 (14:03 -0500)]
freedreno/a4xx: use a factor of 32767 for snorm8 blending

It appears that the hardware wants the integer to be scaled the same way
that the hardware representation is. snorm16 uses one of the float
factors, so this is only relevant for snorm8.

This fixes a number of subcases of
  bin/fbo-blending-formats GL_EXT_texture_snorm

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
8 years agofreedreno/a4xx: only compute texture offset once for the view
Ilia Mirkin [Sun, 22 Nov 2015 17:13:46 +0000 (12:13 -0500)]
freedreno/a4xx: only compute texture offset once for the view

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add ARB_texture_view support
Ilia Mirkin [Sun, 22 Nov 2015 02:24:48 +0000 (21:24 -0500)]
freedreno/a4xx: add ARB_texture_view support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add formats for ARB_texture_buffer_object_rgb32 support
Ilia Mirkin [Sun, 22 Nov 2015 01:33:23 +0000 (20:33 -0500)]
freedreno/a4xx: add formats for ARB_texture_buffer_object_rgb32 support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add ARB_texture_rgb10_a2ui support
Ilia Mirkin [Sun, 22 Nov 2015 00:26:34 +0000 (19:26 -0500)]
freedreno/a4xx: add ARB_texture_rgb10_a2ui support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add astc formats
Ilia Mirkin [Sat, 21 Nov 2015 16:49:03 +0000 (11:49 -0500)]
freedreno/a4xx: add astc formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: add astc support
Ilia Mirkin [Sat, 21 Nov 2015 17:19:52 +0000 (12:19 -0500)]
st/mesa: add astc support

This doesn't account for the ldr/hdr distinction... that will probably
have to be exposed via a separate cap. When relevant hardware appears,
this can be worked out.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium: add ASTC formats
Ilia Mirkin [Sat, 21 Nov 2015 16:23:34 +0000 (11:23 -0500)]
gallium: add ASTC formats

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium/util: remove the fake format helpers for bptc and etc2
Ilia Mirkin [Sat, 21 Nov 2015 15:44:00 +0000 (10:44 -0500)]
gallium/util: remove the fake format helpers for bptc and etc2

This was a silly hack that kept growing and growing. Instead, just write
NULLs for those functions. No need to have helpers that just assert(0)
when you call them.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agofreedreno/a4xx: support 16384 texels in buffer texture
Ilia Mirkin [Sat, 21 Nov 2015 15:28:45 +0000 (10:28 -0500)]
freedreno/a4xx: support 16384 texels in buffer texture

Looks like the width field's bitmask was off-by-one.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add ARB_texture_buffer_range support
Ilia Mirkin [Sat, 21 Nov 2015 15:02:05 +0000 (10:02 -0500)]
freedreno/a4xx: add ARB_texture_buffer_range support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/a4xx: add polygon mode support
Ilia Mirkin [Sat, 21 Nov 2015 18:56:22 +0000 (13:56 -0500)]
freedreno/a4xx: add polygon mode support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>