Commit Graph

189 Commits

Author SHA1 Message Date
Iago Toral Quiroga c608e1350b v3dv: select correct internal type for depth/stencil formats
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:27 +00:00
Iago Toral Quiroga 0e59771339 v3dv: select the depth/stencil buffer from the attachment aspect mask
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:27 +00:00
Iago Toral Quiroga df34b8fac6 v3dv: compute subpass ranges for attachments at render pass creation time
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga a7a402c8bd v3dv: don't always skip tile buffer stores
Otherwise we would lose updates relevant to subsequent subpasses in
the same renderpass that read or partially write the attachment.

The only scenario where we can safely do this is on the last subpass
that uses the attachment, so long as we don't need to emit the store
for the clear.

This also fixes a bug in the computation of the first subpass that
uses an attachment.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 4d0e497a3e v3dv: implement support for depth testing
This ignores stencil for now and focuses on depth testing without
support for early depth testing.

To implement this we need to start considering how many of our
framebuffer attachments are color attachments, since some of the
computations we use to determine tile sizes and binning configuration
depend on this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga c005a18a56 v3dv: don't swap RB channels when copying images to buffers
We don't need to do this, since we are just copying. Also, we are not
swapping on the store, so doing it on the load would be incorrect.
This gets the prime blit present path in WSI common to render R/B
channels correctly after blitting from the BGRA image to the linear
buffer for display output.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 9a72a79d1c v3dv: rename drm device fields so they are more explict
Also, remove references to the master_fd. This is only useful for
VK_KHR_display which we are not currently implementing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 356cf8261e v3dv: allocate winsys BOs properly
When running on real hardware we need to allocate winsys buffers on
the display device and import them into the v3d device for rendering.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 1d92c314f8 v3dv: implement device detection on actual hardware
When running on the real hardware we have two devices: the v3d render
node and the vc4 display node. We need the latter to allocate
winsys BOs for v3d to render into. Since exporting these BOs is
a privileged operation, we need to obtain the fd for this device
through the display server. For now we only support doing this through
the XCB DRI3 platform.

Also, do not duplicate or re-open the DRM devices when creating logical
devices. The simulator checks that the file descriptor is exactly
the same we used to initialize it when we created the physical device
and aborts if it sees a different fd number, even if it points to the
same device.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 1ae844c1c8 v3dv/pipeline: adding some nir-based linking
Among other things, gets a constants output from a vs, used as input
to a fs, to get lowered and moved as a load const on the fs.

Heavily based on st_glsl_to_nir, already used by the v3d
driver. Slightly adapted to our needs, but there are still room for
customization.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro dc45d57c38 v3d/cmd_buffer: emit flat_shade/noperspective/centroid flags
We just emit the default ZERO_ALL values, to cover at least the cases
where that is enough. Need to emit non-default values if needed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 6cac991d3f v3dv: stubs for Create/DestroyPipelineCache
Good enough to avoid vkrunner crashing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 6ab4c51d5c v3dv: hook up WSI support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga c75846e674 v3dv: implement DRM modifier setup for WSI
This is only really relevant when running on real hardware, since
when we run on the simulator we don't care about the format of the
swapchain images.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 4825a76a22 v3dv: implement vkGetImageSubresourceLayout
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 54374f36df v3dv: fix copy image to buffer
If either of bufferRowLength or bufferImageHeight are zero, then that
aspect alone of the image is tighly packed. We were assuming that if
either was zero both aspects were tightly packed, which is wrong.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga beee18103e v3dv: implement VK_KHR_external_memory{_fd,_dma_buf}
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 0fd434d977 v3dv: implement VK_KHR_external_memory_capabilities
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 931b247a7c v3dv/format: add R32G32B32A32_SFLOAT format
This is clearly supported, and we already confirmed that work with
some of our tests.

Needed to avoid an assertion of such tests when validation layers are
enabled.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 0fd72b6ac4 v3dv: implement VK_KHR_get_physical_device_properties2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga ecd0b1f4b1 v3dv: include Vulkan version 1.1 as unsupported.
This is so we can generate entry points for extensions that have been
promoted to core in 1.1.

