platform/upstream/mesa.git
2 years agovenus: add atrace support
Chia-I Wu [Thu, 7 Oct 2021 22:12:58 +0000 (15:12 -0700)]
venus: add atrace support

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13255>

2 years agoandroid_stub: update platform headers to include atrace
Yiwei Zhang [Thu, 7 Oct 2021 18:46:49 +0000 (18:46 +0000)]
android_stub: update platform headers to include atrace

1. Add tracing headers
2. Update to reflect relocated headers
3. Remove redundant apex/window.h

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13255>

2 years agoradv/anv android: rename buffer usage camera mask
Yiwei Zhang [Thu, 7 Oct 2021 19:23:31 +0000 (19:23 +0000)]
radv/anv android: rename buffer usage camera mask

AHARDWAREBUFFER_USAGE_CAMERA_MASK enum is defined later and gets
included in the stub headers.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13255>

2 years agonir/lower_discard_or_demote: Fix metadata
Jason Ekstrand [Thu, 7 Oct 2021 21:53:03 +0000 (16:53 -0500)]
nir/lower_discard_or_demote: Fix metadata

Passes generally shouldn't use nir_metadata_all unless they don't change
the program in any significant way.  Some of these passes insert new
instructions so they should definitely not be preserving most of it.

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

2 years agozink: move glx@glx-multi-window-single-context to flakes
Mike Blumenkrantz [Fri, 8 Oct 2021 22:24:59 +0000 (18:24 -0400)]
zink: move glx@glx-multi-window-single-context to flakes

I got too excited when this passed on all the runners I guess

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

2 years agoisl: Use software programmable render compression format encoding
Sagar Ghuge [Thu, 25 Feb 2021 07:24:41 +0000 (23:24 -0800)]
isl: Use software programmable render compression format encoding

Instead of relying on hardcoded (legacy) encoding format, use software
programmable encoding for render compression format.

v2: (Nanley)
- Fix param mismatch
- Set RenderCompressionFormat unconditionally
- Fix commit message

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12686>

2 years agoisl: Add helper to return render compression format encoding
Sagar Ghuge [Thu, 25 Feb 2021 07:23:57 +0000 (23:23 -0800)]
isl: Add helper to return render compression format encoding

v2:
- Fix typo (Marcin)
- Fix comment (Nanley)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12686>

2 years agointel/genxml: Add new bit fields Render Compression Format
Sagar Ghuge [Wed, 17 Jun 2020 18:30:03 +0000 (11:30 -0700)]
intel/genxml: Add new bit fields Render Compression Format

Add RenderCompressionFormat bit field in 3DSTATE_DEPTH/STENCIL_BUFFER
and RENDER_SURFACE_STATE packet to use compression format encoding for
Unified Losless Compression.

v2: (Nanley)
- Drop default value.

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12686>

2 years agomicrosoft/spirv_to_dxil: use dxil_nir_lower_bool_input pass
Michael Tang [Thu, 7 Oct 2021 23:19:55 +0000 (16:19 -0700)]
microsoft/spirv_to_dxil: use dxil_nir_lower_bool_input pass

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13262>

2 years agogallium/d3d12: move d3d12_lower_bool_input to microsoft/compiler
Michael Tang [Thu, 7 Oct 2021 23:19:33 +0000 (16:19 -0700)]
gallium/d3d12: move d3d12_lower_bool_input to microsoft/compiler

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13262>

2 years agointel/isl: FXT1 support was removed on Gfx12.5
Tapani Pälli [Thu, 7 Oct 2021 05:27:09 +0000 (08:27 +0300)]
intel/isl: FXT1 support was removed on Gfx12.5

v2: cleanup (Jordan Justen)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13241>

2 years agotu: Implement VK_KHR_imageless_framebuffer
Connor Abbott [Wed, 6 Oct 2021 14:45:33 +0000 (16:45 +0200)]
tu: Implement VK_KHR_imageless_framebuffer

This is mostly a matter of auditing uses of
cmd->state.framebuffer and replacing every use of fb->attachments with
cmd->state.attachments. We already weren't using the attachments
anywhere outside of the render pass, so this is pretty straightforward.
We also don't have any use for anything in
VkFramebufferAttachmentImageInfo so we can just ignore it.

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

2 years agotu/clear_blit: Constify some image views
Connor Abbott [Wed, 6 Oct 2021 14:42:50 +0000 (16:42 +0200)]
tu/clear_blit: Constify some image views

I wanted cmd->state.attachments to contain const pointers, since we
can't change the image view, but a few places were still not yet
constified.

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

2 years agoradv: Enable NGG culling by default on GFX10.3, add nonggc debug flag.
Timur Kristóf [Tue, 28 Sep 2021 14:21:42 +0000 (16:21 +0200)]
radv: Enable NGG culling by default on GFX10.3, add nonggc debug flag.

This commit enables NGG culling on all GFX10.3 GPUs by default.

A new debug flag environment variable RADV_DEBUG=nonggc is added to
disable this feature on GPUs where it is enabled by default.

The previous perf test flag RADV_PERFTEST=nggc will not be needed on
GFX10.3 anymore but it can still be used to enable the feature on
GPUs where it isn't on by default.

