platform/upstream/mesa.git
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>

3 years agogitlab-ci: add broadcom vulkan driver
Alejandro Piñeiro [Thu, 1 Oct 2020 10:08:17 +0000 (12:08 +0200)]
gitlab-ci: add broadcom vulkan driver

At this point we are only interested to test if it keeps building.

v2: include meson-arm64 (Eric)

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

3 years agov3dv: add v3d vulkan driver skeleton
Alejandro Piñeiro [Mon, 25 Nov 2019 15:29:12 +0000 (16:29 +0100)]
v3dv: add v3d vulkan driver skeleton

Initial commit, mostly a import of the minimum from anv/radv to get a
skeleton to start to work with.

In includes:
 * meson files
 * Copy & adapt entrypoints ane extensions scripts from anv (that were
   later used on radv)

This is a firt approach, but is is likely that we can remove/simplify
some things.

v2: fix copyright character at broadcom/vulkan/meson.build (Eric)
v3: no spaces inside arrays (Dylan)
v4: add gnu_symbol_visibility (detected by CI on first Merge attemp)

Reviewed-by: Eric Anholt <eric@anholt.net>
squash! v3dv: add v3d vulkan driver skeleton

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

3 years agoglsl: Initialize ir_to_mesa_visitor members in constructor.
Vinson Lee [Thu, 8 Oct 2020 21:55:17 +0000 (14:55 -0700)]
glsl: Initialize ir_to_mesa_visitor members in constructor.

Fix defects reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member ctx is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member prog is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member shader_program is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member options is not initialized in this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7071>

3 years agosvga: Remove unused printf argument.
Vinson Lee [Thu, 8 Oct 2020 22:27:01 +0000 (15:27 -0700)]
svga: Remove unused printf argument.

Fix defect reported by Coverity Scan.

Extra argument to printf format specifier (PRINTF_ARGS)
extra_argument: This argument was not used by the format string: tex->handle.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7072>

3 years agoutil/xmlconfig: Initialize xmlconfig member options in constructor.
Vinson Lee [Wed, 30 Sep 2020 00:27:48 +0000 (17:27 -0700)]
util/xmlconfig: Initialize xmlconfig member options in constructor.

Fix defects reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member field options.info is not
initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member field options.values is not
initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member field options.tableSize is not
initialized in this constructor nor in any functions that it calls.

Suggested-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Acked-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6929>

3 years agozink: do not report SSBOs as halfway supported
Erik Faye-Lund [Tue, 13 Oct 2020 13:18:20 +0000 (15:18 +0200)]
zink: do not report SSBOs as halfway supported

We don't support SSBOs yet, as we don't expose the
PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT-cap. But the gallium
state-tracker's limit-calculation gets confused by this half-way
support, and ends up thinking we can support atomics, which we
don't support yet either.

So let's not confuse the state-tracker here, and let's introduce this
again when SSBOs are actually supported.

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

3 years agoscons: fix SPIR-V -> NIR build
Rhys Perry [Mon, 12 Oct 2020 13:39:27 +0000 (14:39 +0100)]
scons: fix SPIR-V -> NIR build

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Fixes: 18f9fc919e1 ('spirv: add and use a generator id enum')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7096>

3 years agoaco: fix get_ssbo_size with a vgpr resource
Rhys Perry [Mon, 12 Oct 2020 13:07:01 +0000 (14:07 +0100)]
aco: fix get_ssbo_size with a vgpr resource

The result of load_vulkan_descriptor is passed directly to get_ssbo_size.
This caused convert_pointer_to_64_bit() to skip creating a
v_readfirstlane_b32 if it was necessary.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Fixes: 05b6612b4ec ('radv: do not lower UBO/SSBO access to offsets')
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3628
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7095>

3 years agonir/opt_uniform_atomics: don't optimize atomics twice
Rhys Perry [Tue, 1 Sep 2020 16:39:35 +0000 (17:39 +0100)]
nir/opt_uniform_atomics: don't optimize atomics twice

Applications sometimes already do this optimization themselves.