Entry points for promoted extensions are aliased without the KHR suffix
in the Vulkan API XML, and the entry point generation scripts are designed
to point the dispatch tables to entry points generated from the non-aliased
function names, however, these are not included in the header file without
this change.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 5935ef098d v3dv: implement vkGetPhysicalDeviceSparseImageFormatProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 85f1f0690e v3dv: provide default values for input attributes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro aad44cc614 v3dv: vertex input support
This includes:

   * Implementation for CmdBindVertexBuffers

   * Gather vertex input info during CreateGraphicsPipelines
     (pipeline_init) and SHADER_STATE_ATTRIBUTE_RECORD prepacking

   * Final emission of such packet during CmdDraw
     (cmd_buffer_emit_graphics_pipeline)

Default attributes values will be handled on a following patch.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 8c4fcc2bf7 v3dv/pipeline: lower fs/vs inputs/outputs
For now mostly call to nir_assign_io_var_locations

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 45875065fd v3dv: support queue submissions with multiple command buffers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 047ee913e8 v3dv: implement fences
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 56b4eac8d6 v3dv: implement semaphore waits and signals on queue submissions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga d24dbd87ad v3dv: implement vk{Create,Destroy}Semaphore
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 0b08f83817 v3dv: implement vkDeviceWaitIdle
This is really a hack, but it is better than not having anything. In the
future we should have a syncobject that we could wait on.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 4279145124 v3dv: prepack VCM_CACHE_SIZE
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 5226928557 v3dv: partial prepack of the gl_shader_state_record
We can't prepack all the record, as addresses need the job, and
uniforms depend on dynamic value.

Also due cl_emit_with_prepacked and v3dv_pack asserting correct
values, we need to define two values twice, that lead to move
vpm_config to the pipeline. In any case, the latter will be useful
when we start to prepack more stuff.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 0e49c6237f v3dv/cmd_buffer: emit CFG_BITS
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga b60e5ef50e v3dv: handle VK_ATTACHMENT_UNUSED properly in more places
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 04e1a6f359 v3dv/cmd_buffer: rename render pass RCL emission helpers to be more explicit
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga a904b6f082 v3dv: create a helper to start a new frame
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga d902e68732 v3dv: rewrite the attachment needs clearing condition
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 8a5135e6b3 v3dv: fix tile buffer loading
So we do what we actually state in the comment. Particularly, the load
operation only affects the first subpass that uses the attachment,
after that we always want to load, but we were only doing that for
attachments marked as CLEAR.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 22e431e626 v3dv: merge subpasses into the same job when possible
Generally, we can do this when they render to the same collection of
attachments and we only need to emit a single RCL for them.

To implement this, we need to track the first subpass that is included
in the job and rewrite our loads and stores in the RCL to refer to that
subpass instead of the current subpass (which would be the last included
in the RCL).

When we merge jobs we also reuse the tile state/alloc BOs and we only
emit the binning setup once.

The environment variable V3DV_NO_MERGE_JOBS can be set to disable
job merging and have each subpass be in a separate job. This can be
useful for debugging issues spawning from incorrect subpass merges.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 0b5df86c98 v3dv: only clear attachments on the first subpass that uses them
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 2271489077 v3dv: rewrite attachment state tracking
Keep track of attachment state for each attachment in the renderpass
instead of tracking it only for the attachments in the current subpass.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 6379a552a7 v3dv: add a note on interactions between clearing and scissor
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 9f3fd1a3ca v3dv: fix clipping against render area
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 2baeb91ed7 v3dv: do not automatically emit a binner flush when finishing jobs
Binner flushes should be emitted naturally at the end of each draw,
if we are finishing a job and it doesn't have the binner flush, it
probably means that we have bogus emission code somewhere.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 7019700c5f v3dv: implement vkCmdPipelineBarrier
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 856d102037 v3dv: use the correct miplevel slice for the tile load operation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 3da6e6a190 v3dv: implement vkCmdNextSubpass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro be1531a8b7 v3dv/cmd_buffer: start jobs with CmdBeginRenderPass
We want to create jobs when we start a new render pass so that
commands in the first subpass have a job.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 5259175fe8 v3dv: add the concept of a job
As we make progress towards more complex submissions we will need to split
our command buffers into smaller executable units (jobs) that we can
submit indepdently to the kernel. This will be required to implement
pipeline barriers, split subpasses that have depedencies on previous
subpasses, split render passes that use more than 4 render targets, etc.

