platform/upstream/mesa.git
7 years agoradeonsi: explain (non-)monolithic shaders
Marek Olšák [Wed, 19 Apr 2017 23:07:19 +0000 (01:07 +0200)]
radeonsi: explain (non-)monolithic shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: enable OpenGL 4.5
Marek Olšák [Wed, 15 Feb 2017 02:04:01 +0000 (03:04 +0100)]
radeonsi/gfx9: enable OpenGL 4.5

Tentatively enable it, expecting the scratch buffer support to be done before
the next Mesa release.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: 2nd shader of merged shaders should hold a reference of the 1st
Marek Olšák [Thu, 20 Apr 2017 11:06:31 +0000 (13:06 +0200)]
radeonsi/gfx9: 2nd shader of merged shaders should hold a reference of the 1st

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add reference counting for shader selectors
Marek Olšák [Thu, 20 Apr 2017 11:04:02 +0000 (13:04 +0200)]
radeonsi: add reference counting for shader selectors

The 2nd shader of merged shaders should take a reference of the 1st shader.
The next commit will do that.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set VGT_VERTEX_REUSE for ES in ES-GS
Marek Olšák [Sun, 23 Apr 2017 00:53:19 +0000 (02:53 +0200)]
radeonsi/gfx9: set VGT_VERTEX_REUSE for ES in ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set TES registers for merged ES-GS
Marek Olšák [Sun, 23 Apr 2017 00:48:02 +0000 (02:48 +0200)]
radeonsi/gfx9: set TES registers for merged ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: disallow scratch buffer for LS-HS and ES-GS
Marek Olšák [Wed, 19 Apr 2017 01:24:05 +0000 (03:24 +0200)]
radeonsi/gfx9: disallow scratch buffer for LS-HS and ES-GS

not implemented yet

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: always compile monolithic ES-GS (asynchronously)
Marek Olšák [Tue, 18 Apr 2017 23:53:35 +0000 (01:53 +0200)]
radeonsi/gfx9: always compile monolithic ES-GS (asynchronously)

In addition to the non-monolithic variant.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add support for monolithic ES-GS
Marek Olšák [Tue, 18 Apr 2017 23:24:43 +0000 (01:24 +0200)]
radeonsi/gfx9: add support for monolithic ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: make sure the 1st shader's main part exists for merged shaders
Marek Olšák [Tue, 18 Apr 2017 21:49:07 +0000 (23:49 +0200)]
radeonsi/gfx9: make sure the 1st shader's main part exists for merged shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: select shader parts for non-monolithic ES-GS
Marek Olšák [Wed, 19 Apr 2017 01:37:14 +0000 (03:37 +0200)]
radeonsi/gfx9: select shader parts for non-monolithic ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add GS prolog support for merged ES-GS
Marek Olšák [Wed, 19 Apr 2017 01:37:04 +0000 (03:37 +0200)]
radeonsi/gfx9: add GS prolog support for merged ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add VS prolog support for merged ES-GS
Marek Olšák [Wed, 19 Apr 2017 01:36:33 +0000 (03:36 +0200)]
radeonsi/gfx9: add VS prolog support for merged ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: pass GS input SGPRs and VGPRs from the ES part to GS
Marek Olšák [Wed, 19 Apr 2017 01:34:56 +0000 (03:34 +0200)]
radeonsi/gfx9: pass GS input SGPRs and VGPRs from the ES part to GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: store ES outputs to LDS
Marek Olšák [Wed, 19 Apr 2017 01:34:03 +0000 (03:34 +0200)]
radeonsi/gfx9: store ES outputs to LDS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: load GS inputs from LDS
Marek Olšák [Wed, 19 Apr 2017 01:33:03 +0000 (03:33 +0200)]
radeonsi/gfx9: load GS inputs from LDS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: get GS wave ID from the correct input
Marek Olšák [Wed, 19 Apr 2017 01:31:12 +0000 (03:31 +0200)]
radeonsi/gfx9: get GS wave ID from the correct input

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add the function signature of merged ES-GS
Marek Olšák [Wed, 19 Apr 2017 01:29:44 +0000 (03:29 +0200)]
radeonsi/gfx9: add the function signature of merged ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set registers and shader key for merged ES-GS
Marek Olšák [Wed, 19 Apr 2017 01:21:16 +0000 (03:21 +0200)]
radeonsi/gfx9: set registers and shader key for merged ES-GS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add GS user SGPRs
Marek Olšák [Wed, 19 Apr 2017 01:12:55 +0000 (03:12 +0200)]
radeonsi/gfx9: add GS user SGPRs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: rename declare_tess_lds -> declare_lds_as_pointer
Marek Olšák [Wed, 19 Apr 2017 01:17:24 +0000 (03:17 +0200)]
radeonsi: rename declare_tess_lds -> declare_lds_as_pointer

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: simplify some shader type conditions
Marek Olšák [Wed, 19 Apr 2017 01:15:52 +0000 (03:15 +0200)]
radeonsi: simplify some shader type conditions

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: rename the swizzle parameter of lds_store
Marek Olšák [Wed, 19 Apr 2017 01:13:58 +0000 (03:13 +0200)]
radeonsi: rename the swizzle parameter of lds_store

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: add si_shader::prolog2
Marek Olšák [Fri, 7 Apr 2017 19:38:09 +0000 (21:38 +0200)]
radeonsi: add si_shader::prolog2

