platform/upstream/mesa.git
2 years agoturnip: Update the msm_kgsl.h header with the sanitized 4.19 version
Jordan Crouse [Fri, 21 Jan 2022 18:26:12 +0000 (18:26 +0000)]
turnip: Update the msm_kgsl.h header with the sanitized 4.19 version

The current msm_kgsl.h header in the tree isn't sanitized and the kernel
specific macros will confuse a compiler. Copy in the sanitized version of
the header from the 4.19 kernel tree which also adds a few new API bits
that are currently unused but may be useful some day.

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

2 years agotu/blit: Don't set CLAMPENABLE in sampler for 3d path
Connor Abbott [Wed, 19 Jan 2022 10:24:13 +0000 (11:24 +0100)]
tu/blit: Don't set CLAMPENABLE in sampler for 3d path

This was copied from the blob before we understood what it did, and it
has questionable utility: there's nothing in the GL, Vulkan, or D3D11
specs that require the result be clamped to the underlying range to
account for imprecision. And it doesn't make sense at all for cubic
filtering, because the result can legitimately be outside the range in
some scenarios. Just remove it.

This fixes a bunch of tests added in vulkan CTS 1.2.8 to test blitting
from compressed textures, which use random inputs and therefore are more
likely to hit the out-of-range condition. For example,
dEQP-VK.api.copy_and_blit.core.blit_image.all_formats.color.2d.etc2_r8g8b8a8_unorm_block.r8g8b8a8_snorm.general_general_cubic.

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

2 years agofreedreno/a6xx: Name texture descriptor bit
Connor Abbott [Tue, 18 Jan 2022 17:46:49 +0000 (18:46 +0100)]
freedreno/a6xx: Name texture descriptor bit

This appears to do the same thing as CLAMPENABLE on a3xx. That is, it
clamps the result to [0, 1] for unorm formats and [-1, 1] for snorm
formats *after* filtering. In particular it's now more easily observable
with cubic filtering, because cubic filtering can produce values outside
the original range. Presumably this only matters with linear filtering
due to rounding errors when computing the weighted average.

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

2 years agointel/isl: Allow creating MCS in Tile4 memory
Nanley Chery [Thu, 8 Nov 2018 00:39:54 +0000 (16:39 -0800)]
intel/isl: Allow creating MCS in Tile4 memory

This enables MCS support on XeHP, now that MCS can be created with a
tiling supported by that platform.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14464>

2 years agointel/gen125.xml: Increase Auxiliary Surface Pitch
Nanley Chery [Mon, 29 Mar 2021 18:01:51 +0000 (11:01 -0700)]
intel/gen125.xml: Increase Auxiliary Surface Pitch

See Bspec 43862.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14464>

2 years agoRevert "intel/isl: Don't reconfigure aux surfaces for MCS"
Nanley Chery [Wed, 8 Dec 2021 01:40:15 +0000 (20:40 -0500)]
Revert "intel/isl: Don't reconfigure aux surfaces for MCS"

This reverts commit 2f0fbe06e65c5ae6c3e9ab3943a4a7d01ae9dc2f.

We don't handle the reconfiguration of existing HiZ surfaces, nor do we
do so for CCS surfaces. This code path is unused, so we remove it.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14464>

2 years agointel/isl: Strengthen MCS SINT format restriction
Nanley Chery [Wed, 8 Dec 2021 02:23:35 +0000 (21:23 -0500)]
intel/isl: Strengthen MCS SINT format restriction

The gfx7 MCS restriction for SINT formats actually applies to
multisampling in general. Place the stronger restriction in the format
support check and assert this in isl_surf_get_mcs_surf.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14464>

2 years agointel/isl: Don't check pitch in isl_surf_get_mcs_surf
Nanley Chery [Wed, 8 Dec 2021 01:37:25 +0000 (20:37 -0500)]
intel/isl: Don't check pitch in isl_surf_get_mcs_surf

The pitch check for 16x multisampled surfaces should already be covered
by the pitch_in_range check in isl_calc_row_pitch.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14464>

2 years agoradv: optimize CPU overhead of si_cp_dma_prefetch() slightly
Samuel Pitoiset [Wed, 19 Jan 2022 12:40:06 +0000 (13:40 +0100)]
radv: optimize CPU overhead of si_cp_dma_prefetch() slightly

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5008
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/14618>

2 years agowsi/x11: Avoid a class of deadlocks in the WSI queue thread
Adam Jackson [Wed, 27 Oct 2021 21:49:23 +0000 (17:49 -0400)]
wsi/x11: Avoid a class of deadlocks in the WSI queue thread

Here are two facts, each mildly unpleasant, quite nasty taken together:

- xcb_wait_for_special_event retries its poll() if the fd woke up but
  no matching event arrived, without verifying that the special event
  queue is still registered.
- Present gives no in-band notification of window destruction.

Now if the window is destroyed before the swapchain we're in trouble.
Our WSI thread might be stuck in xcb_wait_for_special_event as we're
awaiting a completion that won't come (the pixmap was being presented as
the window, and then the window was destroyed, so no more events can
happen on that window).