Totals from 58239 (45.27% of 128647) affected shaders:
VGPRs: 1989752 -> 2049408 (+3.00%); split: -3.21%, +6.21%
SpillSGPRs: 675 -> 883 (+30.81%); split: -78.07%, +108.89%
CodeSize: 72205968 -> 153572764 (+112.69%)
LDS: 0 -> 227125248 (+inf%)
MaxWaves: 1614598 -> 1646934 (+2.00%); split: +3.08%, -1.08%
Instrs: 14202239 -> 29654042 (+108.80%)
Latency: 87986508 -> 136960419 (+55.66%); split: -0.23%, +55.89%
InvThroughput: 14444832 -> 21141875 (+46.36%); split: -0.01%, +46.37%
VClause: 340794 -> 493067 (+44.68%); split: -1.33%, +46.01%
SClause: 520983 -> 738636 (+41.78%); split: -0.25%, +42.03%
Copies: 775639 -> 2787382 (+259.37%)
Branches: 296911 -> 1225431 (+312.73%)
PreSGPRs: 1316896 -> 2057270 (+56.22%); split: -0.14%, +56.36%
PreVGPRs: 1473558 -> 1658432 (+12.55%); split: -1.44%, +13.99%

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13086>

2 years agovulkan/device-select: select correct default device for xcb apiVersion 1.0
Yogesh Mohanmarimuthu [Sun, 12 Sep 2021 11:00:43 +0000 (16:30 +0530)]
vulkan/device-select: select correct default device for xcb apiVersion 1.0

In function fill_drm_device_info(), struct ext_pci_properties is filled only
if has_vulkan11 is true. But the data received from ext_pci_properties is used
without checking for has_vulkan11. Fixing this by setting
drm_device->has_bus_info also if has_vulkan11 is true.

This fix will help in case of nonidentical gpu being used and xcb_surface
extension enabled.

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12816>

2 years agoaco: constify radv_shader_{info,args}
Samuel Pitoiset [Tue, 5 Oct 2021 08:32:55 +0000 (10:32 +0200)]
aco: constify radv_shader_{info,args}

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192>

2 years agoradv,aco: remap PS inputs when declaring shader arguments
Samuel Pitoiset [Tue, 5 Oct 2021 07:12:54 +0000 (09:12 +0200)]
radv,aco: remap PS inputs when declaring shader arguments

LLVM seems to require all inputs for PS.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192>

2 years agoaco: prevent using undeclared shader arguments for PS
Samuel Pitoiset [Tue, 5 Oct 2021 08:12:13 +0000 (10:12 +0200)]
aco: prevent using undeclared shader arguments for PS

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192>

2 years agoradv,aco: compute and store the SPI PS input in radv_shader_info
Samuel Pitoiset [Mon, 4 Oct 2021 17:05:38 +0000 (19:05 +0200)]
radv,aco: compute and store the SPI PS input in radv_shader_info

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192>

2 years agoradv: gather more information about PS in the shader info pass
Samuel Pitoiset [Mon, 4 Oct 2021 16:37:15 +0000 (18:37 +0200)]
radv: gather more information about PS in the shader info pass

To compute the PS SPI inputs.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13192>

2 years agoradv: do not overwrite loads_push_constants when declaring shader args
Samuel Pitoiset [Fri, 1 Oct 2021 14:14:52 +0000 (16:14 +0200)]
radv: do not overwrite loads_push_constants when declaring shader args

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13149>

2 years agoradv: remove unnecessary radv_shader_info:num_inline_push_consts
Samuel Pitoiset [Fri, 1 Oct 2021 13:59:05 +0000 (15:59 +0200)]
radv: remove unnecessary radv_shader_info:num_inline_push_consts

This can be determined directly from the user SGPR loc.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13149>

2 years agoradv: remove unnecessary radv_shader_info:base_inline_push_consts
Samuel Pitoiset [Fri, 1 Oct 2021 13:29:19 +0000 (15:29 +0200)]
radv: remove unnecessary radv_shader_info:base_inline_push_consts

No need to duplicate it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13149>

2 years agoradv: determine if a shader loads push constants from the SGPR loc
Samuel Pitoiset [Tue, 28 Sep 2021 12:34:22 +0000 (14:34 +0200)]
radv: determine if a shader loads push constants from the SGPR loc

If the SGPR loc is declared, the shader loads push constants.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13149>

2 years agoradv: determine if a shader uses indirect descriptors from the SGPR loc
Samuel Pitoiset [Tue, 28 Sep 2021 08:44:45 +0000 (10:44 +0200)]
radv: determine if a shader uses indirect descriptors from the SGPR loc

If the SGPR loc is declared, the shader needs indirect descriptor sets.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13149>

2 years agoradv: declare the shader user locs from the shader arguments
Samuel Pitoiset [Fri, 1 Oct 2021 12:24:14 +0000 (14:24 +0200)]
radv: declare the shader user locs from the shader arguments

Seems more robust. Basically, the idea is to declare shader arguments
from the shader info, and then the user locs from the arguments.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13149>