For a GS prolog in merged ES-GS.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: move RW_BUFFERS to s[0:1] for merged shaders
Marek Olšák [Sat, 22 Apr 2017 18:07:20 +0000 (20:07 +0200)]
radeonsi/gfx9: move RW_BUFFERS to s[0:1] for merged shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add support for monolithic merged LS-HS
Marek Olšák [Wed, 5 Apr 2017 22:33:45 +0000 (00:33 +0200)]
radeonsi/gfx9: add support for monolithic merged LS-HS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set EXEC for non-mono merged shaders, add a barrier between them
Marek Olšák [Tue, 14 Mar 2017 18:35:28 +0000 (19:35 +0100)]
radeonsi/gfx9: set EXEC for non-mono merged shaders, add a barrier between them

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: don't store the HS control word
Marek Olšák [Tue, 14 Mar 2017 13:11:41 +0000 (14:11 +0100)]
radeonsi/gfx9: don't store the HS control word

GFX9 doesn't have it.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: pass inputs from LS to TCS
Marek Olšák [Tue, 21 Feb 2017 02:07:37 +0000 (03:07 +0100)]
radeonsi/gfx9: pass inputs from LS to TCS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add TCS epilog support for merged LS-HS
Marek Olšák [Tue, 21 Feb 2017 00:42:15 +0000 (01:42 +0100)]
radeonsi/gfx9: add TCS epilog support for merged LS-HS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add VS prolog support for merged LS-HS
Marek Olšák [Mon, 20 Feb 2017 21:25:17 +0000 (22:25 +0100)]
radeonsi/gfx9: add VS prolog support for merged LS-HS

HS input VGPRs must be reserved.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: merged shaders have scratch offset at the beginning
Marek Olšák [Sat, 18 Feb 2017 02:04:21 +0000 (03:04 +0100)]
radeonsi/gfx9: merged shaders have scratch offset at the beginning

also, screen wasn't initialized for compute shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: define LS-HS main shader function prototype
Marek Olšák [Sat, 18 Feb 2017 00:47:27 +0000 (01:47 +0100)]
radeonsi/gfx9: define LS-HS main shader function prototype

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: assign VS/TCS/TES/GS shader input parameter locations dynamically
Marek Olšák [Fri, 17 Feb 2017 17:29:17 +0000 (18:29 +0100)]
radeonsi: assign VS/TCS/TES/GS shader input parameter locations dynamically

