mesa.git
9 years agoradeonsi: clean up copy-pasted scratch buffer updates
Marek Olšák [Thu, 8 Oct 2015 23:35:32 +0000 (01:35 +0200)]
radeonsi: clean up copy-pasted scratch buffer updates

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: unify shader create functions
Marek Olšák [Thu, 8 Oct 2015 23:14:12 +0000 (01:14 +0200)]
radeonsi: unify shader create functions

The shader specifies the processor type, so use that instead.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: unify shader delete functions
Marek Olšák [Thu, 8 Oct 2015 23:08:42 +0000 (01:08 +0200)]
radeonsi: unify shader delete functions

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: fix a GS copy shader leak
Marek Olšák [Thu, 8 Oct 2015 22:54:17 +0000 (00:54 +0200)]
radeonsi: fix a GS copy shader leak

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: remove an unused ctx parameter in si_shader_destroy
Marek Olšák [Thu, 8 Oct 2015 22:49:13 +0000 (00:49 +0200)]
radeonsi: remove an unused ctx parameter in si_shader_destroy

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: print export_prim_id from the shader key
Marek Olšák [Thu, 8 Oct 2015 22:20:30 +0000 (00:20 +0200)]
radeonsi: print export_prim_id from the shader key

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: disable NaNs for LS and HS
Marek Olšák [Thu, 8 Oct 2015 20:23:18 +0000 (22:23 +0200)]
radeonsi: disable NaNs for LS and HS

They're disabled for all other shaders except compute, but I forgot
to do this for tess stages.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: clean up si_llvm_init_export_args
Marek Olšák [Tue, 6 Oct 2015 23:28:18 +0000 (01:28 +0200)]
radeonsi: clean up si_llvm_init_export_args

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agotgsi: move pipe_shader_from_tgsi_processor function to util
Marek Olšák [Thu, 8 Oct 2015 23:11:31 +0000 (01:11 +0200)]
tgsi: move pipe_shader_from_tgsi_processor function to util

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agomesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()
Brian Paul [Wed, 14 Oct 2015 15:08:50 +0000 (09:08 -0600)]
mesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()

Changing the matrix mode alone has no effect on rendering and does
not need to trigger a flush or state validation.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: fix clip state dependencies
Marek Olšák [Sat, 17 Oct 2015 12:20:01 +0000 (14:20 +0200)]
st/mesa: fix clip state dependencies

This allows removing FLUSH_VERTICES in MatrixMode.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium/hud: fix possible NULL pointer dereference
Marek Olšák [Sat, 17 Oct 2015 17:05:46 +0000 (19:05 +0200)]
gallium/hud: fix possible NULL pointer dereference

Trivial.

9 years agoscons: fix MSVC, MinGW build
Brian Paul [Sat, 17 Oct 2015 16:02:04 +0000 (10:02 -0600)]
scons: fix MSVC, MinGW build

Duplicate the glsl_types_hack.cpp work-around from the libgl-xlib target.

9 years agobuild: fix make-check after a6a6a71
Rob Clark [Sat, 17 Oct 2015 13:49:19 +0000 (09:49 -0400)]
build: fix make-check after a6a6a71

   commit a6a6a71092ba912803ae2b47eb56e3afdf36feb5
   Author:     Rob Clark <robclark@freedesktop.org>
   AuthorDate: Sat Oct 10 14:13:50 2015 -0400

       glsl: (mostly) remove libglsl_util

Was a bit too ambitious on removal of libglsl_util.. it is still needed
by some of the tests.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agobuild: fix out-of-tree build after b9b40ef
Rob Clark [Sat, 17 Oct 2015 13:28:23 +0000 (09:28 -0400)]
build: fix out-of-tree build after b9b40ef

   commit b9b40ef9b7644ea24768bc8b7464b1719efe99bf
   Author:     Rob Clark <robclark@freedesktop.org>
   AuthorDate: Sat Oct 10 13:55:07 2015 -0400

       nir: remove dependency on glsl

broke things for i965 out of tree build.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonvc0: add support for performance monitoring metrics on Fermi
Samuel Pitoiset [Sun, 11 Oct 2015 09:23:54 +0000 (11:23 +0200)]
nvc0: add support for performance monitoring metrics on Fermi

As explained in the CUDA toolkit documentation, "a metric is a
characteristic of an application that is calculated from one or more
event values."

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: (mostly) remove libglsl_util
Rob Clark [Sat, 10 Oct 2015 18:13:50 +0000 (14:13 -0400)]
glsl: (mostly) remove libglsl_util