2 years agoradv/llvm: fix parameter index for layer exports
Rhys Perry [Thu, 7 Oct 2021 18:20:55 +0000 (19:20 +0100)]
radv/llvm: fix parameter index for layer exports

Fixes various dEQP-VK.multiview.* tests.

Fixes: 2aa705ec87c ("radv: determine the VS output parameters in the shader info pass")
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13250>

2 years agoac/llvm: fix image_samples with null descriptors
Rhys Perry [Thu, 7 Oct 2021 18:34:41 +0000 (19:34 +0100)]
ac/llvm: fix image_samples with null descriptors

Fixes various dEQP-VK.robustness.robustness2.* tests.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13251>

2 years agospirv: deal with null pointers
Lionel Landwerlin [Thu, 6 May 2021 19:16:21 +0000 (22:16 +0300)]
spirv: deal with null pointers

       %2456 = some complicated struct...
       %8307 = OpTypeInt 32 0
       %8308 = OpTypeInt 8 0
       %8467 = OpTypePointer Generic %8308
       %8500 = OpTypePointer Generic %2456
       %8586 = OpConstantNull %8500
       %8312 = OpConstant %8307 0
       %8314 = OpConstant %8307 2
       %9752 = OpInBoundsPtrAccessChain %8467 %8586 %8312 %8314

Right now the parser can't deal with this %8586. Let's create a value
off the Null constant.

v2: add helpers

v3: Correctly create the Null value

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

2 years agoaco: fix load_barycentric_at_{offset,sample}
Samuel Pitoiset [Thu, 7 Oct 2021 20:56:23 +0000 (22:56 +0200)]
aco: fix load_barycentric_at_{offset,sample}

The linear case was missing.

Cc: 21.2 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13257>

2 years agofreedreno/drm: Move pipe unref after fence removal
Rob Clark [Thu, 7 Oct 2021 23:59:53 +0000 (16:59 -0700)]
freedreno/drm: Move pipe unref after fence removal

Dropping the final pipe ref could in turn drop the final ref to one
of a couple other bo's, which in turn could indirectly recurse back
into cleanup_fences() on the same bo, resulting in a double decrement
of bo->nr_fences and underflow to a large positive #.  This happens
because free'ing a bo back to the bo cache periodically calls
fd_bo_cache_cleanup() and any bo's that have not been re-used can
be really free'd, which in turn calls cleanup_fences().

Fixes: 7dabd624649 ("freedreno/drm: Userspace fences")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13263>

2 years agoradv: do not set TRAP_PRESENT(1) for fragment shaders
Samuel Pitoiset [Thu, 7 Oct 2021 09:09:46 +0000 (11:09 +0200)]
radv: do not set TRAP_PRESENT(1) for fragment shaders

It shouldn't be always set. Found by inspection.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13244>

2 years agozink: ci updates
Mike Blumenkrantz [Fri, 8 Oct 2021 04:01:43 +0000 (00:01 -0400)]
zink: ci updates

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

2 years agozink: rework in-use batch states hash table to be a singly-linked list
Mike Blumenkrantz [Fri, 1 Oct 2021 14:33:56 +0000 (10:33 -0400)]
zink: rework in-use batch states hash table to be a singly-linked list

it was useful to have this be a hash table back before timeline semaphores when
the batch state needed to be looked up every time to determine resource busy state,
but now in the modern world, this is almost never happening, and storing them like
this is actually worse for performance, so flatten it out into a simpler list

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

2 years agozink: stop leaking resource surface cache hash tables
Mike Blumenkrantz [Thu, 7 Oct 2021 15:31:49 +0000 (11:31 -0400)]
zink: stop leaking resource surface cache hash tables

these are owned by the resource, so stick them on a resource context
instead of the screen context

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

2 years agozink: remove reads/writes members from zink_resource_object
Mike Blumenkrantz [Thu, 7 Oct 2021 18:28:18 +0000 (14:28 -0400)]
zink: remove reads/writes members from zink_resource_object

these haven't been used in a while

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

2 years agozink: switch remaining direct access of zink_resource_object::(reads|writes) to util
Mike Blumenkrantz [Thu, 7 Oct 2021 21:50:01 +0000 (17:50 -0400)]
zink: switch remaining direct access of zink_resource_object::(reads|writes) to util

I missed this one

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

2 years agozink: stop leaking buffers on replacement
Mike Blumenkrantz [Thu, 7 Oct 2021 21:45:26 +0000 (17:45 -0400)]
zink: stop leaking buffers on replacement

I tried to be pointlessly clever here to avoid an atomic op, but the move()
here ended up leaking a ref in some cases (descriptor bind + multiple replacements in same cmdbuf)

more importantly, it's a stupid idea now that zink_resource_object structs
are entirely owned by the driver, meaning their refcounts are never
altered in threads, and thus the atomic ops are just regular ops

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

2 years agozink: remove zink_context::curr_batch
Mike Blumenkrantz [Wed, 6 Oct 2021 13:20:41 +0000 (09:20 -0400)]
zink: remove zink_context::curr_batch

this hasn't been a real value in a while and it's confusing to have
it still exist

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