They will vary with merged stages.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: define and set LS-HS user SGPRs
Marek Olšák [Wed, 15 Feb 2017 21:47:57 +0000 (22:47 +0100)]
radeonsi/gfx9: define and set LS-HS user SGPRs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: set up shader registers for merged LS-HS
Marek Olšák [Wed, 15 Feb 2017 10:57:47 +0000 (11:57 +0100)]
radeonsi/gfx9: set up shader registers for merged LS-HS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add initial code generation for non-monolithic merged LS-HS
Marek Olšák [Thu, 6 Apr 2017 20:55:06 +0000 (22:55 +0200)]
radeonsi/gfx9: add initial code generation for non-monolithic merged LS-HS

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: separate out code for selecting the VS prolog
Marek Olšák [Wed, 19 Apr 2017 23:10:17 +0000 (01:10 +0200)]
radeonsi: separate out code for selecting the VS prolog

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: add si_shader::previous_stage for merged shaders
Marek Olšák [Fri, 7 Apr 2017 19:41:10 +0000 (21:41 +0200)]
radeonsi/gfx9: add si_shader::previous_stage for merged shaders

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: enlarge num_input_sgprs in shader keys due to higher hw limit
Marek Olšák [Thu, 16 Feb 2017 18:36:46 +0000 (19:36 +0100)]
radeonsi/gfx9: enlarge num_input_sgprs in shader keys due to higher hw limit

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi/gfx9: update the summary of shader stage configs
Marek Olšák [Fri, 7 Apr 2017 23:04:56 +0000 (01:04 +0200)]
radeonsi/gfx9: update the summary of shader stage configs

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: adjust the signature of si_get_vs_prolog_key
Marek Olšák [Thu, 6 Apr 2017 20:03:07 +0000 (22:03 +0200)]
radeonsi: adjust the signature of si_get_vs_prolog_key

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: separate out VS prolog key generation
Marek Olšák [Thu, 6 Apr 2017 20:55:06 +0000 (22:55 +0200)]
radeonsi: separate out VS prolog key generation

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: separate out VS prolog key printing
Marek Olšák [Thu, 6 Apr 2017 20:00:53 +0000 (22:00 +0200)]
radeonsi: separate out VS prolog key printing

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: code shuffling in si_emit_derived_tess_state
Marek Olšák [Fri, 11 Nov 2016 21:37:39 +0000 (22:37 +0100)]
radeonsi: code shuffling in si_emit_derived_tess_state

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: separate out TGSI initialization of si_shader_context
Marek Olšák [Wed, 15 Mar 2017 22:06:59 +0000 (23:06 +0100)]
radeonsi: separate out TGSI initialization of si_shader_context

so that we can put multiple different TGSI shaders into one module.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/mesa: use min_index and max_index directly from vbo
Marek Olšák [Tue, 25 Apr 2017 22:28:29 +0000 (00:28 +0200)]
st/mesa: use min_index and max_index directly from vbo

also remove the incorrect comment about primitive restart.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agovbo: set min_index = 0 so gallium can use the value directly
Marek Olšák [Tue, 25 Apr 2017 22:28:05 +0000 (00:28 +0200)]
vbo: set min_index = 0 so gallium can use the value directly

We could also remove index_bounds_valid and use max_index != ~0 instead.
Opinions on that are welcome.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoRevert "glsl: reject image qualifiers with non-image types inside uniform blocks"
Matt Turner [Fri, 28 Apr 2017 19:29:11 +0000 (12:29 -0700)]
Revert "glsl: reject image qualifiers with non-image types inside uniform blocks"

This reverts commit 24011ead71ea9980e6b34e40d9dbd64e6560f5a4.

This causes lots of ES 3.1 CTS tests to fail to compile a bit of code
like:

   layout(binding = 0) buffer InOut
   {
        highp uint inputValues[384];
        highp uint outputValues[384];
        coherent highp uint groupValues[64];      <-----
   } sb_inout;

   error: memory qualifiers may only be applied to images

7 years agost/mesa: add more fallback gallium formats for GL integer formats
Brian Paul [Fri, 28 Apr 2017 02:59:44 +0000 (20:59 -0600)]
st/mesa: add more fallback gallium formats for GL integer formats

The VMware driver has a limited set of integer texture formats.  We
often have to fall back to 4-component formats when 1- or 2-component
formats are missing.

