Commit Graph

129414 Commits

Author SHA1 Message Date
Iago Toral Quiroga cff9f08d31 v3dv: implement vkMapMemory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga d1d97ea746 v3dv: implement vkFreeMemory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 85632e4685 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 33bb395621 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 4c80097756 v3dv: implement vkGetImageMemoryRequirements
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Alejandro Piñeiro dc1fbeb0f4 v3dv: Create/DestroyShaderModule implementation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Alejandro Piñeiro a201c45000 v3dv: stubs for graphics pipeline methods
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Alejandro Piñeiro 46fa01f431 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>
2020-10-13 21:21:25 +00:00
Alejandro Piñeiro ccdc5a7bd4 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 0fcce6c319 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga d5dd157775 v3dv: add stub for vkDeviceWaitIdle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 7a045cf5b3 v3dv: implement vkEnumerate{Instance,Device}LayerProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 871ac1ed33 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 63e23a9b2a v3dv: add stubs for the format table and vkGetPhysicalDeviceFormatProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 9cc736f5aa 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 8d9772f6a7 v3dv: implement vkGetDeviceQueue
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 41a5719927 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 1c9f9d8fcb v3dv: implement vkGetPhysicalDeviceQueueFamilyProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 37472a6aa3 v3dv: amend vkEnumerateInstanceExtensionProperties to handle layers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga c2dd7bf634 v3dv: implement vkEnumerateDeviceExtensionProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 10e8967b9b 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga e75d462950 v3dv: implement vkGetPhysicalDeviceMemoryProperties
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 0f0a0145a9 v3dv: add a comment to clarify how we should implement uuid / deviceID retrieval
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 9de4ab17c5 v3dv: retrieve device name from device info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Alejandro Piñeiro 4e88e2d4a9 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga 0e0f18ae5e 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga fc52dc8d7d 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>
2020-10-13 21:21:25 +00:00
Alejandro Piñeiro 36e07a0ab9 v3dv: memory management stubs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga fd81dc64ff 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>
2020-10-13 21:21:25 +00:00
Iago Toral Quiroga dbce41f39b v3dv: implement vkDestroyInstance
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:24 +00:00
Iago Toral Quiroga be1575c625 v3dv: implement vkCreateInstance
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:24 +00:00
Iago Toral Quiroga 20363b0bb9 v3dv: add support for valgrind macros
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:24 +00:00
Alejandro Piñeiro 2f383f9747 v3dv: add support for VK_EXT_debug_report
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6766>
2020-10-13 21:21:24 +00:00
Alejandro Piñeiro e4af07be76 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>
2020-10-13 21:21:24 +00:00
Alejandro Piñeiro e5034f0d0d 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>
2020-10-13 21:21:24 +00:00
Vinson Lee bdb1e5aa0a 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>
2020-10-13 21:07:24 +00:00
Vinson Lee 6529cbd0bc 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>
2020-10-13 21:00:01 +00:00
Vinson Lee 12c20cbac0 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>
2020-10-13 13:34:53 -07:00
Erik Faye-Lund 77c1b01508 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>
2020-10-13 16:55:22 +00:00
Rhys Perry 044d213086 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: 18f9fc919e ('spirv: add and use a generator id enum')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7096>
2020-10-13 16:53:10 +01:00
Rhys Perry c122315702 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: 05b6612b4e ('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>
2020-10-13 14:20:28 +00:00
Rhys Perry a7114f3f46 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>
2020-10-13 12:47:21 +00:00
Rhys Perry bc43650522 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>
2020-10-13 12:47:21 +00:00
Rhys Perry bcf7a70008 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>
2020-10-13 12:47:21 +00:00
Rhys Perry f83bc5beb8 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>
2020-10-13 12:47:21 +00:00
Rhys Perry 37b6b0967c 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>
2020-10-13 12:47:21 +00:00
Rhys Perry e1120f274f 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>
2020-10-13 12:47:21 +00:00
Rhys Perry bb5c0ba0d2 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>
2020-10-13 12:47:21 +00:00
Rhys Perry 1a912a550f 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>
2020-10-13 12:47:20 +00:00
Rhys Perry 8850a63161 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>
2020-10-13 12:47:20 +00:00