mesa.git
4 years agoglsl: add infrastructure for ARB_shading_language_include
Timothy Arceri [Wed, 14 Aug 2019 00:25:14 +0000 (10:25 +1000)]
glsl: add infrastructure for ARB_shading_language_include

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
4 years agomesa: add ARB_shading_language_include stubs
Timothy Arceri [Mon, 5 Aug 2019 05:40:44 +0000 (15:40 +1000)]
mesa: add ARB_shading_language_include stubs

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
4 years agoradv: Do not change scratch settings while shaders are active.
Bas Nieuwenhuizen [Thu, 31 Oct 2019 21:53:30 +0000 (22:53 +0100)]
radv: Do not change scratch settings while shaders are active.

When the scratch ringbuffer settings are changed, the shader unit has
to be idle or we will have shaders using old and new settings.

That combination is not supported on the HW (likely the offset is
ringbuffer idx * WAVESIZE * 1024).

CC: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
4 years agoturnip: Drop the copy of the formats table.
Eric Anholt [Tue, 12 Nov 2019 00:08:25 +0000 (16:08 -0800)]
turnip: Drop the copy of the formats table.

Now that we can (mostly) generate a pipe format for a VkFormat, use that
to answer queries about formats.  This will let us refactor the freedreno
format table surface layout code to be shared between gallium and vulkan.

This causes us to expose fewer formats for now (on a 1/100 CTS run I'm
doing, skips go from 3671 to 3835 out of 5145 tests).  Fails stay about
the same (478 -> 434, but the run is pretty flaky and we're doing fewer
tests now).

v2: Rebase on master, throw a finishme on missing vk-to-pipe formats that
    tu used to support.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> (v1)
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
4 years agoutil: Add a mapping from VkFormat to PIPE_FORMAT.
Eric Anholt [Wed, 6 Nov 2019 23:26:32 +0000 (15:26 -0800)]
util: Add a mapping from VkFormat to PIPE_FORMAT.

I'm planning on using this from radv and tu for queries about formats.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Jonathan Marek <jonathan@marek.ca>
4 years agowinsys/amdgpu: detect noop dependencies on the same ring correctly
Marek Olšák [Thu, 14 Nov 2019 22:56:13 +0000 (17:56 -0500)]
winsys/amdgpu: detect noop dependencies on the same ring correctly

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agoac: fill num_rings for remaining IPs
Marek Olšák [Thu, 14 Nov 2019 22:49:51 +0000 (17:49 -0500)]
ac: fill num_rings for remaining IPs

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agoac: add radeon_info::num_rings and move ring_type to amd_family.h
Marek Olšák [Thu, 14 Nov 2019 22:43:12 +0000 (17:43 -0500)]
ac: add radeon_info::num_rings and move ring_type to amd_family.h

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agonir: don't use GLenum16 in nir.h
Marek Olšák [Tue, 12 Nov 2019 01:03:40 +0000 (20:03 -0500)]
nir: don't use GLenum16 in nir.h

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
4 years agonir: move data.descriptor_set above data.index for better packing
Marek Olšák [Thu, 7 Nov 2019 23:02:06 +0000 (18:02 -0500)]
nir: move data.descriptor_set above data.index for better packing

4 bytes down

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
4 years agoglsl_to_nir: rename image_access to mem_access
Marek Olšák [Thu, 7 Nov 2019 22:54:42 +0000 (17:54 -0500)]
glsl_to_nir: rename image_access to mem_access

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
4 years agonir/print: only print image.format for image variables
Marek Olšák [Thu, 7 Nov 2019 22:54:13 +0000 (17:54 -0500)]
nir/print: only print image.format for image variables

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
4 years agonir: move data.image.access to data.access
Marek Olšák [Thu, 7 Nov 2019 21:53:58 +0000 (16:53 -0500)]
nir: move data.image.access to data.access

The size of the data structure doesn't change.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
4 years agost/mesa: call nir_serialize only once per shader
Marek Olšák [Fri, 8 Nov 2019 00:24:57 +0000 (19:24 -0500)]
st/mesa: call nir_serialize only once per shader

It was called twice.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: keep serialized NIR instead of nir_shader in st_program
Marek Olšák [Sat, 2 Nov 2019 03:55:58 +0000 (23:55 -0400)]
st/mesa: keep serialized NIR instead of nir_shader in st_program

This decreases memory usage, because serialized NIR is more compact.