This fixes about 8 integer texture Piglit tests with the VMware driver
on Linux.  We've had this code in-house for a long time but I guess it
was never up-streamed to Mesa master.

This shouldn't regress any other drivers since we're either choosing
an earlier format in the list, or failing anyway.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agomesa: optimize color_buffer_writes_enabled()
Brian Paul [Thu, 27 Apr 2017 14:52:30 +0000 (08:52 -0600)]
mesa: optimize color_buffer_writes_enabled()

Return as soon as we find an existing color channel that's enabled for
writing.  Typically, this allows us to return true on the first loop
iteration intead of doing four iterations.

No piglit regressions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/mesa: whitespace clean-ups in st_manager.c
Brian Paul [Thu, 27 Apr 2017 15:03:02 +0000 (09:03 -0600)]
st/mesa: whitespace clean-ups in st_manager.c

Trivial.

7 years agoRevert "glsl: set vector_elements to 1 for samplers"
Matt Turner [Fri, 28 Apr 2017 18:48:29 +0000 (11:48 -0700)]
Revert "glsl: set vector_elements to 1 for samplers"

This reverts commit 75a31a20af269c047661af33e28f793269537b79.

This breaks thousands of tests on i965 with malloc corruption.

7 years agoanv: Drop 'x11' prefix from non-X11 WSI funcs
Chad Versace [Mon, 24 Apr 2017 17:32:12 +0000 (10:32 -0700)]
anv: Drop 'x11' prefix from non-X11 WSI funcs

Drop it from x11_anv_wsi_image_create and x11_anv_wsi_image_free. The
functions are used by Wayland WSI too.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
7 years agoanv: Alphabetize KHR extensions
Jason Ekstrand [Fri, 28 Apr 2017 12:02:27 +0000 (05:02 -0700)]
anv: Alphabetize KHR extensions

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agoac: automake: sort sources list alphabetically
Emil Velikov [Fri, 28 Apr 2017 12:35:18 +0000 (13:35 +0100)]
ac: automake: sort sources list alphabetically

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoac: include all sources in the tarball
Emil Velikov [Fri, 28 Apr 2017 12:33:58 +0000 (13:33 +0100)]
ac: include all sources in the tarball

Fixes: e2659176cef ("radeonsi/ac: move vertex export remove to common code.")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agost/mesa: remove redundant stfb->iface checks
Nicolai Hähnle [Fri, 21 Apr 2017 13:11:34 +0000 (15:11 +0200)]
st/mesa: remove redundant stfb->iface checks

stfb->iface is always non-NULL for an st_framebuffer. These checks
were incorrect, relying on out-of-bounds memory access in the
surface-less case of EGL_KHR_surfaceless_context.

v2: remove redundant stread check (Marek)

Reviewed-by: Marek Olšák <marek@olsak@amd.com> (v2)
7 years agost/mesa: don't cast the incomplete framebufer to st_framebuffer
Nicolai Hähnle [Fri, 21 Apr 2017 13:06:47 +0000 (15:06 +0200)]
st/mesa: don't cast the incomplete framebufer to st_framebuffer

The incomplete framebuffer is set for a surfaceless context. This leads to
the following error in piglit spec@egl_khr_surfaceless_context@viewport:

==26703==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7f6886e43240 at pc 0x7f68854db0fd bp 0x7ffca404b3b0 sp 0x7ffca404b3a0
READ of size 8 at 0x7f6886e43240 thread T0
    #0 0x7f68854db0fc in st_viewport ../../../mesa-src/src/mesa/state_tracker/st_cb_viewport.c:57
    #1 0x556840176cdb in main tests/egl/spec/egl_khr_surfaceless_context/viewport.c:101
    #2 0x7f688edcf3f0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x203f0)
    #3 0x556840176e19 in _start (/home/nha/amd/piglit/bin/egl-surfaceless-context-viewport+0xe19)