The solution is to use xcb_poll_for_special_event, which is
non-blocking, and handle the appropriate edge cases. If we've run the
event queue but we still don't have an image to acquire, we poke the X
server with a request that gently verifies that the window exists,
allowing the thread to exit gracefully in the above case.  We detect
when we're busy-looping, and poll on the X connection for up to 1ms in
response to avoid burning the CPU.

Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13564>

2 years agoRevert "nir/algebraic: distribute fmul(fadd(a, b), c) when b and c are constants"
Bas Nieuwenhuizen [Thu, 13 Jan 2022 11:51:52 +0000 (12:51 +0100)]
Revert "nir/algebraic: distribute fmul(fadd(a, b), c) when b and c are constants"

This reverts commit a1af902531122464b0f4eb66a7c4bf207a8a69f1.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5423
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14532>

2 years agoRevert "zink: handle vertex buffer offset overflows"
Charles Baker [Thu, 13 Jan 2022 07:19:33 +0000 (20:19 +1300)]
Revert "zink: handle vertex buffer offset overflows"

This reverts commit 9823b970fb51db21ac6ce29753eba82dc25f3072.

From VkPhysicalDeviceLimits [1]:

> maxVertexInputAttributeOffset is the maximum vertex input attribute
offset that can be added to the vertex input binding stride. The offset
member of the VkVertexInputAttributeDescription structure must be
less than or equal to this limit.

The maxVertexInputAttributeOffset is a limit on the offset of a vertex
attribute within a vertex rather than a limit on offsets for vertex
buffer bindings.  The code to bind temporary buffers can be removed.

[1] https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPhysicalDeviceLimits.html

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

2 years agoradv: use 8x4 workgroups for wave32 RT
Rhys Perry [Wed, 8 Dec 2021 12:31:21 +0000 (12:31 +0000)]
radv: use 8x4 workgroups for wave32 RT

Beginning of Quake II RTX, 50% resolution scale, RX 6800: 54 -> 56 FPS.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14011>

2 years agoradv: use wave32 for raytracing
Rhys Perry [Thu, 2 Dec 2021 16:12:23 +0000 (16:12 +0000)]
radv: use wave32 for raytracing

Beginning of Quake II RTX, 50% resolution scale, RX 6800: 48 -> 54 FPS.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14011>

2 years agoradv: fix raytracing with wave32
Rhys Perry [Thu, 2 Dec 2021 16:08:47 +0000 (16:08 +0000)]
radv: fix raytracing with wave32

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5452
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14011>

2 years agozink: Set vertex binding stride without dynamic state extensions
Charles Baker [Thu, 9 Dec 2021 20:22:28 +0000 (09:22 +1300)]
zink: Set vertex binding stride without dynamic state extensions

EXT_vertex_input_dynamic_state

When both EXT_vertex_input_dynamic_state and EXT_extended_dynamic_state
are not available stride is never set and nothing is rasterized as all
triangles are degenerate.

This fix copies stride into the VkVertexInputBindingDescription array
when the graphics pipeline is created when those extensions aren't
available.

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

2 years agozink: Avoid redundant cast to uint on PackHalf2x16 result
Charles Baker [Fri, 14 Jan 2022 02:07:56 +0000 (15:07 +1300)]
zink: Avoid redundant cast to uint on PackHalf2x16 result

For example the previous code generates the following sequence of
SPIR-V instructions ending with a redundant cast to uint:

  %2018 = OpExtInst %uint %1 PackHalf2x16 %2017
  %2019 = OpBitcast %uint %2018

The new code generates:

  %2018 = OpExtInst %uint %1 PackHalf2x16 %2017

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

2 years agozink: Output PackHalf2x16 to uint not float
Charles Baker [Thu, 9 Dec 2021 20:22:28 +0000 (09:22 +1300)]
zink: Output PackHalf2x16 to uint not float

Fixes InconsistentSpirv validation errors reporting that PackHalf2x16
outputs uint rather than float.

For example the previous code generates the following SPIR-V with
PackHalf2x16 output as a float:

  %2018 = OpExtInst %float %1 PackHalf2x16 %2017
  %2019 = OpBitcast %uint %2018

The new code generates:

  %2018 = OpExtInst %uint %1 PackHalf2x16 %2017
  %2019 = OpBitcast %uint %2018

cc: mesa-stable

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

2 years agoac/nir: use shorter builder names
Rhys Perry [Thu, 6 Jan 2022 19:07:37 +0000 (19:07 +0000)]
ac/nir: use shorter builder names

This makes a lot of lines shorter.

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

2 years agoac/nir: avoid providing an align_mul to intrinsic builders
Rhys Perry [Fri, 7 Jan 2022 16:06:11 +0000 (16:06 +0000)]
ac/nir: avoid providing an align_mul to intrinsic builders

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

2 years agoac/nir: avoid providing a write_mask to intrinsic builders
Rhys Perry [Fri, 7 Jan 2022 16:05:27 +0000 (16:05 +0000)]
ac/nir: avoid providing a write_mask to intrinsic builders

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

