platform/upstream/mesa.git
3 years agodocs: add links to documented drivers
Erik Faye-Lund [Tue, 1 Jun 2021 12:51:12 +0000 (14:51 +0200)]
docs: add links to documented drivers

There's a few more drivers that we have docs for that we didn't link to
from the systems article yet. Let's fix that.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: clean up freedreno links
Erik Faye-Lund [Tue, 1 Jun 2021 12:56:17 +0000 (14:56 +0200)]
docs: clean up freedreno links

Instead of linking directly to the Freedreno wiki, let's link to the
driver docs, and then put a link to the Freedreno wiki there.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: split out layered driver to its own list
Erik Faye-Lund [Tue, 1 Jun 2021 12:30:22 +0000 (14:30 +0200)]
docs: split out layered driver to its own list

This mirrors what we're doing for the front-page at mesa3d.org.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: clean up openswr links
Erik Faye-Lund [Tue, 1 Jun 2021 12:22:48 +0000 (14:22 +0200)]
docs: clean up openswr links

Instead of linking directly to openswr.org, let's link to the driver
docs, and have the driver-docs link to the project-webiste.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: clean up software-drivers list
Erik Faye-Lund [Tue, 1 Jun 2021 12:20:54 +0000 (14:20 +0200)]
docs: clean up software-drivers list

This capitalizes driver names, and spells out OpenSWR (like the docs
does).

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: move swrast to deprecated drivers list
Erik Faye-Lund [Tue, 1 Jun 2021 12:18:49 +0000 (14:18 +0200)]
docs: move swrast to deprecated drivers list