For now we keep things simple and we only keep one job as current
recording target in the command buffer, and we generate a new one
with every subpass or with any commands we see outside of a render pass
(only vkCopyImageToBuffer for now). In the future we probably want to
optimize this by merging subpasses into the same job when possible,
etc.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga aef5a5cbca v3dv: implement vkCmdCopyImageToBuffer
For now we only support the TLB path, which limits us to copying
regions that start at offset (0,0). In the future, we will need to add
a fallback path that uses blitting to copy regions with an offset.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 94b4e1869c v3dv: rename and make compute_tile_size_for_framebuffer() public
We will use this when we implement copying images to buffers using the
TLB, where we'll need to setup a framebuffer and tiling configuration
for the TLB store to the destination buffer.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 00cefce3ca v3dv: split framebuffer internal bpp calculations from tiling calculations
We want to reuse the latter aspect in a context were we already have
the internal bpp available.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 2b02117e64 v3dv: add v3dv_write_uniforms
Initial port of the equivalent v3d_write_uniforms, to be used by the
cmd_buffer when emitting the drawing packets.

Initially doesn't include all the quniform types, only those needed by
the initial basic vulkan tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro a3b440cc2a v3dv/cmd_buffer: cache viewport translate/scale
Before that commit we were calling get_viewport_xform to get those
values twice (to emit scissor and viewport), and we found that we
would need that info even more times. So let's just compute that info
when setting the viewport, and reuse the values.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro e252e536e4 v3dv: clif format dumping support
Add support for V3D_DEBUG=clif. Useful to compare clif_dumps from
vulkan small-programs and the equivalent opengl ones.

As we are here we expand clif_dump_packet wrapper to use
v3d42_clif_dump_packet if needed, as the vulkan driver would use that
packet version.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 15fb14ca1e v3dv/cmd_buffer: add shader source bos to cmd_buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 8431196eb0 v3dv/cmd_buffer: start to emit draw packets
Starting using only the packet VERTEX_ARRAY_PRIMS

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 67aa8029a8 v3dv/cmd_buffer: emit shader_state packets
Values still doesn't take into account having vertex elements data,
but keeps some of that half-done code in comments. It would be better
to do that when we get an example using it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga 746cfff3a6 v3dv: flush at the end of each subpass
We can't start a new BCL if we haven't flushed the current one, so
make sure we do that at the end of each subpass for now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Iago Toral Quiroga e163ea1118 v3dv: emit tile loads
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 29b6e29378 v3dv/cmd_buffer: emit Viewport packets
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 7bfe1db93c v3dv/cmd_buffer: emit Scissor packets
As this is done as part of CmdDraw, we also add the initial stub of
such function here

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro d479f86284 v3dv/cmd_buffer: init command buffer dynamic state during pipeline bind
So copying it from the pipeline to the cmd_buffer if defined.

Starting with Viewport/Scissor dynamic state.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro f752cdbab1 v3dv/pipeline: start to track dynamic state
Starting with Viewport/Scissor data from VkGraphicsPipelineCreateInfo.

Note that initially this can be somewhat counter-intuitive. What we
are really doing it is filling up the structs with the dynamic stuff
from the pipeline, when such is not defined as dynamic. This is what
anv/radv does, and basically means that we treat both in the same way,
so easier after that.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 5285d83974 v3dv: CmdSetViewport and CmdSetScissor implementation
This commit also introduces adding dynamic state definitions, dirty
flags, and setting them on such methods, although this commit still
doesn't use all that info yet.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro fca4dcee9f v3dv: initial stub for CmdBindPipeline
Right now it only sets the pipeline to the command buffer state.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 60145629a2 v3dv: initial CreateGraphicsPipeline/DestroyPipeline implementation
The basic to get the spirv built to nir, including calling some common
nir passes. Pending deep review if all those are needed or if we miss
some, but for that it would be better to be able to run existing
tests.

