platform/upstream/mesa.git
3 years agov3dv: rewrite attachment state tracking
Iago Toral Quiroga [Thu, 9 Jan 2020 11:50:43 +0000 (12:50 +0100)]
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>

3 years agov3dv: add a note on interactions between clearing and scissor
Iago Toral Quiroga [Thu, 9 Jan 2020 09:53:36 +0000 (10:53 +0100)]
v3dv: add a note on interactions between clearing and scissor

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

3 years agov3dv: fix clipping against render area
Iago Toral Quiroga [Thu, 9 Jan 2020 09:24:27 +0000 (10:24 +0100)]
v3dv: fix clipping against render area

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

3 years agov3dv: do not automatically emit a binner flush when finishing jobs
Iago Toral Quiroga [Thu, 9 Jan 2020 08:31:01 +0000 (09:31 +0100)]
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>

3 years agov3dv: implement vkCmdPipelineBarrier
Iago Toral Quiroga [Thu, 9 Jan 2020 08:26:10 +0000 (09:26 +0100)]
v3dv: implement vkCmdPipelineBarrier

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

3 years agov3dv: use the correct miplevel slice for the tile load operation
Iago Toral Quiroga [Wed, 8 Jan 2020 13:35:26 +0000 (14:35 +0100)]
v3dv: use the correct miplevel slice for the tile load operation

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

3 years agov3dv: implement vkCmdNextSubpass
Iago Toral Quiroga [Wed, 8 Jan 2020 11:16:39 +0000 (12:16 +0100)]
v3dv: implement vkCmdNextSubpass

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

3 years agov3d/compiler: update uses_vid/uses_iid check
Alejandro Piñeiro [Wed, 8 Jan 2020 09:56:17 +0000 (10:56 +0100)]
v3d/compiler: update uses_vid/uses_iid check

In order to take into account the vulkan specific system values
SYSTEM_VALUE_INSTANCE_INDEX and SYSTEM_VALUE_VERTEX_ID_ZERO_BASE.

Reviewed-by: Iago Toral <itoral@igalia.com>
Reviewed-by: Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

3 years agov3dv/cmd_buffer: start jobs with CmdBeginRenderPass
Alejandro Piñeiro [Wed, 8 Jan 2020 11:00:49 +0000 (12:00 +0100)]
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>

3 years agov3dv: add the concept of a job
Iago Toral Quiroga [Wed, 8 Jan 2020 10:14:35 +0000 (11:14 +0100)]
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>

3 years agov3dv: implement vkCmdCopyImageToBuffer
Iago Toral Quiroga [Tue, 7 Jan 2020 07:19:47 +0000 (08:19 +0100)]
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>

3 years agov3dv: rename and make compute_tile_size_for_framebuffer() public
Iago Toral Quiroga [Tue, 7 Jan 2020 07:46:12 +0000 (08:46 +0100)]
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>

3 years agov3dv: split framebuffer internal bpp calculations from tiling calculations
Iago Toral Quiroga [Tue, 7 Jan 2020 07:42:38 +0000 (08:42 +0100)]
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>

3 years agov3dv: add v3dv_write_uniforms
Alejandro Piñeiro [Fri, 3 Jan 2020 11:43:35 +0000 (12:43 +0100)]
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>

3 years agov3dv/cmd_buffer: cache viewport translate/scale
Alejandro Piñeiro [Fri, 3 Jan 2020 11:27:08 +0000 (12:27 +0100)]
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>

3 years agov3dv: clif format dumping support
Alejandro Piñeiro [Thu, 2 Jan 2020 12:31:59 +0000 (13:31 +0100)]
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>

3 years agov3dv/cmd_buffer: add shader source bos to cmd_buffer
Alejandro Piñeiro [Thu, 2 Jan 2020 11:52:30 +0000 (12:52 +0100)]
v3dv/cmd_buffer: add shader source bos to cmd_buffer

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

3 years agov3dv/cmd_buffer: start to emit draw packets
Alejandro Piñeiro [Thu, 2 Jan 2020 11:34:43 +0000 (12:34 +0100)]
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>

3 years agov3dv/cmd_buffer: emit shader_state packets
Alejandro Piñeiro [Mon, 30 Dec 2019 12:01:44 +0000 (13:01 +0100)]
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>