Now that NIR does not depend on glsl, we can (mostly[*]) get rid of the
libglsl_util hack.

[*] glsl_compiler is the one remaining user of libglsl_util

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonir: remove dependency on glsl
Rob Clark [Sat, 10 Oct 2015 17:55:07 +0000 (13:55 -0400)]
nir: remove dependency on glsl

Move glsl_types into NIR, now that the dependency on glsl_symbol_table
has been split out.

Possibly makes sense to rename things at this point, but if we do that
I'd like to keep it split out into a separate patch to make git history
easier to follow (IMHO).

v2: fix android build
v3: I f***ing hate scons.. but at least it builds

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoglsl: move half<->float convertion to util
Rob Clark [Sat, 10 Oct 2015 17:26:03 +0000 (13:26 -0400)]
glsl: move half<->float convertion to util

Needed in NIR too, so move out of mesa/main/imports.c

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoglsl: move builtin vector types to glsl_types.cpp
Rob Clark [Sat, 10 Oct 2015 16:39:57 +0000 (12:39 -0400)]
glsl: move builtin vector types to glsl_types.cpp

First step at untangling NIR's dependency on glsl_types without bringing
in the dependency on glsl_symbol_table.  The builtin types are now in
glsl_types (which will end up in NIR), but adding them to the symbol-
table stays in builtin_types.cpp (which will not be part of NIR).

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoglsl: couple shader_enums cleanups
Rob Clark [Fri, 9 Oct 2015 20:27:45 +0000 (16:27 -0400)]
glsl: couple shader_enums cleanups

Add missing enum to gl_system_value_name() and move VARYING_SLOT_MAX /
FRAG_RESULT_MAX / etc into shader_enums.h as suggested by Emil.

v2: add STATIC_ASSERT()'s

Reported-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoglsl: initialise record array count to 1
Timothy Arceri [Thu, 15 Oct 2015 03:10:35 +0000 (14:10 +1100)]
glsl: initialise record array count to 1

This was only being done in one of the two process methods.

Fixes an issue with samplers using the array size of a previous record.

Tested-by: Marek Olšák <marek.olsak@amd.com>
Cc: Jason Ekstrand <jason@jlekstrand.net>
9 years agonir: add atomic lowering support for AoA
Timothy Arceri [Wed, 22 Jul 2015 22:32:00 +0000 (08:32 +1000)]
nir: add atomic lowering support for AoA

Cc: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: wrapper for glsl_type arrays_of_arrays_size()
Timothy Arceri [Wed, 22 Jul 2015 22:31:59 +0000 (08:31 +1000)]
nir: wrapper for glsl_type arrays_of_arrays_size()

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoconfigure: show which gallium drivers/sts are built
Ilia Mirkin [Wed, 14 Oct 2015 19:49:58 +0000 (15:49 -0400)]
configure: show which gallium drivers/sts are built

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agotgsi: initialize ctx.file in tgsi_dump_instruction()
Brian Paul [Fri, 16 Oct 2015 20:31:22 +0000 (14:31 -0600)]
tgsi: initialize ctx.file in tgsi_dump_instruction()

Fixes segfault because of uninitialized file pointer.
Trivial.

9 years agonvc0: add a note about MP counters on GF100/GF110
Samuel Pitoiset [Fri, 16 Oct 2015 08:21:44 +0000 (10:21 +0200)]
nvc0: add a note about MP counters on GF100/GF110

MP counters on GF100/GF110 (compute capability 2.0) are buggy
because there is a context-switch problem that we need to fix.
Results might be wrong sometimes, be careful!

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: add MP counters variants for GF100/GF110
Samuel Pitoiset [Tue, 13 Oct 2015 23:15:43 +0000 (01:15 +0200)]
nvc0: add MP counters variants for GF100/GF110

GF100 and GF110 chipsets are compute capability 2.0, while the other
Fermi chipsets are compute capability 2.1. That's why, some MP counters
are different between these chipsets and we need to handle variants.

Signed-off-by: Samuel Pitoiet <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: move SW/HW queries info to their respective files
Samuel Pitoiset [Tue, 13 Oct 2015 20:16:23 +0000 (22:16 +0200)]
nvc0: move SW/HW queries info to their respective files

This will help for handling HW SM queries variants on Fermi.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: enable compute support by default on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 14:53:18 +0000 (16:53 +0200)]
nvc0: enable compute support by default on Fermi