Enough to get assembly generated for simple tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:26 +00:00
Alejandro Piñeiro 6cb24a3b39 v3dv/format: add v3dv_get_format_swizzle
Heavily based on the equivalent v3d v3d_get_formar_swizzle.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 3f00638cff v3dv: setup color clear values at subpass setup time
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 9e6bf4eebc v3dv: be more conservative resetting command buffer state
We don't want to reset everything, but setting some pointer fields
to NULL should help debug issues better.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga cdc9660662 v3dv: implement vkQueueSubmit
For now this only supports a single command buffer submit without any kind
of sempaphores or fences involved.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 570ff24d3f v3dv: clear set of BOs in the command buffer on reset
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga bd3c28bf69 v3dv: keep track of the numbre of BOs in a command buffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga bb727684e8 v3dv: create the command buffer BO set before we init CLs
The init of the CLs doesn't create any BOs for now, but this looks
like a sensible decision to future-proof things.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 6e4471c14c v3dv: implement vkEndCommandBuffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga e6e80d3f9b v3dv: emit the render command list
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 61399b21c0 v3dv: emit scissor to render area and precompute hw color clear values
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 98697e1fb5 v3dv: precompute more tiling info at framebuffer creation time
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 3b8aeb7f50 v3dv: plug leak when destroying device
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga e6a7d88b53 v3dv: make v3dv_layer_offset public
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 14f72ee4f6 v3dv: implement vkDestroyImage and vkDestroyImageView
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 4075f8e221 v3dv: revert the decision that the command buffer takes ownership of BOs
The CLs in the command buffer will reference BOs allocated by the application
such as images and buffers, that will be destroyed by the application, so
destroying them with the command buffer won't be correct.

For now, let's just assume that the comman buffer only owns the BOs
it explicitly allocates and that other abstractions own their own
BOs and are responsible from freeing them.

In the future, we might consider a ref/unref system similar to v3d's, but
for now this should work.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga ec1d7e453e v3dv: add the tile state and alloc BOs to the command buffer BO list
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga ae235e0f22 v3dv: store base mip level in the image view
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 52d9b8c05b v3dv: add a few more API stubs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga bab28ab1e8 v3dv: make the command buffer own the command list BOs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 0020eb4f90 v3dv: implement vkCmdBeginRenderPass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 51705fc015 v3dv: compute tile size for framebuffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga cd24292fca v3dv: make v3dv_bo_alloc allocate memory for the bo struct
This is just going to be more convenient going forward.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 291cd6e77b v3dv: implement vkGetPhysicalDeviceImageFormatProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 3cf527ab7a v3dv: start handling command buffer status
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 9bb6d6f1ba v3dv: implement vkBeginCommandBuffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 9ac3261076 v3dv: add a concept of a command list
Just barebones for now, will expand as necessary as we start emitting
actual commands into command lists.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga dc005f2677 v3dv: create a v3dv_bo struct and reference it from v3dv_device_memory
So we have a lower level representation of a buffer object that we can
manipulate that is not tied to a Vulkan representation of memory. This
will be useful as we start allocating driver internal buffers, such as
command lists.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga d9a7ba317c v3dv: implement vk{Allocate,Free}CommandBuffers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 1d8d8c06b8 v3dv: implement vkCreateCommandPool
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga e07b657f01 v3dv: implement vk{Create,Destroy}Framebuffer
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga c95904f83e v3dv: implement vk{Create,Destroy}RenderPass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga cdba5361fe v3dv: implement vkCreateRenderPass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 582ebb040c v3dv: implement vkBindBufferMemory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00