If shader_has_one_variant is true and the shader is uncached, the first
variant is created from nir_shader, otherwise the first variant and
all other variants are created from serialized NIR.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: call nir_sweep in st_finalize_nir
Marek Olšák [Tue, 19 Nov 2019 21:35:59 +0000 (16:35 -0500)]
st/mesa: call nir_sweep in st_finalize_nir

This is invoked sooner before (pre-)compiling the first variant and is
also applied to fixed-func and ARB programs.

4 years agost/mesa: subclass st_vertex_program for VP-specific members
Marek Olšák [Sat, 2 Nov 2019 03:04:11 +0000 (23:04 -0400)]
st/mesa: subclass st_vertex_program for VP-specific members

Inheritance:
    gl_program -> st_program -> st_vertex_program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: more cleanups after unification of st_vertex/common_program
Marek Olšák [Sat, 2 Nov 2019 03:21:14 +0000 (23:21 -0400)]
st/mesa: more cleanups after unification of st_vertex/common_program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: rename occurences of stcp to stp to correspond to st_program
Marek Olšák [Sat, 2 Nov 2019 02:47:29 +0000 (22:47 -0400)]
st/mesa: rename occurences of stcp to stp to correspond to st_program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: cleanups after unification of st_vertex/common program
Marek Olšák [Sat, 2 Nov 2019 02:46:11 +0000 (22:46 -0400)]
st/mesa: cleanups after unification of st_vertex/common program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: rename st_common_program to st_program
Marek Olšák [Sat, 2 Nov 2019 02:38:06 +0000 (22:38 -0400)]
st/mesa: rename st_common_program to st_program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: trivially merge st_vertex_program into st_common_program
Marek Olšák [Sat, 2 Nov 2019 02:34:31 +0000 (22:34 -0400)]
st/mesa: trivially merge st_vertex_program into st_common_program

a later commit will add back st_vertex_program as a subclass of
st_common_program

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: consolidate and simplify code flagging program::affected_states
Marek Olšák [Sat, 2 Nov 2019 02:19:28 +0000 (22:19 -0400)]
st/mesa: consolidate and simplify code flagging program::affected_states

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: initialize affected_states and uniform storage earlier in deserialize
Marek Olšák [Sat, 2 Nov 2019 02:09:23 +0000 (22:09 -0400)]
st/mesa: initialize affected_states and uniform storage earlier in deserialize

This matches the uncached codepath.

affected_states was used before initialization, which was technically
a bug, but probably not reproducible due to _NEW_PROGRAM rebinding
everything.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: start deduplicating some program code
Marek Olšák [Sat, 2 Nov 2019 02:04:57 +0000 (22:04 -0400)]
st/mesa: start deduplicating some program code

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: decrease the size of st_fp_variant_key from 48 to 40 bytes
Marek Olšák [Sat, 2 Nov 2019 01:57:22 +0000 (21:57 -0400)]
st/mesa: decrease the size of st_fp_variant_key from 48 to 40 bytes

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: rename delete_basic_variant -> delete_common_variant
Marek Olšák [Sat, 2 Nov 2019 01:49:51 +0000 (21:49 -0400)]
st/mesa: rename delete_basic_variant -> delete_common_variant

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agoanv: add missing "fall-through" annotation
Eric Engestrom [Sun, 17 Nov 2019 23:56:49 +0000 (23:56 +0000)]
anv: add missing "fall-through" annotation

CoverityID: 1455884
Fixes: c1c346f1667375e9330a ("anv: implement VK_KHR_separate_depth_stencil_layouts")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
4 years agoegl: use EGL_CAST() macro in eglmesaext.h
Eric Engestrom [Sat, 16 Nov 2019 17:51:27 +0000 (17:51 +0000)]
egl: use EGL_CAST() macro in eglmesaext.h

Allows eglmesaext.h to be used in C++ code.

This aligns this file with the rest of EGL.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-By: Tapani Pälli <tapani.palli@intel.com>
4 years agovulkan: delete typo'd header
Eric Engestrom [Sun, 17 Nov 2019 09:51:52 +0000 (09:51 +0000)]
vulkan: delete typo'd header

Two files exist in that directory:
- vulkan_xlib_randr.h
- vulkan_xlib_xrandr.h