Compute support was not enabled by default because weird effects
on 3D state happened, but I can't reproduce them anymore.

This also enables MP performance counters by default on Fermi.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: allow only one active query for the MP counters group
Samuel Pitoiset [Mon, 28 Sep 2015 15:29:37 +0000 (17:29 +0200)]
nvc0: allow only one active query for the MP counters group

Because we can't expose the number of hardware counters needed for each
different query, we don't want to allow more than one active query
simultaneously to avoid failure when the maximum number of counters
is reached. Note that these groups of GPU counters are currently only
used by AMD_performance_monitor.

Like for Kepler, this limits the maximum number of active queries
to 1 on Fermi.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: read MP counters of all GPCs on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 14:10:19 +0000 (16:10 +0200)]
nvc0: read MP counters of all GPCs on Fermi

When a card has more than one GPC, the grid used by the compute
kernel which reads MP performance counters seems to be too small.
The consequence is that the kernel is not launched on all TPCs.

Increasing the grid size using the number of GPCs now launches
enough blocks and we can read MP performance counters of all TPCs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: store the number of GPCs to nvc0_screen
Samuel Pitoiset [Tue, 6 Oct 2015 20:24:31 +0000 (22:24 +0200)]
nvc0: store the number of GPCs to nvc0_screen

NOUVEAU_GETPARAM_GRAPH_UNITS param returns the number of GPCs, the total
number of TPCs and the number of ROP units. Note that when the DRM
version is too old the default number of GPCs is fixed to 4.

This will be used to launch the compute kernel which is used to read MP
performance counters over all GPCs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: fix unaligned mem access when reading MP counters on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 09:22:20 +0000 (11:22 +0200)]
nvc0: fix unaligned mem access when reading MP counters on Fermi

Memory access have to be aligned to 128-bits. Note that this
doesn't happen when the card only has TPC.

This patch fixes the following dmesg fail:

gr: GPC0/TPC1/MP trap: global 00000004 [MULTIPLE_WARP_ERRORS] warp 000f
[UNALIGNED_MEM_ACCESS]

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: fix monitoring multiple MP counters queries on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 09:18:45 +0000 (11:18 +0200)]
nvc0: fix monitoring multiple MP counters queries on Fermi

For strange reasons, the signal id depends on the slot selected on Fermi
but not on Kepler. Fortunately, the signal ids are just offseted by the
slot id!

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: fix queries which use multiple MP counters on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 09:14:31 +0000 (11:14 +0200)]
nvc0: fix queries which use multiple MP counters on Fermi

Queries which use more than one MP counters was misconfigured and
computing the final result was also wrong because sources need to
be configured on different hardware counters instead.

According to the blob, computing the result is now as follows:

FOR  i..n
val += ctr[i] * pow(2, i)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: allow to use 8 MP counters on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 09:01:56 +0000 (11:01 +0200)]
nvc0: allow to use 8 MP counters on Fermi

On Fermi, we have one domain of 8 MP counters while we have
two domains of 4 MP counters on Kepler.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: fix sequence field init for MP counters on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 13:33:23 +0000 (15:33 +0200)]
nvc0: fix sequence field init for MP counters on Fermi

Sequence fields are located at MP[i] + 0x20 in the buffer object.
This is used to check if result is available for MP[i].

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: correctly enable the MP counters' multiplexer on Fermi
Samuel Pitoiset [Fri, 9 Oct 2015 08:55:25 +0000 (10:55 +0200)]
nvc0: correctly enable the MP counters' multiplexer on Fermi

Writing 0x408000 to 0x419e00 (like on Kepler) has no effect on Fermi
because we only have one domain of 8 counters. Instead, we have to
write 0x80000000.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: rip off the kepler MP-enabling logic from the Fermi codepath
Samuel Pitoiset [Fri, 9 Oct 2015 08:54:15 +0000 (10:54 +0200)]
nvc0: rip off the kepler MP-enabling logic from the Fermi codepath

Writing 0x1fcb to 0x419eac is definitely not related to MP counters and
has no effect on Fermi (although this enables MP counters on Kepler).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: split out begin_query() hook used by MP counters
Samuel Pitoiset [Fri, 9 Oct 2015 08:45:04 +0000 (10:45 +0200)]
nvc0: split out begin_query() hook used by MP counters

