platform/upstream/mesa.git
2 years agovulkan/util: generate define for a selected few enums
Lionel Landwerlin [Wed, 11 Nov 2020 13:27:29 +0000 (15:27 +0200)]
vulkan/util: generate define for a selected few enums

One of the unfortunate effect of Vulkan starting to use 64bit bitmasks
is that they can no longer be defined using enums because C doesn't
guarantees that enum values will be 64bits.

Vulkan therefore started using those patterns :

  static const VkAccessFlags2KHR VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 0x00000001;

This has the effect that we can not longer use those values in
switch/case statements.

This change introduces defines so that we can keep doing this. For now
only VkAccessFlags2KHR/VkPipelineStageFlags2KHR are allowed to be
redefined this way, this list could be changed later (or all bitmask
could be processed this way).

v2: Generate hexadecimal numbers (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>

2 years agovulkan: remove unused VkCommand
Lionel Landwerlin [Wed, 22 Sep 2021 07:59:02 +0000 (10:59 +0300)]
vulkan: remove unused VkCommand

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>

2 years agovulkan: handle new VK_KHR_synchronization2 image layouts
Lionel Landwerlin [Wed, 22 Sep 2021 07:42:47 +0000 (10:42 +0300)]
vulkan: handle new VK_KHR_synchronization2 image layouts

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>

2 years agovulkan: put generated defines into their own header
Lionel Landwerlin [Wed, 22 Sep 2021 07:52:43 +0000 (10:52 +0300)]
vulkan: put generated defines into their own header

v2: Put vk_enum_defines.h in the list of generated files

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9045>

2 years agowsi/x11: cleanup properly after mit shm paths are used.
Dave Airlie [Wed, 6 Oct 2021 07:23:39 +0000 (17:23 +1000)]
wsi/x11: cleanup properly after mit shm paths are used.

This path was being skipped on sw + has_mit_shm, when it
shouldn't be.

Fixes: a069b4e9b9a1 ("vulkan/wsi/sw: add mit-shm support for pixmap allocation")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13217>

2 years agodocs: mark off missing lavapipe exts
Michel Zou [Wed, 6 Oct 2021 17:27:01 +0000 (19:27 +0200)]
docs: mark off missing lavapipe exts

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13232>

2 years agoturnip: Free disk cache on pdev init failure.
Emma Anholt [Tue, 5 Oct 2021 17:34:01 +0000 (10:34 -0700)]
turnip: Free disk cache on pdev init failure.

Noticed while debugging test failure under valgrind (the disk cache
doesn't come from the vulkan allocator, so we could leak it and not fail
the test).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13200>

2 years agoturnip: Fix allocation failure handling around device->name.
Emma Anholt [Tue, 5 Oct 2021 17:22:45 +0000 (10:22 -0700)]
turnip: Fix allocation failure handling around device->name.

Fixes regressions in dEQP-VK.api.device_init.create_instance_device_intentional_alloc_fail

Fixes: 5116388e0ba9 ("turnip: Expose a device name similar to the blob.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13200>

2 years agoturnip: Plug the vendor/device ID into the pipeline cache fields, too.
Emma Anholt [Tue, 5 Oct 2021 16:50:24 +0000 (09:50 -0700)]
turnip: Plug the vendor/device ID into the pipeline cache fields, too.

Fixes a regression in dEQP-VK.pipeline.cache.misc_tests.cache_header_test.

Fixes: 7e471541e0d1 ("turnip: Match the blob's format for vendorID and deviceID.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13200>

2 years agoir3: remove obsolete assert for intrinsic_store_output in tess
Danylo Piliaiev [Tue, 5 Oct 2021 11:29:58 +0000 (14:29 +0300)]
ir3: remove obsolete assert for intrinsic_store_output in tess

We do support non-zero nir_intrinsic_component for
nir_intrinsic_store_output in tess shaders.

Fixes vkd3d test "test_hull_shader_fork_phase_dxbc"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13196>

2 years agoanv: allocate zeroed device object
Marcin Ślusarz [Wed, 6 Oct 2021 11:14:20 +0000 (13:14 +0200)]
anv: allocate zeroed device object

When enabling a new feature we made the mistake of initializing some fields
of the device object conditionally, which leads to crashes later. Initializing
those fields would be a trivial fix, but it's probably better to just zero
everything at allocation time and prevent any future screwups. Device objects
are allocated rarely enough for this additional memset to not matter for
performance.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13221>

2 years agogenxml: Drop bit 27 from RENDER_SURFACE_STATE::Surface Format
Jason Ekstrand [Tue, 5 Oct 2021 21:42:58 +0000 (16:42 -0500)]
genxml: Drop bit 27 from RENDER_SURFACE_STATE::Surface Format

Bit 27 is the "ASTC Format" bit in the PRMs but we just extended the
Surface Format field by one bit and made sure all the ASTC formats have
that bit set.  Since Gfx12.5 doesn't support ASTC, we can drop that bit
from the field and this will cause GenXML packing functions to assert if
it's ever set.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13206>

2 years agointel/isl: ASTC support was removed on Gfx12.5
Jason Ekstrand [Tue, 5 Oct 2021 21:16:16 +0000 (16:16 -0500)]
intel/isl: ASTC support was removed on Gfx12.5

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13206>

2 years agoanv: Ask ISL about ASTC support
Jason Ekstrand [Tue, 5 Oct 2021 21:19:49 +0000 (16:19 -0500)]
anv: Ask ISL about ASTC support

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13206>

2 years agointel/isl: Stop claiming ASTC works on Cherry View
Jason Ekstrand [Tue, 5 Oct 2021 21:12:41 +0000 (16:12 -0500)]
intel/isl: Stop claiming ASTC works on Cherry View

We do, however, leave a nice tombstone comment in case anyone comes
looking.  Given the age and scarcity of Cherry View hardware and ASTC
apps that run on desktop Linux, it's unlikely we'll ever bother to
implement it.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13206>

2 years agointel/isl: Simplify isl_format_supports_filtering
Jason Ekstrand [Tue, 5 Oct 2021 21:09:21 +0000 (16:09 -0500)]
intel/isl: Simplify isl_format_supports_filtering

For compressed formats, filtering and sampling has always gone together.
This lets us avoid duplicating all those nasty special cases between the
two functions.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13206>

2 years agobuild: unify vulkan cpp platform args
Mike Blumenkrantz [Fri, 1 Oct 2021 13:43:00 +0000 (09:43 -0400)]
build: unify vulkan cpp platform args

these were duplicated all over the place, and it's annoying to have to keep
duplicating them any time a new component includes the vulkan header

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13141>

2 years agolavapipe: remove display extension support
Mike Blumenkrantz [Tue, 5 Oct 2021 16:35:42 +0000 (12:35 -0400)]
lavapipe: remove display extension support

lavapipe doesn't actually support these

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13141>

2 years agolavapipe: enable KHR_external_memory_fd
Thomas Wagner [Wed, 11 Aug 2021 08:49:34 +0000 (10:49 +0200)]
lavapipe: enable KHR_external_memory_fd

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12345>

2 years agollvmpipe: enable EXT_memory_object(_fd)
Thomas Wagner [Wed, 11 Aug 2021 08:49:08 +0000 (10:49 +0200)]
llvmpipe: enable EXT_memory_object(_fd)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12345>

2 years agolavapipe: add support for KHR_external_memory_fd
Thomas Wagner [Wed, 11 Aug 2021 08:40:45 +0000 (10:40 +0200)]
lavapipe: add support for KHR_external_memory_fd

Support creating exportable memory. Use memfd file
descriptors and import/export them as opaque fd handles.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12345>

2 years agollvmpipe: add support for EXT_memory_object(_fd)
Thomas Wagner [Wed, 11 Aug 2021 08:31:41 +0000 (10:31 +0200)]
llvmpipe: add support for EXT_memory_object(_fd)

Enable the import of memory via opaque fd handles, which
are based upon memory-fds. The extension is necessary for sharing
images and buffers from Vulkan.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12345>

2 years agogallium: add utility and interface for memory fd allocations
Thomas Wagner [Wed, 11 Aug 2021 08:17:46 +0000 (10:17 +0200)]
gallium: add utility and interface for memory fd allocations

Add utility functions to allocate aligned memory backed by
mem_fd objects. Add interface to Gallium for same allocation.
It will be used in later commits for external memory support
in Vulkan/OpenGL.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Heinrich Fink <hfink@snap.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12345>

2 years agoir3: Use source in ir3_output_conv_src_type()
Connor Abbott [Wed, 6 Oct 2021 10:55:23 +0000 (12:55 +0200)]
ir3: Use source in ir3_output_conv_src_type()

This was incorrectly converted when splitting the regs array. Noticed by
inspection.

Fixes: d3e08327cf8 ("ir3/core: Switch to srcs/dsts arrays")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13220>

2 years agomeson_options: Bump max value of platform-sdk-version to 31
Roman Stratiienko [Wed, 6 Oct 2021 07:14:33 +0000 (10:14 +0300)]
meson_options: Bump max value of platform-sdk-version to 31

During building Android-12, the following error appears:
meson.build:21:0: ERROR: New value 31 is more than maximum value 30.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Acked-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13216>

2 years agoturnip: fix vbs emission when there are holes in bindings
Danylo Piliaiev [Tue, 5 Oct 2021 11:25:52 +0000 (14:25 +0300)]
turnip: fix vbs emission when there are holes in bindings

Otherwise we read garbage for bindings with value above
vertexBindingDescriptionCount.

Fixes vkd3d test "test_append_aligned_element"

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13195>

2 years agov3dv: use NULL for vk_error on initialization failures
Alejandro Piñeiro [Wed, 6 Oct 2021 09:28:15 +0000 (11:28 +0200)]
v3dv: use NULL for vk_error on initialization failures

This commit fixes two issues:

  * On CreateInstance, we are freeing the instance, and then trying to
    use it when calling vk_error. This could be problematic, so let's
    just use NULL.

  * On CreateDevice, we are getting a unsupported feature error, and
    then trying to call vk_error using the instance. That's is not
    really a instance error, and will assert when the ongoing common
    vk_error lands mesa. Let's use NULL instead, as the object it
    applies, the device, was not created.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13219>

2 years agodevice_select: close dri3 fd after using it.
Dave Airlie [Wed, 6 Oct 2021 07:13:46 +0000 (17:13 +1000)]
device_select: close dri3 fd after using it.

This can leak and causes crashes in some CTS test groups
dEQP-VK.wsi.xcb.incremental_present*

Fixes: 9bc5b2d169d3 ("vulkan: add initial device selection layer. (v6.1)")
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13215>

2 years agolvp/fence: quick fix to previous commit.
Dave Airlie [Wed, 6 Oct 2021 05:26:19 +0000 (15:26 +1000)]
lvp/fence: quick fix to previous commit.

This fixes last of xcb cts issues.

Fixes: 8a294b6f975e1 ("lavapipe: Fix vkWaitForFences for initially-signalled fences")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13212>

2 years agolavapipe: Fix vkWaitForFences for initially-signalled fences
Pavel Asyutchenko [Thu, 30 Sep 2021 19:34:40 +0000 (22:34 +0300)]
lavapipe: Fix vkWaitForFences for initially-signalled fences

Fences with VK_FENCE_CREATE_SIGNALED_BIT are created with
signalled=true and timeline=0, waiting on them without
submitting first returned VK_TIMEOUT instead of VK_SUCCESS.

Signed-off-by: Pavel Asyutchenko <sventeam@yandex.ru>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13128>

2 years agolavapipe: EXT_4444_formats support
Mike Blumenkrantz [Wed, 21 Jul 2021 15:02:17 +0000 (11:02 -0400)]
lavapipe: EXT_4444_formats support

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12001>

2 years agollvmpipe: fix 4-bit output scaling.
Dave Airlie [Mon, 20 Jul 2020 05:41:27 +0000 (15:41 +1000)]
llvmpipe: fix 4-bit output scaling.

This is overkill, but hey 4-bits per channel is hardly something to
care about.

(Suggestions welcome for a better version).

Fixes:
dEQP-GLES2.functional.fbo.render.*rgba4*

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12001>

2 years agovirgl: Add support for NIR shaders when VIRGL_DEBUG=nir.
Emma Anholt [Thu, 9 Sep 2021 20:13:41 +0000 (13:13 -0700)]
virgl: Add support for NIR shaders when VIRGL_DEBUG=nir.

This will let me incrementally fix nir-to-tgsi against virgl without
having to carry around the whole "remove TGSI from mesa/st" MR.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Force the TXQ LOD argument to be scalar.
Emma Anholt [Mon, 2 Aug 2021 23:17:08 +0000 (16:17 -0700)]
nir_to_tgsi: Force the TXQ LOD argument to be scalar.

Otherwise, older virglrenderer fails all the texturesize tests.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Add a workaround for virgl UBO array dynamic indexing.
Emma Anholt [Wed, 15 Sep 2021 21:49:46 +0000 (14:49 -0700)]
nir_to_tgsi: Add a workaround for virgl UBO array dynamic indexing.

virgl makes one array of UBOs starting from the first non-CB0 UBO used,
and does dynamic indexing off of that.  It requires that the dynamic
indexing be CONST[ADDR[0]+base], rather than having the base be loaded in
addr0.

If we had a nir_intrinsic_base() on load_ubo, this would be easy.  As we
don't, emit a subtract at address deref time.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Sort FS output declarations to avoid virglrenderer bugs.
Emma Anholt [Wed, 4 Aug 2021 23:58:52 +0000 (16:58 -0700)]
nir_to_tgsi: Sort FS output declarations to avoid virglrenderer bugs.

The TGSI debug output is a lot more readable if it's in location order,
anyway.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir-to-tgsi: Avoid emitting TXL just for lod 0 on non-vertex shaders.
Emma Anholt [Thu, 29 Jul 2021 21:59:11 +0000 (14:59 -0700)]
nir-to-tgsi: Avoid emitting TXL just for lod 0 on non-vertex shaders.

Prompted by comparing virgl fails and finding that it has issues with
immediate args to TXL/TXB, at least.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Turn GS PRIMID into an input instead of a sysval.
Emma Anholt [Fri, 10 Sep 2021 18:38:35 +0000 (11:38 -0700)]
nir_to_tgsi: Turn GS PRIMID into an input instead of a sysval.

While TGSI can represent it either way, virgl and r600 at least demand an
input.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Add support for nir_intrinsic_load_barycentric_at_sample.
Emma Anholt [Fri, 10 Sep 2021 23:38:43 +0000 (16:38 -0700)]
nir_to_tgsi: Add support for nir_intrinsic_load_barycentric_at_sample.

It doesn't have to be a constant sample, so we need to store it at load
time and use the load's dest at interpolate_at time.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Add support for load_barycentric_sample.
Emma Anholt [Thu, 29 Jul 2021 19:48:26 +0000 (12:48 -0700)]
nir_to_tgsi: Add support for load_barycentric_sample.

This is used for var->data.sample inputs, which are already declared to be
TGSI_INTERPOLATE_LOC_SAMPLE, so we can just use the interpolated inputs.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Add support for declaring image arrays.
Emma Anholt [Thu, 9 Sep 2021 16:18:03 +0000 (09:18 -0700)]
nir_to_tgsi: Add support for declaring image arrays.

Required for virgl.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agogallium/ureg: Sort the input decls, too.
Emma Anholt [Thu, 9 Sep 2021 19:52:00 +0000 (12:52 -0700)]
gallium/ureg: Sort the input decls, too.

Just like outputs, virglrenderer needs its inputs sorted.  Should be
harmless for other TGSI producers, and makes the declarations more
readable.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Add support for load_output/load_per_vertex_output.
Emma Anholt [Wed, 4 Aug 2021 23:03:25 +0000 (16:03 -0700)]
nir_to_tgsi: Add support for load_output/load_per_vertex_output.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agonir_to_tgsi: Include txf_ms's sample index.
Emma Anholt [Wed, 8 Sep 2021 22:42:04 +0000 (15:42 -0700)]
nir_to_tgsi: Include txf_ms's sample index.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agomesa/st: Don't bump locations of patch vars for !PIPE_CAP_TEXCOORD.
Emma Anholt [Wed, 8 Sep 2021 23:24:02 +0000 (16:24 -0700)]
mesa/st: Don't bump locations of patch vars for !PIPE_CAP_TEXCOORD.

There's no need to reserve the bottom 9 VARYING_SLOT_PATCH*, since
VARYING_SLOT_TEXCOORD won't be mapped there.  This helps us match up with
nir_to_tgsi, which wasn't shifting down by 9 for patch.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>

2 years agolavapipe: inherit from vk_image
Mike Blumenkrantz [Fri, 1 Oct 2021 14:41:57 +0000 (10:41 -0400)]
lavapipe: inherit from vk_image

simple and easy since we don't use much of this anyway

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13146>

2 years agollvmpipe/cs: change submission pattern for threadpool
Dave Airlie [Wed, 6 Oct 2021 00:31:26 +0000 (10:31 +1000)]
llvmpipe/cs: change submission pattern for threadpool

Recent ncnn benchmarks showed a slowdown, and this change seemed
more likely.

The batching into threads for the main workloads is fine, however
the remainder stuff doesn't get spread out and can bottleneck in
one thread.

Switch to a model where the initial work is batched, but the
remainder is iterated over one by one.

Brings ncnn benchmarks back in line with previously.

Fixes: 69109e0b1935 ("llvmpipe/cs: rework thread pool for avoid mtx locking")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13210>

2 years agoanv: enable VK_KHR_maintenance4
Lionel Landwerlin [Wed, 28 Jul 2021 11:57:51 +0000 (14:57 +0300)]
anv: enable VK_KHR_maintenance4

v2 (Jason Ekstrand):
 - Get maxBufferSize from ISL.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agointel/isl: Add a max_buffer_size limit to isl_device
Jason Ekstrand [Tue, 7 Sep 2021 15:28:41 +0000 (10:28 -0500)]
intel/isl: Add a max_buffer_size limit to isl_device

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: implement vkGetDeviceImageSparseMemoryRequirementsKHR
Lionel Landwerlin [Wed, 28 Jul 2021 11:38:18 +0000 (14:38 +0300)]
anv: implement vkGetDeviceImageSparseMemoryRequirementsKHR

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: implement vkGetDeviceImageMemoryRequirementsKHR
Lionel Landwerlin [Wed, 28 Jul 2021 11:36:45 +0000 (14:36 +0300)]
anv: implement vkGetDeviceImageMemoryRequirementsKHR

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: move VkImage object allocation to anv_CreateImage
Lionel Landwerlin [Wed, 28 Jul 2021 10:36:51 +0000 (13:36 +0300)]
anv: move VkImage object allocation to anv_CreateImage

v2 (Jason Ekstrand):
 - Switch the order of arguments to be device, image, other stuff

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: Add an anv_image_get_memory_requirements helper
Jason Ekstrand [Tue, 5 Oct 2021 15:44:42 +0000 (10:44 -0500)]
anv: Add an anv_image_get_memory_requirements helper

This is similar to a patch from Lionel except works in terms of aspects
rather than bindings.  This makes it easy to use from the Android code.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: remove unused function
Lionel Landwerlin [Wed, 28 Jul 2021 10:18:23 +0000 (13:18 +0300)]
anv: remove unused function

Fixes: 49908c602ffd ("anv/android: Rework our handling of AHardwareBuffer imports")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: implement vkGetDeviceBufferMemoryRequirementsKHR
Lionel Landwerlin [Wed, 28 Jul 2021 09:29:35 +0000 (12:29 +0300)]
anv: implement vkGetDeviceBufferMemoryRequirementsKHR

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agoanv: move GetBufferMemoryRequirement with other buffer functions
Lionel Landwerlin [Wed, 28 Jul 2021 09:20:02 +0000 (12:20 +0300)]
anv: move GetBufferMemoryRequirement with other buffer functions

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agovulkan: Update the XML and headers to 1.2.195
Jason Ekstrand [Tue, 5 Oct 2021 14:15:27 +0000 (09:15 -0500)]
vulkan: Update the XML and headers to 1.2.195

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13199>

2 years agonir/algebraic: Small optimizations for SpvOpFOrdNotEqual and SpvOpFUnordEqual
Ian Romanick [Fri, 12 Mar 2021 00:20:06 +0000 (16:20 -0800)]
nir/algebraic: Small optimizations for SpvOpFOrdNotEqual and SpvOpFUnordEqual

No shader-db changes on any Intel platform.

Fossil-db results:

All Intel platforms had similar results. (Ice Lake shown)
Instructions in all programs: 144380118 -> 143692823 (-0.5%)
SENDs in all programs: 6920822 -> 6920822 (+0.0%)
Loops in all programs: 38299 -> 38299 (+0.0%)
Cycles in all programs: 8434782176 -> 8423078994 (-0.1%)
Spills in all programs: 206830 -> 204469 (-1.1%)
Fills in all programs: 318737 -> 313660 (-1.6%)

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12320>

2 years agospirv: Generate shorter code for SpvOpFUnord comparisons
Ian Romanick [Thu, 11 Mar 2021 17:46:07 +0000 (09:46 -0800)]
spirv: Generate shorter code for SpvOpFUnord comparisons

No shader-db or fossil-db changes on any Intel platform.

v2: Keep the flt <-> fge switcharoo local to the SpvOpFUnordLessThan,
etc. handling.  Add a comment explaining why the suboptimal
SpvOpFUnordEqual implementation is used here.  Suggested by Caio.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12320>

2 years agospirv: SpvOpFUnordNotEqual doesn't need special treatment
Ian Romanick [Fri, 12 Mar 2021 00:31:39 +0000 (16:31 -0800)]
spirv: SpvOpFUnordNotEqual doesn't need special treatment

The NIR fneu opcode already matches the "unordered not equal" semantics
of the SPIR-V opcode.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12320>

2 years agospirv: Minor cleanup in SpvOpFOrdNotEqual
Ian Romanick [Fri, 12 Mar 2021 00:20:47 +0000 (16:20 -0800)]
spirv: Minor cleanup in SpvOpFOrdNotEqual

v2: Add a comment explaining why the suboptimal SpvOpFOrdNotEqual
implementation is still used here.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12320>

2 years agospirv: Silence unused parameter warnings in vtn_alu.c
Ian Romanick [Fri, 12 Mar 2021 00:40:52 +0000 (16:40 -0800)]
spirv: Silence unused parameter warnings in vtn_alu.c

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12320>

2 years agoci: updates
Mike Blumenkrantz [Tue, 14 Sep 2021 02:53:30 +0000 (22:53 -0400)]
ci: updates

fails are from #4571

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12831>

2 years agozink: support 16bit rgbx formats
Mike Blumenkrantz [Fri, 2 Apr 2021 15:59:52 +0000 (11:59 -0400)]
zink: support 16bit rgbx formats

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12831>

2 years agopan/bi: Optimize abs(derivative)
Alyssa Rosenzweig [Sat, 2 Oct 2021 13:02:36 +0000 (09:02 -0400)]
pan/bi: Optimize abs(derivative)

We implement fine derivatives as:

broadcast(x, (lane & ~1) + 1) - broadcast(x, lane & ~1)

Most of the complexity is to get the right sign. If we can ignore the
sign, we can generate the simpler code:

broadcast(x, lane ^ 1) - lane

This is a particular win on v7+ where the broadcast instruction (CLPER)
can do `lane ^ value` for free. However, even on v6 where we lower to an
explicit XOR instruction, it's still a win.

The limiting case is fwidth. The fragment shader

   gl_FragColor = fwidth(vec4_varying);

has the following results on v6, v7, and v9:

G72 (-26% instructions, -43% cycles):
38 inst, 30 tuples, 5 clauses, 1.166667 cycles, 1.166667 arith, 28 quadwords
28 inst, 19 tuples, 4 clauses, 0.666667 cycles, 0.666667 arith, 19 quadwords

G76 (-37% instructions, -54% cycles):
38 inst, 30 tuples, 5 clauses, 1.166667 cycles, 1.166667 arith, 28 quadwords
24 inst, 16 tuples, 4 clauses, 0.541667 cycles, 0.541667 arith, 18 quadwords

G78 (-40% instructions, -56% cycles):
40 inst, 1.125000 cycles, 0.250000 fma, 0.109375 cvt, 1.125000 sfu, 20 quadwords
24 inst, 0.500000 cycles, 0.250000 fma, 0.015625 cvt, 0.500000 sfu, 12 quadwords

shader-db tells a similar story -- most shaders are unaffected, but a
shader that uses fwidth has a 20% reduction in cycle count:

instructions helped:   shaders/tesseract/488.shader_test MESA_SHADER_FRAGMENT: 264 -> 262 (-0.76%)
instructions helped:   shaders/chromeos/109-1.shader_test MESA_SHADER_FRAGMENT: 36 -> 28 (-22.22%)
tuples helped:   shaders/chromeos/109-1.shader_test MESA_SHADER_FRAGMENT: 27 -> 22 (-18.52%)
tuples HURT:   shaders/tesseract/488.shader_test MESA_SHADER_FRAGMENT: 211 -> 212 (0.47%)
clauses HURT:   shaders/tesseract/488.shader_test MESA_SHADER_FRAGMENT: 32 -> 33 (3.12%)
cycles helped:   shaders/chromeos/109-1.shader_test MESA_SHADER_FRAGMENT: 1 -> 0.79 (-20.83%)
arith helped:   shaders/chromeos/109-1.shader_test MESA_SHADER_FRAGMENT: 1 -> 0.79 (-20.83%)
quadwords helped:   shaders/chromeos/109-1.shader_test MESA_SHADER_FRAGMENT: 31 -> 28 (-9.68%)
quadwords HURT:   shaders/tesseract/488.shader_test MESA_SHADER_FRAGMENT: 176 -> 178 (1.14%)

total instructions in shared programs: 148370 -> 148360 (<.01%)
instructions in affected programs: 300 -> 290 (-3.33%)
helped: 2
HURT: 0

total tuples in shared programs: 124188 -> 124184 (<.01%)
tuples in affected programs: 238 -> 234 (-1.68%)
helped: 1
HURT: 1
helped stats (abs) min: 5.0 max: 5.0 x̄: 5.00 x̃: 5
helped stats (rel) min: 18.52% max: 18.52% x̄: 18.52% x̃: 18.52%
HURT stats (abs)   min: 1.0 max: 1.0 x̄: 1.00 x̃: 1
HURT stats (rel)   min: 0.47% max: 0.47% x̄: 0.47% x̃: 0.47%

total clauses in shared programs: 25692 -> 25693 (<.01%)
clauses in affected programs: 32 -> 33 (3.12%)
helped: 0
HURT: 1

total cycles in shared programs: 12132.04 -> 12131.83 (<.01%)
cycles in affected programs: 1 -> 0.79 (-20.83%)
helped: 1
HURT: 0

total arith in shared programs: 4623.75 -> 4623.54 (<.01%)
arith in affected programs: 1 -> 0.79 (-20.83%)
helped: 1
HURT: 0

total quadwords in shared programs: 110386 -> 110385 (<.01%)
quadwords in affected programs: 207 -> 206 (-0.48%)
helped: 1
HURT: 1
helped stats (abs) min: 3.0 max: 3.0 x̄: 3.00 x̃: 3
helped stats (rel) min: 9.68% max: 9.68% x̄: 9.68% x̃: 9.68%
HURT stats (abs)   min: 2.0 max: 2.0 x̄: 2.00 x̃: 2
HURT stats (rel)   min: 1.14% max: 1.14% x̄: 1.14% x̃: 1.14%

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12332>

2 years agonir: Add Mali-specific derivative opcodes
Alyssa Rosenzweig [Sat, 2 Oct 2021 13:02:19 +0000 (09:02 -0400)]
nir: Add Mali-specific derivative opcodes

Add derivative opcodes fddx_must_abs_mali/fddy_must_abs_mali satisfying:

   fabs(fdd*_must_abs_mali(v)) = fabs(fdd*(v))

The sign of their result is undefined.

On Bifrost and Valhall, these unsigned derivatives can be implemented
more efficiently than the correctly-signed counterparts, since the sign
fixup requires extra ALU instructions. On backends where this is the
case, it is useful to optimize fabs(fdd*(v)) to
fabs(fdd*_must_abs_mali(v)). This pattern comes up with the GLSL builtin
`fwidth`.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12332>

2 years agoac/surface: Use 64 && 128 for GFX10_3 on non-modifier path
Joshua Ashton [Thu, 30 Sep 2021 15:03:51 +0000 (16:03 +0100)]
ac/surface: Use 64 && 128 for GFX10_3 on non-modifier path

DCC_IND_BLK is not hooked up for this to work in the kernel in any released version, and it's unsafe to do so even if it was because it doesn't check the modifiers.

There's no reason to change the legacy non-modifier path to be more performant at the expense of breaking backwards compatibility with older versions of Mesa.

Fixes: 0f6251b3 ("ac/surface: use DCC compatible with image stores for < 4K resolutions")
Closes: #5422

Signed-off-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13122>

2 years agomesa: use simple_mtx_t for ShaderIncludeMutex
Marek Olšák [Fri, 1 Oct 2021 19:59:00 +0000 (15:59 -0400)]
mesa: use simple_mtx_t for ShaderIncludeMutex

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agomesa: use simple_mtx_t for TexMutex
Marek Olšák [Fri, 1 Oct 2021 19:46:48 +0000 (15:46 -0400)]
mesa: use simple_mtx_t for TexMutex

change mtx_recursive -> mtx_plain, there's no recursive locking

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agogallium/pb_slab: use simple_mtx_t
Marek Olšák [Fri, 1 Oct 2021 19:44:43 +0000 (15:44 -0400)]
gallium/pb_slab: use simple_mtx_t

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agogallium/pb_cache: use simple_mtx_t
Marek Olšák [Fri, 1 Oct 2021 19:44:30 +0000 (15:44 -0400)]
gallium/pb_cache: use simple_mtx_t

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agoutil/queue: use simple_mtx_t for finish_lock
Marek Olšák [Fri, 1 Oct 2021 19:40:48 +0000 (15:40 -0400)]
util/queue: use simple_mtx_t for finish_lock

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agoutil/slab: use simple_mtx_t
Marek Olšák [Fri, 1 Oct 2021 19:40:40 +0000 (15:40 -0400)]
util/slab: use simple_mtx_t

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agomesa: add missing unlock_texture into generate_texture_mipmap
Marek Olšák [Tue, 5 Oct 2021 22:06:08 +0000 (18:06 -0400)]
mesa: add missing unlock_texture into generate_texture_mipmap

Fixes: 5a39938b0004de36ac55 "mesa: Throw an error for compressed glGenerateMipmap on GLES2 contexts."

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>

2 years agonir_to_dxil: Add tagging raw SRVs in shader flags
Enrico Galli [Fri, 1 Oct 2021 22:16:22 +0000 (15:16 -0700)]
nir_to_dxil: Add tagging raw SRVs in shader flags

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13157>

2 years agogallivm/format: clamp SINT conversion rather than truncate.
Dave Airlie [Tue, 5 Oct 2021 01:33:49 +0000 (11:33 +1000)]
gallivm/format: clamp SINT conversion rather than truncate.

KHR-GL32.packed_pixels.pbo_rectangle.r16i on zink on lavapipe
ends up using a pbo that does an SINT image write. This was producing
truncated rather than clamped values.

Fix the calculations for 8/16-bit signed ints to clamp not truncate.

Fixes: 13e5f331db77 ("gallivm/nir: fix image store conversions")

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13187>

2 years agoi915g: Check for the scanout-layout conditions before setting level info.
Emma Anholt [Tue, 5 Oct 2021 19:33:15 +0000 (12:33 -0700)]
i915g: Check for the scanout-layout conditions before setting level info.

Fixes leaks (release) or assertion failures (debug) on allocating small
scanout resources, when falling through to the non-scanout-specific layout
code, which became more common as of ad50b47a14e9 ("gbm: assume
USE_SCANOUT in create_with_modifiers").

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13202>

2 years agopanfrost: Fix PAN_MESA_DEBUG=sync with INTEL_blackhole_render
Alyssa Rosenzweig [Mon, 27 Sep 2021 23:47:22 +0000 (19:47 -0400)]
panfrost: Fix PAN_MESA_DEBUG=sync with INTEL_blackhole_render

We need to ignore the "sync" in this case, or we'll crash with
"incomplete job" since we never submitted the work. Fixes the Piglit
intel_blackhole-draw_gles2 when run in CI.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>

2 years agopanfrost: Don't set CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER
Alyssa Rosenzweig [Mon, 27 Sep 2021 21:32:57 +0000 (17:32 -0400)]
panfrost: Don't set CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER

We already set HALF_INTEGER, which is what the compiler actually does.
If we also set PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER, we get
incorrect lowering. Only set the CAP we respect.

On Bifrost, this convention is arbitrary. We should consider moving the
Bifrost lowering into NIR to optimize this better...

Fixes Piglit glsl-arb-fragment-coord-conventions.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>

2 years agopanfrost: Introduce PAN_MAX_VARYINGS define
Alyssa Rosenzweig [Mon, 27 Sep 2021 20:53:30 +0000 (16:53 -0400)]
panfrost: Introduce PAN_MAX_VARYINGS define

The number of varying records we need to reserve in the worst case is
greater than the number of source-level varyings we advertise
(gl_Position, gl_PointSize...)

We advertise MAX_VARYINGS source level varyings, which means anywhere we
manipulate varyings we need up to (MAX_VARYINGS + max non-source level
varyings) records. Add a PAN_MAX_VARYINGS define for this and use it
throughout.

Fixes a buffer overflow in Piglit glsl-max-varyings, which now passes
instead of crashes.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>

2 years agopanfrost: Fix off-by-one in varying count assert
Alyssa Rosenzweig [Mon, 27 Sep 2021 20:51:32 +0000 (16:51 -0400)]
panfrost: Fix off-by-one in varying count assert

We want to assert that the number of varyings (the count) is at most the
the maximum count. This is <=, not <, with the assertion previously
failing for exactly the maximum.

Fixes: 2c2cf0ecfe6 ("panfrost: Streamline varying linking code")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>

2 years agopanfrost: Move special_varying to compiler definitions
Alyssa Rosenzweig [Mon, 27 Sep 2021 20:48:33 +0000 (16:48 -0400)]
panfrost: Move special_varying to compiler definitions

The number of special varyings on midgard can influence how much space
we need to allocate for varyings in the compiler ABI. Move the enum so
we can get access it.

No functional change. This is cc stable purely so the following patches
can be backported.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13070>

2 years agollvmpipe: fix crash when doing FB fetch + gl_FragDepth write in one shader
Pavel Asyutchenko [Thu, 2 Sep 2021 18:11:04 +0000 (21:11 +0300)]
llvmpipe: fix crash when doing FB fetch + gl_FragDepth write in one shader

Reproducible by piglit test from this MR:
https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/576

Signed-off-by: Pavel Asyutchenko <sventeam@yandex.ru>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12705>

2 years agoturnip: Replace our format table with fd6_format_table.
Emma Anholt [Mon, 27 Sep 2021 20:05:13 +0000 (13:05 -0700)]
turnip: Replace our format table with fd6_format_table.

Now we have a common format table with just a little bit of overriding in
turnip, which I hope we can decrease over time.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agoturnip: Do format lookups from the fd6 format table and cross-check.
Emma Anholt [Mon, 27 Sep 2021 18:33:07 +0000 (11:33 -0700)]
turnip: Do format lookups from the fd6 format table and cross-check.

Intermediate step to make sure things stay the same as I transition us to
sharing the format table.

The YUV special casing is pretty not the prettiest, but I'm hoping to
continue working on planar RGB formats as pipe formats separately.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agoturnip: Switch tu_format internals to using pipe_format more.
Emma Anholt [Mon, 27 Sep 2021 18:56:32 +0000 (11:56 -0700)]
turnip: Switch tu_format internals to using pipe_format more.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agoturnip: Give D32_SFLOAT_S8_UINT a native format.
Emma Anholt [Mon, 27 Sep 2021 18:04:22 +0000 (11:04 -0700)]
turnip: Give D32_SFLOAT_S8_UINT a native format.

We won't actually use the native format here, as when sampling our image
we we just see the format for either the D or S aspect.  This syncs us up
with freedreno's table, though.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Enable UBWC for RGBA5551 (and 1555) textures.
Emma Anholt [Fri, 1 Oct 2021 23:31:50 +0000 (16:31 -0700)]
freedreno/a6xx: Enable UBWC for RGBA5551 (and 1555) textures.

Turnip has it enabled, and it seems to be happy in the CTS.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Add support for A/XRGB1555 formats.
Emma Anholt [Fri, 1 Oct 2021 22:43:49 +0000 (15:43 -0700)]
freedreno/a6xx: Add support for A/XRGB1555 formats.

This switches the format we use by default for GLES's rgb5_a1, and means
that our formats supported more closely matches turnip.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Rewrite the format table format/swap helpers.
Emma Anholt [Fri, 1 Oct 2021 23:46:54 +0000 (16:46 -0700)]
freedreno/a6xx: Rewrite the format table format/swap helpers.

We need to take a tiling mode to in order to support 1555 like turnip
does, and I like this naming better.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Make the format table const.
Emma Anholt [Fri, 1 Oct 2021 23:45:10 +0000 (16:45 -0700)]
freedreno/a6xx: Make the format table const.

This data never changes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Use fd6_pipe2tex() for the 2D src format.
Emma Anholt [Fri, 1 Oct 2021 23:41:39 +0000 (16:41 -0700)]
freedreno/a6xx: Use fd6_pipe2tex() for the 2D src format.

The differences between the two are:

- tex supports more formats (fine, we've already decided on which formats
  we can blit)
- FMT6_10_10_10_2_UNORM instead of FMT6_10_10_10_2_UNORM_DEST.
- FMT6_A8_UNORM for PIPE_FORMAT_A8_UNORM.

For 1555 support we get another difference between tex and color, and we
need 2/3 of the tex differences for blit srcs, so switch it over.  This
also matches what turnip does (except it doesn't have A8 as a format).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Put R8_G8_B8_420_UNORM in the format table.
Emma Anholt [Fri, 1 Oct 2021 21:19:28 +0000 (14:19 -0700)]
freedreno/a6xx: Put R8_G8_B8_420_UNORM in the format table.

turnip will use this format, even if we don't have the freedreno side
rigged up yet.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agoutil/format: Add an RGB planar format for YV12, like we have for NV12.
Emma Anholt [Fri, 1 Oct 2021 21:14:00 +0000 (14:14 -0700)]
util/format: Add an RGB planar format for YV12, like we have for NV12.

Turnip will use this for mapping the to the corresponding hardware format,
and we could also extend mesa/st to avoid adding extra samplers for
external image sampling of YV12 on freedreno.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx+: Add support for the R8G8_R8B8 and G8R8_B8R8 formats.
Emma Anholt [Thu, 30 Sep 2021 18:03:49 +0000 (11:03 -0700)]
freedreno/a6xx+: Add support for the R8G8_R8B8 and G8R8_B8R8 formats.

This means that EGLimage imports of YUYV and UYVY can use a single sampler
instead of having to create RGBA8 and RG8 samplers mapping the same
texture.  The swizzles are the same as turnip uses, and it makes the
piglit tests for these formats happy.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Add some more 16-bit rgb/rgba swaps to our format tables.
Emma Anholt [Fri, 24 Sep 2021 22:20:58 +0000 (15:20 -0700)]
freedreno/a6xx: Add some more 16-bit rgb/rgba swaps to our format tables.

BGR565 is chosen for GL_RGB565 and BGRA4 for GL_RGBA4, so it doesn't
change GLES's behavior.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Drop texturing support from other scaled formats.
Emma Anholt [Fri, 24 Sep 2021 22:32:23 +0000 (15:32 -0700)]
freedreno/a6xx: Drop texturing support from other scaled formats.

GLES doesn't expose these texture formats, and we don't want to start
exposing them when turnip starts using our tables.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Add support for EXT_texture_sRGB_R8/RG8.
Emma Anholt [Fri, 24 Sep 2021 22:05:57 +0000 (15:05 -0700)]
freedreno/a6xx: Add support for EXT_texture_sRGB_R8/RG8.

Noticed to be missing when comparing format tables between turnip and
freedreno.  Passes dEQP-GLES31 fine.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: disable vertex fetch support flag for b8g8r8a8_srgb.
Emma Anholt [Fri, 24 Sep 2021 21:21:07 +0000 (14:21 -0700)]
freedreno/a6xx: disable vertex fetch support flag for b8g8r8a8_srgb.

We don't have an srgb decode flag on vertex fetch, r8g8b8a8_srgb isn't
supported either, and GL doesn't ask for vertex fetch for this anyway.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>

2 years agofreedreno/a6xx: Add int/scaled/snorm vertex formats to match turnip.
Emma Anholt [Fri, 24 Sep 2021 21:18:18 +0000 (14:18 -0700)]
freedreno/a6xx: Add int/scaled/snorm vertex formats to match turnip.

Noticed because the vertex formats didn't match up between the two.  GL
doesn't actually look for these vertex formats, though.

Having these marked as supporting texture or color could theoretically
change things I think.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13046>