This driver was removed in 435de835cd6 ("swrast: Remove the classic
swrast DRI driver"), but we forgot to update the documentation to
reflect that.

Better late than never!

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: clean up list of deprecated systems
Erik Faye-Lund [Tue, 1 Jun 2021 12:01:03 +0000 (14:01 +0200)]
docs: clean up list of deprecated systems

This mostly spells out brand-names, and sorts the list.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: rename vmware-guest article
Erik Faye-Lund [Tue, 1 Jun 2021 11:30:44 +0000 (13:30 +0200)]
docs: rename vmware-guest article

No other drivers use the vendor in the title or path, so it seems better
to not do this for the vmware-guest driver as well. So let's rename it
to SVGA instead. The actual text itself makes it clear enough what it is
about.

This makes it stand out less in the toctree.

I chose the name "WMware SVGA3D", because that's less ambigious than the
"SVGA"-alternative, and was requested by VMware people.t

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: update llvm requirement
Erik Faye-Lund [Tue, 1 Jun 2021 11:23:29 +0000 (13:23 +0200)]
docs: update llvm requirement

Our build-scripts no longer support LLVM versions prior to 3.9, so let's
remove mentions of older versions.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: update list of apis to match website
Erik Faye-Lund [Tue, 1 Jun 2021 10:31:26 +0000 (12:31 +0200)]
docs: update list of apis to match website

This adds a few missing APIs (like Vulkan), and reorders the list to
match the order we're listing them on the frontpage of mesa3d.org.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agodocs: do not list all gles major versions
Erik Faye-Lund [Tue, 1 Jun 2021 10:29:20 +0000 (12:29 +0200)]
docs: do not list all gles major versions

We support all versions of OpenGL ES, no need to point out each version.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11109>

3 years agoloader: allocate VRAM in display GPU in case of prime
Yogesh Mohanmarimuthu [Mon, 3 May 2021 18:22:40 +0000 (23:52 +0530)]
loader: allocate VRAM in display GPU in case of prime

Allocates VRAM in display GPU in case of prime. Then the dma_buf is imported
into prime GPU.

v2: add comments to make code more readable (Pierre-Eric)
    removed if check limiting p2p only for matching driver name
v3: keep old path for non mesa driver (Michel Dänzer)
v4: destroy linear_buffer_display_gpu after import (Michel Dänzer)
    fall back if linear_buffer_display_gpu alloc fail (Michel Dänzer)

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10595>

3 years agoglx: create DRI screen for display GPU incase of prime
Yogesh Mohanmarimuthu [Mon, 3 May 2021 17:52:28 +0000 (23:22 +0530)]
glx: create DRI screen for display GPU incase of prime

The created DRI screen can be used to allocate VRAM memory from
display GPU in case of prime.

v2: add comments to make code readable (Pierre-Eric)
    remove driver name match check
v3: keep old path for non-mesa driver (Michel Dänzer)
v4: fallback if driver not found for display GPU (Michel Dänzer)
    fallback if create screen fail for display gpu (Michel Dänzer)

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10595>

3 years agoglx: Keep display fd open for prime
Yogesh Mohanmarimuthu [Mon, 3 May 2021 17:27:07 +0000 (22:57 +0530)]
glx: Keep display fd open for prime

Keep the display fd open for creating DRI screen on display gpu in
case of prime.

v2: initialize psc->fd_display_gpu early (Michel Dänzer)
    fix display gpu fd leakage (Michel Dänzer)
v3: fix more display gpu fd leakage (Michel Dänzer)

Signed-off-by: Yogesh Mohanmarimuthu <yogesh.mohanmarimuthu@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10595>

3 years agoturnip/kgsl: Fix to build on android.
Hyunjun Ko [Thu, 3 Jun 2021 02:00:59 +0000 (02:00 +0000)]
turnip/kgsl: Fix to build on android.

Fixes: 3f229e34 ("turnip: Implement VK_KHR_timeline_semaphore.")

Signed-off-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11153>

3 years agoradeonsi: fix encryption check for buffers
Pierre-Eric Pelloux-Prayer [Tue, 1 Jun 2021 14:54:29 +0000 (16:54 +0200)]
radeonsi: fix encryption check for buffers

The writable bit means read-write, not just write.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: 8873ea0e253 ("radeonsi: determine secure flag must be set for gfx IB")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11107>

3 years agoradeonsi: allow write-only mapping of encrypted textures
Pierre-Eric Pelloux-Prayer [Tue, 1 Jun 2021 12:03:37 +0000 (14:03 +0200)]
radeonsi: allow write-only mapping of encrypted textures

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

3 years agofrontend/dri: fix bool/int comparison
Pierre-Eric Pelloux-Prayer [Tue, 1 Jun 2021 12:02:46 +0000 (14:02 +0200)]
frontend/dri: fix bool/int comparison

Cast tex->bind & PIPE_BIND_PROTECTED to a bool before doing the
comparison, otherwise it'll incorrectly fail.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Fixes: 18b7cafc700 ("driconf: add disable_protected_content_check option")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11107>

3 years agofrontend/dri: set PIPE_BIND_PROTECTED later
Pierre-Eric Pelloux-Prayer [Tue, 1 Jun 2021 12:00:08 +0000 (14:00 +0200)]
frontend/dri: set PIPE_BIND_PROTECTED later

NV12, YUV, YUYV and UYVY handling checks !tex_usage so set
PIPE_BIND_PROTECTED after.

This fixes encrypted nv12 textures handling.

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

3 years agovenus: use vk_default_allocator
Chia-I Wu [Tue, 1 Jun 2021 16:32:57 +0000 (09:32 -0700)]
venus: use vk_default_allocator

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4870
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

3 years agoanv: use vk_default_allocator
Chia-I Wu [Tue, 1 Jun 2021 16:37:39 +0000 (09:37 -0700)]
anv: use vk_default_allocator

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

3 years agotu: use vk_default_allocator
Chia-I Wu [Tue, 1 Jun 2021 16:36:02 +0000 (09:36 -0700)]
tu: use vk_default_allocator

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

3 years agov3dv: use vk_default_allocator
Chia-I Wu [Tue, 1 Jun 2021 16:35:27 +0000 (09:35 -0700)]
v3dv: use vk_default_allocator

This also fixes the allocator used in v3dv_DestroyDevice.

v2: fix two more occurences of default_alloc (Roman Stratiienko)

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

3 years agoradv: use vk_default_allocator
Chia-I Wu [Tue, 1 Jun 2021 16:34:10 +0000 (09:34 -0700)]
radv: use vk_default_allocator

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

3 years agovulkan/util: add vk_default_allocator
Chia-I Wu [Tue, 1 Jun 2021 16:30:04 +0000 (09:30 -0700)]
vulkan/util: add vk_default_allocator

We cannot use os_{malloc,free,realloc}_aligned because
os_realloc_aligned needs the old size (for memcpy).

v2: no max_align_t on MSVC

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11117>

3 years agovenus: initial AHB support for multi-planar format
Yiwei Zhang [Wed, 2 Jun 2021 22:32:29 +0000 (22:32 +0000)]
venus: initial AHB support for multi-planar format

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

3 years agoac: import performance counters from RadeonSI
Samuel Pitoiset [Mon, 31 May 2021 08:10:42 +0000 (10:10 +0200)]
ac: import performance counters from RadeonSI

Performance counters will be used by RADV for VK_KHR_performance_query
and also for adding SPM support.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11140>

3 years agoradv: enable RADV_DEBUG=invariantgeom for SotTR DX11/DX12 versions
Samuel Pitoiset [Wed, 26 May 2021 14:32:42 +0000 (16:32 +0200)]
radv: enable RADV_DEBUG=invariantgeom for SotTR DX11/DX12 versions

DXVK 1.8.1 marks position as always invariant but it's disabled for
SotTR because it introduces rendering issues on NV. The DX12 version
also likely needs that.

Fixes a similar foliage issue initially found with the native version.

Cc: 21.1 mesa-stable
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/11006>

3 years agointel/vec4: Also use MOV_FOR_SCRATCH for swizzle resolves
Jason Ekstrand [Thu, 3 Jun 2021 04:08:13 +0000 (23:08 -0500)]
intel/vec4: Also use MOV_FOR_SCRATCH for swizzle resolves

In 2db88679432b, we introduced a new meta-op MOV_FOR_SCRATCH which is
identical to MOV except it lets us identify MOVs emitted during spilling
so we know not to re-spill those instructions.  We emit them from
shuffle_for_64bit_data whenever the new for_scratch parameter is true.
Unfortunately, we missed the one used for resolving swizzles.

Fixes: 2db88679432b "intel/vec4: Don't spill fp64 registers more..."
Tested-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11155>

3 years agovenus: enable wsi image ownership transfer for common wsi
Chia-I Wu [Fri, 14 May 2021 19:03:31 +0000 (12:03 -0700)]
venus: enable wsi image ownership transfer for common wsi

v2: this is split out from the last commit

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10709>

3 years agovenus: reland wsi image ownership transfer for Android
Chia-I Wu [Wed, 5 May 2021 22:58:39 +0000 (15:58 -0700)]
venus: reland wsi image ownership transfer for Android

This takes a different approach.  It turns out we can patch
vkCmd{Begin,End}RenderPass, vkCmdWaitEvents, and vkCmdPipelineBarrier to
do queue family ownership transfers without tracking image ownerships.

v2: check the value of VN_PRESENT_SRC_INTERNAL_LAYOUT and keep this
    Android-only

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10709>

3 years agovenus: undo wsi iamge ownership transfer for Android
Chia-I Wu [Thu, 6 May 2021 17:17:30 +0000 (10:17 -0700)]
venus: undo wsi iamge ownership transfer for Android

This reverts most of commit 96ec6b3d8fa828bd4bc58cd2183797953caaa405.
It keeps vn_image::sharing_mode.

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

3 years agovenus: clean up vn_get_intercepted_barriers
Chia-I Wu [Thu, 6 May 2021 16:57:57 +0000 (09:57 -0700)]
venus: clean up vn_get_intercepted_barriers

Add vn_cmd_{wait_events,pipeline_barrier}_fix_image_memory_barries to
replace vn_get_intercepted_barriers.  The two new functions are
identical currently, but that will change soon.

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

3 years agovenus: add vn_cmd_get_image_memory_barriers
Chia-I Wu [Thu, 6 May 2021 16:41:58 +0000 (09:41 -0700)]
venus: add vn_cmd_get_image_memory_barriers

And call it regardless of ANDROID or not.

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

3 years agovenus: add vn_image_memory_barrier_has_present_src
Chia-I Wu [Thu, 6 May 2021 16:41:35 +0000 (09:41 -0700)]
venus: add vn_image_memory_barrier_has_present_src

And call it regardless of ANDROID or not.

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

3 years agovenus: remember cmd buffer fb attachments
Chia-I Wu [Wed, 5 May 2021 23:17:34 +0000 (16:17 -0700)]
venus: remember cmd buffer fb attachments

We need them for wsi queue ownership transfer.

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

3 years agovenus: remember cmd buffer render pass and framebuffer
Chia-I Wu [Wed, 5 May 2021 19:24:21 +0000 (12:24 -0700)]
venus: remember cmd buffer render pass and framebuffer

We need them for wsi queue ownership transfer.

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

3 years agovenus: remember framebuffer attachments
Chia-I Wu [Wed, 5 May 2021 17:42:50 +0000 (10:42 -0700)]
venus: remember framebuffer attachments

We need them for wsi queue ownership transfer.

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

3 years agovenus: remember image view image
Chia-I Wu [Wed, 5 May 2021 17:42:50 +0000 (10:42 -0700)]
venus: remember image view image

We need that for wsi queue ownership transfer.

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

3 years agovenus: remember render pass PRESENT_SRC barriers
Chia-I Wu [Fri, 7 May 2021 18:23:38 +0000 (11:23 -0700)]
venus: remember render pass PRESENT_SRC barriers

We need them for wsi queue ownership transfer.

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

3 years agovenus: remember render pass PRESENT_SRC attachments
Chia-I Wu [Wed, 5 May 2021 17:42:50 +0000 (10:42 -0700)]
venus: remember render pass PRESENT_SRC attachments

We need them for wsi queue ownership transfer.

v2: make VN_PRESENT_SRC_INTERNAL_LAYOUT public

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org> (v1)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10709>

3 years agovenus: handle VN_COMMAND_BUFFER_STATE_INVALID
Chia-I Wu [Mon, 10 May 2021 20:04:15 +0000 (13:04 -0700)]
venus: handle VN_COMMAND_BUFFER_STATE_INVALID

If the state was set to VN_COMMAND_BUFFER_STATE_INVALID, return
VK_ERROR_OUT_OF_HOST_MEMORY in vn_EndCommandBuffer.

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

3 years agovenus: remember image wsi states
Chia-I Wu [Thu, 13 May 2021 22:23:48 +0000 (15:23 -0700)]
venus: remember image wsi states

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

3 years agovenus: move wsi_image_create_info parsing
Chia-I Wu [Wed, 12 May 2021 21:15:33 +0000 (14:15 -0700)]
venus: move wsi_image_create_info parsing

Move it from vn_CreateImage to vn_wsi_create_image.

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

3 years agovenus: fix opaque fd re-import
Chia-I Wu [Thu, 3 Jun 2021 01:56:58 +0000 (18:56 -0700)]
venus: fix opaque fd re-import

dEQP-VK.api.external.memory.opaque_fd.* re-imports and fails because
external_handles was VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT on
allocation and is VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT on
re-import.

Fixes: ccefcb0baf9 ("venus: fix misaligned bo_flags between import and query")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11154>

3 years agovenus: fix asserts on mem bo
Chia-I Wu [Thu, 3 Jun 2021 03:17:22 +0000 (20:17 -0700)]
venus: fix asserts on mem bo

They failed to check the result before asserting.

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

3 years agovenus: add vn_device_memory_alloc as a helper
Chia-I Wu [Thu, 3 Jun 2021 03:16:24 +0000 (20:16 -0700)]
venus: add vn_device_memory_alloc as a helper

It is used for the most common case (non-ahb, non-import, and
non-suballocate).

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

3 years agointel/nir,i965: Move HW generation check for UBO pushing to i965
Jason Ekstrand [Wed, 2 Jun 2021 19:01:24 +0000 (14:01 -0500)]
intel/nir,i965: Move HW generation check for UBO pushing to i965

Iris only runs on BDW+ and ANV already handles this by not even trying
on anything older than HSW.  The only driver benefiting from this common
check is i965.  Moving it out makes the pass more generic and if some
driver comes along which can push UBOs on IVB, it should work for that.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11145>

3 years agoutil/format: Change the pointer offset.
Sergii Melikhov [Thu, 27 May 2021 11:46:04 +0000 (14:46 +0300)]
util/format: Change the pointer offset.

Changed the pointer offset to 2 to account for the second structure variable.

Fixes: 90f98b56f85 ("mesa: Deduplicate _mesa_pack_uint_z_row().")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4685
Signed-off-by: Sergii Melikhov <sergii.v.melikhov@globallogic.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11060>

3 years agovulkan/wsi: provide more info in wsi_image_create_info
Chia-I Wu [Wed, 12 May 2021 20:11:52 +0000 (13:11 -0700)]
vulkan/wsi: provide more info in wsi_image_create_info

Always chain wsi_image_create_info to VkImageCreateInfo, which indicates
that the image is a wsi image and can be transitioned to/from
VK_IMAGE_LAYOUT_PRESENT_SRC_KHR.

Add prime_blit_buffer to the struct as well.  When set, it indicates the
prime blit destination and implies that the image is a prime blit
source.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10789>

3 years agointel/gfx6: move xfb_setup outside the gs compiler into the driver.
Dave Airlie [Mon, 24 May 2021 00:11:25 +0000 (10:11 +1000)]
intel/gfx6: move xfb_setup outside the gs compiler into the driver.

This remove the use of a GL thing from the backend compiler

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11097>

3 years agoaco: don't create 4 and 5 dword NSA instructions on GFX10
Rhys Perry [Wed, 2 Jun 2021 15:30:35 +0000 (16:30 +0100)]
aco: don't create 4 and 5 dword NSA instructions on GFX10

"stability issues", apparently: https://reviews.llvm.org/D103348

fossil-db (Navi10):
Totals from 4512 (3.01% of 149839) affected shaders:
VGPRs: 221516 -> 223308 (+0.81%); split: -0.07%, +0.88%
CodeSize: 23000080 -> 23070672 (+0.31%); split: -0.08%, +0.39%
MaxWaves: 107718 -> 107496 (-0.21%); split: +0.11%, -0.32%
Instrs: 4321890 -> 4362822 (+0.95%); split: -0.00%, +0.95%
Latency: 71495710 -> 71581476 (+0.12%); split: -0.07%, +0.19%
InvThroughput: 11858568 -> 11938960 (+0.68%); split: -0.00%, +0.68%
VClause: 76575 -> 76585 (+0.01%); split: -0.05%, +0.07%
SClause: 168771 -> 168709 (-0.04%); split: -0.06%, +0.02%
Copies: 182305 -> 221948 (+21.75%); split: -0.00%, +21.75%
PreVGPRs: 194657 -> 195635 (+0.50%); split: -0.00%, +0.50%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: c353895c922 ("aco: use non-sequential addressing")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10898>

3 years agoaco/tests: improve reporting of failed code checks
Rhys Perry [Thu, 20 May 2021 09:47:47 +0000 (10:47 +0100)]
aco/tests: improve reporting of failed code checks

Instead of just reporting the failed statements, print where they
originated. This is useful for tests which have a number of similar
checks.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10898>

3 years agoaco/tests: add tests for form_hard_clauses()
Rhys Perry [Thu, 20 May 2021 09:41:37 +0000 (10:41 +0100)]
aco/tests: add tests for form_hard_clauses()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10898>

3 years agoaco: do not clause NSA instructions
Rhys Perry [Wed, 19 May 2021 13:36:43 +0000 (14:36 +0100)]
aco: do not clause NSA instructions

According to LLVM, this has "unpredictable results on GFX10.1".

https://reviews.llvm.org/D102211

fossil-db (Navi10):
Totals from 26690 (17.81% of 149839) affected shaders:
CodeSize: 167935160 -> 167706280 (-0.14%); split: -0.14%, +0.00%
Instrs: 31801427 -> 31744142 (-0.18%); split: -0.18%, +0.00%
Latency: 732672435 -> 732622463 (-0.01%)
InvThroughput: 163361435 -> 163357838 (-0.00%); split: -0.00%, +0.00%
VClause: 546131 -> 546903 (+0.14%); split: -0.00%, +0.14%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Fixes: c353895c922 ("aco: use non-sequential addressing")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10898>

3 years agofreedreno/a6xx: Fix mh31 intermittent faults
Rob Clark [Wed, 2 Jun 2021 16:41:13 +0000 (09:41 -0700)]
freedreno/a6xx: Fix mh31 intermittent faults

It appears that CP can over-fetch push constants slightly.  While it
otherwise has no problem fetching from an alignment of 32 bytes, if that
32 bytes is at the end of a mapped bo, this can trigger fetching up to
32 bytes beyond the patch, triggering an iova fault.  While otherwise
"harmless", it is probably better to not have random intermittent
faults.

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

3 years agodocs/freedreno: Rewrite the section on array access.
Emma Anholt [Wed, 2 Jun 2021 20:12:41 +0000 (13:12 -0700)]
docs/freedreno: Rewrite the section on array access.

We don't use collect/split for array access these days, instead use
ir3_array structs that the ir3_register can point to.

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

3 years agodocs/freedreno: Update for the fanin/fanout -> collect/split rename.
Emma Anholt [Wed, 2 Jun 2021 19:28:05 +0000 (12:28 -0700)]
docs/freedreno: Update for the fanin/fanout -> collect/split rename.

See 611258d5782c ("freedreno/ir3: rename fanin/fanout to collect/split")

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

3 years agoci/freedreno: Add some more known flakes from recent marge runs.
Emma Anholt [Wed, 2 Jun 2021 17:30:54 +0000 (10:30 -0700)]
ci/freedreno: Add some more known flakes from recent marge runs.

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

3 years agodocs: update calendar and link releases notes for 21.1.2
Eric Engestrom [Wed, 2 Jun 2021 20:32:14 +0000 (22:32 +0200)]
docs: update calendar and link releases notes for 21.1.2

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

3 years agodocs: add release notes for 21.1.2
Eric Engestrom [Wed, 2 Jun 2021 19:00:20 +0000 (21:00 +0200)]
docs: add release notes for 21.1.2

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

3 years agointel/fs: Handle non-perspective-correct interpolation on gen4-5
Jason Ekstrand [Fri, 24 Apr 2020 22:45:08 +0000 (17:45 -0500)]
intel/fs: Handle non-perspective-correct interpolation on gen4-5

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

3 years agost/nir: always revectorise if scalarising happens.
Dave Airlie [Tue, 18 May 2021 03:31:14 +0000 (13:31 +1000)]
st/nir: always revectorise if scalarising happens.

This fixes arb_gpu_shader_fp64-vs-non-uniform-control-flow-ssbo
on crocus.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11098>

3 years agozink: Add a missing VKAPI_ATTR.
Georg Lehmann [Tue, 1 Jun 2021 15:45:42 +0000 (17:45 +0200)]
zink: Add a missing VKAPI_ATTR.

Closes #4868

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reported-by: Roman Stratiienko <r.stratiienko@gmail.com>
Tested-by: Roman Stratiienko <r.stratiienko@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11115>

3 years agollvmpipe: add the interesting bit of cpu detection to the cache.
Dave Airlie [Sun, 23 May 2021 19:19:43 +0000 (05:19 +1000)]
llvmpipe: add the interesting bit of cpu detection to the cache.

This should detect if someone changes CPU configuration that matters like in a VM

Reviewed-by: Emma Anholt <emma@anholt.net>
Fixes: 6c0c61cb48e8 ("llvmpipe: add infrastructure for disk cache support")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10946>

3 years agou_format: Use the computed BE channels/swizzles for bitmask formats.
Eric Anholt [Wed, 28 Apr 2021 21:18:09 +0000 (14:18 -0700)]
u_format: Use the computed BE channels/swizzles for bitmask formats.

No more error-prone encoding of swizzles in the .csv for non-planar
formats!

No change to generated u_format_table.c

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Sanity check that BE swizzles are appropriately mapped from LE.
Eric Anholt [Wed, 28 Apr 2021 21:10:08 +0000 (14:10 -0700)]
u_format: Sanity check that BE swizzles are appropriately mapped from LE.

Once you read enough of them, there's an obvious pattern that we can just
write a little code for instead of making every dev write it out each time.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Sanity check the BE channels for all bitmask formats.
Eric Anholt [Tue, 27 Apr 2021 22:17:39 +0000 (15:17 -0700)]
u_format: Sanity check the BE channels for all bitmask formats.

Just check against the CSV (which has its codegen now tested with
u_format_test in CI) for now, so we know that our computed channels are
correct.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Fix the BE channel ordering for R5G5B5A1_UINT.
Eric Anholt [Tue, 27 Apr 2021 23:50:06 +0000 (16:50 -0700)]
u_format: Fix the BE channel ordering for R5G5B5A1_UINT.

It notably didn't fit the pattern of RGB5_A1_UNORM, and violated the
general pattern for bitmask format BE channels (channels are ordered
right-to-left in the BE columns in the CSV due to the parser walking them
in that order for historical reasons).

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Define tests for r3g3b2 formats and fix BE swizzles for them.
Eric Anholt [Tue, 27 Apr 2021 23:48:20 +0000 (16:48 -0700)]
u_format: Define tests for r3g3b2 formats and fix BE swizzles for them.

These tests passed for LE, and the BE channel ordering specified obviously
didn't fit the pattern of the other BE formats (channels are listed
right-to-left in the BE columns for historical reasons).