2 years agozink: move semaphore reset handling to submit
Mike Blumenkrantz [Wed, 6 Oct 2021 13:18:56 +0000 (09:18 -0400)]
zink: move semaphore reset handling to submit

this is the earliest place the batch_id is available now, so check it
here since ctx->curr_batch isn't actually a thing anymore

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

2 years agozink: wait in the flush thread when ETOOMANY batches are out
Mike Blumenkrantz [Tue, 5 Oct 2021 19:24:07 +0000 (15:24 -0400)]
zink: wait in the flush thread when ETOOMANY batches are out

when dispatch is fast enough, some tests fire off cmdbufs so quickly that the normal
oom flushing and batch pruning in end_batch isn't sufficient to keep memory
usage down

to combat this, start throwing in stalls after submission to clean out a bunch of cmdbufs
while preventing further ones from being submitted

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

2 years agoradeonsi: remove duplicate partial_count variable
Marek Olšák [Wed, 6 Oct 2021 20:26:40 +0000 (16:26 -0400)]
radeonsi: remove duplicate partial_count variable

"count" is computed identically.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13235>

2 years agoradeonsi: fix a leak in draw_vertex_state if threaded_context is disabled
Marek Olšák [Wed, 6 Oct 2021 20:28:39 +0000 (16:28 -0400)]
radeonsi: fix a leak in draw_vertex_state if threaded_context is disabled

Fixes: fb8f532ea1b - radeonsi: implement draw_vertex_state for lower display list overhead

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13235>

2 years agogallium/u_threaded: fix draw_vertex_state with multi draws
Marek Olšák [Wed, 6 Oct 2021 20:25:39 +0000 (16:25 -0400)]
gallium/u_threaded: fix draw_vertex_state with multi draws

It caused an assertion failure in debug builds and a GPU hang in release
builds.

Fixes: 0842488859e - gallium/u_threaded: implement draw_vertex_state
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5457

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13235>

2 years agozink: split out fb state updating to helper function
Mike Blumenkrantz [Thu, 30 Sep 2021 19:16:40 +0000 (15:16 -0400)]
zink: split out fb state updating to helper function

no functional changes

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

2 years agozink: wait on thread queue before destroying context
Mike Blumenkrantz [Thu, 30 Sep 2021 14:50:14 +0000 (10:50 -0400)]
zink: wait on thread queue before destroying context

ensure there's no submits in progress that would explode if they were deleted

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

2 years agocrocus: Honor scanout requirement from DRI
Dave Airlie [Thu, 7 Oct 2021 22:35:19 +0000 (08:35 +1000)]
crocus: Honor scanout requirement from DRI

Translate PIPE_BIND_SCANOUT as ISL_SURF_USAGE_DISPLAY_BIT,
instead of PIPE_BIND_DISPLAY_TARGET.

