Commit Graph

137699 Commits

Author SHA1 Message Date
Bas Nieuwenhuizen 580f1ac473 nir: Extract shader_info->cs.shared_size out of union.
It is valid for all stages, just 0 for most of them. In particular
mesh/task shaders might be using it.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10094>
2021-04-08 14:39:28 +00:00
Chad Versace afd2f489d3 anv: Drop unused anv_image_create_info::stride
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 5e6db19168 anv: Remove vkCreateDmaBufINTEL (v4)
Superceded by VK_EXT_image_drm_format_modifier.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (v4)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace f4c6988184 anv: Enable VK_EXT_image_drm_format_modifier
Also enable the dependency VK_EXT_queue_family_foreign.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 13ee22c662 anv/image: Support VkImageDrmFormatModifierExplicitCreateInfoEXT
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace d526fcba0d anv/image: Add 'offset' param to add_surface()
Will be used by VkImageDrmFormatModifierExplicitCreateInfoEXT.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 13498cdd34 anv: Declare anv_layout_to_* as pure functions
Because I want the compiler to eliminate some function calls in
transition_color_buffer() that produce unused return values. Let's hope
the compiler gets the hint.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 0e3199d912 anv: Implement image acquire/release of modifier images
If VkImageMemoryBarrier acquires ownership of the image on
VK_QUEUE_FAMILY_FOREIGN_EXT or VK_QUEUE_FAMILY_EXTERNAL, and if the
image has a DRM format modifier with an aux surface, then we must ensure
that the image's aux state is consistent with the modifier. In the other
direction, if VkImageMemoryBarrier releases ownership, then we may have
to resolve the image's aux surface.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 7fcec8ea5e anv/image: Fix vkGetImageSubresourceLayout for modifier images
For modifier images, the spec requires that aspect be one of
VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 46f0e5b1e9 anv: Move assert in vkGetImageSubresourceLayout
Assert the value is valid before we use it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 3a62d02c17 anv/image: Fix Vk*ImagePlaneMemory*Info for modifier images
In VkImagePlaneMemoryRequirementsInfo and VkBindImagePlaneMemoryInfo,
the spec requires the aspect to be
VK_IMAGE_ASPECT_MEMORY_PLANE_i_BIT_EXT for modifier images.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace f9fa09ec92 anv/image: Add ANV_IMAGE_MEMORY_BINDING_PRIVATE
Used for storing the aux surface and/or aux state data for some images
that have a DRM format modifier.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace c21dc4101a anv/image: Fix cleanup of failed image creation
In anv_image_create(), the failure path neglected to call
vk_object_base_finish().

CC: mesa-stable@lists.freedesktop.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace 2e4c153c6b anv/image: Refactor check_memory_bindings()
Reduce boilerplate with a helper function, because DRM format modifiers
will soon increase the complexity. In particular, remove the
'prev_range' variable.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:55 +00:00
Chad Versace a7a59d8dd1 anv/image: Check that anv_image is compatible with its modifier
At end of image creation, check for incompatibilities that
vkGetPhysicalDeviceImageFormatProperties2() has difficulty predicting.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:54 +00:00
Chad Versace 96f4568b63 anv/image: In vkCreateDmaBufImageINTEL use modifiers
In vkCreateDmaBufImageINTEL, use VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT.

No intended change in publicly visible behavior.

I really don't want to update this soon-to-be-removed function, but this
change is necessary to avoid upcoming assertion failures. In particular,
we will soon assert that the image has a modifier if and only if it has
modifier tiling.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:54 +00:00
Chad Versace 12e8e20802 anv/image: Fix tiling if VkImageSwapchainCreateInfoKHR
We incorrectly used VK_IMAGE_TILING_OPTIMAL when the original swapchain
image had VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT. When we soon begin
using a different memory layout for modifier images, this mismatch would
have produced undefined behavior.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:54 +00:00
Chad Versace de870cc4b2 anv/image: Simplify assertions in anv_image_from_swapchain()
No intended change in behavior.

Conceptual diff:
  |- assert(swapchain_image->apples == (pCreateInfo->apples + MORE));
  |  local_create_info->apples = pCreateInfo->apples + MORE;
  |+ assert(swapchain_image->apples == local_create_info->apples);

And, where appropriate:
  |- local_create_info->orange = X;
  |+ /* See spec anchor #swapchain-wsi-image-create-info .  */
  |+ assert(local_create_info->orange == X);

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:54 +00:00
Chad Versace 0845cabc72 vulkan: Track dependencies of Python imports
The meson.build was unaware of transitive dependencies introduced by
Python imports.

Android still needs fixing. But I did not update the Android files lest
I break the build.

Ideally, we would fix this by using a Python runner that generates
a depfile, similar to how meson creates depfiles for C files by passing
flags -MD -MQ -MF to gcc. But this patch gets the job done, without
stalling on the ideal general solution, by manually tracking the Python
imports in new 'foo_depend_files' variables.

CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466>
2021-04-08 14:15:54 +00:00
Bas Nieuwenhuizen 84e0f6dbd8 nir: Fix shader calls with nir_opt_dead_write_vars.
Fixes: 5a28893279 ("spirv,nir: Add ray-tracing intrinsics")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10096>
2021-04-08 11:10:52 +00:00
Jose Maria Casanova Crespo 95c4f0f910 v3d: Enables DRM_FORMAT_MOD_BROADCOM_SAND128 support
It enables SAND modifier with columns 128-bytes-wide support for
NV12 format.

When a DRM_FORMAT_MOD_BROADCOM_SAND128 is enabled an imported NV12
texture format has a different layout. Luma and Chroma planes layout
is interleaved for every 128-bytes-wide columns.

Although TFU was supposed to convert a NV12 with SAND_COL128 modifier
from YUV to sRGB color space, it expects a particular swizzle that is not
the one provided by the video decoder available at the Raspberry Pi 4.

This patch follows a similar approach to VC4 YUV blit, using a custom
blit shader that transforms a NV12 texture with SAND_COL128 modifier
with the two interleaved planes to two not-interleaved textures with
UIF format, as it was a regular NV12 format texture.

To reduce the number of texture-fetch operations during the blit, we
are reading and writing the textures in pixel groups of 32-bits. This
implies some swizzling of the pixels to meet the particularities
of the different micro-tile layouts for 8bpp, 16bpp and 32bpp.

With this approach, we are not adding a new format that could be named
"NV12_SAND128". We are just enabling a format modifier.

v2: Rework checks for supported modifiers (Alejandro Piñeiro)
    Destroy custom shaders on context destroy (Alejandro Piñeiro)
    Add more comments (Alejandro Piñeiro)
    SAND128 in query_dmabuf_modifiers should report external_only true.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10051>
2021-04-08 10:40:34 +00:00
Philipp Zabel 2470bcb946 meson: Fix missing xcb-xrandr dependency for Vulkan X11 WSI
Fixes a build failure when building any Vulkan driver for the X11
platform with -Dxlib-lease=disabled. For example:

  /usr/bin/ld: src/vulkan/wsi/libvulkan_wsi.a(wsi_common_x11.c.o): in function `wsi_x11_detect_xwayland':
  src/vulkan/wsi/wsi_common_x11.c:123: undefined reference to `xcb_randr_query_version_unchecked'