0x7f6886e43240 is located 32 bytes to the left of global variable 'DummyRenderbuffer' defined in '../../../mesa-src/src/mesa/main/fbobject.c:69:31' (0x7f6886e43260) of size 112
0x7f6886e43240 is located 8 bytes to the right of global variable 'IncompleteFramebuffer' defined in '../../../mesa-src/src/mesa/main/fbobject.c:73:30' (0x7f6886e42de0) of size 1112
SUMMARY: AddressSanitizer: global-buffer-overflow ../../../mesa-src/src/mesa/state_tracker/st_cb_viewport.c:57 in st_viewport

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Marek Olšák <marek@olsak@amd.com>
7 years agost/glsl_to_tgsi: make undef_src and undef_dst const
Nicolai Hähnle [Wed, 19 Apr 2017 08:05:33 +0000 (10:05 +0200)]
st/glsl_to_tgsi: make undef_src and undef_dst const

7 years agost/glsl_to_tgsi: cleanup using visit_generic_intrinsic
Nicolai Hähnle [Wed, 19 Apr 2017 08:53:13 +0000 (10:53 +0200)]
st/glsl_to_tgsi: cleanup using visit_generic_intrinsic

It turns out that explicitly setting the writemask isn't actually
needed; emit_asm does the right thing based on looking at the types.

7 years agoglsl: remove the shader_group_vote and shader_ballot expression ops
Nicolai Hähnle [Wed, 19 Apr 2017 08:47:08 +0000 (10:47 +0200)]
glsl: remove the shader_group_vote and shader_ballot expression ops

They are now no longer used.

7 years agoglsl: implement arb_shader_ballot builtins using intrinsics
Nicolai Hähnle [Wed, 19 Apr 2017 08:29:30 +0000 (10:29 +0200)]
glsl: implement arb_shader_ballot builtins using intrinsics

7 years agoglsl: implement arb_shader_group_vote builtins via intrinsics
Nicolai Hähnle [Wed, 19 Apr 2017 08:17:19 +0000 (10:17 +0200)]
glsl: implement arb_shader_group_vote builtins via intrinsics

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agost/glsl_to_tgsi: implement shader_group_vote and shader_ballot intrinsics
Nicolai Hähnle [Wed, 19 Apr 2017 08:08:49 +0000 (10:08 +0200)]
st/glsl_to_tgsi: implement shader_group_vote and shader_ballot intrinsics

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: add intrinsics for ARB_shader_group_vote and ARB_shader_ballot
Nicolai Hähnle [Wed, 19 Apr 2017 08:08:25 +0000 (10:08 +0200)]
glsl: add intrinsics for ARB_shader_group_vote and ARB_shader_ballot

These operations are currently implemented as IR expressions. However,
they cannot be transformed and moved in the way that other IR
expressions can because they have non-trivial interactions with
control-flow.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: reject image qualifiers with non-image types inside uniform blocks
Samuel Pitoiset [Wed, 26 Apr 2017 16:50:16 +0000 (18:50 +0200)]
glsl: reject image qualifiers with non-image types inside uniform blocks

Fixes the following ARB_shader_image_load_store tests:

format-layout-with-non-image-type.frag
memory-qualifier-with-non-image-type.frag

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: introduce validate_image_qualifier_for_type() helper
Samuel Pitoiset [Wed, 26 Apr 2017 16:50:15 +0000 (18:50 +0200)]
glsl: introduce validate_image_qualifier_for_type() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: fix error when using format qualifiers with non-image types
Samuel Pitoiset [Wed, 26 Apr 2017 16:50:14 +0000 (18:50 +0200)]
glsl: fix error when using format qualifiers with non-image types

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoutil/disk_cache: remove percentage based max cache limit
Timothy Arceri [Fri, 28 Apr 2017 03:05:52 +0000 (13:05 +1000)]
util/disk_cache: remove percentage based max cache limit

The more I think about it the more this seems like a bad idea.
When we were deleting old cache dirs this wasn't so bad as it
was unlikely we would ever hit the actual limit before things
were cleaned up. Now that we only start cleaning up old cache
items once the limit is reached the a percentage based max
cache limit is more risky.