The way we configure MP performance counters is going to pretty
different between Fermi and Kepler. Having two separate functions
is much better.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonvc0: remove useless call to query_get_cfg() in nvc0_hw_sm_query_end()
Samuel Pitoiset [Fri, 9 Oct 2015 08:36:39 +0000 (10:36 +0200)]
nvc0: remove useless call to query_get_cfg() in nvc0_hw_sm_query_end()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agosvga: only count hardware buffer mappings for HUD
Brian Paul [Tue, 13 Oct 2015 00:40:27 +0000 (18:40 -0600)]
svga: only count hardware buffer mappings for HUD

Don't count client memory buffer mappings since they're basically free.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agosvga: add new GALLIUM_HUD queries
Neha Bhende [Fri, 9 Oct 2015 22:10:16 +0000 (16:10 -0600)]
svga: add new GALLIUM_HUD queries

Add new GALLIUM_HUD queries for:
    num-shaders
    num-resources
    num-state-objects
    num-validations
    map-buffer-time
    num-surface-views
    num-resources-mapped
    num-flushes

Most of this patch was originally written by Neha.  Additional clean-ups
and num-flushes counter added by Brian Paul.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agosvga: use new svga_new_shader_variant() function
Brian Paul [Fri, 9 Oct 2015 03:06:18 +0000 (21:06 -0600)]
svga: use new svga_new_shader_variant() function

To simplify upcoming new HUD shader count implementation.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agosvga: pass context to svga_tgsi_vgpu9_translate()
Brian Paul [Fri, 9 Oct 2015 03:03:27 +0000 (21:03 -0600)]
svga: pass context to svga_tgsi_vgpu9_translate()

Will be used for upcoming change.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agosvga: remove svga_tgsi_vgpu9_translate() call in GS path
Brian Paul [Fri, 9 Oct 2015 03:00:37 +0000 (21:00 -0600)]
svga: remove svga_tgsi_vgpu9_translate() call in GS path

We can never have geometry shaders with vgpu9.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
9 years agoglsl: silence warning about unhandled ast_unsized_array_dim case in switch
Brian Paul [Thu, 15 Oct 2015 13:26:49 +0000 (07:26 -0600)]
glsl: silence warning about unhandled ast_unsized_array_dim case in switch

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agost/mesa: fix incorrect pointer type arguments in st_new_program()
Brian Paul [Thu, 15 Oct 2015 13:25:51 +0000 (07:25 -0600)]
st/mesa: fix incorrect pointer type arguments in st_new_program()

Silences 5 warnings of the type:
state_tracker/st_cb_program.c: In function 'st_new_program':
state_tracker/st_cb_program.c:108:7: warning: passing argument 1 of
'_mesa_init_gl_program' from incompatible pointer type [enabled by default]
       return _mesa_init_gl_program(&prog->Base, target, id);
       ^
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoRevert "mesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()"
Brian Paul [Fri, 16 Oct 2015 15:10:22 +0000 (09:10 -0600)]
Revert "mesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()"

This reverts commit 0de5e0f3fb0f3671a3ecec6ab4473f9131ecd0ae.

Michel Dänzer spotted two piglit regressions from the change.  I suspect
that removing the FLUSH_VERTICES() actually exposed a bug elsewhere but
I don't have time to hunt down the root issue at this time.

9 years agoglsl: fix check SSBOs support for builtin functions
Samuel Iglesias Gonsalvez [Fri, 16 Oct 2015 06:44:38 +0000 (08:44 +0200)]
glsl: fix check SSBOs support for builtin functions

has_shader_storage_buffer_objects() returns true also if the OpenGL
context is 4.30 or ES 3.1.

Previously, we were saying that all atomic*() GLSL builtin functions
for SSBOs were not available when OpenGL ES 3.1 context was in use.

Fixes 48 dEQP-GLES31 tests:

dEQP-GLES31.functional.ssbo.atomic.*

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agomesa: Set api prefix to version string when overriding version
Tapani Pälli [Tue, 13 Oct 2015 05:49:57 +0000 (08:49 +0300)]
mesa: Set api prefix to version string when overriding version

Otherwise there are problems when user overrides version and application
such as Piglit wants to detect used api with glGetString(GL_VERSION).

This makes it currently impossible to run glslparsertest tests for
OpenGL ES when using version override.

Below is example when using MESA_GLES_VERSION_OVERRIDE=3.1.

Before:
"3.1 Mesa 11.1.0-devel (git-24a1a15)"

After:
"OpenGL ES 3.1 Mesa 11.1.0-devel (git-78042ff)"