Note that we can't write pure-integer format tests in u_format_tests.c
currently.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Assert that array formats don't include BE swizzles.
Eric Anholt [Tue, 27 Apr 2021 22:47:31 +0000 (15:47 -0700)]
u_format: Assert that array formats don't include BE swizzles.

Z32_FLOAT_S8X24_UINT and X32_S8X24_UINT are in fact the only non-bitmask
formats that have BE swizzles specified, but sorting out those two is
harder.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Use the nice helper for reversing an array.
Emma Anholt [Tue, 1 Jun 2021 20:37:56 +0000 (13:37 -0700)]
u_format: Use the nice helper for reversing an array.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Move the BE swizzle computation into Format init.
Eric Anholt [Tue, 27 Apr 2021 22:39:16 +0000 (15:39 -0700)]
u_format: Move the BE swizzle computation into Format init.

I wanted to do the next set BE changes here where I have Format's helper
functions available.

No changes in generated u_format_table.c.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Drop redundant .name init.
Eric Anholt [Tue, 27 Apr 2021 22:56:23 +0000 (15:56 -0700)]
u_format: Drop redundant .name init.

It's the first member that's set.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agou_format: Fix some pep8 in u_format_parse.py.
Eric Anholt [Tue, 27 Apr 2021 22:40:21 +0000 (15:40 -0700)]
u_format: Fix some pep8 in u_format_parse.py.