For the inital release of shader cache I think its better to
stick to a more conservative cache limit, at least until we
have some way of cleaning up the cache more aggressively.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoanv: Move queues, events, and semaphores to their own file
Jason Ekstrand [Thu, 16 Feb 2017 00:48:47 +0000 (16:48 -0800)]
anv: Move queues, events, and semaphores to their own file

Things are about to get more complicated, especially as far as
semaphores are concerned.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_memory_fd
Jason Ekstrand [Tue, 28 Feb 2017 18:58:40 +0000 (10:58 -0800)]
anv: Implement VK_KHX_external_memory_fd

This commit just exposes the memory handle type.  There's interesting we
need to do here for images.  So long as the user doesn't set any crazy
environment variables such as INTEL_DEBUG=nohiz, all of the compression
formats etc. should "just work" at least for opaque handle types.

v2 (chadv):
  - Rebase.
  - Fix vkGetPhysicalDeviceImageFormatProperties2KHR when
    handleType == 0.
  - Move handleType-independency comments out of handleType-switch, in
    vkGetPhysicalDeviceExternalBufferPropertiesKHX.  Reduces diff in
    future dma_buf patches.

Co-authored-with: Chad Versace <chadversary@chromium.org>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Use the BO cache for DeviceMemory allocations
Jason Ekstrand [Tue, 14 Mar 2017 00:20:15 +0000 (17:20 -0700)]
anv: Use the BO cache for DeviceMemory allocations

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/allocator: Add a BO cache
Jason Ekstrand [Mon, 13 Mar 2017 23:18:54 +0000 (16:18 -0700)]
anv/allocator: Add a BO cache

This cache allows us to easily ensure that we have a unique anv_bo for
each gem handle.  We'll need this in order to support multiple-import of
memory objects and semaphores.

v2 (Jason Ekstrand):
 - Reject BO imports if the size doesn't match the prime fd size as
   reported by lseek().

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_memory
Jason Ekstrand [Wed, 15 Feb 2017 02:57:22 +0000 (18:57 -0800)]
anv: Implement VK_KHX_external_memory

This is the trivial implementation that just exposes the extension
string but exposes zero external handle types.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Implement VK_KHX_external_memory_capabilities
Chad Versace [Tue, 28 Feb 2017 18:58:31 +0000 (10:58 -0800)]
anv: Implement VK_KHX_external_memory_capabilities

This is a complete but trivial implementation. It's trivial becasue We
support no external memory capabilities yet.  Most of the real work in
this commit is in reworking the UUIDs advertised by the driver.

v2 (chadv):
  - Fix chain traversal in vkGetPhysicalDeviceImageFormatProperties2KHR.
    Extract VkPhysicalDeviceExternalImageFormatInfoKHX from the chain of
    input structs, not the chain of output structs.
  - In vkGetPhysicalDeviceImageFormatProperties2KHR, iterate over the
    input chain and the output chain separately. Reduces diff in future
    dma_buf patches.

Co-authored-with: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Chad Versace <chadversary@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv/physical_device: Rename uuid to pipeline_cache_uuid
Jason Ekstrand [Mon, 27 Feb 2017 17:36:20 +0000 (09:36 -0800)]
anv/physical_device: Rename uuid to pipeline_cache_uuid

We're about to have more UUIDs for different things so this one really
needs to be properly labeled.

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Refactor device_get_cache_uuid into physical_device_init_uuids
Jason Ekstrand [Mon, 27 Feb 2017 17:34:53 +0000 (09:34 -0800)]
anv: Refactor device_get_cache_uuid into physical_device_init_uuids

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv: Set EXEC_OBJECT_ASYNC when available
Jason Ekstrand [Thu, 13 Apr 2017 23:30:19 +0000 (16:30 -0700)]
anv: Set EXEC_OBJECT_ASYNC when available

Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agoanv/cmd_buffer: Use the device allocator for QueueSubmit
Jason Ekstrand [Tue, 28 Feb 2017 01:31:05 +0000 (17:31 -0800)]
anv/cmd_buffer: Use the device allocator for QueueSubmit