v2: only include api prefix for OpenGL ES (Boyan Ding)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agonir: Get the number of SSBOs and UBOs right
Iago Toral Quiroga [Thu, 15 Oct 2015 06:47:09 +0000 (08:47 +0200)]
nir: Get the number of SSBOs and UBOs right

Before d31f98a272e429d and 56e2bdbca36a20 we had a sigle index space for UBOs
and SSBOs, so NumBufferInterfaceBlocks would contain the combined number of
blocks, not just one kind. This means that for shader programs using both
UBOs and SSBOs, we were setting num_ssbos and num_ubos to a larger number than
we should. Since the above commits  we have separate index spaces for each
so we can just get the right numbers.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/vec4: Use the right number of UBOs
Iago Toral Quiroga [Thu, 15 Oct 2015 06:48:03 +0000 (08:48 +0200)]
i965/vec4: Use the right number of UBOs

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/fs: use the right number of UBOs
Iago Toral Quiroga [Thu, 15 Oct 2015 06:47:40 +0000 (08:47 +0200)]
i965/fs: use the right number of UBOs

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agofreedreno: add debug option to dirty state after draw
Rob Clark [Thu, 15 Oct 2015 20:28:17 +0000 (16:28 -0400)]
freedreno: add debug option to dirty state after draw

Similar to "dclear", "ddraw" will mark all state dirty after each draw.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agofreedreno/a3xx: cache-flush is needed after MEM_WRITE
Rob Clark [Thu, 15 Oct 2015 20:22:23 +0000 (16:22 -0400)]
freedreno/a3xx: cache-flush is needed after MEM_WRITE

Otherwise the mem2gmem blit would see potentially bogus texture
coordinates.  Fixes an issue that shows up with glamor.

CC: "11.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agogallium/util: fix debug_get_flags_option on 32-bit harder
Rob Clark [Thu, 15 Oct 2015 17:30:24 +0000 (13:30 -0400)]
gallium/util: fix debug_get_flags_option on 32-bit harder

(yes, we want PRI?64, but we want the x version rather than the u
version)

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agonv30: include the header of ffs prototype
Chih-Wei Huang [Thu, 15 Oct 2015 15:46:32 +0000 (23:46 +0800)]
nv30: include the header of ffs prototype

It fixes a building error of the android 6.0 64-bit target.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonv50/ir: use C++11 standard std::unordered_map if possible
Chih-Wei Huang [Thu, 15 Oct 2015 15:46:30 +0000 (23:46 +0800)]
nv50/ir: use C++11 standard std::unordered_map if possible

Note Android version before Lollipop is not supported.

Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: mesa-stable@lists.freedesktop.org
9 years agonir/prog: Don't double-insert the fog-coord variable
Jason Ekstrand [Thu, 15 Oct 2015 16:20:24 +0000 (09:20 -0700)]
nir/prog: Don't double-insert the fog-coord variable

nir_variable_create already inserts it in the right list for us so
inserting it again causes a linked list corruption.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/glsl: Use shader_prog->Name for naming the NIR shader
Jason Ekstrand [Fri, 9 Oct 2015 01:36:27 +0000 (18:36 -0700)]
nir/glsl: Use shader_prog->Name for naming the NIR shader

This has the better name to use. Aparently, sh->Name is usually 0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
9 years agonir: Add helpers for creating variables and adding them to lists
Jason Ekstrand [Fri, 9 Oct 2015 14:05:11 +0000 (07:05 -0700)]
nir: Add helpers for creating variables and adding them to lists

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agonir/prog: Use nir_foreach_variable
Jason Ekstrand [Fri, 9 Oct 2015 14:02:57 +0000 (07:02 -0700)]
nir/prog: Use nir_foreach_variable

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agomesa: wrap a ridiculously long line in es1_conversion.c
Brian Paul [Wed, 14 Oct 2015 15:53:53 +0000 (09:53 -0600)]
mesa: wrap a ridiculously long line in es1_conversion.c

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: add num_buffers() helper in blend.c
Brian Paul [Wed, 14 Oct 2015 15:53:26 +0000 (09:53 -0600)]
mesa: add num_buffers() helper in blend.c

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize _UsesDualSrc blend flag setting
Brian Paul [Wed, 14 Oct 2015 16:08:18 +0000 (10:08 -0600)]
mesa: optimize _UsesDualSrc blend flag setting