My editor likes to enforce pep8, here's some low hanging fruit so I don't
have to do too much add -p.

Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10505>

3 years agoturnip: fix register_index calculations of xfb outputs
Danylo Piliaiev [Tue, 1 Jun 2021 13:27:27 +0000 (16:27 +0300)]
turnip: fix register_index calculations of xfb outputs

nir_assign_io_var_locations() does not use outputs_written when
assigning driver locations. Use driver_location to avoid incorrectly
guessing what locations it assigned.

Copied from lavapipe 8731a1beb72da8f4165e5596519a56d16299c3f0

Will fix provoking vertex tf tests when VK_EXT_provoking_vertex
would be enabled:
 dEQP-VK.rasterization.provoking_vertex.transform_feedback.*

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11111>

3 years agoturnip: emit vb stride dynamic state when it is dirty
Danylo Piliaiev [Wed, 2 Jun 2021 11:15:46 +0000 (14:15 +0300)]
turnip: emit vb stride dynamic state when it is dirty

Due to incorrect condition we never emitted vb stride
if state was dynamically set.

Fixes vertex explosion with Zink.

See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4738

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11133>

3 years agoiris: Use bo->mmap_mode in transfer map read check
Kenneth Graunke [Thu, 27 May 2021 03:13:26 +0000 (20:13 -0700)]
iris: Use bo->mmap_mode in transfer map read check