2 years agoradv: avoid providing an align_offset to intrinsic builders
Rhys Perry [Thu, 6 Jan 2022 19:03:00 +0000 (19:03 +0000)]
radv: avoid providing an align_offset to intrinsic builders

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>

2 years agoradv: avoid providing an align_mul to intrinsic builders
Rhys Perry [Fri, 7 Jan 2022 16:06:04 +0000 (16:06 +0000)]
radv: avoid providing an align_mul to intrinsic builders

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>

2 years agoradv: avoid providing a write_mask to intrinsic builders
Rhys Perry [Fri, 7 Jan 2022 16:05:20 +0000 (16:05 +0000)]
radv: avoid providing a write_mask to intrinsic builders

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14455>

2 years agonir/builder: assume scalar alignment if not provided
Rhys Perry [Thu, 6 Jan 2022 18:04:21 +0000 (18:04 +0000)]
nir/builder: assume scalar alignment if not provided

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

2 years agonir/builder: set write mask if not provided
Rhys Perry [Thu, 6 Jan 2022 17:52:15 +0000 (17:52 +0000)]
nir/builder: set write mask if not provided

Zero isn't really a valid write mask. If it's provided, use a full write
mask.

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

2 years agov3dv: check correct format when load/storing on a depth/stencil buffer
Alejandro Piñeiro [Wed, 19 Jan 2022 13:24:59 +0000 (14:24 +0100)]
v3dv: check correct format when load/storing on a depth/stencil buffer

When we create a image view with D24S8 format we made a reformatting
to RGBA8UI if the aspect selected is just STENCIL. But when
configuring the stores we select the aspects based on the attachment
format. Quoting from cmd_buffer_render_pass_emit_stores:

      /* From the Vulkan spec, VkImageSubresourceRange:
       *
       *   "When an image view of a depth/stencil image is used as a
       *   depth/stencil framebuffer attachment, the aspectMask is ignored
       *   and both depth and stencil image subresources are used."
       *
       * So we ignore the aspects from the subresource range of the image
       * view for the depth/stencil attachment, but we still need to restrict
       * the to aspects compatible with the render pass and the image.
       */
      const VkImageAspectFlags aspects =
         vk_format_aspects(ds_attachment->desc.format);

So we could ending trying to store on a Z+Stencil buffer, using a
RGBA8UI format.

So far this only affected some tests when using the simulator
(assert). Those were working on the real hw, but probably would fail
on other situations, so lets use the original image format on that
case.

v2 (Iago)
   * Improve comment grammar
   * Do the same on load too (not just store)

v3 (Iago)
    * Re-word comments.

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

2 years agov3dv: remove unused v3dv_descriptor_map_get_texture_format
Alejandro Piñeiro [Wed, 19 Jan 2022 12:08:35 +0000 (13:08 +0100)]
v3dv: remove unused v3dv_descriptor_map_get_texture_format

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

2 years agov3dv: signal fence when all submitted jobs complete execution
Melissa Wen [Thu, 16 Dec 2021 10:47:18 +0000 (10:47 +0000)]
v3dv: signal fence when all submitted jobs complete execution

We track last submitted jobs by queue type. After all cmd buffer
batches have been submitted, we emit a noop job that waits all jobs
submitted to each GPU queue complete and signals the fence.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: process signal semaphores in the very last job
Melissa Wen [Thu, 16 Dec 2021 22:43:49 +0000 (22:43 +0000)]
v3dv: process signal semaphores in the very last job

With multiple semaphores support, we can use a GPU job to handle
multiple signal semaphores in the end of a cmd buffer batch. It
means, the last job in the last cmd buffer will be in change of
signalling semaphores as long as it meets some conditions:
1 - A GPU-job signals semaphores whenever we only have submitted
jobs for the same queue (there is no syncobj created for any
other type). Otherwise, we emit a noop job that waits on the
completion of all jobs submitted and then signals semaphores.
2 - A CPU-job is never in charge of signalling semaphores. We
process it first and emit a noop job that depends on all jobs
previously submitted to signal semaphores.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: handle wait semaphores in the first job by queue
Melissa Wen [Mon, 3 Jan 2022 13:55:37 +0000 (12:55 -0100)]
v3dv: handle wait semaphores in the first job by queue

With multiple semaphore support, we can improve the way we handle
wait semaphores considering different job types and cmd buffer
batch scenarios, that means:

- A GPU job depends on wait semaphores whenever it is the first job
submitted to a queue in this command buffer batch (the `first` flag
for the job's queue type is set).
- For the first CPU job, if there are wait semaphores, we should
wait for the CPU and GPU being idle to process the job.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: track submitted jobs by GPU queue type
Melissa Wen [Tue, 14 Dec 2021 14:40:34 +0000 (13:40 -0100)]
v3dv: track submitted jobs by GPU queue type

The order in which a GPU job is scheduled is guaranteed within the
same queue type (CL, TFU, CSD), but the order of completion of jobs
from different queues cannot be guaranteed. Since we have multiple
semaphores support now, we can track the completion of the last job
submitted to each queue and therefore better determine when gpu is
idle. We do it using an array of syncobj (last_job_syncs) for each
GPU queue (CL, TFU, CSD). With this, job serialization also become
more accurate. We also keep tracking the very last job submitted
(last_job_sync became an element of the last_job_syncs array as
V3DV_QUEUE_ANY) for the case we don't have multisync support.
To help in handling wait semaphores, we set a flag per queue to
indicate we are starting a new cmd buffer batch and a job submitted
to this queue will be the first.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: enable GPU jobs to signal multiple semaphores
Melissa Wen [Thu, 11 Nov 2021 13:54:30 +0000 (12:54 -0100)]
v3dv: enable GPU jobs to signal multiple semaphores

In addition to keep a copy of wait semaphores, extend
v3dv_submit_info_semaphores to hold a copy of signal semaphores too.
With a copy of wait and signal semaphores, we can enable GPU jobs to
handle more than one wait and signal semaphores.

By now, we don't change the way as we signalling semaphores when all
jobs complete, i.e., we still use the master thread to signal
semaphores. In this context, no GPU job is actually in charge of
signalling, but the support for multiple signal semaphores is done
here.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: enable multiple semaphores for csd job
Melissa Wen [Mon, 4 Oct 2021 14:53:51 +0000 (15:53 +0100)]
v3dv: enable multiple semaphores for csd job

Whenever v3d kernel-driver supports multisync extension, use it to
allow add multiple semaphores as csd job dependency.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: enable multiple semaphores for tfu job
Melissa Wen [Mon, 4 Oct 2021 13:36:12 +0000 (14:36 +0100)]
v3dv: enable multiple semaphores for tfu job

Whenever v3d kernel-driver supports multisync extension, use it to
enable more than one semaphores in a tfu job.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: enable multiple semaphores on cl submission
Melissa Wen [Mon, 4 Oct 2021 13:31:55 +0000 (14:31 +0100)]
v3dv: enable multiple semaphores on cl submission

Whenever v3d kernel-driver supports multisync extension, use it to
enable more than one semaphores in cl submission. In CL, we have two
kind of job (bin and render), therefore, we need also to determine
the stage to sync, that means to add job dependencies/wait
semaphores.

Also, as we currently process all signal semaphores of a cmd buffer
batch together in the submit master thread (when the last wait
thread completes), there isn't now a situation in which GPU jobs
need to handle signal VkSemaphores.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: check multiple semaphores capability
Melissa Wen [Mon, 4 Oct 2021 11:53:17 +0000 (12:53 +0100)]
v3dv: check multiple semaphores capability

Check if kernel-driver supports multisync extension

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agodrm-uapi/v3d: extend interface for multiple semaphores support
Melissa Wen [Mon, 4 Oct 2021 11:22:38 +0000 (12:22 +0100)]
drm-uapi/v3d: extend interface for multiple semaphores support

Extends command submission ioctls to support multiple semaphores through
generic ioctl extension design. In this approach, a multisync extension
subclasses a generic ioctl extension struct (base) and enables more than
one wait and signal semaphores. Multisync extension also uses v3d_queue
to specify the wait_stage, i.e. which job should sync before start (wait
semaphores).

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: store wait semaphores in event_wait_cpu_job_info
Melissa Wen [Mon, 8 Nov 2021 20:10:45 +0000 (19:10 -0100)]
v3dv: store wait semaphores in event_wait_cpu_job_info

Instead of a boolean (sem_wait) in v3dv_event_wait_cpu_job_info,
that is used to determine wait condition for jobs put in a wait
thread, copy the wait semaphores data and store it as struct
v3dv_submit_info_semaphores. In the following patches we enable
multiple semaphores in GPU jobs, and therefore we need this data
to add wait semaphores as job dependencies for pending jobs
submitted from a wait thread.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: wrap wait semaphores info in v3dv_submit_info_semaphores
Melissa Wen [Mon, 8 Nov 2021 15:50:52 +0000 (14:50 -0100)]
v3dv: wrap wait semaphores info in v3dv_submit_info_semaphores

Instead of pass pSubmit to queue_submit_cmd_buffer, create a struct
v3dv_submit_info_semaphores to wrap semaphores data from VkSubmitInfo.
In the next commit, this struct will help to handle wait condition for
jobs submitted in a wait event context, since we need to hold this
data when handle wait events and pass it to queue_submit_job() called
from wait threads. The main goal is to allow multiple wait semaphores
in a job submission. Later, this struct will be extended to include a
copy of signal semaphores too.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agov3dv: drop unused variable on handle_set_event_cpu_job
Melissa Wen [Wed, 13 Oct 2021 09:33:15 +0000 (10:33 +0100)]
v3dv: drop unused variable on handle_set_event_cpu_job

is_wait_thread is passed, but not actually used; and cpu_queue_handle_idle
is in charge to handle wait threads spawned before this one.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13178>

2 years agomesa: use less temporaries in build_lighting
Pierre-Eric Pelloux-Prayer [Tue, 18 Jan 2022 10:50:37 +0000 (11:50 +0100)]
mesa: use less temporaries in build_lighting

Preallocating temporaries can cause "out of temporaries" error.
Switch to on-demand allocation.

Growing temp_in_use would be an alternative, but some drivers
support less than 64 temps (see PIPE_SHADER_CAP_MAX_TEMPS) so
this wouldn't help them.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5777
Fixes: 272acbed0e2 ("mesa: merge STATE_LIGHTPROD parameters")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14590>

2 years agoradv: fix computing the number of color samples if no attachments
Samuel Pitoiset [Thu, 20 Jan 2022 22:49:08 +0000 (23:49 +0100)]
radv: fix computing the number of color samples if no attachments

When no color attachments, the rasterization samples should be used.

Fixes: 0222dace909 ("radv: Support VK_KHR_dynamic_rendering for pipeline creation.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5830
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/14642>

2 years agodriconf: enable vs_position_always_invariant for Dirt Rally
Pierre-Eric Pelloux-Prayer [Wed, 19 Jan 2022 11:10:49 +0000 (12:10 +0100)]
driconf: enable vs_position_always_invariant for Dirt Rally

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5648
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14614>

2 years agor300: properly initialize new_vs in r300_draw_init_vertex_shader
Pavel Ondračka [Wed, 19 Jan 2022 14:43:11 +0000 (15:43 +0100)]
r300: properly initialize new_vs in r300_draw_init_vertex_shader

Fixes the following valgrind warnings:
 Conditional jump or move depends on uninitialised value(s)
    at 0x5D1298C: draw_pt_so_emit_prepare (draw_pt_so_emit.c:95)
    by 0x5D89FD7: llvm_middle_end_prepare (draw_pt_fetch_shade_pipeline_llvm.c:319)
    by 0x5D13BFF: vsplit_prepare (draw_pt_vsplit.c:229)
    by 0x5D0D5D8: draw_pt_arrays.isra.0 (draw_pt.c:124)
    by 0x5D0DA08: draw_instances (draw_pt.c:484)
    by 0x5D0DEB9: draw_vbo (draw_pt.c:610)
    by 0x5E847D6: r300_swtcl_draw_vbo (r300_render.c:901)
    by 0x5D67125: u_vbuf_draw_vbo (u_vbuf.c:1470)
    by 0x5CFCAD3: cso_multi_draw (cso_context.c:1639)
    by 0x58FEC37: st_draw_gallium (st_draw.c:186)
    by 0x5A486BA: _mesa_draw_arrays.part.0 (draw.c:1323)
    by 0x48B4E27: stub_glDrawArrays (piglit-dispatch-gen.c:12421)
  Uninitialised value was created by a stack allocation
    at 0x5E90D3F: r300_draw_init_vertex_shader (r300_vs_draw.c:313)

 Conditional jump or move depends on uninitialised value(s)
    at 0x5D175D9: draw_create_vertex_shader (draw_vs.c:70)
    by 0x5E90E7A: r300_draw_init_vertex_shader (r300_vs_draw.c:366)
    by 0x5E8751F: r300_create_vs_state (r300_state.c:1950)
    by 0x594453B: st_create_common_variant (st_program.c:888)
    by 0x594720C: st_get_common_variant (st_program.c:973)
    by 0x59484B6: st_precompile_shader_variant (st_program.c:1994)
    by 0x59484B6: st_finalize_program (st_program.c:2056)
    by 0x58F0571: st_program_string_notify (st_cb_program.c:128)
    by 0x5928C9B: st_link_tgsi (st_glsl_to_tgsi.cpp:7514)
    by 0x5904B53: st_link_shader (st_glsl_to_ir.cpp:178)
    by 0x58D3E08: _mesa_glsl_link_shader (link_program.cpp:91)
    by 0x58865C7: link_program (shaderapi.c:1363)
    by 0x58865C7: link_program_error.part.0 (shaderapi.c:1474)
    by 0x48DBC5A: stub_glLinkProgram (piglit-dispatch-gen.c:34426)
  Uninitialised value was created by a stack allocation
    at 0x5E90D4F: r300_draw_init_vertex_shader (r300_vs_draw.c:313)

Based on Filip Gawin's
   r300: set new_vs.type to PIPE_SHADER_IR_TGSI

CC: mesa-stable
Reviewed-by: Emma Anholt <emma@anholt.net>
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14620>

2 years agomesa/st: move perf query test to st_context, drop files.
Dave Airlie [Tue, 21 Dec 2021 04:28:31 +0000 (14:28 +1000)]
mesa/st: move perf query test to st_context, drop files.

This removes the unused cb perf query files

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: drop lots of perfquery wrappers
Dave Airlie [Tue, 21 Dec 2021 04:27:07 +0000 (14:27 +1000)]
mesa/st: drop lots of perfquery wrappers

Just direct call into pipe driver.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: drop some bindless wrappers
Dave Airlie [Tue, 21 Dec 2021 03:51:50 +0000 (13:51 +1000)]
mesa/st: drop some bindless wrappers

Just call directly into pipe

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: move memory query into mesa.
Dave Airlie [Mon, 20 Dec 2021 04:14:45 +0000 (14:14 +1000)]
mesa/st: move memory query into mesa.

Drop the gl_memory_info type as it's equiv to the pipe one, and
internal

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: move shader completion into mesa
Dave Airlie [Mon, 20 Dec 2021 05:27:50 +0000 (15:27 +1000)]
mesa/st: move shader completion into mesa

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: inline st_max_shader_compiler_threads
Dave Airlie [Mon, 20 Dec 2021 05:21:44 +0000 (15:21 +1000)]
mesa/st: inline st_max_shader_compiler_threads

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/ctx: store screen pointer in ctx as well
Dave Airlie [Mon, 20 Dec 2021 05:24:03 +0000 (15:24 +1000)]
mesa/ctx: store screen pointer in ctx as well

This is actually useful to have.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: move evaluate depth values into mesa
Dave Airlie [Tue, 21 Dec 2021 05:44:35 +0000 (15:44 +1000)]
mesa/st: move evaluate depth values into mesa

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st/vdpau: direct call the vdpau functions.
Dave Airlie [Mon, 20 Dec 2021 04:37:08 +0000 (14:37 +1000)]
mesa/st/vdpau: direct call the vdpau functions.

This provides versions when vdpau is turned off, removes dd.h entries

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: drop release all sampler views wrapper
Dave Airlie [Tue, 21 Dec 2021 05:33:24 +0000 (15:33 +1000)]
mesa/st: drop release all sampler views wrapper

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: move st_TexParameter into mesa
Dave Airlie [Tue, 21 Dec 2021 05:29:54 +0000 (15:29 +1000)]
mesa/st: move st_TexParameter into mesa

Some places this just passes an always true pname, so just call
sampler view invalidate directly

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: drop useless tex parameter calls.
Dave Airlie [Tue, 21 Dec 2021 05:22:05 +0000 (15:22 +1000)]
mesa/st: drop useless tex parameter calls.

st_TexParameter never does anything for these

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/dd: drop GetProgramBinaryDriverSHA1
Dave Airlie [Mon, 20 Dec 2021 04:52:24 +0000 (14:52 +1000)]
mesa/dd: drop GetProgramBinaryDriverSHA1

Just call direct into state tracker

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: move pin l3 cache to direct check/call.
Dave Airlie [Mon, 20 Dec 2021 04:27:37 +0000 (14:27 +1000)]
mesa/st: move pin l3 cache to direct check/call.

Drop another dd.h entry

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: drop emit string marker device table entry.
Dave Airlie [Mon, 20 Dec 2021 04:25:21 +0000 (14:25 +1000)]
mesa/st: drop emit string marker device table entry.

Just check for the gallium callback instead

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: directly call the uuid get funcs.
Dave Airlie [Mon, 20 Dec 2021 04:19:37 +0000 (14:19 +1000)]
mesa/st: directly call the uuid get funcs.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: drop last user of st_Enable.
Dave Airlie [Mon, 20 Dec 2021 04:10:37 +0000 (14:10 +1000)]
mesa/st: drop last user of st_Enable.

Move the debug output piece into mesa

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: migrate debug callback code into mesa
Dave Airlie [Mon, 20 Dec 2021 04:09:14 +0000 (14:09 +1000)]
mesa/st: migrate debug callback code into mesa

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: remove st_context from debug callback
Dave Airlie [Mon, 20 Dec 2021 04:04:33 +0000 (14:04 +1000)]
mesa/st: remove st_context from debug callback

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agomesa/st: move intel blackhole noop enable to frontend
Dave Airlie [Mon, 20 Dec 2021 04:01:33 +0000 (14:01 +1000)]
mesa/st: move intel blackhole noop enable to frontend

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>

2 years agozink: hook up planar image format creation
Mike Blumenkrantz [Thu, 18 Nov 2021 22:04:02 +0000 (17:04 -0500)]
zink: hook up planar image format creation

it'll explode if used for anything, but this is how it's done

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

2 years agozink: link with vulkan utils
Mike Blumenkrantz [Thu, 18 Nov 2021 21:40:56 +0000 (16:40 -0500)]
zink: link with vulkan utils

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

2 years agontt: Extend ntt_compile::addr_declared and ntt_compile::addr_reg
Ian Romanick [Mon, 10 Jan 2022 22:52:08 +0000 (14:52 -0800)]
ntt: Extend ntt_compile::addr_declared and ntt_compile::addr_reg

This was identified by Coverity.  4bb9c0a28a5 added uses of a third
address register, but the arrays for tracking address registers only
have two slots.

Add back a version of the assertion from before 4bb9c0a28a5 to help
prevent future problems.  I don't think any drivers that would hit
this path use NIR-to-TGSI yet, so it may be moot.

Reviewed-by: Matt Turner <mattst88@gmail.com>
CID: 1496942
CID: 1496944
Fixes: 4bb9c0a28a5 ("nir_to_tgsi: Use the same address reg mappings as GLSL-to-TGSI did.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14487>

2 years agonir/algebraic: optimize expressions using fmulz/ffmaz
Rhys Perry [Tue, 14 Sep 2021 17:02:01 +0000 (18:02 +0100)]
nir/algebraic: optimize expressions using fmulz/ffmaz

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/13436>

2 years agonir: add some missing nir_alu_type_get_base_type
Rhys Perry [Fri, 15 Oct 2021 16:23:51 +0000 (17:23 +0100)]
nir: add some missing nir_alu_type_get_base_type

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/13436>

2 years agonir/algebraic: optimize open-coded fmulz/ffmaz
Rhys Perry [Fri, 1 Oct 2021 10:27:00 +0000 (11:27 +0100)]
nir/algebraic: optimize open-coded fmulz/ffmaz

This pattern will be found in future versions of D3D9 DXVK.

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/13436>

2 years agonir/algebraic: add ignore_exact() wrapper
Rhys Perry [Fri, 15 Oct 2021 15:39:35 +0000 (16:39 +0100)]
nir/algebraic: add ignore_exact() wrapper

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/13436>

2 years agoaco: create v_mac_legacy_f32/v_fmac_legacy_f32
Rhys Perry [Tue, 27 Apr 2021 11:11:37 +0000 (12:11 +0100)]
aco: create v_mac_legacy_f32/v_fmac_legacy_f32

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/13436>

2 years agoaco: consider legacy multiplications in optimizer
Rhys Perry [Tue, 21 Sep 2021 16:03:05 +0000 (17:03 +0100)]
aco: consider legacy multiplications in optimizer

Optimize omod, -(a*b), b2f(a)*b, a*1, a*0 and create MAD/FMA.

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/13436>

2 years agoradv,aco,ac/llvm: implement fmulz and ffmaz
Rhys Perry [Tue, 27 Apr 2021 11:28:27 +0000 (12:28 +0100)]
radv,aco,ac/llvm: implement fmulz and ffmaz

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/13436>

2 years agonir: add nir_op_fmulz and nir_op_ffmaz
Rhys Perry [Wed, 28 Apr 2021 16:48:54 +0000 (17:48 +0100)]
nir: add nir_op_fmulz and nir_op_ffmaz

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/13436>

2 years agointel/fs: Fix gl_FrontFacing optimization on Gfx12+
Ian Romanick [Wed, 19 Jan 2022 00:30:37 +0000 (16:30 -0800)]
intel/fs: Fix gl_FrontFacing optimization on Gfx12+

It's not obvious why the (gl_FrontFacing ? -1.0 : 1.0) case was handled
different for Gfx12+ than for previous generations, and it's not
correct.  It tries to negate the result as an integer, and it does this
before the mask operation that clears the other bits in the value.

When we eventually support dual-SIMD8 dispatch, the other front-facing
bit is in g1.6 at bit 15, so similar code should be possible there.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Fixes: c92fb60007f ("intel/fs/gen12: Implement gl_FrontFacing on gen12+.")
Closes: #5876
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14625>

2 years agozink: fix non-modifer dmabuf usage
Mike Blumenkrantz [Tue, 18 Jan 2022 20:07:31 +0000 (15:07 -0500)]
zink: fix non-modifer dmabuf usage

drivers/hardware lacking VK_EXT_image_drm_format_modifier can still use dmabuf,
but that setup has to do the old copy to linear scanout instead of copy to
modifier scanout

this requires a couple extra checks to be added to handle the case

Fixes: 619438bf7ce ("zink: check EXT_image_drm_format_modifier for dmabuf support")

fixes #5836

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14597>

2 years agoanv: add helper methods related to enabling CCS for external images
Renato Pereyra [Wed, 19 Jan 2022 02:35:56 +0000 (18:35 -0800)]
anv: add helper methods related to enabling CCS for external images

Also, clarify/improve related comments

Signed-off-by: Renato Pereyra <renatopereyra@google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14416>

2 years agoanv: Enable implicit CCS for external images
Renato Pereyra [Thu, 6 Jan 2022 02:27:23 +0000 (18:27 -0800)]
anv: Enable implicit CCS for external images

AUX and clear state is stored in the VkDevice private binding

Signed-off-by: Renato Pereyra <renatopereyra@google.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14416>

2 years agodocs: add features/relnotes for zink sparse texture support
Mike Blumenkrantz [Thu, 20 Jan 2022 15:49:02 +0000 (10:49 -0500)]
docs: add features/relnotes for zink sparse texture support

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

2 years agozink: ARB_sparse_texture2
Mike Blumenkrantz [Thu, 13 Jan 2022 17:31:23 +0000 (12:31 -0500)]
zink: ARB_sparse_texture2

there is no vulkan driver that can currently pass all these tests, and
some of the tests themselves are broken, but this seems like it should be
correct

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

2 years agozink: enable ARB_sparse_texture pipe caps
Mike Blumenkrantz [Mon, 3 Jan 2022 19:35:31 +0000 (14:35 -0500)]
zink: enable ARB_sparse_texture pipe caps

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

2 years agozink: handle sparse texture miptail commits
Mike Blumenkrantz [Fri, 14 Jan 2022 18:03:41 +0000 (13:03 -0500)]
zink: handle sparse texture miptail commits

basically just allocate pages for miptail levels (probably just one) and
then bind them separately since they're probably never going to be batched

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

2 years agozink: batch sparse texture binds
Mike Blumenkrantz [Wed, 12 Jan 2022 20:27:17 +0000 (15:27 -0500)]
zink: batch sparse texture binds

do 10 binds per submit now (4 is enough for cts but yolo)

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

2 years agozink: handle min_lod texture operands
Mike Blumenkrantz [Fri, 14 Jan 2022 16:22:43 +0000 (11:22 -0500)]
zink: handle min_lod texture operands

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

2 years agozink: emit sparse residency cap in ntv
Mike Blumenkrantz [Fri, 14 Jan 2022 17:01:15 +0000 (12:01 -0500)]
zink: emit sparse residency cap in ntv

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

2 years agozink: only allocate ntv residency info if it will be used
Mike Blumenkrantz [Fri, 14 Jan 2022 14:51:47 +0000 (09:51 -0500)]
zink: only allocate ntv residency info if it will be used

odds are it will never be used, so don't bother allocating

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

2 years agozink: add nir_intrinsic_image_deref_sparse_load to image scanning in compiler
Mike Blumenkrantz [Fri, 14 Jan 2022 14:51:20 +0000 (09:51 -0500)]
zink: add nir_intrinsic_image_deref_sparse_load to image scanning in compiler

this flags the shader as having image use

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

2 years agozink: always pass shader info to ntv
Mike Blumenkrantz [Fri, 14 Jan 2022 15:58:29 +0000 (10:58 -0500)]
zink: always pass shader info to ntv

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

2 years agozink: rename zink_so_info -> zink_shader_info
Mike Blumenkrantz [Fri, 14 Jan 2022 14:45:17 +0000 (09:45 -0500)]
zink: rename zink_so_info -> zink_shader_info

start passing more useful info to ntv

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

2 years agozink: handle residency return value from sparse texture instructions
Mike Blumenkrantz [Thu, 13 Jan 2022 17:27:10 +0000 (12:27 -0500)]
zink: handle residency return value from sparse texture instructions

this one's a bit tricky since vulkan doesn't support vec5, the return from
the instructions is a struct, and I don't want to add temp var support to zink

now instead the process for these ops is:
* rewrite the is_sparse_texels_resident instruction to read the first vec member of the texop
* (temporarily) decrement num_components for sparse texop's dest to get real result size
* wrap texop's return type in spirv-required struct(uint, result)
* unwrap struct, store result normally + store residency info to separate array
* for is_sparse_texels_resident, ignore the mov alu for src[0] and instead use the ssa index
  from the parent instr since this is the original texop that was used to store the residency result

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

2 years agozink: always set actual_dest_type for ntv tex instruction emission
Mike Blumenkrantz [Thu, 13 Jan 2022 17:26:45 +0000 (12:26 -0500)]
zink: always set actual_dest_type for ntv tex instruction emission

no-op for now

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

2 years agozink: implement sparse shader instructions in ntv
Mike Blumenkrantz [Thu, 13 Jan 2022 17:25:58 +0000 (12:25 -0500)]
zink: implement sparse shader instructions in ntv

this automatically wraps the results into the required struct(int, result) type,
handling will come next

note that there is no cts coverage for sparseImageLoadARB, so this is purely
hypothetical

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

2 years agozink: fake sparse R9G9B9E5 support as needed
Mike Blumenkrantz [Mon, 3 Jan 2022 19:34:44 +0000 (14:34 -0500)]
zink: fake sparse R9G9B9E5 support as needed

these just allocate the whole thing now, which means they aren't actually
sparse, but who cares because nobody but cts is actually going to use it
and those tests pass just fine

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

2 years agozink: stop allocating such massive staging regions for buffer maps
Mike Blumenkrantz [Fri, 7 Jan 2022 17:58:06 +0000 (12:58 -0500)]
zink: stop allocating such massive staging regions for buffer maps

this would allocate a new stream uploader for every map if the offset was
large (e.g., all sparse buffer usage), which almost immediately consumes all vram

cc: mesa-stable

fixes KHR-GL46.CommonBugs.CommonBug_SparseBuffersWithCopyOps

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

2 years agozink: allow sparse buffers to be suballocated
Mike Blumenkrantz [Fri, 7 Jan 2022 17:56:31 +0000 (12:56 -0500)]
zink: allow sparse buffers to be suballocated

this is now symmetrical since the backing memory was being cached,
and there's no reason not to allow this since memory is no longer in use
by the time it gets returned to the cache

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

2 years agozink: support sparse texture range commits
Mike Blumenkrantz [Mon, 3 Jan 2022 19:33:12 +0000 (14:33 -0500)]
zink: support sparse texture range commits

this is a bit duplicated because the buffer and image commit code is
a little shared but not enough to combine without becoming spaghetti

this will only get worse once multisampling is supported

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

2 years agozink: set up image create bits for sparse textures
Mike Blumenkrantz [Mon, 3 Jan 2022 19:34:30 +0000 (14:34 -0500)]
zink: set up image create bits for sparse textures

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

2 years agozink: add get_sparse_texture_virtual_page_size hook
Mike Blumenkrantz [Mon, 3 Jan 2022 19:32:32 +0000 (14:32 -0500)]
zink: add get_sparse_texture_virtual_page_size hook

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