The command is really operating on a Queue not a command buffer and the
nearest object to that with an allocator is VkDevice.

Reviewed-by: Chad Versace <chadversary@chromium.org>
Cc: "17.0 17.1" <mesa-dev@lists.freedesktop.org>
7 years agomesa: remove wip framebuffer code
Timothy Arceri [Thu, 27 Apr 2017 11:07:11 +0000 (21:07 +1000)]
mesa: remove wip framebuffer code

This was added in 34b3b40af97d back in 2006. Seems it wasn't
needed.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: set vector_elements to 1 for samplers
Samuel Pitoiset [Wed, 26 Apr 2017 11:49:13 +0000 (13:49 +0200)]
glsl: set vector_elements to 1 for samplers

I don't see any reasons why vector_elements is 1 for images and
0 for samplers. This increases consistency and allows to clean
up some code a bit.

This will also help for ARB_bindless_texture.

No piglit regressions with RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoclover: Fix build since clang r301442
Jan Vesely [Thu, 27 Apr 2017 16:11:37 +0000 (12:11 -0400)]
clover: Fix build since clang r301442

v2: rename default_ik -> ik_opencl

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agodisk_cache: use block size rather than file size
Timothy Arceri [Thu, 27 Apr 2017 01:15:30 +0000 (11:15 +1000)]
disk_cache: use block size rather than file size

The majority of cache files are less than 1kb this resulted in us
greatly miscalculating the amount of disk space used by the cache.

Using the number of blocks allocated to the file is more
conservative and less likely to cause issues.

This change will result in cache sizes being miscalculated further
until old items added with the previous calculation have all been
removed. However I don't see anyway around that, the previous
patch should help limit that problem.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agodisk_cache: reduce default cache size to 5% of filesystem
Timothy Arceri [Thu, 27 Apr 2017 01:15:29 +0000 (11:15 +1000)]
disk_cache: reduce default cache size to 5% of filesystem

Modern disks are extremely large and are only going to get bigger.
Usage has shown frequent Mesa upgrades can result in the cache
growing very fast i.e. wasting a lot of disk space unnecessarily.

5% seems like a more reasonable default.

Cc: "17.1" <mesa-stable@lists.freedesktop.org>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
7 years agoradeon/ac: remove assert causing regression
Dave Airlie [Thu, 27 Apr 2017 10:35:56 +0000 (11:35 +0100)]
radeon/ac: remove assert causing regression

This assert wasn't in the original radeonsi code but I added
it without totally understanding the original code, it caused
some regressions in variable-indexing tessellation shaders.

Fixes: e2659176 radeonsi/ac: move vertex export remove to common code.
Reported-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeon/ac: fix build on llvm 3.8.1
Dave Airlie [Thu, 27 Apr 2017 10:20:25 +0000 (11:20 +0100)]
radeon/ac: fix build on llvm 3.8.1

Add missing include to fix build.

Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonvc0: Enable compute support for Pascal
Boyan Ding [Sun, 23 Apr 2017 15:19:23 +0000 (23:19 +0800)]
nvc0: Enable compute support for Pascal

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonvc0: Add new launch descriptor format for GP100
Boyan Ding [Wed, 26 Apr 2017 13:21:58 +0000 (21:21 +0800)]
nvc0: Add new launch descriptor format for GP100

v2:
Also handle the the new format in indirect dispatch
Use compute class check instead of chipset check

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonvc0: Fix index of unk fields in nve4_cp_launch_desc
Boyan Ding [Sun, 23 Apr 2017 15:19:21 +0000 (23:19 +0800)]
nvc0: Fix index of unk fields in nve4_cp_launch_desc

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agonouveau: Fix indentation of maxwell compute class definitions
Boyan Ding [Sun, 23 Apr 2017 15:19:20 +0000 (23:19 +0800)]
nouveau: Fix indentation of maxwell compute class definitions

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoanv: Don't place scratch buffers above the 32-bit boundary
Jason Ekstrand [Sat, 22 Apr 2017 22:51:01 +0000 (15:51 -0700)]
anv: Don't place scratch buffers above the 32-bit boundary