The scenario we want to avoid is reading from WC or UC mappings,
so this is an easier to follow check.

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

3 years agoiris: Pick a single mmap mode (WB/WC) at BO allocation time
Kenneth Graunke [Thu, 20 May 2021 09:02:51 +0000 (02:02 -0700)]
iris: Pick a single mmap mode (WB/WC) at BO allocation time

Previously, iris_bufmgr had the ability to maintain multiple
simultaneous memory mappings for a BO, one in WB mode (with CPU caches),
and another in WC (streaming) mode.  Depending on the flags passed to
iris_bo_map(), we would select one mode or the other.

The rules for deciding which to use were:

- Systems with LLC always use WB mode because it's basically free
- Non-LLC systems used...
  - WB maps for all BOs where snooping is enabled (which translates to
    when BO_ALLOC_COHERENT is set at allocation time)
  - WB maps for reads unless persistent, coherent, async, or raw.
  - WC maps for everything else.

This patch simplifies the system by selecting a single mmap mode at
BO allocation time, and always using that.  Each BO now has at most one
map at a time, rather than up to two (or three before we deleted GTT
map support in recent patches).

In practical terms, this eliminates the capability to use WB maps for
reads of non-snooped BOs on non-LLC systems.  Such reads would now be
slow, uncached reads.  However, iris_transfer_map recently began using
staging blits for such reads - so the GPU copies the data to a snooped
buffer which will be mapped WB.  So, rather than incurring slow UC
reads, we really just take the hit of a blit, and retain fast reads.