3 years agov3dv: flush at the end of each subpass
Iago Toral Quiroga [Fri, 3 Jan 2020 10:27:01 +0000 (11:27 +0100)]
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>

3 years agov3dv: emit tile loads
Iago Toral Quiroga [Thu, 2 Jan 2020 10:33:06 +0000 (11:33 +0100)]
v3dv: emit tile loads

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

3 years agov3dv/cmd_buffer: emit Viewport packets
Alejandro Piñeiro [Fri, 27 Dec 2019 15:13:31 +0000 (16:13 +0100)]
v3dv/cmd_buffer: emit Viewport packets

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

3 years agov3dv/cmd_buffer: emit Scissor packets
Alejandro Piñeiro [Sat, 28 Dec 2019 10:42:53 +0000 (11:42 +0100)]
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>

3 years agov3dv/cmd_buffer: init command buffer dynamic state during pipeline bind
Alejandro Piñeiro [Sat, 28 Dec 2019 11:20:45 +0000 (12:20 +0100)]
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>

3 years agov3dv/pipeline: start to track dynamic state
Alejandro Piñeiro [Sat, 28 Dec 2019 11:11:48 +0000 (12:11 +0100)]
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>

3 years agov3dv: CmdSetViewport and CmdSetScissor implementation
Alejandro Piñeiro [Sat, 28 Dec 2019 10:59:32 +0000 (11:59 +0100)]
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>

3 years agov3dv: initial stub for CmdBindPipeline
Alejandro Piñeiro [Wed, 18 Dec 2019 14:38:21 +0000 (15:38 +0100)]
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>

3 years agov3dv: initial CreateGraphicsPipeline/DestroyPipeline implementation
Alejandro Piñeiro [Mon, 2 Dec 2019 12:59:04 +0000 (13:59 +0100)]
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>

3 years agov3dv/format: add v3dv_get_format_swizzle
Alejandro Piñeiro [Tue, 10 Dec 2019 14:15:06 +0000 (15:15 +0100)]
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>

3 years agov3d/compiler: num_tex_used on v3d_key
Alejandro Piñeiro [Mon, 16 Dec 2019 11:11:37 +0000 (12:11 +0100)]
v3d/compiler: num_tex_used on v3d_key

We would need on OpenGL to update values for all the textures used. On
OpenGL that value can be always took from the context or the nir
shader, but there are cases on Vulkan that it is not the case, or
would force up to recompute it.

Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>

3 years agov3dv: setup color clear values at subpass setup time
Iago Toral Quiroga [Wed, 18 Dec 2019 10:44:35 +0000 (11:44 +0100)]
v3dv: setup color clear values at subpass setup time

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

3 years agov3dv: be more conservative resetting command buffer state
Iago Toral Quiroga [Wed, 18 Dec 2019 10:19:32 +0000 (11:19 +0100)]
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>

3 years agov3dv: implement vkQueueSubmit
Iago Toral Quiroga [Tue, 17 Dec 2019 10:39:36 +0000 (11:39 +0100)]
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>

3 years agov3dv: clear set of BOs in the command buffer on reset
Iago Toral Quiroga [Tue, 17 Dec 2019 10:38:36 +0000 (11:38 +0100)]
v3dv: clear set of BOs in the command buffer on reset

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

3 years agov3dv: keep track of the numbre of BOs in a command buffer
Iago Toral Quiroga [Tue, 17 Dec 2019 10:32:15 +0000 (11:32 +0100)]
v3dv: keep track of the numbre of BOs in a command buffer

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

3 years agov3dv: create the command buffer BO set before we init CLs
Iago Toral Quiroga [Tue, 17 Dec 2019 10:30:23 +0000 (11:30 +0100)]
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>

3 years agov3dv: implement vkEndCommandBuffer
Iago Toral Quiroga [Tue, 17 Dec 2019 08:48:54 +0000 (09:48 +0100)]
v3dv: implement vkEndCommandBuffer

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

3 years agov3dv: emit the render command list
Iago Toral Quiroga [Tue, 17 Dec 2019 08:01:32 +0000 (09:01 +0100)]
v3dv: emit the render command list

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