Fixes: 1de2fd0cf2 "wsi/x11: Always link against xcb-xrandr"
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9972>
2021-04-08 10:08:40 +00:00
Rhys Perry 961361cdc9 aco: ensure loops nested in a WQM loop are in WQM
Fixes a potential empty exec mask in this situation:
enter_wqm()
loop {
   ... wqm code ...
   enter_exact()
   loop {
      ... no wqm code ...
   }
}

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: f0074a6f05 ("aco: do not flag all blocks WQM to ensure we enter all nested loops in WQM")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4546
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10075>
2021-04-08 09:56:25 +00:00
Rhys Perry 49cb1fac13 draw: fix pstipple, aaline and aapoint without LLVM
Because of nir_to_tgsi, LLVM is not required here.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: d0f8fe5909 ("softpipe: Switch to using NIR as the shader format from mesa/st.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10072>
2021-04-08 09:33:59 +00:00
Lionel Landwerlin 49be175a4b intel/fs: limit OW reads to 8 owords on XeHP+
We can only use 16 OW reads/writes on SLM.

v2: Update comment (Curro)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
BSpec: 47652
Fixes: 369eab9420 ("intel/fs: Emit code for Gen12-HP indirect compute data")
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10082>
2021-04-08 09:25:38 +00:00
Lionel Landwerlin 655251ad30 anv: put correct number of BT prefetch for compute on XeHP+
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10084>
2021-04-08 09:17:35 +00:00
Samuel Pitoiset 9a3d496398 radv: make sure FMASK decompress and FCE are performed on gfx queue
To catch possible transition failures.

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/10056>
2021-04-08 08:21:40 +02:00
Mike Blumenkrantz 6528cd762d zink: support ARB_fragment_shader_interlock
just smashing in some caps and intrinsics

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10013>
2021-04-08 04:13:14 +00:00
Mike Blumenkrantz 7580a69844 zink: hook up EXT_fragment_shader_interlock
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10013>
2021-04-08 04:13:14 +00:00
Mike Blumenkrantz 9114863609 zink: use explicit subpass deps
this lets us avoid the spec-mandated barrier and use flags based on
what we'll actually be doing in the pass

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9986>
2021-04-08 04:02:21 +00:00
Mike Blumenkrantz 6536d5a947 zink: use set_foreach_remove()
this saves potentially thousands of iterations on each batch reset

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10097>
2021-04-08 03:51:49 +00:00
Mike Blumenkrantz c7e4f28a16 zink: simplify clear-apply on fb state change
since surfaces are cached and deduplicated, we no longer have to
do deep comparisons to determine whether two surfaces are equal and can
just compare the pointers

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10087>
2021-04-08 03:44:20 +00:00
Mike Blumenkrantz f19946ca6e zink: stop unmapping resources
it turns out there's not actually a requirement that resources be unmapped,
which means that a ton of overhead can be saved both in the unmap codepath
(the cpu overhead here is pretty insane) and then also when mapping cached
resource memory, as the map can now be added to the cache for immediate reuse

as seen in radeonsi

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9980>
2021-04-08 03:34:49 +00:00
Mike Blumenkrantz eab985d070 zink: fix conditional when assigning tess variable io
this was not copied directly and changed the old conditional, which
was intended to catch only non-patch tess io

fixes tess io with legacy builtins, e.g., spec@!opengl 2.0@vertex-program-two-side back front2 back2

Fixes: 2d98efd323 ("zink: pre-populate locations in variables")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9996>
2021-04-08 03:25:57 +00:00
Mike Blumenkrantz 8ebdb8c687 zink: bypass separate stencil path in resource_reference_rw when not a zs image
no point in trying to get a stencil resource if none exists

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9961>
2021-04-08 03:15:25 +00:00
Mike Blumenkrantz 40e8328ce5 zink: remove atomic usage from batch tracking comparisons
race conditions here have no impact because it cannot change the evaluation
of this condition

also no need to check zs stuff if there's no update happening

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9961>
2021-04-08 03:15:25 +00:00
Mike Blumenkrantz 15f2c1f661 zink: add env var to force uniform inlining
this is great for debugging/testing, but there's no great heuristics
for using it yet

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9888>
2021-04-08 03:00:48 +00:00
Mike Blumenkrantz 7f28775edc zink: implement uniform inlining
this lets us inline away our problems

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9888>
2021-04-08 03:00:48 +00:00
Mike Blumenkrantz b47815c772 zink: add a pipe_screen::finalize_nir hook
moves some of the always-run passes into the base nir

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9888>
2021-04-08 03:00:47 +00:00
Mike Blumenkrantz 193c02e0cf aux/trace: add GALLIUM_TRACE_TRIGGER mode
similar to amd/radv driver debug modes for sqtt, this specifies a filename
which is checked on every flush(PIPE_FLUSH_END_OF_FRAME); when it exists,
the next frame (and only that frame) is captured into the trace

to use, specify a file with the env var, run your app, and 'touch /path/to/file'
when you want to capture a trace

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10058>
2021-04-08 00:01:31 +00:00
Enrico Galli ad88e2f959 microsoft/spirv_to_dxil: Use non-zero exit code on failed compilations
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10064>
2021-04-07 23:50:39 +00:00
Enrico Galli 5756f2cd2c microsoft/spirv_to_dxil: Add support for load_vulkan_descriptor
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10064>
2021-04-07 23:50:39 +00:00
Mike Blumenkrantz 31e546a762 util/hash_table: add macro for destructively iterating entries
a common usage for hash tables is for tracking exactly one instance of a pointer
for a given period of time, after which the table's entries are purged and it
is reused

this macro enables the purge phase of such usage to reset the table to a
pristine state, avoiding future rehashing due to ballooning of deleted entries

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8498>
2021-04-07 22:57:27 +00:00
Mike Blumenkrantz 759cc91450 util/set: add macro for destructively iterating set entries
a common usage for sets is for tracking exactly one instance of a pointer
for a given period of time, after which the set's entries are purged and it
is reused

this macro enables the purge phase of such usage to reset the table to a
pristine state, avoiding future rehashing due to ballooning of deleted entries

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8498>
2021-04-07 22:57:27 +00:00
Mike Blumenkrantz 539c7ca508 aux/trace: add a bunch of methods for lavapipe
with all of these, lavapipe can now be traced

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9958>
2021-04-07 22:11:46 +00:00
Mike Blumenkrantz c1270d4845 aux/trace: add screen deduplication for zink+lavapipe tracing
if zink+lavapipe is enabled at compile-time, special handling is needed
to ensure that only the intended screen is traced, otherwise malformed
xml will be generated

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10059>
2021-04-07 21:48:37 +00:00
Dave Airlie f89c8ba410 docs: update lavapipe bits for 1.1
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10086>
2021-04-07 20:30:10 +00:00
Mike Blumenkrantz e1ba6158c0 zink: export PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER
avoids memcpy slowpath

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9733>
2021-04-07 20:19:59 +00:00
Dave Airlie e1eb72ae3c lavapipe: enable Vulkan 1.1 support
This is not fully conformant but the failures are the same as the Vulkan 1.0
failures.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9645>
2021-04-07 19:56:17 +00:00
Dave Airlie 7b79db11c2 lavapipe: enable correct workgroup sizing
If I say layering violation, you say?

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9645>
2021-04-07 19:56:17 +00:00