For glBlendFunc and glBlendFuncSeparate(), the _UsesDualSrc flag
will be the same for all buffers, so no need to compute it N times.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: fix incorrect error string in _mesa_BlendEquationiARB()
Brian Paul [Wed, 14 Oct 2015 15:34:39 +0000 (09:34 -0600)]
mesa: fix incorrect error string in _mesa_BlendEquationiARB()

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: move validate_blend_factors() call after no-change check
Brian Paul [Wed, 14 Oct 2015 15:35:53 +0000 (09:35 -0600)]
mesa: move validate_blend_factors() call after no-change check

A redundant call to glBlendFuncSeparateiARB() is more likely than getting
invalid values, so do the no-op check first.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize no-change check in _mesa_BlendEquationSeparate()
Brian Paul [Wed, 14 Oct 2015 15:45:36 +0000 (09:45 -0600)]
mesa: optimize no-change check in _mesa_BlendEquationSeparate()

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize no-change check in _mesa_BlendEquation()
Brian Paul [Wed, 14 Oct 2015 15:41:11 +0000 (09:41 -0600)]
mesa: optimize no-change check in _mesa_BlendEquation()

Same story as preceeding change to _mesa_BlendFuncSeparate().

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: optimize no-change check in _mesa_BlendFuncSeparate()
Brian Paul [Wed, 14 Oct 2015 15:31:41 +0000 (09:31 -0600)]
mesa: optimize no-change check in _mesa_BlendFuncSeparate()

Streamline the checking for no state change in _mesa_BlendFuncSeparate()
(and _mesa_BlendFunc()).  If _BlendFuncPerBuffer is false, we only need
to check the 0th buffer state.  Move argument validation after the no-op
check.

I'm looking at an app that issues about 1000 redundant glBlendFunc()
calls per frame!

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()
Brian Paul [Wed, 14 Oct 2015 15:10:19 +0000 (09:10 -0600)]
mesa: short-cut new_state == _NEW_LINE in _mesa_update_state_locked()

We can skip to the end of _mesa_update_state_locked() if only the
_NEW_LINE flag is set since none of the derived state depends on it
(just like _NEW_CURRENT_ATTRIB).  Note that we still call the
ctx->Driver.UpdateState() function, of course.

v2: use bitmask-based test, per Eric.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()
Brian Paul [Wed, 14 Oct 2015 15:08:50 +0000 (09:08 -0600)]
mesa: remove FLUSH_VERTICES() in _mesa_MatrixMode()

Changing the matrix mode alone has no effect on rendering and does
not need to trigger a flush or state validation.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: android: Fix the incorrect path of sse_minmax.c
Chih-Wei Huang [Mon, 12 Oct 2015 15:36:59 +0000 (23:36 +0800)]
mesa: android: Fix the incorrect path of sse_minmax.c

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Fixes: 669cfc267a1 (android: mesa: fix the path of the SSE4_1
optimisations)
Signed-off-by: Chih-Wei Huang <cwhuang@linux.org.tw>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: android: add the i965_compile_FILES sources to the driver
Mauro Rossi [Sun, 11 Oct 2015 11:49:38 +0000 (13:49 +0200)]
i965: android: add the i965_compile_FILES sources to the driver

i965_compile_FILES are needed otherwise we'll error out as below:

target SharedLib: i915_dri (out/target/product/x86/obj/SHARED_LIBRARIES/i915_dri_intermediates/LINKED/i915_dri.so)
external/mesa/src/mesa/drivers/dri/i965/brw_ir_fs.h:181: error: undefined reference to 'fs_inst::~fs_inst()'
...
...
external/mesa/src/mesa/drivers/dri/i965/intel_screen.c:1484: error: undefined reference to 'brw_compiler_create'
collect2: error: ld returned 1 exit status
build/core/shared_library.mk:81: recipe for target 'out/target/product/x86/obj/SHARED_LIBRARIES/i965_dri_intermediates/LINKED/i965_dri.so' failed
make: *** [out/target/product/x86/obj/SHARED_LIBRARIES/i965_dri_intermediates/LINKED/i965_dri.so] Error 1

[Emil Velikov: tweak commit message]
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoprogram: convert _mesa_init_gl_program() to take struct gl_program *
Emil Velikov [Tue, 13 Oct 2015 10:26:09 +0000 (11:26 +0100)]
program: convert _mesa_init_gl_program() to take struct gl_program *