3 years agov3dv: emit scissor to render area and precompute hw color clear values
Iago Toral Quiroga [Tue, 17 Dec 2019 07:58:20 +0000 (08:58 +0100)]
v3dv: emit scissor to render area and precompute hw color clear values

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

3 years agov3dv: precompute more tiling info at framebuffer creation time
Iago Toral Quiroga [Tue, 17 Dec 2019 07:51:33 +0000 (08:51 +0100)]
v3dv: precompute more tiling info at framebuffer creation time

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

3 years agov3dv: plug leak when destroying device
Iago Toral Quiroga [Tue, 17 Dec 2019 07:48:52 +0000 (08:48 +0100)]
v3dv: plug leak when destroying device

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

3 years agov3dv: make v3dv_layer_offset public
Iago Toral Quiroga [Tue, 17 Dec 2019 07:48:10 +0000 (08:48 +0100)]
v3dv: make v3dv_layer_offset public

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

3 years agov3dv: implement vkDestroyImage and vkDestroyImageView
Iago Toral Quiroga [Tue, 17 Dec 2019 07:47:08 +0000 (08:47 +0100)]
v3dv: implement vkDestroyImage and vkDestroyImageView

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

3 years agov3dv: revert the decision that the command buffer takes ownership of BOs
Iago Toral Quiroga [Tue, 17 Dec 2019 07:41:35 +0000 (08:41 +0100)]
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>

3 years agov3dv: add the tile state and alloc BOs to the command buffer BO list
Iago Toral Quiroga [Mon, 16 Dec 2019 16:18:55 +0000 (17:18 +0100)]
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>

3 years agov3dv: store base mip level in the image view
Iago Toral Quiroga [Mon, 16 Dec 2019 13:21:29 +0000 (14:21 +0100)]
v3dv: store base mip level in the image view

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

3 years agov3dv: add a few more API stubs
Iago Toral Quiroga [Mon, 16 Dec 2019 08:09:40 +0000 (09:09 +0100)]
v3dv: add a few more API stubs

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

3 years agov3dv: make the command buffer own the command list BOs
Iago Toral Quiroga [Mon, 16 Dec 2019 08:05:07 +0000 (09:05 +0100)]
v3dv: make the command buffer own the command list BOs

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

3 years agov3dv: implement vkCmdBeginRenderPass
Iago Toral Quiroga [Fri, 13 Dec 2019 09:48:12 +0000 (10:48 +0100)]
v3dv: implement vkCmdBeginRenderPass

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

3 years agov3dv: compute tile size for framebuffer
Iago Toral Quiroga [Fri, 13 Dec 2019 09:31:05 +0000 (10:31 +0100)]
v3dv: compute tile size for framebuffer

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

3 years agov3dv: make v3dv_bo_alloc allocate memory for the bo struct
Iago Toral Quiroga [Thu, 12 Dec 2019 10:02:04 +0000 (11:02 +0100)]
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>

3 years agov3dv: implement vkGetPhysicalDeviceImageFormatProperties
Iago Toral Quiroga [Thu, 12 Dec 2019 09:14:42 +0000 (10:14 +0100)]
v3dv: implement vkGetPhysicalDeviceImageFormatProperties

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

3 years agov3dv: start handling command buffer status
Iago Toral Quiroga [Wed, 11 Dec 2019 10:57:08 +0000 (11:57 +0100)]
v3dv: start handling command buffer status

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

3 years agov3dv: implement vkBeginCommandBuffer
Iago Toral Quiroga [Wed, 11 Dec 2019 09:14:10 +0000 (10:14 +0100)]
v3dv: implement vkBeginCommandBuffer

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

3 years agov3dv: add a concept of a command list
Iago Toral Quiroga [Wed, 11 Dec 2019 09:10:27 +0000 (10:10 +0100)]
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>

3 years agov3dv: create a v3dv_bo struct and reference it from v3dv_device_memory
Iago Toral Quiroga [Tue, 10 Dec 2019 11:00:49 +0000 (12:00 +0100)]
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>