Both were imported in 205c271562db8cb2effc ("vulkan: Update the XML and
headers to 1.1.70") with identical contents (ie. the
VK_EXT_acquire_xlib_display extension), but the former was never
included anywhere and can't be found upstream [1], while the latter is
included in vulkan.h and found upstream.

[1] https://github.com/KhronosGroup/Vulkan-Headers/tree/master/include/vulkan

Fixes: 205c271562db8cb2effc ("vulkan: Update the XML and headers to 1.1.70")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
4 years agoCL: sync C++ headers with Khronos
Eric Engestrom [Sun, 17 Nov 2019 11:22:01 +0000 (11:22 +0000)]
CL: sync C++ headers with Khronos

https://github.com/KhronosGroup/OpenCL-CLHPP at commit
cf9fc1035e8298c7ce65ee33066a660fd9892ebb

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agoCL: sync C headers with Khronos
Eric Engestrom [Sun, 17 Nov 2019 11:28:53 +0000 (11:28 +0000)]
CL: sync C headers with Khronos

https://github.com/KhronosGroup/OpenCL-Headers at commit
0d5f18c6e7196863bc1557a693f1509adfcee056

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agointel: Add workaround for stencil state.
Rafael Antognolli [Wed, 13 Nov 2019 22:30:57 +0000 (14:30 -0800)]
intel: Add workaround for stencil state.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
4 years agoturnip: fix sRGB GMEM clear
Jonathan Marek [Mon, 18 Nov 2019 23:42:12 +0000 (18:42 -0500)]
turnip: fix sRGB GMEM clear

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agoturnip: implement CmdClearColorImage/CmdClearDepthStencilImage
Jonathan Marek [Mon, 18 Nov 2019 23:41:23 +0000 (18:41 -0500)]
turnip: implement CmdClearColorImage/CmdClearDepthStencilImage

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agoradv/aco: enable VK_KHR_shader_subgroup_extended_types
Rhys Perry [Thu, 14 Nov 2019 17:57:02 +0000 (17:57 +0000)]
radv/aco: enable VK_KHR_shader_subgroup_extended_types

We could enable it on GFX10 if LLVM wasn't used as a fallback for
unsupported stages. Note that the CTS only tests it if
VK_KHR_shader_float16_int8 is enabled, even though it's not a
requirement.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
4 years agoaco: implement 64-bit integer reductions
Rhys Perry [Mon, 11 Nov 2019 19:48:54 +0000 (19:48 +0000)]
aco: implement 64-bit integer reductions

The multiplication reduction is larger than it could be, but it should be
easier to implement this way.

No failures with dEQP-VK.subgroups.*int64* except those caused by LLVM
being used for other stages.

v2: don't call setFixed() for v_add carry-out, since setHint sets physReg
v3: add and use emit_vadd32() helper
v4: use num_opcodes instead of last_opcode

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> (v3)
4 years agoaco: refactor reduction lowering helpers
Rhys Perry [Mon, 11 Nov 2019 17:37:43 +0000 (17:37 +0000)]
aco: refactor reduction lowering helpers

Should make 64-bit integer reductions easier to implement.

v4: use num_opcodes instead of last_opcode

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> (v3)
4 years agoradv: advertise VK_KHR_shader_subgroup_extended_types on GFX8-GFX9
Samuel Pitoiset [Fri, 8 Nov 2019 11:45:03 +0000 (12:45 +0100)]
radv: advertise VK_KHR_shader_subgroup_extended_types on GFX8-GFX9

This extension allows to use subgroup operations with 8 and 16-bits