The rest of the rules remain the same.

There are a few reasons for this:

1. TTM doesn't support mapping an object as both WB and WC.  The
   cacheability is treated as a property of the object, not the map.
   The kernel is moving to use TTM as part of adding discrete local
   memory support.  So it makes sense to centralize on that model.

2. Mapping the same BO as both WB and WC is impossible to support on
   some CPUs.  It works on x86/x86_64, which was fine for integrated
   GPUs, but it may become an issue for discrete graphics paired with
   other CPUs (should that ever be a thing we need to support).

3. It's overall much simpler.  We only have one bo->map field, and
   manage to drop a significant amount of boilerplate.

One issue that arises is the interaction with the BO cache: BOs with
WB maps and WC maps will be lumped together into the same cache.  This
means that a cached BO may have the wrong mmap mode.  We check that,
and if it doesn't match, we unmap it, waiting until iris_bo_map is
called to restore one with the desired mode.  This may underutilize
cache mappings slightly on non-LLC systems, but I don't expect it to
have a large impact.

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

3 years agoiris: Delete GTT mapping support
Kenneth Graunke [Thu, 20 May 2021 09:22:51 +0000 (02:22 -0700)]
iris: Delete GTT mapping support

In the bad old days, i965 used GTT mapping for detiling maps.  iris
never has, however.  The only reason it used GTT maps was in weird
fallback cases for dealing with BO imports from foreign memory.  We
now do staging blits for those, and never mmap them.