3 years agov3dv: implement vk{Allocate,Free}CommandBuffers
Iago Toral Quiroga [Tue, 10 Dec 2019 08:33:13 +0000 (09:33 +0100)]
v3dv: implement vk{Allocate,Free}CommandBuffers

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

3 years agov3dv: implement vkCreateCommandPool
Iago Toral Quiroga [Tue, 10 Dec 2019 08:03:49 +0000 (09:03 +0100)]
v3dv: implement vkCreateCommandPool

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

3 years agov3dv: implement vk{Create,Destroy}Framebuffer
Iago Toral Quiroga [Mon, 9 Dec 2019 12:16:16 +0000 (13:16 +0100)]
v3dv: implement vk{Create,Destroy}Framebuffer

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

3 years agov3dv: implement vk{Create,Destroy}RenderPass
Iago Toral Quiroga [Mon, 9 Dec 2019 11:16:35 +0000 (12:16 +0100)]
v3dv: implement vk{Create,Destroy}RenderPass

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

3 years agov3dv: implement vkCreateRenderPass
Iago Toral Quiroga [Mon, 9 Dec 2019 10:16:09 +0000 (11:16 +0100)]
v3dv: implement vkCreateRenderPass

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

3 years agov3dv: implement vkBindBufferMemory
Iago Toral Quiroga [Mon, 9 Dec 2019 09:40:32 +0000 (10:40 +0100)]
v3dv: implement vkBindBufferMemory

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

3 years agov3dv: implement vkGetBufferMemoryRequirements
Iago Toral Quiroga [Mon, 9 Dec 2019 09:35:03 +0000 (10:35 +0100)]
v3dv: implement vkGetBufferMemoryRequirements

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

3 years agov3dv: implement vk{Create,Destroy}Buffer
Iago Toral Quiroga [Mon, 9 Dec 2019 09:07:36 +0000 (10:07 +0100)]
v3dv: implement vk{Create,Destroy}Buffer

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

3 years agov3dv: implement vkCreateImageView
Iago Toral Quiroga [Thu, 5 Dec 2019 11:35:02 +0000 (12:35 +0100)]
v3dv: implement vkCreateImageView

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

3 years agov3dv: implement vkBindImageMemory
Iago Toral Quiroga [Thu, 5 Dec 2019 09:36:24 +0000 (10:36 +0100)]
v3dv: implement vkBindImageMemory

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

3 years agov3dv: implement vkUnmapMemory
Iago Toral Quiroga [Wed, 4 Dec 2019 11:29:00 +0000 (12:29 +0100)]
v3dv: implement vkUnmapMemory

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

3 years agov3dv: implement vkMapMemory
Iago Toral Quiroga [Wed, 4 Dec 2019 11:21:35 +0000 (12:21 +0100)]
v3dv: implement vkMapMemory

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

3 years agov3dv: implement vkFreeMemory
Iago Toral Quiroga [Wed, 4 Dec 2019 09:58:05 +0000 (10:58 +0100)]
v3dv: implement vkFreeMemory

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

3 years agov3dv: implement vkAllocateMemory
Iago Toral Quiroga [Wed, 4 Dec 2019 09:39:01 +0000 (10:39 +0100)]
v3dv: implement vkAllocateMemory

Removed MAX_MEMORY_ALLOCATION_SIZE definition because that comes from
VK_KHR_maintenance3 which we don't support yet. We can care about that
when we iplement it.

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

3 years agov3dv: initialize mememory heaps in the physical device
Iago Toral Quiroga [Wed, 4 Dec 2019 09:25:21 +0000 (10:25 +0100)]
v3dv: initialize mememory heaps in the physical device

When we allocate memory we will be referring to memory types by index
so this is more convenient.

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

3 years agov3dv: implement vkGetImageMemoryRequirements
Iago Toral Quiroga [Wed, 4 Dec 2019 08:24:03 +0000 (09:24 +0100)]
v3dv: implement vkGetImageMemoryRequirements

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

3 years agov3dv: Create/DestroyShaderModule implementation
Alejandro Piñeiro [Mon, 2 Dec 2019 10:47:25 +0000 (11:47 +0100)]
v3dv: Create/DestroyShaderModule implementation

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