fossil-db (Navi):
Totals from 51 (0.04% of 135946) affected shaders:
CodeSize: 507484 -> 501860 (-1.11%)
Instrs: 99635 -> 98471 (-1.17%)
Cycles: 2421944 -> 2414780 (-0.30%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agonir/opt_uniform_atomics: optimize image atomics
Rhys Perry [Tue, 1 Sep 2020 16:40:32 +0000 (17:40 +0100)]
nir/opt_uniform_atomics: optimize image atomics

fossil-db (Navi):
Totals from 65 (0.05% of 135946) affected shaders:
SGPRs: 3792 -> 3784 (-0.21%)
VGPRs: 2784 -> 2716 (-2.44%)
CodeSize: 707492 -> 713080 (+0.79%)
MaxWaves: 873 -> 887 (+1.60%)
Instrs: 133376 -> 134524 (+0.86%)
Cycles: 3004772 -> 3011440 (+0.22%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agoaco: use nir_opt_uniform_atomics
Rhys Perry [Tue, 1 Sep 2020 16:42:45 +0000 (17:42 +0100)]
aco: use nir_opt_uniform_atomics

Significantly improves performance of a Control compute shader. Also seems
to increase FPS at the very start of the game by ~9% (RX 580, 1080p,
medium settings, no MSAA).

fossil-db (Navi):
Totals from 315 (0.23% of 135946) affected shaders:
SGPRs: 18296 -> 18336 (+0.22%); split: -0.26%, +0.48%
VGPRs: 11856 -> 11844 (-0.10%); split: -0.81%, +0.71%
CodeSize: 2233800 -> 2457508 (+10.01%)
MaxWaves: 4506 -> 4497 (-0.20%); split: +0.04%, -0.24%
Instrs: 438766 -> 486215 (+10.81%); split: -0.00%, +10.81%
Cycles: 7880180 -> 8963340 (+13.75%); split: -0.00%, +13.75%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agonir: add pass to optimize uniform atomics
Rhys Perry [Tue, 1 Sep 2020 15:31:37 +0000 (16:31 +0100)]
nir: add pass to optimize uniform atomics

This optimizes atomics with a uniform offset so that only one atomic
operation is done in the subgroup.

For shaders which do a very large amount of atomics, this can
significantly improve performance.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agonir: allow divergence information to be updated when inserting instruction
Rhys Perry [Wed, 2 Sep 2020 10:48:20 +0000 (11:48 +0100)]
nir: allow divergence information to be updated when inserting instruction

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agonir: move divergence analysis options to nir_shader_compiler_options
Rhys Perry [Wed, 2 Sep 2020 10:45:46 +0000 (11:45 +0100)]
nir: move divergence analysis options to nir_shader_compiler_options

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agoaco: implement last_invocation
Rhys Perry [Tue, 1 Sep 2020 15:31:02 +0000 (16:31 +0100)]
aco: implement last_invocation

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agonir: add last_invocation intrinsic
Rhys Perry [Tue, 1 Sep 2020 15:30:34 +0000 (16:30 +0100)]
nir: add last_invocation intrinsic

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agoradv/aco,nir/lower_subgroups: don't lower elect
Rhys Perry [Tue, 1 Sep 2020 15:35:24 +0000 (16:35 +0100)]
radv/aco,nir/lower_subgroups: don't lower elect

ACO can implement this better.

fossil-db (Navi):
Totals from 33 (0.02% of 135946) affected shaders:
SGPRs: 1736 -> 1744 (+0.46%)
VGPRs: 1680 -> 1656 (-1.43%)
CodeSize: 246160 -> 245916 (-0.10%); split: -0.14%, +0.04%
MaxWaves: 449 -> 461 (+2.67%)
Instrs: 48301 -> 48266 (-0.07%); split: -0.12%, +0.05%
Cycles: 469740 -> 469240 (-0.11%); split: -0.18%, +0.08%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agoaco: implement elect
Rhys Perry [Tue, 1 Sep 2020 15:36:58 +0000 (16:36 +0100)]
aco: implement elect

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agoaco: optimize more uniform reductions/scans
Rhys Perry [Tue, 1 Sep 2020 15:30:06 +0000 (16:30 +0100)]
aco: optimize more uniform reductions/scans

Uniform atomic optimization will create these.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6558>

3 years agonir: update ubo locations in nir_lower_uniforms_to_ubo
Mike Blumenkrantz [Wed, 29 Jul 2020 23:27:35 +0000 (19:27 -0400)]
nir: update ubo locations in nir_lower_uniforms_to_ubo

locations are important for these because they provide info about how
many block indices each ubo takes up

UBO arrays have nonzero values here. all non-array UBOs have either 0
for the base or nonzero for an io lowered block at an offset,
but only arrays need to be changed here because they're the only ones
with absolute values, whereas all the others are relative.

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

3 years agoglsl: fix up location setting for variables pointing to a UBO's base
Mike Blumenkrantz [Thu, 9 Jul 2020 19:36:54 +0000 (15:36 -0400)]
glsl: fix up location setting for variables pointing to a UBO's base

while linking uniforms, we might get a variable which is the only reference
to the ubo (i.e., offset 0), as determined by its type being the UBO's
interface_type, at which point we can assign the previously-gotten
block index to this variable's location

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

3 years agozink: ARB_uniform_buffer_object is now implemented, so add cap and feature doc
Mike Blumenkrantz [Fri, 26 Jun 2020 19:57:11 +0000 (15:57 -0400)]
zink: ARB_uniform_buffer_object is now implemented, so add cap and feature doc

fixes mesa/mesa#2872

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

3 years agozink: support loading any UBO
Erik Faye-Lund [Fri, 9 Oct 2020 11:35:43 +0000 (13:35 +0200)]
zink: support loading any UBO

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

3 years agozink: support non-const offsets
Erik Faye-Lund [Fri, 9 Oct 2020 11:21:53 +0000 (13:21 +0200)]
zink: support non-const offsets

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

3 years agozink: use nir_lower_ubo_vec4 to simplify things a bit
Erik Faye-Lund [Fri, 9 Oct 2020 11:18:37 +0000 (13:18 +0200)]
zink: use nir_lower_ubo_vec4 to simplify things a bit

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

3 years agoaco: implement missing nir_op_unpack_half_2x16_split_{x,y}_flush_to_zero
Samuel Pitoiset [Wed, 30 Sep 2020 13:41:00 +0000 (15:41 +0200)]
aco: implement missing nir_op_unpack_half_2x16_split_{x,y}_flush_to_zero

SPIRV->NIR emits nir_op_unpack_half_2x16_flush_to_zero instead of
nir_op_unpack_half_2x16 if the shader enables denorm flush to zero
for 16-bit floating point.

This doesn't fix anything known and CTS doesn't have tests.

Fixes: 56d9bcdded8 ("radv: enable more float_controls features")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6939>

3 years agoandroid: fix SPIR-V -> NIR build
Rhys Perry [Mon, 12 Oct 2020 13:44:36 +0000 (14:44 +0100)]
android: fix SPIR-V -> NIR build

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Mauro Rossi <issor.oruam@gmail.com>
Fixes: 18f9fc919e1 ('spirv: add and use a generator id enum')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7097>

3 years agodocs: fix 20.2.0 relnotes
Eric Engestrom [Mon, 12 Oct 2020 21:41:29 +0000 (23:41 +0200)]
docs: fix 20.2.0 relnotes

Fixes: ddad8d9c983e04267115 ("docs: add release notes for 20.2.0")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7107>

3 years agodocs: fix release calendar
Eric Engestrom [Mon, 12 Oct 2020 21:31:23 +0000 (23:31 +0200)]
docs: fix release calendar

Fixes: 7d72110a1ceb38f7032b ("docs/release-calender: Add 20.2 stable releases")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7107>

3 years agodocs: fix relnotes index
Eric Engestrom [Mon, 12 Oct 2020 21:28:38 +0000 (23:28 +0200)]
docs: fix relnotes index

Add missing `.0` to 20.2.0 and fix bad merge.

Fixes: 63f61b084a5310c58eaf ("docs: update calendar and link releases notes for 20.2")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7107>

3 years agoradv: add missing u_atomic.h include
Eric Engestrom [Wed, 7 Oct 2020 18:52:42 +0000 (20:52 +0200)]
radv: add missing u_atomic.h include

Fixes: 7568c97df14f8702efcc ("radv: Use atomics to read query results.")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7050>

3 years agoradv: Fix mipmap extent adjustment on GFX9+.
Bas Nieuwenhuizen [Fri, 9 Oct 2020 01:12:55 +0000 (03:12 +0200)]
radv: Fix mipmap extent adjustment on GFX9+.

With arrays we really have to use the correct size for the base
mipmap to get the right array pitch. In particular, using
surf_pitch results in pitch that is bigger than the base mipmap
and hence results in wrong pitches computed by the HW.

It seems that on GFX9 this has mostly been hidden by the epitch
provided in the descriptor but this is not something we do on
GFX10 anymore.

Now this has some draw-backs:

1. normalized coordinates don't work
2. Bounds checking uses slightly bigger bounds.

2 mostly is not an issue as we still ensure that they're within
the texture memory and not overlapping other layers/mips, but
we can't properly ignore writes.

1 is kinda dead in the water ... On the other hand I'd argue that
using normalized coords & a filter for sampling a block view of
a compressed format is extraordinarily useless.

The old method we employed already had these drawbacks for everything
except the base miplevel of the imageview.

AFAICT this is the same tradeoff AMDVLK makes and no CTS test hits
this. (once it does I think the HW is dead in the water ... Only
workaround I can think of is shader processing which is hard because
we don't know texture formats at compile time.)

I also removed the extra calculations when the image has only 1 mip
level because they ended up being a no-op in that case.

CC: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2292
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2266
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2483
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2906
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3607
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7090>

3 years agozink: enable VK_EXT_shader_stencil_export
Mike Blumenkrantz [Sat, 10 Oct 2020 14:53:46 +0000 (10:53 -0400)]
zink: enable VK_EXT_shader_stencil_export

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

3 years agozink: add VK_EXT_pipeline_creation_cache_control
Mike Blumenkrantz [Thu, 8 Oct 2020 12:46:19 +0000 (08:46 -0400)]
zink: add VK_EXT_pipeline_creation_cache_control

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

3 years agozink: support VK_EXT_extended_dynamic_state
Mike Blumenkrantz [Wed, 16 Sep 2020 16:56:05 +0000 (12:56 -0400)]
zink: support VK_EXT_extended_dynamic_state

just the screen parts

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