Rather than accepting a void pointer, only to down and up cast around
it, convert the function to take the base (struct gl_program) pointer.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agonir: include nir_instr_set.h in the tarball
Emil Velikov [Sat, 10 Oct 2015 15:13:38 +0000 (16:13 +0100)]
nir: include nir_instr_set.h in the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
9 years agoglsl: Allow arrays of arrays in GLSL ES 3.10 and GLSL 4.30
Timothy Arceri [Fri, 5 Jun 2015 23:10:55 +0000 (09:10 +1000)]
glsl: Allow arrays of arrays in GLSL ES 3.10 and GLSL 4.30

V3: use a check_*_allowed style function for requirements checking
rather than has_* which doesn't encapsulate the error message

V2: add missing 's' to the extension name in error messages
 and add decimal place in version string

Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agoglsl: allow for AoA in calculating offset to ubo start region
Timothy Arceri [Fri, 9 Oct 2015 11:00:20 +0000 (22:00 +1100)]
glsl: allow for AoA in calculating offset to ubo start region

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: build ubo name and indexing offset for AoA
Timothy Arceri [Fri, 9 Oct 2015 10:54:09 +0000 (21:54 +1100)]
glsl: build ubo name and indexing offset for AoA

V2: split out unrelated change as suggested by Samuel

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: link uniform block arrays of arrays
Timothy Arceri [Tue, 25 Aug 2015 04:15:25 +0000 (14:15 +1000)]
glsl: link uniform block arrays of arrays

This adds support for setting up the UniformBlock structures for AoA
and also adds support for resizing AoA blocks with a packed layout.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: Add AoA support when checking for non-const index
Timothy Arceri [Thu, 4 Jun 2015 01:19:05 +0000 (11:19 +1000)]
glsl: Add AoA support when checking for non-const index

When checking for non-const indexing of interfaces
take into account arrays of arrays

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: Add support for lowering interface block arrays of arrays
Timothy Arceri [Mon, 16 Mar 2015 04:31:11 +0000 (15:31 +1100)]
glsl: Add support for lowering interface block arrays of arrays

V2: make array processing functions static

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: add AoA support for an inteface with unsized array members
Timothy Arceri [Sun, 19 Jul 2015 04:08:44 +0000 (14:08 +1000)]
glsl: add AoA support for an inteface with unsized array members

Add support for setting the max access of an unsized member
of an interface array of arrays.

For example ifc[j][k].foo[i] where foo is unsized.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: add AoA support for linking interface blocks with unsized members
Timothy Arceri [Thu, 12 Mar 2015 08:52:47 +0000 (19:52 +1100)]
glsl: add AoA support for linking interface blocks with unsized members

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: avoid hitting assert for arrays of arrays
Timothy Arceri [Mon, 12 May 2014 10:25:26 +0000 (20:25 +1000)]
glsl: avoid hitting assert for arrays of arrays

Also add TODO comment about adding proper support

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: add AoA support for atomic counters
Timothy Arceri [Sun, 30 Aug 2015 11:08:22 +0000 (21:08 +1000)]
glsl: add AoA support for atomic counters

This marks all counters in an AoA as active.

For AoA all but the innermost array are treated as separate
counters/uniforms. The Nvidia binary also goes further and
finds inactive counters in the AoA, in future we should do
this too, however this gets things working for the time being.

This change also removes the use of UniformHash for atomic counters,
this avoids having to generate name strings used as hash keys.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: add std140 layout support for AoA
Timothy Arceri [Fri, 18 Sep 2015 12:51:40 +0000 (22:51 +1000)]
glsl: add std140 layout support for AoA

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: add arrays of arrays support for varyings
Timothy Arceri [Sat, 18 Jul 2015 07:24:22 +0000 (17:24 +1000)]
i965: add arrays of arrays support for varyings

V2: get the correct vector elements value for outputs

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: calculate AoA uniform offset correctly for structs
Timothy Arceri [Thu, 17 Sep 2015 04:17:17 +0000 (14:17 +1000)]
glsl: calculate AoA uniform offset correctly for structs

This allows the correct offset to be calculated for use in indirect
indexing of samplers.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: remove dead code in a single pass
Timothy Arceri [Sat, 11 Jul 2015 11:38:54 +0000 (21:38 +1000)]
glsl: remove dead code in a single pass

Currently only one ir assignment is removed for each var in a single
dead code optimisation pass. This means if a var has more than one
assignment, then it requires all the glsl optimisations to be run again
for each additional assignment to be removed.
Another pass is also required to remove the variable itself.