PIPE_BIND_DISPLAY_TARGET isn't used for dri images and seem to
be set only for fake winsys buffers (which aren't displayed).
The trouble is that a fake buffer could be multisampled and we
cannot have multisampled surface with display bit.

Ported from iris 82b46667836647226387442b2feb9d7f1475bd36

Fixes: f3630548f1da ("crocus: initial gallium driver for Intel gfx 4-7")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Tested-by: Jason Ekstrand <jason@jlekstrand.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5464
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13260>

2 years agointel/isl: Add mocs settings for DG2
Jordan Justen [Wed, 16 Sep 2020 07:55:17 +0000 (00:55 -0700)]
intel/isl: Add mocs settings for DG2

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12712>

2 years agoutil/vector: make util_vector_init harder to misuse
Chia-I Wu [Tue, 5 Oct 2021 18:58:58 +0000 (11:58 -0700)]
util/vector: make util_vector_init harder to misuse

Make u_vector_init a wrapper to u_vector_init_pot.  Let both take
(element_count, element_size) as parameters.

Motivated by eed0fc4caf2 ("vulkan/wsi/wayland: fix an invalid
u_vector_init call")

v2: rename u_vector_init_pot to u_vector_init_pow2

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13201>

2 years agoRevert "mesa: use simple_mtx_t for TexMutex"
Jason Ekstrand [Thu, 7 Oct 2021 20:01:30 +0000 (15:01 -0500)]
Revert "mesa: use simple_mtx_t for TexMutex"

This reverts the following commit from main:

    commit f6abb3445b7f244c0243f03bd7cf1e7ad1e2f1ab
    Author: Marek Olšák <maraeo@gmail.com>
    Date:   Fri Oct 1 15:46:48 2021 -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>

Contrary to the claim in the commit message, there is recursive locking.
The meta stuff used by i965 does GL operations while the texture is
locked.  If we don't allow recursive locks, it will deadlock.  No, it's
not great, but it's the current state of affairs.  Once we delete i965
in favor of crocus and any other users of meta, we can restore the above
patch.  Until then, we need mtx_recursive.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13254>

2 years agovulkan/device: Use vk_errorf to report missing features
Jason Ekstrand [Thu, 30 Sep 2021 16:41:15 +0000 (11:41 -0500)]
vulkan/device: Use vk_errorf to report missing features

With a tiny bit more code-gen, we can now not only throw the error but
also log back to the client exactly which feature was missing.

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

2 years agovulkan/device: Use vk_error
Jason Ekstrand [Fri, 24 Sep 2021 21:04:51 +0000 (16:04 -0500)]
vulkan/device: Use vk_error

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agovulkan/instance: Use vk_error in vk_instance_init
Jason Ekstrand [Fri, 24 Sep 2021 20:52:04 +0000 (15:52 -0500)]
vulkan/instance: Use vk_error in vk_instance_init

We have to be a bit careful here.  Calling log functions during instance
initialization can be a bit sketchy.  However, we know that __vk_log_impl
only ever touches the callbacks lists if instance->base.client_visible
so it's safe to call vk_error as soon as we've set up instance_callbacks.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agovulkan/log: Drop _impl from the log helper names
Jason Ekstrand [Fri, 24 Sep 2021 20:38:40 +0000 (15:38 -0500)]
vulkan/log: Drop _impl from the log helper names

Now that we no longer have every driver in the tree defining their own
__vk_errorf and __vk_errorv, we don't need to worry about the symbol
collision anymore and can use the "real" names for the common ones.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agoturnip: Plumb non-startup errors through the new vk_error helpers
Jason Ekstrand [Fri, 24 Sep 2021 20:35:20 +0000 (15:35 -0500)]
turnip: Plumb non-startup errors through the new vk_error helpers

Also, change every vk_error to use the closest object instead of
fetching all the way back to the instance.

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

2 years agov3dv: Switch to the new vk_error helpers
Jason Ekstrand [Fri, 24 Sep 2021 20:31:03 +0000 (15:31 -0500)]
v3dv: Switch to the new vk_error helpers

Also, change every vk_error to use the closest object instead of
fetching all the way back to the instance.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agopanvk: Switch to the new vk_error helpers
Jason Ekstrand [Fri, 24 Sep 2021 20:23:14 +0000 (15:23 -0500)]
panvk: Switch to the new vk_error helpers

Also switch all our calls to use the closest object to the error and let
vk_error sort out which object to actually use.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agolavapipe: Switch to the new vk_error helpers
Jason Ekstrand [Fri, 24 Sep 2021 20:20:49 +0000 (15:20 -0500)]
lavapipe: Switch to the new vk_error helpers

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

2 years agoradv: Switch to the new common vk_error helpers
Jason Ekstrand [Fri, 24 Sep 2021 20:19:16 +0000 (15:19 -0500)]
radv: Switch to the new common vk_error helpers

Also, change every vk_error to use the closest object instead of
fetching all the way back to the instance.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agoradv: Stop printing descriptor pool allocation failures
Jason Ekstrand [Wed, 6 Oct 2021 14:18:42 +0000 (09:18 -0500)]
radv: Stop printing descriptor pool allocation failures

The VK_ERROR_FRAGMENTED_POOL and VK_ERROR_OUT_OF_POOL_MEMORY errors are
not as exceptional cases as most.  These are expected to be hit by
applications in the normal course of doing their thing.  Probably best
not to spam stderr and the debug logs with them.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agoanv: Use the common vk_error and vk_errorf helpers
Jason Ekstrand [Fri, 24 Sep 2021 17:06:32 +0000 (12:06 -0500)]
anv: Use the common vk_error and vk_errorf helpers

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

2 years agoanv/queue: Plumb the queue through all the queue_submit calls
Jason Ekstrand [Fri, 24 Sep 2021 16:22:10 +0000 (11:22 -0500)]
anv/queue: Plumb the queue through all the queue_submit calls

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

2 years agoanv: Drop unused logging helpers
Jason Ekstrand [Fri, 24 Sep 2021 20:15:24 +0000 (15:15 -0500)]
anv: Drop unused logging helpers

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

2 years agovulkan/log: Add common vk_error and vk_errorf helpers
Jason Ekstrand [Fri, 24 Sep 2021 18:38:17 +0000 (13:38 -0500)]
vulkan/log: Add common vk_error and vk_errorf helpers

These helpers have quite a bit of smarts in them to log errors to chase
the object chain as needed and log errors to roughly the appropriate
object.  For instance, VK_ERROR_OUT_OF_DEVICE_MEMORY always goes to a
device while VK_ERROR_OUT_OF_HOST_MEMORY always goes to the instance.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agovulkan/log: Handle logging to a physical device
Jason Ekstrand [Fri, 24 Sep 2021 19:53:13 +0000 (14:53 -0500)]
vulkan/log: Handle logging to a physical device

Instance-level objects won't have a device pointer so we can't rely on
that.  Instead, we should look at the object type and try to chase it
back to an instance.  Sadly, we can't do that for certain display and
WSI objects.  However, we never use the vk_log* helpers for those.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agoanv: s/vk_error/anv_error/g
Jason Ekstrand [Fri, 24 Sep 2021 18:44:41 +0000 (13:44 -0500)]
anv: s/vk_error/anv_error/g

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

2 years agoanv: Stop printing descriptor pool allocation failures
Jason Ekstrand [Wed, 6 Oct 2021 14:12:43 +0000 (09:12 -0500)]
anv: Stop printing descriptor pool allocation failures

The VK_ERROR_FRAGMENTED_POOL and VK_ERROR_OUT_OF_POOL_MEMORY errors are
not as exceptional cases as most.  These are expected to be hit by
applications in the normal course of doing their thing.  Probably best
not to spam stderr and the debug logs with them.

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

2 years agoanv: drop a misplaced and wrong comment
Jason Ekstrand [Fri, 24 Sep 2021 18:43:53 +0000 (13:43 -0500)]
anv: drop a misplaced and wrong comment

We do actually use vk_error in the one place we check that limit.

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

2 years agovulkan/log: Log to instance messages during instance construction
Jason Ekstrand [Fri, 24 Sep 2021 19:26:35 +0000 (14:26 -0500)]
vulkan/log: Log to instance messages during instance construction

If the instance isn't client-visible yet (i.e. foo_instance_to_handle
hasn't been called), then the instance is still under construction and
we should log using vk_debug_message_instance.  This makes the vk_log*
macros work regardless of whether the instance is fully constructed or
not.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agovulkan/log: Assert if the driver logs a client-invisible object
Jason Ekstrand [Fri, 24 Sep 2021 19:27:49 +0000 (14:27 -0500)]
vulkan/log: Assert if the driver logs a client-invisible object

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agovulkan: Track which objects are client-visible
Jason Ekstrand [Fri, 24 Sep 2021 15:58:39 +0000 (10:58 -0500)]
vulkan: Track which objects are client-visible

When dealing with debug logging, it's useful to track when an object's
construction is finished and it's now visible to the client.  We can
detect this pretty easily by setting a flag the first time foo_to_handle
is called.  As long as drivers only ever call that function at the end
of object construction (they all do to my knowledge), this should be a
reliable mechanism for detecting when a client knows about a handle.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agovulkan: Drop vk_object_base_reset
Jason Ekstrand [Fri, 24 Sep 2021 19:05:16 +0000 (14:05 -0500)]
vulkan: Drop vk_object_base_reset

It's no longer used and just makes the init/finish path more
complicated.

Tested-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>

2 years agospirv: Declare PointCoord as a sysval
Boris Brezillon [Mon, 27 Sep 2021 13:20:49 +0000 (15:20 +0200)]
spirv: Declare PointCoord as a sysval

Now that all drivers have been patched to convert sysvals to input
varyings when they have too, we can safely declare PointCoord as a sysval
too.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13017>

2 years agospirv: Always declare FragCoord as a sysval
Boris Brezillon [Mon, 27 Sep 2021 13:16:43 +0000 (15:16 +0200)]
spirv: Always declare FragCoord as a sysval

Now that all spirv_to_nir() users take care of converting sysvals to
varyings, we can unconditionally declare FragCoord as a sysval.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13017>

2 years agospirv: Let spirv_to_nir() users turn sysvals into input varyings
Boris Brezillon [Mon, 27 Sep 2021 13:05:44 +0000 (15:05 +0200)]
spirv: Let spirv_to_nir() users turn sysvals into input varyings

This is an attempt at simplifying the spirv_to_nir() backend when it
comes to choosing between system values and input varyings. Let's patch
drivers to do the sysval to input varying conversion on their own so we
can get rid of the frag_coord_is_varying field in spirv_to_nir_options
and unconditionally create create sysvals for FragCoord, FrontFacing and
PointCoord inputs instead of adding new xxx_is_{sysval,varying} flags.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13017>

2 years agonir: Add a nir_sysvals_to_varyings() helper
Boris Brezillon [Mon, 27 Sep 2021 12:20:20 +0000 (14:20 +0200)]
nir: Add a nir_sysvals_to_varyings() helper

Allow backends to turn some sysvals into input varyings so the frontend
(in our case spirv_to_nir()) doesn't have to bother selecting which
one is expected.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.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/13017>

2 years agonir/algebraic: Add some opts for comparisons of comparisons
Jason Ekstrand [Sat, 13 Feb 2021 07:32:40 +0000 (01:32 -0600)]
nir/algebraic: Add some opts for comparisons of comparisons

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

2 years agonir/algebraic: Add some boolean optimizations
Jason Ekstrand [Thu, 29 Oct 2020 03:32:16 +0000 (22:32 -0500)]
nir/algebraic: Add some boolean optimizations

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

2 years agonir/algebraic: Lower fisfinite
Jason Ekstrand [Thu, 24 Sep 2020 18:35:32 +0000 (13:35 -0500)]
nir/algebraic: Lower fisfinite

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

2 years agomesa: signal driver when buffer is bound to different texture format
Gert Wollny [Wed, 6 Oct 2021 16:11:52 +0000 (18:11 +0200)]
mesa: signal driver when buffer is bound to different texture format

Gallium caches sampler states for TBOs. Now if a buffer is first
attached to a TBO specifying one format, and later attached by
specifying another format and this TBO is then used, that would lead
to an assertion failure in debug builds, or to invalid rendering in
release builds, because the TBO picks the original, wrong format for
the sampler view.

Resolve this by signalling the change to Gallium (and other drivers), so
that Gallium clears the sampler view cache.

Fixes: f0ecd36ef8e10c087738c92cf62bad3815366963
  st/mesa: add an entirely separate codepath for setting up buffer views

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13230>

2 years agogallium/u_threaded: Split out options struct
Rob Clark [Tue, 5 Oct 2021 23:24:47 +0000 (16:24 -0700)]
gallium/u_threaded: Split out options struct

Rather than having an ever increasing list of parameters to
threaded_context_create(), split out a struct for optional
flags and parameters.  This should reduce churn in adding
new options.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13207>

2 years agoradv,aco: don't include FMASK in the storage descriptor
Rhys Perry [Wed, 4 Aug 2021 17:19:20 +0000 (18:19 +0100)]
radv,aco: don't include FMASK in the storage descriptor

We perform a FMASK expand when transitioning to GENERAL or TRANSFER_DST
layout, so storage images always have an identity FMASK.

radeonsi doesn't appear to expand the FMASK for read-only storage images,
so the sample index adjustment is still needed there.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agoradv,aco: use lower_to_fragment_fetch
Rhys Perry [Wed, 4 Aug 2021 15:17:56 +0000 (16:17 +0100)]
radv,aco: use lower_to_fragment_fetch

This simplifies ACO and will let us optimize the FMASK fetch (for example,
move it out of loops).

fossil-db (Sienna Cichlid):
Totals from 955 (0.64% of 150170) affected shaders:
CodeSize: 4722016 -> 4722952 (+0.02%); split: -0.02%, +0.04%
Instrs: 875619 -> 875760 (+0.02%); split: -0.02%, +0.04%
Latency: 14069089 -> 14071699 (+0.02%); split: -0.02%, +0.04%
InvThroughput: 2321419 -> 2321218 (-0.01%); split: -0.02%, +0.01%
VClause: 23080 -> 23081 (+0.00%)
SClause: 32426 -> 32019 (-1.26%); split: -1.88%, +0.62%
Copies: 42787 -> 42777 (-0.02%); split: -0.19%, +0.16%
Branches: 17900 -> 17902 (+0.01%); split: -0.04%, +0.06%
PreSGPRs: 43229 -> 41002 (-5.15%); split: -5.16%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agoaco: use correct dim for FMASK fetches
Rhys Perry [Wed, 6 Oct 2021 17:10:25 +0000 (18:10 +0100)]
aco: use correct dim for FMASK fetches

I think it somehow worked fine previously, but this is more correct.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agoac/nir: return 0x76543210 for NULL FMASK fetch
Rhys Perry [Wed, 4 Aug 2021 16:02:14 +0000 (17:02 +0100)]
ac/nir: return 0x76543210 for NULL FMASK fetch

This can replace several v_cndmask_b32 with a single v_cndmask_b32.

fossil-db (Sienna Cichlid):
Totals from 1169 (0.78% of 150170) affected shaders:
SGPRs: 82032 -> 81984 (-0.06%); split: -0.19%, +0.13%
VGPRs: 68368 -> 68280 (-0.13%); split: -0.30%, +0.18%
SpillSGPRs: 8754 -> 8609 (-1.66%); split: -4.06%, +2.40%
CodeSize: 5460132 -> 5446308 (-0.25%); split: -0.42%, +0.17%
MaxWaves: 24456 -> 24462 (+0.02%); split: +0.03%, -0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agoaco: return 0x76543210 for NULL FMASK fetch
Rhys Perry [Wed, 4 Aug 2021 15:13:47 +0000 (16:13 +0100)]
aco: return 0x76543210 for NULL FMASK fetch

This can replace several v_cndmask_b32 with a single v_cndmask_b32, and
will be useful when we lower sample index adjustment in NIR.

fossil-db (Sienna Cichlid):
Totals from 955 (0.64% of 150170) affected shaders:
VGPRs: 53232 -> 53208 (-0.05%)
CodeSize: 4712548 -> 4722016 (+0.20%); split: -0.02%, +0.23%
MaxWaves: 19052 -> 19056 (+0.02%)
Instrs: 875891 -> 875619 (-0.03%); split: -0.04%, +0.00%
Latency: 14070164 -> 14069089 (-0.01%); split: -0.02%, +0.01%
InvThroughput: 2322982 -> 2321419 (-0.07%); split: -0.08%, +0.01%
VClause: 23070 -> 23080 (+0.04%); split: -0.00%, +0.05%
SClause: 32463 -> 32426 (-0.11%); split: -0.12%, +0.01%
Copies: 42840 -> 42787 (-0.12%); split: -0.19%, +0.07%
Branches: 17907 -> 17900 (-0.04%); split: -0.06%, +0.02%
PreSGPRs: 43585 -> 43229 (-0.82%)
PreVGPRs: 47676 -> 47625 (-0.11%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agoradv: don't create blit pipelines for multisampled 3D images
Rhys Perry [Wed, 4 Aug 2021 17:40:48 +0000 (18:40 +0100)]
radv: don't create blit pipelines for multisampled 3D images

These don't create sensible NIR.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agonir/lower_tex: add lower_to_fragment_fetch_amd
Rhys Perry [Wed, 4 Aug 2021 15:17:39 +0000 (16:17 +0100)]
nir/lower_tex: add lower_to_fragment_fetch_amd

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agonir: add _amd suffix to fragment_mask_fetch and fragment_fetch texops
Rhys Perry [Thu, 5 Aug 2021 15:19:51 +0000 (16:19 +0100)]
nir: add _amd suffix to fragment_mask_fetch and fragment_fetch texops

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12214>

2 years agonir/print: pad 64-bit constants with zeroes
Marcin Ślusarz [Wed, 6 Oct 2021 13:40:18 +0000 (15:40 +0200)]
nir/print: pad 64-bit constants with zeroes

... just like other-size constants are.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13223>

2 years agoradeonsi: make the DRI_PRIME dGPU -> iGPU copy async
Pierre-Eric Pelloux-Prayer [Tue, 7 Sep 2021 18:12:30 +0000 (20:12 +0200)]
radeonsi: make the DRI_PRIME dGPU -> iGPU copy async

Doing this copy using SDMA frees up the dGPU to do more
interesting things while the copy is happening; for instance
the rendering of the next frame.

hw queue activity before:
------------------------
dGPU:
  gfx: [renderframe 1][copy->iGPU][renderframe 2][copy->iGPU]...
iGPU:
  gfx:                            [Xorg]                    [Xorg]

hw queue activity before after:
------------------------------
dGPU:
  gfx: [renderframe 1][renderframe 2][renderframe 3]....
 sdma:                [copy->iGPU]  [copy->iGPU]   [copy->iGPU]
iGPU:
  gfx:                           [Xorg]        [Xorg] ...

If SDMA isn't available or can't do the copy, use an async compute
context instead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12763>

2 years agogallium: add a is_dri_blit_image bool to pipe_blit_info
Pierre-Eric Pelloux-Prayer [Thu, 9 Sep 2021 14:57:15 +0000 (16:57 +0200)]
gallium: add a is_dri_blit_image bool to pipe_blit_info

This indicates driver that a given blit is coming from the DRI
frontend.
This information can then be used to pick an appropriate blitting
method.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12763>

2 years agoradeonsi: add an async compute context
Pierre-Eric Pelloux-Prayer [Mon, 27 Sep 2021 09:52:46 +0000 (11:52 +0200)]
radeonsi: add an async compute context

It'll be used exclusively for DRI_PRIME copies for now.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12763>

2 years agoradeonsi: implement si_sdma_copy_image for gfx7+
Pierre-Eric Pelloux-Prayer [Tue, 7 Sep 2021 18:07:19 +0000 (20:07 +0200)]
radeonsi: implement si_sdma_copy_image for gfx7+

SDMA support was dropped in 1f31a216640 mainly because the
advantages of delegating some copy/clear operations to the
SDMA hw came with large drawbacks: CPU overhead due to the
sdma/gfx synchronization and hangs.

This commit restores SDMA support for all gfx7+ chips but
only for the image copy operations.

SDMA operations won't be intertwined with gfx operations
like before. Instead, a SDMA IB will contain a single copy
at a time and the synchronization will be handled by the
winsys (based on the used buffers).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12763>

2 years agoradv: Add VK_FORMAT_R16G16B16A16_UNORM for accel. structures.
Bas Nieuwenhuizen [Tue, 5 Oct 2021 22:31:02 +0000 (00:31 +0200)]
radv: Add VK_FORMAT_R16G16B16A16_UNORM for accel. structures.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13240>

2 years agoir3: support source modes for resinfo.b
Danylo Piliaiev [Wed, 6 Oct 2021 13:44:50 +0000 (16:44 +0300)]
ir3: support source modes for resinfo.b

IBO/SSBO may have dynamic index, previously we just silently ignored
this fact. However resinfo supports different modes.

Fixes vkd3d test "test_null_uav"

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

2 years agoci/freedreno: try to fix the a630 cubearray flake's regex.
Emma Anholt [Thu, 7 Oct 2021 00:00:06 +0000 (17:00 -0700)]
ci/freedreno: try to fix the a630 cubearray flake's regex.

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

2 years agoci/freedreno: Move the other a530 test jobs to test-manual-mr.
Emma Anholt [Wed, 6 Oct 2021 23:55:12 +0000 (16:55 -0700)]
ci/freedreno: Move the other a530 test jobs to test-manual-mr.

I meant to put this in the general a530 properties, not just the a530 deqp.

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

2 years agor300: avoid searching for temp variable twice
Filip Gawin [Wed, 6 Oct 2021 16:16:11 +0000 (18:16 +0200)]
r300: avoid searching for temp variable twice

(when once is enough)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13229>

2 years agofeatures: be explicit about EXT_color_buffer_half_float support
Mike Blumenkrantz [Wed, 6 Oct 2021 01:33:31 +0000 (21:33 -0400)]
features: be explicit about EXT_color_buffer_half_float support

it's annoying not being able to glance at this and see whether my
driver has support, so these are the drivers I know support it

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