Iago Toral Quiroga [Thu, 23 Jul 2020 10:45:41 +0000 (12:45 +0200)]
v3dv: fix dynamic state after meta operation
We should always save state on a push before starting a meta operation,
even if we don't have a pipeline, since dynamic state can be set at any
time directly on the command buffer. Similarly, we should always restore
it if the pop after the meta operation signals that it has written any
state, not only if we have a graphics pipeline to restore.
Fixes a rendering artifact in VkQuake.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 22 Jul 2020 08:12:51 +0000 (10:12 +0200)]
v3dv: enable fillModeNonSolid
This, together with the shaderClipDistance changes, gets vkQuake3
to run without hacks.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 21 Jul 2020 08:29:21 +0000 (10:29 +0200)]
v3dv: enable shaderClipDistance
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 16 Jul 2020 10:34:30 +0000 (12:34 +0200)]
v3dv: add a fast path for vkCmdClearAttachments
Since vkCmdClearAttachments executes inside a render pass, we would
benefit from converting it to a draw within the current subpass job to
improve batching and avoid expensive tile load/store operations.
This can dramatically improve performance for applications using this
command, however, we can only use this if we are clearing the base
layers of framebuffer attachments, since otherwise we would need to
use layered rendering, which we don't support yet.
This improves vkQuake3 performance dramatically (almost 100%
performance improvement at 1080p), which calls this twice per frame.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 17 Jul 2020 08:30:35 +0000 (10:30 +0200)]
v3dv: only clear depth/stencil attachments if any aspect needs clearing
When we can't perform the clears using the TLB and fallback to
vkCmdClearAttachments make sure we only emit the clear if any of
the depth/stencil aspects actually needs it.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 17 Jul 2020 10:28:46 +0000 (12:28 +0200)]
v3dv: emit new shader state if viewport is dirty
If we have a dirty viewport then we need to re-emit our uniforms
to update QUNIFORM_VIEWPORT_*.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 16 Jul 2020 07:25:18 +0000 (09:25 +0200)]
v3dv: only care about barriers between GPU jobs
We don't need to do anything special for host/gpu synchronization.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 15 Jul 2020 07:31:39 +0000 (09:31 +0200)]
v3dv: avoid prime blit path when presenting WSI images
This allows us to present WSI images directly rather than going through
a blit path, improving performance.
This improves vkQuake performance at 1080p by 10-20%.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 14 Jul 2020 09:29:12 +0000 (11:29 +0200)]
v3dv: only use per-buffer clear bit for cases were we are already storing
This bit is helpful if we already need to store the buffer, but otherwise
we should not emit the store only to get the clear, we can use the global
clear packet for that and save us an expensive tile buffer store operation.
Also, we have not been using the per-buffer clear bit for depth/stencil
stores since "v3dv: fix depth/stencil clears on hardware", so we should
never been considering clearing needs to flag stores.
This improves vkQuake performance somewhere between 5%-15% by allowing
us to skip the store of the depth attachment.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 10 Jul 2020 07:50:57 +0000 (09:50 +0200)]
v3dv: ignore stencil load operation if attachment format doesn't have stencil
This gets vkQuake to render correctly, which creates render passes with
stencil load operations even when the depth/stencil attachment format
doesn't have a stencil aspect. While this is a bit weird, it seems to
be allowed by the spec:
"If the format has depth and/or stencil components, loadOp and storeOp
apply only to the depth data, while stencilLoadOp and stencilStoreOp
define how the stencil data is handled."
In our case we were not ignoring it and this was causing that we emitted a
Z buffer load that seemed to clobber the Z clear, preventing all draw calls
from passing the depth test.
While we are at it, also change the depth/stencil store operation (which
was already handling this scenario correctly) to use the format of the
render pass attachment description rather than the underlying image
format.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 9 Jul 2020 06:47:59 +0000 (08:47 +0200)]
v3dv: use a binning sync for CL jobs waiting on a semaphore
If we have a semaphore wait the job cannot be started before the semaphore
has been signaled, so we need to wait before starting the binning stage.
Fixes CTS failures in:
dEQP-VK.synchronization.op.single_queue.binary_semaphore.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 8 Jul 2020 07:56:44 +0000 (09:56 +0200)]
v3dv: improve pipeline barrier handling
So far we have been getting away with finishing the current job in the
presence of a pipeline barrier and relying on the RCL serialization,
but of course this is not always enough.
This patch addresses synchronization across different GPU units
(i.e. draw indirect after compute), as well as cases where we need to
sync before binning.
Fixes CTS failures in:
dEQP-VK.synchronization.op.single_queue.barrier.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 7 Jul 2020 11:10:44 +0000 (13:10 +0200)]
v3dv: don't support sRGB buffer formats
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 6 Jul 2020 09:44:00 +0000 (11:44 +0200)]
v3dv: handle VK_FORMAT_B8G8R8A8_UNORM vertex attributes
This is the only mandatory vertex attribute format that requires a
swizzle.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 7 Jul 2020 09:10:57 +0000 (11:10 +0200)]
v3d/compiler: support swapping R/B channels in vertex attributes.
We will need this in Vulkan to support vertex format
VK_FORMAT_B8G8R8A8_UNORM. The hardware doesn't allow to swizzle
vertex attribute components, so we need to do it in the shader.
v2:
- Use nir_intrinsic_io_semantics() to retrieve the location instead
of looping through the shader input variables (Eric).
- Assert that we only have one component (Eric).
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com> (v1)
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 7 Jul 2020 06:22:31 +0000 (08:22 +0200)]
v3dv: make sure we emit vertex attributes in location order
The order in which we emit the attributes is relevant, since
GL_SHADER_STATE_ATTRIBUTE_RECORD packets don't include an explicit
attribute index. This means that we need to emit them in driver
location order, since the compiler uses that location to compute
attribute offsets in the VPM.
Fixes ~1300 CTS tests in:
dEQP-VK.pipeline.vertex_input.multiple_attributes.out_of_order.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
n00b7 [Fri, 3 Jul 2020 08:46:51 +0000 (10:46 +0200)]
v3dv/device: handle primary nodes for newer kernels
For kernels rpi-5.X.y it changed from brcm,bcm2835-vc4 to
brcm,bcm2711-vc5, so let's just check for both strings.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 3 Jul 2020 08:06:28 +0000 (10:06 +0200)]
v3dv: fix color border clamping with specific formats
For some reason, CTS expects E5B9G9R9 and B10G11R11 with
transparent black border clamping produce alpha 1 instead of 0.
Since border color takes precedence over the texture state swizzle,
the only way to fix this is to lower the texture swizzle in the shader
to set alpha to 1.
Fixes:
dEQP-VK.pipeline.sampler.view_type.*b10g11r11*clamp_to_border_transparent_black
dEQP-VK.pipeline.sampler.view_type.*e5b9g9r9*.clamp_to_border_transparent_black
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 2 Jul 2020 10:43:42 +0000 (12:43 +0200)]
v3dv: fix regressions for cubemap array load/store
It seems that we only want to set the texture state's depth to the
number of 2D layers divided by 6 when sampling, not wen doing
load/store.
This means that we need to generate two different states and choose
the one to use depending on the descriptor.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 2 Jul 2020 08:56:05 +0000 (10:56 +0200)]
v3dv: use swizzle X001 with D/S formats
This matches Vulkan CTS expectations.
Fixes (for D/S formats):
dEQP-VK.pipeline.sampler.view_type.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Wed, 1 Jul 2020 15:03:28 +0000 (17:03 +0200)]
v3dv/image: fix TEXTURE_SHADER_STATE depth for cube arrays
For these we want to divide the number of layers by 6.
Fixes:
dEQP-VK.pipeline.image_view.view_type.cube_array.*
dEQP-VK.pipeline.image.suballocation.sampling_type.combined.view_type.cube_array.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 1 Jul 2020 12:21:09 +0000 (14:21 +0200)]
v3dv: handle unnormalized coordinates in samplers
In OpenGL, unnormalized coordinates are implicit based on the sampler
type (rectangle textures), so the compiler can set the flag when needed.
In Vulkan, however, this is configured explicitly in the sampler object,
so the compiler won't set it and we need to do it manually when we are
writing the P1 uniform.
Fixes:
dEQP-VK.pipeline.sampler.exact_sampling.*.unnormalized_coords
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 1 Jul 2020 09:05:28 +0000 (11:05 +0200)]
v3dv: fix blit_shader() to honor the region's aspect mask
When translating combined depth/stencil blits to compatible color blits we
should look at the requested region aspects to decide the color
mask to apply.
Fixes:
dEQP-VK.api.copy_and_blit.*.buffer_to_depthstencil.buffer_offset_d24_unorm_s8_uint_D
dEQP-VK.api.copy_and_blit.*.buffer_to_depthstencil.buffer_offset_d24_unorm_s8_uint_SD
dEQP-VK.api.copy_and_blit.*.buffer_to_depthstencil.buffer_offset_d24_unorm_s8_uint_S_D
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 30 Jun 2020 11:19:01 +0000 (13:19 +0200)]
v3dv: fix srcSubresource description for image to buffer blits
We are emitting a loop copying layer by layer here.
Fixes:
dEQP-VK.pipeline.render_to_image.core.*.huge.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 30 Jun 2020 08:44:43 +0000 (10:44 +0200)]
v3dv: fix textureSize() for cube arrays
For these we want to divide the number of layers by 6.
Fixes:
dEQP-VK.glsl.texture_functions.query.texturesize.*samplercubearray*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 30 Jun 2020 08:07:12 +0000 (10:07 +0200)]
v3dv: fix vkCmdCopyBuffer unaligned TLB access
We need to make sure that our tile load/store operations are aligned
to the selected item size for the copy.
Fixes simulator assert in VkQuake.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 29 Jun 2020 10:39:53 +0000 (12:39 +0200)]
v3dv: handle draw after barrier
Currently, we end the current job whenever the user emits a
pipeline barrier, but we then expect to have a valid job when
we emit a draw call.
If by the time we have to emit a draw call we don't have a valid
job, we need to create one by resuming execution of the current
subpass.
Fixes some tests in:
dEQP-VK.renderpass.suballocation.attachment_allocation.input_output.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 29 Jun 2020 09:56:48 +0000 (11:56 +0200)]
v3dv: improve handling of too large image sizes
Instead of asserting that users don't try to create images that
would require 4GB+ of memory, error out with the corresponding
OOM error when the user tries to actually allocate the memory
for the image.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 29 Jun 2020 09:17:19 +0000 (11:17 +0200)]
v3dv: add workaround for GFXH-1602
The first attribute must be active if using builtins.
This fixes a lot of simulator crashes for vertex input CTS tests.
It should be noted that some of these tests still fail after this
fix though, so there may be some other bug.
Fixes crashes in:
dEQP-VK.pipeline.vertex_input.multiple_attributes.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 29 Jun 2020 09:15:25 +0000 (11:15 +0200)]
v3dv: fix GFXH-930 workaround
We want to check if the coordinate shader is reading attributes, not
the vertex shader.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Sun, 28 Jun 2020 00:08:16 +0000 (02:08 +0200)]
v3dv/device: expose support for image cube array
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Mon, 29 Jun 2020 09:17:32 +0000 (11:17 +0200)]
nir: include texture query lod as one of the ops that requires a sampler
In practice we found that we need this for v3d (specifically for cube
map arrays, as they don't support the default value for wrap_i, so a
sampler object is needed to override that value).
It is worth to note that the main reason behind this auxiliar method
was to identify those cases that we didn't have a sampler object
available for Vulkan. So far, we found that we have a sampler object
coming from nir always for that operation.
Fixes cube map array tests like the following:
dEQP-VK.glsl.texture_functions.query.texturequerylod.usamplercubearray_fragment
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Wed, 24 Jun 2020 09:36:58 +0000 (11:36 +0200)]
v3dv/uniforms: support for some QUNIFORM_IMAGE_XXX
As we are using the descriptor sets to access to the specific
v3dv_image_view, we can just reuse the existing methods for the
textures.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Tue, 23 Jun 2020 23:55:20 +0000 (01:55 +0200)]
v3dv/pipeline: lower_image_deref
This is really similar to the existing lower_tex_src_to_offset, but
for now we prefer to keep them independent, just in case we start to
found specific image use-cases as we advance fixing CTS tests.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Tue, 23 Jun 2020 14:37:02 +0000 (16:37 +0200)]
v3dv/descriptors: support for DESCRIPTOR_TYPE_STORAGE_IMAGE
From the descriptor pov is mostly another image without sampler, so
for example, on the descriptor pool bo we only store the texture
shader state.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 26 Jun 2020 10:45:09 +0000 (12:45 +0200)]
v3dv: implement support for shader spilling
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 25 Jun 2020 08:49:13 +0000 (10:49 +0200)]
v3dv: lower frexp
Fixes:
dEQP-VK.glsl.builtin.precision.frexp.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 25 Jun 2020 08:28:07 +0000 (10:28 +0200)]
v3dv: lower unpack_{u,s}norm_2x16
The hardware doesn't have unorm/snorm packing variants and we were
already lowering the packing versions of these.
Fixes:
dEQP-VK.glsl.builtin.function.pack_unpack.unpacksnorm2x16_compute
dEQP-VK.glsl.builtin.function.pack_unpack.unpackunorm2x16_compute
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 25 Jun 2020 07:30:04 +0000 (09:30 +0200)]
v3dv: don't reset descriptor state after a meta operation
If the meta operation did not change descriptor state then we should keep it,
not reset it.
Fixes:
dEQP-VK.fragment_operations.early_fragment.early_fragment_tests_stencil
dEQP-VK.fragment_operations.early_fragment.no_early_fragment_tests_stencil
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 25 Jun 2020 06:54:34 +0000 (08:54 +0200)]
v3dv: handle empty set layouts
Fixes:
dEQP-VK.api.object_management.max_concurrent.descriptor_set_layout_empty
dEQP-VK.api.object_management.single_alloc_callbacks.descriptor_set_layout_empty
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Tue, 23 Jun 2020 13:47:53 +0000 (15:47 +0200)]
v3dv: initial support for input attachments
We are treating them as a special case of texture, so the commit is
mostly about integrating them with the existing
SAMPLER/SAMPLER_IMAGE/COMBINED_IMAGE_SAMPLER infrastructure.
This commit doesn't use in any special way the render pass
information, including the dependencies, so it is possible that we
would need to do something else. But this commit gets several CTS
tests, and two Sascha Willem Vulkan demos, so let's start with this
commit and handle any other use case for following commits.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Fri, 8 May 2020 23:06:12 +0000 (01:06 +0200)]
v3dv/pipeline: set load_layer_id to zero
We don't support layered rendering so let's lower the intrinsic to
zero for now. Based on turnip commit 99a4f7c ("turnip: set
load_layer_id to zero")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Mon, 22 Jun 2020 15:20:24 +0000 (17:20 +0200)]
v3dv/pipeline: iterate used textures using the combined index map
So far we were using nir->data.num_textures to fill the default values
for the textures used on the shader, and set the value for the number
of textures used.
But nir->data.num_textures doesn't take into account input
attachments, even after nir_lower_input_attachments. Although that
could make sense from a general pov, in our case we are treating input
attachments mostly as textures.
This commit count the number of textures interating through the
pipeline combined index map, as it includes both. This also makes the
populate of the shader key for default values more similar to the one
done at cmd_buffer with real values.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Mon, 22 Jun 2020 23:52:48 +0000 (01:52 +0200)]
v3d/tex: avoid to ask back for a sampler state if not needed
So far we were not asking the driver for the sampler state if we could
just use the default P1 values. But even if we need to fill P1 (for
example to fill up the output type of the format), if the texture
operation doesn't need a sampler, we can let that field as NULL (so
default values) and avoid calling back the driver for a sampler.
This is not mandatory for OpenGL (as we always have a sampler object),
although still a good to have. For Vulkan this is needed, as we don't
have a sampler object in that case.
v2: reword comment (Eric)
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 23 Jun 2020 10:46:49 +0000 (12:46 +0200)]
v3dv: pipeline initialization fixes for disabled rasterization
When rasterization is disabled there are a number of CreateInfo
structs that should be ignored. We were managing this correctly
for some cases, but not all of them. Specifically, viewport state
must be ignored and we weren't doing that.
Fixes:
dEQP-VK.api.descriptor_set.descriptor_set_layout_lifetime.graphics
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 23 Jun 2020 11:36:15 +0000 (13:36 +0200)]
v3dv: don't free BOs from imported memory objects
Only free the underlying BO when the exported memory object is freed
to avoid multiple frees of the same memory.
The only exception is winsys BOs where we import a BO created in the
display device into the render device. In this case, we only have one
memory object referencing the BO and we want to destroy it with that
memory object.
Fixes:
dEQP-VK.api.external.memory.dma_buf.*
dEQP-VK.api.external.memory.opaque_fd.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 23 Jun 2020 10:11:30 +0000 (12:11 +0200)]
v3dv: assert that our framebuffers are single sampled
This makes it easier to track CTS test fails related to multisampling,
which we don't support yet.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 23 Jun 2020 09:32:04 +0000 (11:32 +0200)]
v3dv: return a proper error for too large buffer allocations
Fixes: dEQP-VK.api.buffer.basic.size_max_uint64
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 19 Jun 2020 09:56:20 +0000 (11:56 +0200)]
v3dv: implement indirect compute dispatch
The hardware can't do this, so we need to record a CPU job that will
map the indirect buffer at queue submission time, read the dispatch
parameters and then submit a regular dispatch.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 19 Jun 2020 11:42:21 +0000 (13:42 +0200)]
v3dv: always emit index buffer state for new jobs
New jobs need to re-emit all state. Typically, this is achieved
by resetting all dirty state flags when we start a new job, but
for index buffers we were not using a dirty bit because we always
emit them immediately. This patch adds the bit and only tries
to skip index buffer state if the bit is not dirty, which will
ensure that we will always emit it for new jobs.
This fixes a regression in the shadowmapping demo from Sascha Willems
introduced with "v3dv: try harder to skip emission of redundant state".
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 19 Jun 2020 07:52:53 +0000 (09:52 +0200)]
v3dv: handle unsized arrays in SSBOs
CTS coverage for this was hiding behind compute shaders so
we didn't notice this was not working properly until now.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 18 Jun 2020 11:53:51 +0000 (13:53 +0200)]
v3dv: implement compute dispatch
for now this only implements regular dispatches, not indirect.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 18 Jun 2020 10:14:58 +0000 (12:14 +0200)]
v3dv: handle separate binding points for compute and graphics
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 18 Jun 2020 09:06:00 +0000 (11:06 +0200)]
v3dv: support compute pipelines
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Thu, 18 Jun 2020 08:59:57 +0000 (10:59 +0200)]
v3dv/bo: add dump stats info
Focused specially on the cache, how many BOs and how much bo_size is
store on the cache, freed bos, bos moved to cache etc.
Initially not configured with V3D_DEBUG (like v3d) to avoid a runtime
check on most of v3dv_bo functions.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Tue, 16 Jun 2020 23:41:13 +0000 (01:41 +0200)]
v3dv/bo: add a maximum size for the bo_cache and a envvar to configure it
V3DV_MAX_BO_CACHE_SIZE can be used to configure it.
So one way to disable the bo cache is setting V3DV_MAX_BO_CACHE_SIZE
to zero. This would still run all the bo_cache size checks, but having
another envvar just to ensure that anything related to the cache is
used seemed like an overkill.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Fri, 5 Jun 2020 10:21:54 +0000 (12:21 +0200)]
v3dv/bo: adding a BO cache
Heavily based on the already existing for the v3d OpenGL driver, but
without references, and with some extra OOM checks (Vulkan CTS has
several OOM tests).
With this commit v3dv_bo_alloc and v3dv_bo_free became frontends to
the bo_cache. The former tries to get a BO from the cache if possible,
and the latter stores the BO on the cache if possible. The former also
adds a new parameter to point if the BO to allocate is private.
As v3d we are only caching private BOs, those created by the driver
for internal use (like CLs, tile_alloc, etc). They are the ones with
the highest change of being reused (for example, CL BOs are always
4KB, so they can always be reused). User-created BOs can have any
size, including some very large ones for buffers and images, which
makes them far less likely to be reused and would add a lot of memory
pressure if we decided to cache them.
In any case, in practice, we found that we could get a performance
improvement by caching also user-created BOs, but that would need more
care and an analysis to decide which ones makes sense. Would also
require to change how the cached BOs are stored by size. Right now
there are an array of list_head, that doesn't work well with big
BOs. If done, that would be handled on a separate commit.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 17 Jun 2020 10:15:42 +0000 (12:15 +0200)]
v3dv: always map full BOs
Both the API user and the driver may attempt to map a BO, possibly
only partially and using different ranges. This is a problem because
we only have a single map per BO. Fix this by making sure that when
a BO is mapped, we always map its entire range. This way if a BO
has been mapped before, we know that map is still valid no matter the
region we need to access now.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 16 Jun 2020 07:47:23 +0000 (09:47 +0200)]
v3dv: try to use TFU path when creating tiled images from linear buffers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 15 Jun 2020 14:44:49 +0000 (16:44 +0200)]
v3dv: add a CPU path for buffer to image copies
The blit shader path for buffer to image copies is pretty bad,
since it needs to produce a tiled image from the linear buffer
prior to emitting the blit copy.
This patch adds a new preferential path where we implement the
copy using the CPU, similar to what the GL driver does for
texture uploads. This makes vkQuake2 at least 4x faster when
dynamic lights are enabled (which triggers dynamic texture
updates).
We also tested a GPU path where we use a shader that takes the
linear buffer as a UBO and copies directly from it. This also
shows a clear performance gain, but still worse than the CPU
implementation.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 15 Jun 2020 08:49:11 +0000 (10:49 +0200)]
v3dv: add a TFU path for buffer to image copies
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 11 Jun 2020 09:59:24 +0000 (11:59 +0200)]
v3dv: try harder to skip emission of redundant state
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 11 Jun 2020 06:32:26 +0000 (08:32 +0200)]
v3dv: actually enable early Z
We had done all the plumbing for this but EZ can be disabled in 3 places
and we were never setting the enable bit in the configuration bits packet.
Also, configuration bits must not enable EZ if this has been disabled in
the RCL for the whole frame, which we do if we don't have a depth
attachment at all.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 10 Jun 2020 10:12:21 +0000 (12:12 +0200)]
v3dv: fix release build warnings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 9 Jun 2020 10:06:50 +0000 (12:06 +0200)]
v3dv: fix a few cases where we were ignoring suballocated buffers
This gets VkQuake2 to render correctly.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 9 Jun 2020 12:31:40 +0000 (14:31 +0200)]
v3dv: regen BO lists for CLs inside cloned jobs
Otherwise cloned BO lists point to the original list objects and not
the cloned ones, and that will confuse anything that tries to iterate over
them, such as list_length(), leading to infinite loops.
Fixes (in debug mode):
dEQP-VK.api.command_buffers.render_pass_continue
In that test we clone a full CL job from a secondary, and without this,
the BO lists in its CL lists will point to the bo_list field in the
original job, leading to an infinite loop as we assert the expected size
of these lists at queue submit time in handle_cl_job.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Fri, 5 Jun 2020 23:42:58 +0000 (01:42 +0200)]
v3dv/meta-copy: add uintptr_t casting to avoid warning
Without it, on the rpi4 (and any 32-bit SO) we would get a warning
about wrong sizes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 8 Jun 2020 08:13:22 +0000 (10:13 +0200)]
v3dv: fix BCL start offset in presence of chained BOs
If a job's BCL spans multiple BOs we should take the start offset of the
BCL from the first BO in the list.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 4 Jun 2020 09:14:10 +0000 (11:14 +0200)]
v3dv: warn users that this is not a conformant driver
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 4 Jun 2020 07:03:42 +0000 (09:03 +0200)]
v3dv: add stubs for missing API implementations
Asserting on them makes it easier to identify applications and tests that
try to use unimplemented features.
Also, there are some APIs that relate to optional features we don't
(or can't) support, such as sparse, so for these we just provide
the trivial implementation.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Tue, 2 Jun 2020 23:22:48 +0000 (01:22 +0200)]
v3dv/descriptor: use descriptor pool bo for image/samplers
This allows us to remove some individual bos for the image and
sampler, used to store the SAMPLER_STATE and TEXTURE_SHADER_STATE. Now
they are prepacked on static memory as part of the vulkan object
struct.
This commit introduces small descriptor structs, used to define what
the bo subregion would contain. It is used mostly to compute offsets
to that specific data, and define the size needed. Having said so, it
would be possible to replace them with some kind of flag (like anv) or
just compute the offset based on the context.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Tue, 2 Jun 2020 23:10:01 +0000 (01:10 +0200)]
v3dv/descriptor: add general bo on descriptor pool
So far we were saving all the descriptor info on the host memory. With
this commit we do the equivalent that other mesa vulkan drivers (Anvil
and Turnip) and create a bo on the descriptor pool that would be
suballocated for each descriptor.
This would allow to clean up individual bos from some vulkan objects,
reducing device memory fragmentation, and allowing to avoid to alloc
bos for that info. After all, pre-allocating needed memory is one of
the purposes of the descriptor pool.
This commit introduces all the infrastructure, but doesn't use it for
any descriptor yet, as if no descriptor needed data uploaded to a bo.
The idea to decide which info goes to the descriptor pool bo is info
that we would need to upload to a bo in any case, as it is referenced
as an address by any packet.
We could be more aggressive with that general rule, but that would be
enough for now. If in the future we support
VK_EXT_descriptor_indexing, we probably would need to store more info,
as under that extension, descriptors can be updated after being bound.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 2 Jun 2020 11:13:43 +0000 (13:13 +0200)]
v3dv: don't leak attachment state
We were assuming that if the command buffer state doesn't have any
attachments (as per the attachment count) the attachment state array
should not be allocated, however, during meta operations it is
possible that the attachment state grows (since meta operations can
emit render passes of their own). In that case, we would grow the
state for the meta operation but then pop the previous attachment
count and we would leak the state.
An example of that is a secondary command buffer which has no
attachment state by default since it doesn't execute a render pass
begin, but that executes one in a meta operation (for
vkCmdClearAttachments for example).
Fix this by making the attachment count an allocation count instead
and not popping it once we finish a meta operation. Also, always free
the state so long as there is a valid pointer, and assert that the
allocated count is not zero in that case.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 2 Jun 2020 10:26:50 +0000 (12:26 +0200)]
v3dv: support vkCmdClearAttachments in secondary command buffers
The main change we are introducing here is that now we allow secondary
command buffers that execute in a render pass to have a job list with
more than one job.
The main issue with vkCmdClearAttachments is that we currently need
this to spawn multiple jobs to clear multilayered framebuffers, as we
need to setup a different 2D framebuffer for each layer to clear and
therefore emit a different RCL for each. We could avoid this
completely by used layered rendering with the "clear rect" path to
redirect the clear rects to appropriate layers of the primary
framebuffer, however, our hardware only supports layered rendering
with geometry shaders, which we don't support at present.
Because vkCmdClearAttachments relies on having framebuffer state
available (something we would not need if we used the geometry shader
implementation), if this is not available in the secondary we need to
postpone emission of the command until the secondary is executed
inside a primary. We do this by using a new CPU job
V3DV_JOB_TYPE_CPU_CLEAR_ATTACHMENTS that is processed during
vkCmdExecuteCommands by calling vkCmdClearAttachments directly in the
primary.
As a consequence of these changes, it is now possible that a secondary
command buffer that runs inside a render pass have any kind of job in
its job list, including partial CLs that need to be branched to and
full CLs that need to be submitted to the GPU as is, so we introduced
a new GPU job type V3DV_JOB_TYPE_GPU_CL_SECONDARY to identify partial
CLs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 1 Jun 2020 10:00:16 +0000 (12:00 +0200)]
v3dv: implement vkCmdWaitEvents for secondary command buffers
Event waits can be safely moved before a render pass start, since
event setting and resetting commands cannot happen inside one. We
don't need to go that far, but we can use this to record the wait
in its own separate job and then execute this job before the
binning commands recorded in the secondary command buffer when
we execute the secondary into a primary.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 26 May 2020 10:05:43 +0000 (12:05 +0200)]
v3dv: add basic support for secondary command buffers
There are basically two types of scenarios to consider:
- Secondary command buffers that run inside a render pass.
- Secondary command buffers that run outside a render pass.
For the former we want to record their commands into a binning command
list that we can branch to when executed into a primary command
buffer. This means this kind of command buffers don't spawn new jobs,
just the default one where they record the binning commands which
won't include the frame setup, which will be provided by the primary
they will be executed in.
For the latter we don't require anything special, we just record as
many jobs as we need as usual and link that job list from the primary
job list when executed.
This handles most scenarios except:
- vkCmdWaitForEvents
- VkCmdClearAttachments
Both of these can spawn new jobs inside a render pass, which is not
what we want for secondary command buffers. We will address this is
follow-up patches.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 29 May 2020 10:00:12 +0000 (12:00 +0200)]
v3dv: fix bogus command buffer allocation scopes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 29 May 2020 09:59:34 +0000 (11:59 +0200)]
v3dv: handle OOM properly during command buffer recording in more places
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 28 May 2020 07:14:30 +0000 (09:14 +0200)]
v3dv: ensure BCL space is available before emitting packets
We should always do this. So far we have been getting away with this
because we overallocate at v3dv_job_start_frame, but that won't do
for secondary command buffers for example, it is also unreliable
if CLs grow past that initial allocation.
In the future, we might want to fix our emit macros so they do the
allocation check implicitly, which would simplify the code and would
make this process a lot less error prone.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 26 May 2020 06:38:31 +0000 (08:38 +0200)]
v3dv: check that GPU device matches requirements
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 25 May 2020 08:32:01 +0000 (10:32 +0200)]
v3dv: assert command buffers are executable when submitting to a queue
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 25 May 2020 08:28:07 +0000 (10:28 +0200)]
v3dv: remove some unnecessary / unused functions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 25 May 2020 07:56:23 +0000 (09:56 +0200)]
v3dv: drop the extra BO handling from the command buffer
Now that we have a framework to register objects allocated internally
by the driver we can just use that.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 25 May 2020 07:41:33 +0000 (09:41 +0200)]
v3dv: make TLB clearing paths return true/false
We are currently able to clear any supported format using the TLB, but
this is more consistent with other parts of the code and is what we want
should we add any formats in the future where we can't get away with
TLB clears.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 22 May 2020 12:27:38 +0000 (14:27 +0200)]
v3dv: fix vkResetCommandPool
During a command buffer reset we call cmd_buffer_init(), which will
add the command buffer to the pool, so make sure we remove it first
and that we use a safe iterator when resetting a pool.
Fixes:
dEQP-VK.api.command_buffers.pool_reset_reuse
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 22 May 2020 07:03:32 +0000 (09:03 +0200)]
v3dv: don't leak BOs from CLs when using BRANCH
Keep the list of BOs referenced in the CL and free all of them
when the CL is destroyed.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Thu, 21 May 2020 21:28:58 +0000 (23:28 +0200)]
v3dv/pipeline: support for specialization constants
That it is justconvert VkSpecializationInfo to
nir_spirv_specialization and pass it to spirv_to_nir.
The code is also basically the same used by anv, tu, and radv
Eventually it would make sense to move it to a common place.
Note that we are using calloc there to allocate the temporary
spec_entries. Trying to use vk_alloc2 causes some problems with the
nir_validate.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Alejandro Piñeiro [Thu, 21 May 2020 13:18:44 +0000 (15:18 +0200)]
v3dv/cmd_buffer: move variant checking to CmdDraw
In order to properly check (and possibly compile) shader variants we
need a pipeline and a compatible descriptor set. So far we were trying
to do that check as early as possible, so we were trying to do it at
CmdBindPipeline or CmdBindDescriptorSets, and a combination of dirty
flags. This showed to not cover all the corners cases, and made the
code complex, as needed to handle cases where the descriptors were not
yet available, and return early. The latter also meant that we were
running several checks that failed in the middle.
This commit moves the variant check to CmdDraw, when we should have a
pipeline and compatible descriptor sets, and simplifies and makes more
strict the existing code.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 18 May 2020 08:41:11 +0000 (10:41 +0200)]
v3dv: implement events
This reverts a previous half-attempt at an implementation of events
using a BO to hold the event state, and provides a full
implementation. V3D doesn't have any built-in GPU functionality to
wait on any kind of events, so we need to implement this in the driver
an therefore we no longer need to use a BO for the event state.
Instead, we implement GPU waits by using a CPU job for the wait
operation that spawns a wait thread if the wait operation doesn't have
all its events signaled by the time it is processed. To implement the
semantics of the wait correctly, any jobs in the same command buffer
that come after the wait will not be emitted until the wait thread
completes.
If a submit spawns any wait threads for a command buffer we can't
signal any semaphores for it until all the wait threads complete and
we know that all the jobs for those command buffers have been
submitted. The same applies to the submit fence, if present.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Fri, 15 May 2020 08:46:13 +0000 (10:46 +0200)]
v3dv: make the driver more robust against OOM
This is generally very difficult to handle properly everywhere, but
at least this is good enough to make the few CTS tests for this happy.
Fixes (on Rpi4):
dEQP-VK.wsi.xlib.swapchain.simulate_oom.*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 14 May 2020 10:09:57 +0000 (12:09 +0200)]
v3dv: fix depth/stencil clears on hardware
There is a hw bug by which the only way to clear the depth/stencil
tile buffers is to emit a clear of all tile buffers, so if we have
to do any such clears, we just emit a single clear of all tile
buffers and skip doing any per-buffer clears, even for color buffers,
since they would be redundant.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Thu, 14 May 2020 07:23:40 +0000 (09:23 +0200)]
v3dv: fix the command buffer private object framework for 32-bit
We were declaring the destroy callback function as taking a pointer for the
vulkan object handle and relying on an implicit conversion to the Vulkan
handle type, however that would be incorrect on 32-bit platforms, where
non-dispatchable Vulkan objects (the kind that we may allocate privately during
command buffer recording), are defined as uint64_t, so the signature of the
destry callback type doesn't match the signature of the actual Vulkan
function, leading to bogus results. Fix that by using uint64_t instead.
This fixes compilation warnings and also crashes in some tests when
compiling and executing natively in Rpi4.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 13 May 2020 10:32:29 +0000 (12:32 +0200)]
v3dv: fix dynamic blend constants
We were pre-packing the constants from the pipeline state and then
always emitting that at draw time, ignoring dynamic state. This makes
it so we don't prepack at pipeline creation time and we always emit
the correct constants directly the command buffer dynamic state.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 13 May 2020 10:21:55 +0000 (12:21 +0200)]
v3dv: implement wide lines
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 13 May 2020 09:21:12 +0000 (11:21 +0200)]
v3dv: ignore dynamic updates of depth bounds state
Depth bounds testing is not available in V3D 4.2 so we just ignore
this piece of state and assert if any pipeline attempts to enable
the feature.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Wed, 13 May 2020 08:35:30 +0000 (10:35 +0200)]
v3dv: implement depth bias
This doesn't implement depth bias clamp, which requires to support the
depth bias clamp feature, which we do not advertise as available at present.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 12 May 2020 08:39:54 +0000 (10:39 +0200)]
v3dv: drop blit path for depth/stencil formats
We can now implement all depth/stencil blits as compatible color blits,
so let's just have the blit shader interface simply convert any blit with
a depth/stencil format to a compatible color blit (like we were already
doing for s8d24) and get rid of the depth blitting path. This also allows
us to ignore the blit aspect in the blit pipeline cache key.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Tue, 12 May 2020 07:53:08 +0000 (09:53 +0200)]
v3dv: do not rewrite blit spec for combined depth/stencil in get_blit_pipeline
Now that our blit shader interface supports color writemasks and swizzles,
users can specify depth/stencil blits as color blits properly when needed,
so let's just do instead, which is more straight forward and less error prone.
Because s8d24 to s8d24 blits always require the same conversion to color blit,
the blit shader will handle these automatically, including blits of just one
aspect, however, for scenarios where there are additional semantics to consider
(particularly, copies from/to buffer), it is still up to the blit shader caller
to specify a proper color blit matching the required semantics.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 11 May 2020 06:14:15 +0000 (08:14 +0200)]
v3dv: implement partial image to buffer copies
We implement this by blitting the requested region to a linear image
setup to use the buffer memory store at the requested offset.
Because we can't store linear depth/stencil images, we implement
copies of depth/stencil aspects by using a compatible color blit.
To do this, we also need to account for the fact that when we are
copying depth from a d24 format we need to copy them from the MSB
24-bits of each word as provided by the hardware and store them
in the LSB 24-bit of the buffer (as per Vulkan requirements). This
is achieved by expanding our blit interface to also accept a swizzle
to apply to the source texture.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
Iago Toral Quiroga [Mon, 11 May 2020 06:05:59 +0000 (08:05 +0200)]
v3dv: only require 4-byte alignment for linear images
The page alignment requirement is for UIF images only, and for linear
images it is actually useful to use a 4-byte alignment so we can
use them to write images to linear buffers at arbitrary positions, which
we will need when copying subrects of an image to a buffer.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>