3 years agov3dv: stubs for graphics pipeline methods
Alejandro Piñeiro [Sat, 30 Nov 2019 21:59:23 +0000 (22:59 +0100)]
v3dv: stubs for graphics pipeline methods

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

3 years agov3dv/debug: add v3dv_debug
Alejandro Piñeiro [Mon, 2 Dec 2019 21:43:35 +0000 (22:43 +0100)]
v3dv/debug: add v3dv_debug

Note that for the Vulkan driver we are also reusing v3d_debug.h. This
file is for debug utilities exclusive to the Vulkan driver.

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

3 years agov3dv/debug: plug v3d_debug
Alejandro Piñeiro [Tue, 3 Dec 2019 09:54:52 +0000 (10:54 +0100)]
v3dv/debug: plug v3d_debug

Right now there is not a big reason/difference to implement the
utilities present at v3d_debug for the vulkan driver, so lets just
reuse it.

The other advantage is that is the debug utilities used by common
parts of the driver, like broadcom/compiler

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

3 years agov3dv: implement vkCreateImage
Iago Toral Quiroga [Tue, 3 Dec 2019 11:54:30 +0000 (12:54 +0100)]
v3dv: implement vkCreateImage

This relies heavily in infrastructure taken from the v3d driver. We should
probably look for ways to share the code between both drivers by creating
a surface layout library that we can use from both, or at least moving
parts of the v3d driver to broadcom/common. Specifically:

We take v3d_tiling.c, which requires gallium's pipe_box type for some
helper functions that we don't quite need yet.

We copied and adapted bits of v3d_resource.c into v3dv_image.c, however,
it should be possible to look for ways to reuse the code instead of
duplicating it.

Pre-compute UIF padding into the slice setup. This is different from
what we do in v3d (we do this at cerate_surface time), but it is
more convenient for us to pre-calculate it here for all mipmap
slices.

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

3 years agov3dv: add stub for vkDeviceWaitIdle
Iago Toral Quiroga [Tue, 3 Dec 2019 08:15:43 +0000 (09:15 +0100)]
v3dv: add stub for vkDeviceWaitIdle

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

3 years agov3dv: implement vkEnumerate{Instance,Device}LayerProperties
Iago Toral Quiroga [Tue, 3 Dec 2019 08:10:10 +0000 (09:10 +0100)]
v3dv: implement vkEnumerate{Instance,Device}LayerProperties

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

3 years agov3dv: add some basic support for format properties
Iago Toral Quiroga [Mon, 2 Dec 2019 12:19:59 +0000 (13:19 +0100)]
v3dv: add some basic support for format properties

This takes a subset of vk_format_info.h from Anvil which has some
Intel specific elements. At some point we might want to discuss
if we want to make the file reusable and move the intel bits to
some other place, but it is not a lot of code and for now this works,
so we keep going.

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

3 years agov3dv: add stubs for the format table and vkGetPhysicalDeviceFormatProperties
Iago Toral Quiroga [Mon, 2 Dec 2019 10:25:28 +0000 (11:25 +0100)]
v3dv: add stubs for the format table and vkGetPhysicalDeviceFormatProperties

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

3 years agov3dv: add dummy implementations for the packet definition generator
Iago Toral Quiroga [Mon, 2 Dec 2019 10:23:08 +0000 (11:23 +0100)]
v3dv: add dummy implementations for the packet definition generator

For now we are only interested in being able to include the header
file for format definitions, so this is enough. When we start actually
emitting packets we will need to provide proper hooks.

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

3 years agov3dv: implement vkGetDeviceQueue
Iago Toral Quiroga [Mon, 2 Dec 2019 08:49:50 +0000 (09:49 +0100)]
v3dv: implement vkGetDeviceQueue

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

3 years agov3dv: implement vkCreateDevice
Iago Toral Quiroga [Fri, 29 Nov 2019 11:44:40 +0000 (12:44 +0100)]
v3dv: implement vkCreateDevice

We will probably have to amend this as we make progress with the
implementation, but for now this is enough.

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

3 years agov3dv: implement vkGetPhysicalDeviceQueueFamilyProperties
Iago Toral Quiroga [Fri, 29 Nov 2019 10:33:37 +0000 (11:33 +0100)]
v3dv: implement vkGetPhysicalDeviceQueueFamilyProperties

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