Untested on GFX6-GFX7, and most of subgroup operations are broken
on GFX10, so don't enable it for now. Not enabled on ACO because
it's still doesn't support 8-bits/16-bits.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 16-bit float support to ac_build_alu_op()
Samuel Pitoiset [Fri, 8 Nov 2019 14:57:02 +0000 (15:57 +0100)]
ac: add 16-bit float support to ac_build_alu_op()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_optimization_barrier()
Samuel Pitoiset [Fri, 8 Nov 2019 16:12:39 +0000 (17:12 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_optimization_barrier()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_wwm()
Samuel Pitoiset [Fri, 8 Nov 2019 16:12:15 +0000 (17:12 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_wwm()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to get_reduction_identity()
Samuel Pitoiset [Fri, 8 Nov 2019 15:35:45 +0000 (16:35 +0100)]
ac: add 8-bit and 16-bit supports to get_reduction_identity()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_swizzle()
Samuel Pitoiset [Fri, 8 Nov 2019 13:51:40 +0000 (14:51 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_swizzle()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_dpp()
Samuel Pitoiset [Fri, 8 Nov 2019 13:27:15 +0000 (14:27 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_dpp()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_set_inactive()
Samuel Pitoiset [Fri, 8 Nov 2019 13:15:59 +0000 (14:15 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_set_inactive()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_readlane()
Samuel Pitoiset [Fri, 8 Nov 2019 12:00:50 +0000 (13:00 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_readlane()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: add 8-bit and 16-bit supports to ac_build_shuffle()
Samuel Pitoiset [Fri, 8 Nov 2019 11:44:39 +0000 (12:44 +0100)]
ac: add 8-bit and 16-bit supports to ac_build_shuffle()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agoac: remove useless cast in ac_build_set_inactive()
Samuel Pitoiset [Fri, 8 Nov 2019 13:12:58 +0000 (14:12 +0100)]
ac: remove useless cast in ac_build_set_inactive()

The return type is always the src type (32 or 64 bits).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agospirv: fix lowering of OpGroupNonUniformAllEqual
Samuel Pitoiset [Mon, 11 Nov 2019 09:15:01 +0000 (10:15 +0100)]
spirv: fix lowering of OpGroupNonUniformAllEqual

It should rely on the source type, not on the return type which
is always a boolean anyways, so vote_feq was never selected. For
OpSubgroupAllEqualKHR it's always an integer comparison.

This fixes some VK_KHR_shader_subgroup_extended_types tests with RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agogitlab-ci: Remove limit on kernel logging
Tomeu Vizoso [Mon, 18 Nov 2019 10:17:39 +0000 (11:17 +0100)]
gitlab-ci: Remove limit on kernel logging

We don't seem to fault any more when running dEQP GLES2, and we don't
scrape serial output any more anyway so no problems should be caused by
that.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agomesa: fix warning in 32 bits build
Pierre-Eric Pelloux-Prayer [Thu, 7 Nov 2019 14:06:24 +0000 (15:06 +0100)]
mesa: fix warning in 32 bits build

Fixes: febedee4f6c ("mesa: add EXT_dsa glGetVertexArray* 4 functions")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: enable EXT_direct_state_access
Pierre-Eric Pelloux-Prayer [Wed, 30 Oct 2019 14:11:22 +0000 (15:11 +0100)]
mesa: enable EXT_direct_state_access

Always enabled; this doesn't require any driver work, it's just
core mesa bits.

quick_gl.txt is also updated because previously piglit ext_dsa
tests were skipped.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_sparse_buffer NamedBufferPageCommitmentEXT function
Pierre-Eric Pelloux-Prayer [Thu, 7 Nov 2019 13:25:19 +0000 (14:25 +0100)]
mesa: add ARB_sparse_buffer NamedBufferPageCommitmentEXT function

The spec is unclear on how to handle the buffer argument so we reuse
the logic from the EXT_direct_state_access spec.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_vertex_attrib_binding glVertexArray* functions
Pierre-Eric Pelloux-Prayer [Thu, 7 Nov 2019 12:47:17 +0000 (13:47 +0100)]
mesa: add ARB_vertex_attrib_binding glVertexArray* functions

We can't simply alias ARB_direct_state_access functions because
those fail if the vao has never been bound before.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: extend vertex_array_attrib_format to support EXT_dsa
Pierre-Eric Pelloux-Prayer [Thu, 7 Nov 2019 09:55:23 +0000 (10:55 +0100)]
mesa: extend vertex_array_attrib_format to support EXT_dsa

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: implement ARB_texture_storage_multisample + EXT_dsa functions
Pierre-Eric Pelloux-Prayer [Wed, 6 Nov 2019 14:42:10 +0000 (15:42 +0100)]
mesa: implement ARB_texture_storage_multisample + EXT_dsa functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_texture_buffer_range glTextureBufferRangeEXT function
Pierre-Eric Pelloux-Prayer [Wed, 6 Nov 2019 13:04:55 +0000 (14:04 +0100)]
mesa: add ARB_texture_buffer_range glTextureBufferRangeEXT function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_instanced_arrays EXT_dsa function
Pierre-Eric Pelloux-Prayer [Wed, 6 Nov 2019 11:16:30 +0000 (12:16 +0100)]
mesa: add ARB_instanced_arrays EXT_dsa function

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_gpu_shader_fp64 selector-less functions
Pierre-Eric Pelloux-Prayer [Wed, 6 Nov 2019 09:57:53 +0000 (10:57 +0100)]
mesa: add ARB_gpu_shader_fp64 selector-less functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_clear_buffer_object named functions
Pierre-Eric Pelloux-Prayer [Tue, 5 Nov 2019 14:37:12 +0000 (15:37 +0100)]
mesa: add ARB_clear_buffer_object named functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_vertex_attrib_64bit VertexArrayVertexAttribLOffsetEXT
Pierre-Eric Pelloux-Prayer [Tue, 5 Nov 2019 14:04:52 +0000 (15:04 +0100)]
mesa: add ARB_vertex_attrib_64bit VertexArrayVertexAttribLOffsetEXT

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: add ARB_framebuffer_no_attachments named functions
Pierre-Eric Pelloux-Prayer [Tue, 5 Nov 2019 13:47:53 +0000 (14:47 +0100)]
mesa: add ARB_framebuffer_no_attachments named functions

The wording in ARB_framebuffer_no_attachments and EXT_direct_state_access
is different.
In the former framebuffer names must have been generated using glGenFramebuffers
before using the named functions.
In the latter framebuffer names have no such constraints, so we can't use
the _mesa_lookup_framebuffer_dsa function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: update features.txt to reflect EXT_dsa status
Pierre-Eric Pelloux-Prayer [Wed, 6 Nov 2019 09:30:13 +0000 (10:30 +0100)]
mesa: update features.txt to reflect EXT_dsa status

All features from the EXT_dsa spec are implemented.

Interactions with other specs:
- GL_AMD_gpu_shader_int64: not needed, since it's not enabled in
  compatibility profile.
- GL_ARB_bindless_texture is DONE
    "INVALID_OPERATION is generated when calling various functions
    to modify the state of a texture object from which handles have
    been extracted"
- GL_ARB_buffer_storage/GL_EXT_buffer_storage is DONE (NamedBufferStorageEXT function)
- GL_ARB_texture_storage is DONE (3 TextureStorage*DEXT functions)
- GL_ARB_vertex_attrib_binding is DONE (6 VertexArray* functions)
- GL_EXT_external_buffer is not supported by Mesa

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agopanfrost: Set PIPE_COMPUTE_CAP_ADDRESS_BITS to 64
Alyssa Rosenzweig [Wed, 6 Nov 2019 19:55:41 +0000 (14:55 -0500)]
panfrost: Set PIPE_COMPUTE_CAP_ADDRESS_BITS to 64

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Disable tiling for GLOBAL resources
Alyssa Rosenzweig [Tue, 5 Nov 2019 16:18:42 +0000 (11:18 -0500)]
panfrost: Disable tiling for GLOBAL resources

It doesn't make sense to have nonlinear layouts for a buffer that can be
accessed as direct memory for a compute kernel. Turn that off so things
work as expected.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Pass kernel inputs as uniforms
Alyssa Rosenzweig [Tue, 5 Nov 2019 16:19:20 +0000 (11:19 -0500)]
panfrost: Pass kernel inputs as uniforms

We can take the OpenCL kernel inputs and interpret them as uniforms by
simply reusing the Gallium callback.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopanfrost: Stub out clover callbacks
Alyssa Rosenzweig [Tue, 5 Nov 2019 14:37:51 +0000 (09:37 -0500)]
panfrost: Stub out clover callbacks

We don't implement these yet but let's not crash.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agoi965: Ensure that all 2101010 image imports can pass framebuffer completeness.
Miguel Casas-Sanchez [Tue, 19 Nov 2019 02:21:12 +0000 (02:21 +0000)]
i965: Ensure that all 2101010 image imports can pass framebuffer completeness.

Chrome OS would like to import and render to any supported format that has
a corresponding display plane format, and this prevents throwing
framebuffer incomplete for FBOs using these textures.

See: crbug.com/949260

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agonir/serialize: fix serializing functions with no implementations.
Dave Airlie [Mon, 18 Nov 2019 22:19:34 +0000 (08:19 +1000)]
nir/serialize: fix serializing functions with no implementations.

Store a flag stating if there was an implmentation, and use
fxn->impl as a temporary flag between deserializsation stages.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
4 years agonir/serialize: pack function has name and entry point into flags.
Dave Airlie [Mon, 18 Nov 2019 22:16:22 +0000 (08:16 +1000)]
nir/serialize: pack function has name and entry point into flags.

Suggested by Jason.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
4 years agoiris: Re-enable param compaction
Jason Ekstrand [Mon, 18 Nov 2019 22:52:02 +0000 (16:52 -0600)]
iris: Re-enable param compaction

In d1c4e64a69e, we added a parameter to tell the back-end compiler to
ignore the param array and just push however many constants you ask it
to push.  I enabled it for iris because this is really what iris wants
but it seems to have caused a number of regressions.  Revert to the old
behavior for now.

Fixes: d1c4e64a69e "intel/compiler: Add a flag to avoid compacting..."
4 years agomesa: enable glthread for 7 Days To Die
Marek Olšák [Mon, 18 Nov 2019 20:50:31 +0000 (15:50 -0500)]
mesa: enable glthread for 7 Days To Die

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agointel/compiler: Don't change hstride if not needed
Iván Briano [Wed, 23 Oct 2019 16:18:03 +0000 (09:18 -0700)]
intel/compiler: Don't change hstride if not needed

Alignment requirements may have changed the horizontal stride already,
so don't set it if not required to avoid breaking said requirements.

Fixes several tests such as
dEQP-VK.subgroups.vote.graphics.subgroupallequal_int8_t

Signed-off-by: Iván Briano <ivan.briano@intel.com>
Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
4 years agoturnip: add x11 wsi
Jonathan Marek [Wed, 13 Nov 2019 22:02:43 +0000 (17:02 -0500)]
turnip: add x11 wsi

Copied from radv

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agoturnip: add display wsi
Jonathan Marek [Wed, 13 Nov 2019 21:50:36 +0000 (16:50 -0500)]
turnip: add display wsi

Copied from radv (minus the fence change)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agonir: Validate that variables are in the right lists
Jason Ekstrand [Thu, 14 Nov 2019 18:12:50 +0000 (12:12 -0600)]
nir: Validate that variables are in the right lists

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agoetnaviv: blt: set TS dirty after clear
Jonathan Marek [Tue, 2 Jul 2019 21:05:27 +0000 (17:05 -0400)]
etnaviv: blt: set TS dirty after clear

RS engine does this already, it is missing for BLT engine. This fixes
cases where a clear isn't immediately at the start of the frame.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
4 years agoetnaviv: separate PE and RS formats, use only RS only for tiling
Jonathan Marek [Fri, 9 Aug 2019 20:27:47 +0000 (16:27 -0400)]
etnaviv: separate PE and RS formats, use only RS only for tiling

There are PE formats not supported by RS, so we can't have a single
to translate both.

Use RS only for same formats until we have a translate_rs_format and test
the possible different format blits.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
4 years agoetnaviv: blt: use only for tiling, and add missing formats
Jonathan Marek [Fri, 9 Aug 2019 14:41:22 +0000 (10:41 -0400)]
etnaviv: blt: use only for tiling, and add missing formats

* Removes the incorrect usage of translate_rs_format
* Disables use of BLT engine for different src/dst format

We only really need the BLT engine for tiling/detiling right now, but it
would be nice to support as many blit cases as possible to avoid using PE
for that.

To deal with different formats we need to:
 * Have a translate_blt_format which has all supported formats
 * Fix the swizzle translation from gallium (current version was wrong)
 * Set the src/dst sRGB bits as needed
 * Find which type conversions the BLT engine can actually do

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
4 years agoCall shmget() with permission 0600 instead of 0777
Brian Paul [Wed, 9 Oct 2019 18:05:16 +0000 (12:05 -0600)]
Call shmget() with permission 0600 instead of 0777

A security advisory (TALOS-2019-0857/CVE-2019-5068) found that
creating shared memory regions with permission mode 0777 could allow
any user to access that memory.  Several Mesa drivers use shared-
memory XImages to implement back buffers for improved performance.

This path changes the shmget() calls to use 0600 (user r/w).

Tested with legacy Xlib driver and llvmpipe.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agoanv: Emit a NULL vertex for zero base_vertex/instance
Jason Ekstrand [Fri, 8 Nov 2019 04:05:21 +0000 (22:05 -0600)]
anv: Emit a NULL vertex for zero base_vertex/instance

If both are zero (the common case), we can emit a null vertex buffer
rather than emitting a vertex buffer with zeros in it.  The packing of
the VERTEX_BUFFER_STATE is faster because no relocation is emitted and
we can avoid creating the vertex buffer which means one less
anv_state_stream_alloc.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Use an anv_state for the next binding table
Jason Ekstrand [Thu, 7 Nov 2019 20:02:09 +0000 (14:02 -0600)]
anv: Use an anv_state for the next binding table

This is a bit more natural because we're already getting an anv_state
most places in the pipeline.  The important part here, however, is that
we're no longer calling anv_block_pool_map on every alloc_binding_table
call.  While it's probably pretty cheap, it is potentially a linear walk
over the list of BOs and it was showing up in profiles.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: More carefully dirty state in BindPipeline
Jason Ekstrand [Thu, 7 Nov 2019 17:28:47 +0000 (11:28 -0600)]
anv: More carefully dirty state in BindPipeline

Instead of blindly dirtying descriptors and push constants the moment we
see a pipeline change, check to see if it actually changes the bind
layout or push constant layout.  This doubles the runtime performance of
one CPU-limited example running with the Dawn WebGPU implementation when
running on my laptop.

NOTE: This effectively reverts beca63c6c07.  While it was a nice
optimization, it was based on prog_data and we can't do that anymore
once we start allowing the same binding table to be used with multiple
different pipelines.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: More carefully dirty state in BindDescriptorSets
Jason Ekstrand [Thu, 7 Nov 2019 17:44:08 +0000 (11:44 -0600)]
anv: More carefully dirty state in BindDescriptorSets

Instead of dirtying all graphics or all compute based on binding point,
we're now much more careful.  We first check to see if the actual
descriptor set changed and then only dirty the stages used by that
descriptor set.  For dynamic offsets, we keep a bitfield per-stage of
which offsets are actually used in that stage and we only dirty push
constants and descriptors if that stage has dynamic offsets AND those
offsets actually change.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Use a switch statement for binding table setup
Jason Ekstrand [Thu, 7 Nov 2019 20:39:28 +0000 (14:39 -0600)]
anv: Use a switch statement for binding table setup

It theoretically could be more efficient but the real point here is that
it's no longer really a matter of dealing with special cases and then
the "real" thing.  The way we're handling binding tables, it's more of a
multi-step process and a switch is more natural.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Rework push constant handling
Jason Ekstrand [Thu, 7 Nov 2019 23:16:14 +0000 (17:16 -0600)]
anv: Rework push constant handling

This substantially reworks both the state setup side of push constant
handling and the pipeline compile side.  The fundamental change here is
that we're no longer respecting the prog_data::param array and instead
are just instructing the back-end compiler to leave the array alone.
This makes the state setup side substantially simpler because we can now
just memcpy the whole block of push constants and don't have to
upload one DWORD at a time.

This also means that we can compute the full push constant layout
up-front and just trust the back-end compiler to not mess with it.
Maybe one day we'll decide that the back-end compiler can do useful
things there again but for now, this is functionally no different from
what we had before this commit and makes the NIR handling cleaner.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Re-arrange push constant data a bit
Jason Ekstrand [Wed, 6 Nov 2019 16:59:15 +0000 (10:59 -0600)]
anv: Re-arrange push constant data a bit

This moves the compute stuff into a anv_push_constants::cs sub-struct.
It also moves dynamic offsets into the push constants.  This means we
have to duplicate the data per-stage but that doesn't seem like the end
of the world and one day we may wish to make dynamic offsets per-stage
anyway.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agointel/compiler: Add a flag to avoid compacting push constants
Jason Ekstrand [Thu, 31 Oct 2019 20:57:52 +0000 (15:57 -0500)]
intel/compiler: Add a flag to avoid compacting push constants

In vec4, we can just not run the pass.  In fs, things are a bit more
deeply intertwined.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Pre-compute push ranges for graphics pipelines
Jason Ekstrand [Fri, 8 Nov 2019 15:42:30 +0000 (09:42 -0600)]
anv: Pre-compute push ranges for graphics pipelines

It turns off that emitting push constants is one of the hottest paths in
the driver and ANY work we do there costs us.  By pre-computing things a
bit ahead of time, we shave 5% off the runtime of a CPU-limited example
running with the Dawn WebGPU implementation.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Stop bounds-checking pushed UBOs
Jason Ekstrand [Fri, 8 Nov 2019 15:33:07 +0000 (09:33 -0600)]
anv: Stop bounds-checking pushed UBOs

The bounds checking is actually less safe than just pushing the data.
If the bounds checking actually ever kicks in and it's not on the last
UBO push range, then the shrinking will cause all subsequent ranges to
be pushed to the wrong place in the GRF.  One of the behaviors we
definitely don't want is for OOB UBO access to result in completely
unrelated UBOs returning garbage values.  It's safer to just push the
UBOs as-requested.  If we're really concerned about robustness, we can
emit shader code to do bounds checking which should be stupid cheap (a
CMP followed by SEL).

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Delete dead shader constant pushing code
Jason Ekstrand [Wed, 6 Nov 2019 20:13:44 +0000 (14:13 -0600)]
anv: Delete dead shader constant pushing code

As of 2d78e55a8c5481, nir_intrinsic_load_constant with a constant offset
is constant-folded so we should never end up with any that trigger
brw_nir_analyze_ubo_ranges.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Flatten descriptor bindings in anv_nir_apply_pipeline_layout
Jason Ekstrand [Thu, 31 Oct 2019 19:09:39 +0000 (14:09 -0500)]
anv: Flatten descriptor bindings in anv_nir_apply_pipeline_layout

This lets us stop tracking the pipeline layout.  It also means less
indirection on a very hot path.  As an extra bonus, we can make some of
our data structures smaller.  No measurable CPU overhead improvement.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv: Input attachments are always single-plane
Jason Ekstrand [Thu, 31 Oct 2019 21:57:29 +0000 (16:57 -0500)]
anv: Input attachments are always single-plane

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agogenxml: Mark everything in genX_pack.h always_inline
Jason Ekstrand [Thu, 31 Oct 2019 15:25:48 +0000 (10:25 -0500)]
genxml: Mark everything in genX_pack.h always_inline

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agoanv/pipeline: Assume layout != NULL
Jason Ekstrand [Wed, 6 Nov 2019 17:19:00 +0000 (11:19 -0600)]
anv/pipeline: Assume layout != NULL

In the early days of the driver we allowed layout to be VK_NULL_HANDLE
and used that for some internal pipelines when we wanted to be lazy.
Vulkan doesn't actually allow NULL layouts, however, so there's no
reason to have this check.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
4 years agointel/compiler: remove old comment
Italo Nicola [Fri, 8 Nov 2019 14:29:59 +0000 (11:29 -0300)]
intel/compiler: remove old comment

This comment was correct some time ago, but since commit
d3c10ad42729c1fe74a7f7c67465bd2, it isn't true anymore.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
4 years agopan/midgard: Use shader stage in mir_op_computes_derivative
Alyssa Rosenzweig [Mon, 18 Nov 2019 13:02:58 +0000 (08:02 -0500)]
pan/midgard: Use shader stage in mir_op_computes_derivative

A 'normal' texture op may be emitted in a vertex shader on T720 but it
still doesn't take any derivatives.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agoi965: Unify CC_STATE and BLEND_STATE atoms on Haswell as a workaround
Danylo Piliaiev [Thu, 14 Nov 2019 13:36:27 +0000 (15:36 +0200)]
i965: Unify CC_STATE and BLEND_STATE atoms on Haswell as a workaround

Re-emitting 3DSTATE_CC_STATE_POINTERS after emitting
3DSTATE_BLEND_STATE_POINTERS fixes the shadow flickering in
SuperTuxCart and Tropico 6 which was seen only on Haswell.
The reason for this is unknown and fix was found empirically.

The closest mention in PRM is that it should improve performance.
From the HSW PRM, volume 2b, page 823 (3DSTATE_BLEND_STATE_POINTERS):
 "When the BLEND_STATE pointer changes but not the CC_STATE pointer,
  driver needs to force a CC_STATE pointer change to improve
  blend performance in pixel backend."

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1834
Fixes: eca4a654 ("i965: Disable dual source blending when shader doesn't support it on gen8+")
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
4 years agoradv: implement VK_AMD_device_coherent_memory
Samuel Pitoiset [Wed, 13 Nov 2019 07:58:37 +0000 (08:58 +0100)]
radv: implement VK_AMD_device_coherent_memory

This extension adds the device coherent and device uncached memory
types. It's known to be slower than non-device coherent memory but
it might be useful for debugging.

This is only exposed for chips that support L2 uncached.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>