This fixes rendering corruptions in DOOM.  Hopefully, it will also make
Jenkins a bit more stable as we've been seeing some random failures and
GPU hangs ever since turning on 48bit.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100620
Fixes: 651ec926fc1 "anv: Add support for 48-bit addresses"
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: "17.1" <mesa-stable@lists.freedesktop.org>
7 years agoradv/ac: eliminate unused vertex shader outputs. (v2)
Dave Airlie [Fri, 21 Apr 2017 02:38:05 +0000 (03:38 +0100)]
radv/ac: eliminate unused vertex shader outputs. (v2)

This is ported from radeonsi, and I can see at least one
Talos shader drops an export due to this, and saves some
VGPR usage.

v2: use shared code.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeonsi/ac: move vertex export remove to common code.
Dave Airlie [Tue, 25 Apr 2017 22:33:29 +0000 (23:33 +0100)]
radeonsi/ac: move vertex export remove to common code.

This code can be shared by radv, we bump the max to
VARYING_SLOT_MAX here, but that shouldn't have too
much fallout.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix regression in descriptor set freeing.
Dave Airlie [Wed, 26 Apr 2017 23:31:29 +0000 (09:31 +1000)]
radv: fix regression in descriptor set freeing.

Since the host pool changes,

Fixes:
dEQP-VK.api.descriptor_pool.out_of_pool_memory

Fixes: 126d5ad "radv: Use host memory pool for non-freeable descriptors."
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoglsl: remove duplicate validation
Timothy Arceri [Wed, 26 Apr 2017 03:56:45 +0000 (13:56 +1000)]
glsl: remove duplicate validation

Varying types have already been validated in
apply_type_qualifier_to_variable() by this point.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoglsl: use without_array() rather than get_scalar_type()
Timothy Arceri [Wed, 26 Apr 2017 03:56:44 +0000 (13:56 +1000)]
glsl: use without_array() rather than get_scalar_type()

Here get_scalar_type() was just being use to remove the array
after that we converted it back to base_type anyway so just
use the without_array() helper.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agosvga: fix vertex buffer binding issue
Brian Paul [Tue, 25 Apr 2017 14:02:28 +0000 (08:02 -0600)]
svga: fix vertex buffer binding issue

When we ran Viewperf11's Maya-03 test 3 we saw warnings about flushing
the command buffer with mapped buffers.  This happened when transitioning
from hardware rendering to a 'draw' fallback path.

The problem is the util_set_vertex_buffers_count() function doesn't do
exactly what we want in svga_hwtnl_vertex_buffers().  In a case such as
dst_count=2, dst={bufA, bufB}, count=1 and src={bufC}, when the function
returns we'll have dst_count=2 and dst={bufC, bufB}.  What we really want
is dst_count=1 and dst={bufC, NULL}.  As it was, we were telling the svga
device that there were two vertex buffers when in fact we really only
needed one for the subsequent drawing command.

In this particular case, we first did hardware drawing with {bufA, bufB}
then we transitioned to the 'draw' module, consuming vertex data from
bufA and bufB and writing the new vertex data to bufC.  bufA and bufB are
mapped for reading when we flush the command buffer but should not be
referenced by the command buffer.  The above change fixes that.

No Piglit regressions.  Also tested with Viewperf, Google Earth, Heaven,
etc.

VMware bug 1842059

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agogallium/util: reduce util_snprintf() calls in debug_flush_might_flush_cb()
Brian Paul [Mon, 24 Apr 2017 18:58:22 +0000 (12:58 -0600)]
gallium/util: reduce util_snprintf() calls in debug_flush_might_flush_cb()

We only need to construct the debug message if the mapped_sync flag is set.
This should make the function faster since the flag is usually false.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
7 years agogallium/util: add some comments in u_debug_flush.c
Brian Paul [Mon, 24 Apr 2017 18:57:14 +0000 (12:57 -0600)]
gallium/util: add some comments in u_debug_flush.c

Trivial.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>