There are no more users of GTT mapping, so we can delete it.

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

3 years agoiris: Drop fallback GEM_MMAP_GTT if GEM_MMAP with I915_MMAP_WC fails
Kenneth Graunke [Thu, 20 May 2021 08:41:37 +0000 (01:41 -0700)]
iris: Drop fallback GEM_MMAP_GTT if GEM_MMAP with I915_MMAP_WC fails

XXX: This is actually wrong.  The dmabuf imported case can be mapped via
GEM_MMAP_GTT if the iommu is working, according to Joonas, but GEM_MMAP
would fall over and fail.  So we would need this fallback.
ALTERNATIVELY...we would need to flag such imported dmabufs as
unmappable, and then make iris_transfer_map/unmap always do blits
instead of direct mappings.  That seems like the saner approach

We never want to use GEM_MMAP_GTT, as it does detiling maps, and iris
always wants direct maps.  There were originally two cases that this
fallback path was attempting to handle:

1. The BO was allocated from stolen memory that we can't GEM_MMAP.

   At one point, kernel patches were being proposed to use stolen
   memory for userspace buffers, but these never landed.  The kernel
   has never given us stolen memory, so we cannot hit this case.

2. Imported objects may be from memory we can't GEM_MMAP.

   For example, a DMABUF from a discrete AMD/NVIDIA GPU in a PRIME
   setup would be backed by memory that we can't GEM_MMAP.  We could
   try and mmap these directly with GEM_MMAP_GTT, but that relies on
   the IOMMU working.  We could mmap the DMABUF fd directly (but have
   never tried to do so), but there are complex rules there.  Instead,
   we now flag those imports, however, and rely on the iris_transfer_map
   code to perform staging blits on the GPU, so we never even try to
   map them directly.  So this case won't reach us here any longer.

With both of those out of the way, there is no need for a fallback.

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

3 years agoiris: Assert on mapping a tiled buffer without MAP_RAW
Kenneth Graunke [Thu, 20 May 2021 07:46:30 +0000 (00:46 -0700)]
iris: Assert on mapping a tiled buffer without MAP_RAW

iris has never relied on detiled maps using hardware fences.
This code is a remnant of i965, where that was actually used.

We can just assert that callers don't do such a thing.

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

3 years agoiris: Use staging blits for transfers involving imported BOs
Kenneth Graunke [Thu, 20 May 2021 18:22:22 +0000 (11:22 -0700)]
iris: Use staging blits for transfers involving imported BOs

Direct mappings of imported DMABUFs can be tricky.  If they're allocated
from our own device, then we can probably mmap them and it'd be fine.
But they may come from a different device (such as a discrete GPU), in
which case I915_GEM_MMAP wouldn't work, I915_GEM_MMAP_GTT would require
a working IOMMU, and directly mmap'ing the DMABUF fd would come with a
bunch of rules and restrictions which are hard to get right.

CPU mapping an imported DMABUF image for writes seems very uncommon,
solidly in the "what are you even doing?" realm.  Mapping an imported
DMABUF for reading might be a thing, in case someone wanted to do
glReadPixels on it.  But in that case, the cost of doing a staging
blit is probably acceptable.

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

3 years agoiris: Use staging blits for reads from uncached buffers.
Kenneth Graunke [Thu, 20 May 2021 07:14:53 +0000 (00:14 -0700)]
iris: Use staging blits for reads from uncached buffers.

If we're doing CPU reads of a resource that doesn't have CPU caches
enabled for the mapping (say, in device local memory, or WC mapped),
then blit it to a temporary that does have those caches enabled.

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

3 years agoiris: Track imported vs. exported status separately
Kenneth Graunke [Thu, 20 May 2021 17:55:53 +0000 (10:55 -0700)]
iris: Track imported vs. exported status separately

Not all external objects are the same.  Imported buffers may be from
other devices (say a dmabuf from an AMD or NVIDIA discrete card) which
are backed by memory that we can't use with I915_GEM_MMAP.  However,
exported buffers are ones that we know we allocated ourselves from our
own device.  We may not know what other clients are doing with them,
but we can assume a bit more about where they came from.

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

3 years agoiris: Make an iris_bo_is_external() helper and use it in a few places
Kenneth Graunke [Thu, 20 May 2021 17:53:39 +0000 (10:53 -0700)]
iris: Make an iris_bo_is_external() helper and use it in a few places

I'd like to start tracking "imported" vs. "exported" for objects,
rather than a blanket "external" flag.  Instead of directly checking
bo->external, use a new helper that will eventually be "imported or
exported".

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

3 years agoiris: Delete a comment suggesting we use tiled staging buffers
Kenneth Graunke [Thu, 20 May 2021 18:25:35 +0000 (11:25 -0700)]
iris: Delete a comment suggesting we use tiled staging buffers

We basically tried this, and it performed worse, so delete the
suggestion in the comments that we may want to do it someday.

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

3 years agoiris: Promote to MAP_DIRECTLY when required before NULL return
Kenneth Graunke [Thu, 20 May 2021 18:15:30 +0000 (11:15 -0700)]
iris: Promote to MAP_DIRECTLY when required before NULL return