3 years agov3dv: amend vkEnumerateInstanceExtensionProperties to handle layers
Iago Toral Quiroga [Fri, 29 Nov 2019 10:09:51 +0000 (11:09 +0100)]
v3dv: amend vkEnumerateInstanceExtensionProperties to handle layers

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

3 years agov3dv: implement vkEnumerateDeviceExtensionProperties
Iago Toral Quiroga [Fri, 29 Nov 2019 10:06:25 +0000 (11:06 +0100)]
v3dv: implement vkEnumerateDeviceExtensionProperties

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

3 years agov3dv: implement vkGetPhysicalDeviceFeatures
Iago Toral Quiroga [Fri, 29 Nov 2019 09:58:53 +0000 (10:58 +0100)]
v3dv: implement vkGetPhysicalDeviceFeatures

For now we don't support any optional feature, we will turn them on
as they get implemented.

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

3 years agov3dv: implement vkGetPhysicalDeviceMemoryProperties
Iago Toral Quiroga [Fri, 29 Nov 2019 09:37:49 +0000 (10:37 +0100)]
v3dv: implement vkGetPhysicalDeviceMemoryProperties

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

3 years agov3dv: add a comment to clarify how we should implement uuid / deviceID retrieval
Iago Toral Quiroga [Fri, 29 Nov 2019 09:22:26 +0000 (10:22 +0100)]
v3dv: add a comment to clarify how we should implement uuid / deviceID retrieval

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

3 years agov3dv: retrieve device name from device info
Iago Toral Quiroga [Fri, 29 Nov 2019 08:01:56 +0000 (09:01 +0100)]
v3dv: retrieve device name from device info

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

3 years agov3dv: add support to use v3d simulator
Alejandro Piñeiro [Fri, 29 Nov 2019 12:55:38 +0000 (13:55 +0100)]
v3dv: add support to use v3d simulator

v2: use spaces on both sides of ':'

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

3 years agov3dv: Implement vkGetPhysicalDeviceProperties
Iago Toral Quiroga [Thu, 28 Nov 2019 11:47:19 +0000 (12:47 +0100)]
v3dv: Implement vkGetPhysicalDeviceProperties

This is just something to get us going. We will need to tune all these
limits as we make progress with driver features.

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

3 years agov3dv: pretend to initialize a physical device
Iago Toral Quiroga [Thu, 28 Nov 2019 08:48:29 +0000 (09:48 +0100)]
v3dv: pretend to initialize a physical device

Just to keep us moving forward for now. Later, we should probably
revisit this after running on real hardware or after enabling
the simulator.

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

3 years agov3dv: memory management stubs
Alejandro Piñeiro [Wed, 27 Nov 2019 21:08:51 +0000 (22:08 +0100)]
v3dv: memory management stubs

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

3 years agov3dv: implement vkEnumeratePhysicalDevices
Iago Toral Quiroga [Wed, 27 Nov 2019 12:58:02 +0000 (13:58 +0100)]
v3dv: implement vkEnumeratePhysicalDevices

Not an actual implementation since this doesn't initialize any actual
physical devices just yet.

Also, this doesn't check that available decices are really compatible
with the driver for now. This is for convenience, so we can move
past this point even if we are not running on actual hardware.

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

3 years agov3dv: implement vkDestroyInstance
Iago Toral Quiroga [Wed, 27 Nov 2019 11:43:36 +0000 (12:43 +0100)]
v3dv: implement vkDestroyInstance

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

3 years agov3dv: implement vkCreateInstance
Iago Toral Quiroga [Wed, 27 Nov 2019 10:49:49 +0000 (11:49 +0100)]
v3dv: implement vkCreateInstance

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

3 years agov3dv: add support for valgrind macros
Iago Toral Quiroga [Wed, 27 Nov 2019 10:49:12 +0000 (11:49 +0100)]
v3dv: add support for valgrind macros

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

3 years agov3dv: add support for VK_EXT_debug_report
Alejandro Piñeiro [Wed, 27 Nov 2019 10:24:22 +0000 (11:24 +0100)]
v3dv: add support for VK_EXT_debug_report

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