With this change all assignments and the variable are removed in a single
pass.

Some of the arrays of arrays conformance tests that were looping
through 8 dimensions ended up with a var with hundreds of assignments.

This change helps ES31-CTS.arrays_of_arrays.InteractionFunctionCalls1
go from around 3 min 20 sec -> 2 min

ES31-CTS.arrays_of_arrays.InteractionFunctionCalls2 went from
around 9 min 20 sec to 7 min 30 sec

I had difficulty getting the public shader-db to give a consistent result
with or without this change but the results seemed unchanged at between
15-20 seconds.

Thomas Helland measured change with shader-db on his machine from
approx 117 secs to 112 secs.

V3: Simplify freeing of list as suggested by Ian, and spelling fixes.

V2: Add assert to be sure references are counted before assignments.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-By: Thomas Helland <thomashelland90@gmail.com>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: dont allow gl_PerVertex to be redeclared as an array of arrays
Timothy Arceri [Mon, 23 Jun 2014 21:43:05 +0000 (07:43 +1000)]
glsl: dont allow gl_PerVertex to be redeclared as an array of arrays

V3: move patch after fixes to ast for AoA and add const to helper
as suggested by Ian

V2: move single dimensional array detection into a helper

Signed-off-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: check that only the outermost array is unsized
Timothy Arceri [Thu, 15 Oct 2015 03:35:41 +0000 (14:35 +1100)]
glsl: check that only the outermost array is unsized

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: allow AoA to be sized by initializer or constructor
Timothy Arceri [Thu, 15 Oct 2015 03:32:41 +0000 (14:32 +1100)]
glsl: allow AoA to be sized by initializer or constructor

V2: Split out unsized array validation to its own patch as
suggested by Samuel.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
9 years agoglsl: add support for initialising sampler AoA
Timothy Arceri [Wed, 29 Jul 2015 01:57:44 +0000 (11:57 +1000)]
glsl: add support for initialising sampler AoA

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: Add support for linking uniform arrays of arrays
Timothy Arceri [Sun, 5 Jul 2015 05:18:10 +0000 (15:18 +1000)]
glsl: Add support for linking uniform arrays of arrays

V3: Fix setting of data.location for struct AoA UBO members

V2: Handle arrays of arrays in the same way structures are handled

The ARB_arrays_of_arrays spec doesn't give very many details on how
AoA uniforms are intended to be implemented. However in the
ARB_program_interface_query spec there are details that show AoA are
intended to be handled in a similar way to structs.

Issues 7 from the ARB_program_interface_query spec:

 We define rules consistent with our enumeration rules for
 other complex types.  For existing one-dimensional arrays, we enumerate
 a single entry if the array is an array of basic types, or separate
 entries for each array element if the array is an array of structures.
 We follow similar rules here.  For a uniform array such as:

   uniform vec4 a[5][4][3];

 we enumerate twenty different entries ("a[0][0][0]" through
 "a[4][3][0]"), each of which is treated as an array with three elements.
 This is morally equivalent to what you'd get if you worked around the
 limitation in current GLSL via:

    struct ArrayBottom { vec4 c[3]; };
    struct ArrayMid    { ArrayBottom b[3]; };
    uniform ArrayMid   a[5];

 which would enumerate "a[0].b[0].c[0]" through "a[4].b[3].c[0]".

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Don't hardcode FS in "validation failed!" message.
Kenneth Graunke [Tue, 13 Oct 2015 22:15:57 +0000 (15:15 -0700)]
i965: Don't hardcode FS in "validation failed!" message.

Instead, print "Scalar VS" or "Scalar FS".  Otherwise it's really
confusing which stage is broken.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
9 years agoglsl: Support uint index in lower_vector_insert
Jordan Justen [Tue, 13 Oct 2015 03:28:28 +0000 (20:28 -0700)]
glsl: Support uint index in lower_vector_insert

The ES31-CTS.compute_shader.pipeline-compute-chain test case generates
an unsigned index by using gl_LocalInvocationID.x and
gl_LocalInvocationID.y as array indices.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agoglsl: Support uint index in do_vec_index_to_cond_assign
Jordan Justen [Tue, 13 Oct 2015 03:22:14 +0000 (20:22 -0700)]
glsl: Support uint index in do_vec_index_to_cond_assign

The ES31-CTS.compute_shader.pipeline-compute-chain test case generates
an unsigned index by using gl_LocalInvocationID.x and
gl_LocalInvocationID.y as array indices.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>