In some cases, we have to map directly (e.g. coherent/persistent maps).
In other cases (e.g. tiled), we /cannot/ map directly.  We should put
the code which adds the PIPE_MAP_DIRECTLY flag in mandatory cases before
the "bail and return NULL" check for cases where we can't do that.

We leave the "we would prefer to direct map this" cases after the error
check, since we -can- use blits for those, we'd just rather not.  ASTC
also stays because even though it's tiled, our tiled memcpy paths work.

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

3 years agoiris: Replace no_gpu flag with PIPE_MAP_DIRECTLY
Kenneth Graunke [Thu, 13 May 2021 05:19:42 +0000 (22:19 -0700)]
iris: Replace no_gpu flag with PIPE_MAP_DIRECTLY

Here, we're deciding when to map the buffer directly, rather than using
the GPU to blit to/from a temporary.  There is already a flag for that,
PIPE_MAP_DIRECTLY, which has the added benefit of not being a negative
(such as "no_gpu").

Currently, we intend to map directly if:

1. Direct mappings were requested explicitly
2. Persistent or coherent mappings were requested (and so we must)
3. ASTC textures (we currently can't blit those correctly)
4. There is no need for a temporary (there's no image compression that
   the CPU wouldn't understand, and we don't need to avoid stalls due
   to the buffer being busy on the GPU)

Expressing "please memory map this directly" is easier to follow than
"please don't use the GPU as part of mapping this".

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

3 years agozink: ci updates
Mike Blumenkrantz [Wed, 2 Jun 2021 16:39:14 +0000 (12:39 -0400)]
zink: ci updates

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

3 years agozink: handle null bufferview/imageview descriptors when robustness2 is missing
Mike Blumenkrantz [Thu, 25 Mar 2021 19:55:47 +0000 (15:55 -0400)]
zink: handle null bufferview/imageview descriptors when robustness2 is missing

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11122>

3 years agozink: create dummy surface/bufferview for null descriptor use
Mike Blumenkrantz [Thu, 25 Mar 2021 19:55:33 +0000 (15:55 -0400)]
zink: create dummy surface/bufferview for null descriptor use

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11122>

3 years agozink: replace context-based null framebuffer surfaces with internal ones
Mike Blumenkrantz [Thu, 25 Mar 2021 19:44:18 +0000 (15:44 -0400)]
zink: replace context-based null framebuffer surfaces with internal ones

this is a bit cleaner and avoids accessing the context

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11122>

3 years agozink: add a util function to create a null surface
Mike Blumenkrantz [Thu, 25 Mar 2021 19:42:53 +0000 (15:42 -0400)]
zink: add a util function to create a null surface

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11122>

3 years agoci: build the hang-detection tool into x86_test-vk
Andres Gomez [Mon, 31 May 2021 11:41:21 +0000 (14:41 +0300)]
ci: build the hang-detection tool into x86_test-vk

hang-detection is a vulkan-based lightweight wrapper from
parallel-deqp-runner that periodically submits empty command buffers
and waits for their completions. If the completion never happens, the
GPU is considered hung, the wrapped script is killed, and the job
should get aborted.

This should have no negative impact on the runtime of dEQP/traces/...,
but will allow saving time when the GPU gets hung as we can abort the
job immediately rather than waiting for the timeout.

In the case of B2C, we are using this tool's error message as a way to
trigger the reboot of the test machine and start again.

v2:
  - Use hang-detection already with some jobs (Martin).

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11087>

3 years agoci: fix the vkd3d-proton runner
Andres Gomez [Mon, 31 May 2021 19:35:25 +0000 (22:35 +0300)]
ci: fix the vkd3d-proton runner

Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Martin Peres <martin.peres@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11087>

3 years agoturnip: reset push descriptor set on command buffer reset
Danylo Piliaiev [Wed, 2 Jun 2021 13:07:13 +0000 (16:07 +0300)]
turnip: reset push descriptor set on command buffer reset

Otherwise it will store a pointer to already unmapped memory which
could lead to a crash in tu_CmdPushDescriptorSetWithTemplateKHR since
it tries to copy data from the old memory.

Fixes a crash with Zink's new lazy descriptor manager instroduced
in bfdd1d8d

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11137>

3 years agoradv: explicitly load a desc set layout struct member during set allocate
Mike Blumenkrantz [Tue, 1 Jun 2021 15:11:00 +0000 (11:11 -0400)]
radv: explicitly load a desc set layout struct member during set allocate

accessing this variable repeatedly like this is a contended hotpath somehow,
so instead just create a const for reference

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11124>

3 years agoradv: declare index_va in a single call for indexed draw packet emit
Mike Blumenkrantz [Tue, 30 Mar 2021 20:22:27 +0000 (16:22 -0400)]
radv: declare index_va in a single call for indexed draw packet emit

this is an extreme hotpath, so having a single calculation in a const
variable is slightly better for compiler microoptimizing

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11124>

3 years agodocs: add the doc-comment for fse-vars
Erik Faye-Lund [Tue, 1 Jun 2021 10:22:00 +0000 (12:22 +0200)]
docs: add the doc-comment for fse-vars

This just copies the comment that's in the code where this state is
stored. It seems better than nothing.

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11106>