Commit Graph

235 Commits

Author SHA1 Message Date
Roman Stratiienko 2686c5419d v3dv: add Android support
Acknowledgements to android-rpi team and lineage-rpi maintainer (KonstaT)
for creating/testing initial vulkan support. Their experience was used as
a baseline for this work.

Most of the code is a copy of turnip and anv.
Improved by cleaning dEQP failures:

 - Improved gralloc support (use allocation time stride, size, modifier).
 - Fixed some dEQP crashes due to memory allocation issues.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14016>
2021-12-21 09:24:43 +00:00
Roman Stratiienko 2cbbfd23ce v3dv: Hotfix: Rename remaining V3DV_HAS_SURFACE->V3DV_USE_WSI_PLATFORM
This was somehow missed by me and during review.

Fixes fcfc4ddfccd5: ("v3dv: Fix V3DV_HAS_SURFACE preprocessor condition")

Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14190>
2021-12-14 10:33:28 +00:00
Roman Stratiienko fcfc4ddfcc v3dv: Fix V3DV_HAS_SURFACE preprocessor condition
Currently V3DV_HAS_SURFACE is always defined.
There is no WSI for Android in mesa3d, therefore WSI related extensions
should not be exposed.

1. Define V3DV_HAS_SURFACE only for platforms which has WSI implemented.
2. Rename V3DV_HAS_SURFACE -> V3DV_USE_WSI_PLATFORM to align naming
with other platforms.

Fixes dEQP-VK.wsi.android.surface#query_protected_capabilities

Fixes: 79e4451430 ("v3dv: move extensions table to v3dv_device")
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14144>
2021-12-13 07:11:20 +00:00
Roman Stratiienko 72db15913f v3dv: Fix dEQP-VK.info#instance_extensions test
When mesa3d is built without VK_USE_PLATFORM_DISPLAY_KHR definition,
dEQP test fails:

    dEQP    : Test case 'dEQP-VK.info.instance_extensions'..
    dEQP    :   Fail (Extension VK_KHR_get_display_properties2 is missing
                                                 dependency: VK_KHR_display)
    dEQP    : DONE!

Enable KHR_get_display_properties2 only if VK_USE_PLATFORM_DISPLAY_KHR
is enabled.

Fixes: f884c2e3be ("v3dv: implement VK_KHR_get_display_properties2")
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14047>
2021-12-08 21:34:47 +00:00
Ella Stanforth 3c86292321 v3dv: Implement VK_KHR_create_renderpass2
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13575>
2021-11-02 07:43:31 +00:00
Iago Toral Quiroga acb83e1b13 v3dv: enable Vulkan 1.1
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13465>
2021-10-21 10:12:38 +02:00
Ella-0 9ee060b614 v3dv: enable VK_KHR_swapchain_mutable_format
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13297>
2021-10-15 08:36:36 +00:00
Ella-0 835b98e101 v3dv: implement VK_EXT_host_query_reset
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13319>
2021-10-15 05:36:42 +00:00
Jason Ekstrand dfed852ddf v3dv: Use the common WSI wrappers
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>
2021-10-13 00:06:15 +00:00
Ella-0 17dcdb000a v3dv: enable VK_KHR_surface_protected_capabilities
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13298>
2021-10-12 22:12:46 +00:00
Jason Ekstrand bab0530f07 v3dv: Switch to the new vk_error helpers
Also, change every vk_error to use the closest object instead of
fetching all the way back to the instance.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045>
2021-10-07 20:51:36 +00:00
Alejandro Piñeiro bc5892b7fc v3dv: use NULL for vk_error on initialization failures
This commit fixes two issues:

  * On CreateInstance, we are freeing the instance, and then trying to
    use it when calling vk_error. This could be problematic, so let's
    just use NULL.

  * On CreateDevice, we are getting a unsupported feature error, and
    then trying to call vk_error using the instance. That's is not
    really a instance error, and will assert when the ongoing common
    vk_error lands mesa. Let's use NULL instead, as the object it
    applies, the device, was not created.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13219>
2021-10-06 11:42:28 +02:00
Tapani Pälli f056fb1e56 v3dv: remove feature checks from device creation
This is already handled by vk_device_init(); drivers no longer
need to do it themselves.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12867>
2021-10-01 17:37:02 +00:00
Jason Ekstrand 01622bee5e v3dv: Use the common GetDeviceQueue implementation
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:26 +00:00
Jason Ekstrand 713af72048 v3dv: Drop v3dv_queue::flags
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Jason Ekstrand b2313b6884 vulkan: Add the pCreateInfo to vk_queue_init()
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13003>
2021-09-28 21:08:25 +00:00
Yevhenii Kolesnikov c9dbd3c06e v3dv: Use a common vk_queue structure
Switch to using common structure.

Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13000>
2021-09-23 15:57:46 +00:00
Iago Toral Quiroga 09cb4e3010 v3dv: start using Broadcom's device identifiers
Instead of creating our own based on the V3D version. CTS waivers
are registered using a combination of VendorID and DeviceID, so if
we want to reuse any wavers filed by Broadcom we want to use the
same identifiers. We are already using the Broadcom VendorId, so
let's start using the same deviceID as well.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12865>
2021-09-15 12:54:48 +00:00
Ella-0 bd0f9283f8 v3dv: Implement VK_EXT_vertex_attribute_divisor
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12524>
2021-09-12 21:01:20 +00:00
Ella-0 43790a4d08 v3dv: Expose correct point size granularity
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12524>
2021-09-12 21:01:20 +00:00
Iago Toral Quiroga 38d79d00a1 v3dv: honor VkPhysicalDeviceFeatures2 in pNext chain of VkDeviceCreateInfo
Fixes:
dEQP-VK.robustness.buffer_access.through_pointers.*.reads.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12718>
2021-09-06 08:11:42 +02:00
Iago Toral Quiroga 0496a39b1f v3dv: make v3dv_image_view derive from vk_image_view
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12668>
2021-09-02 05:53:39 +00:00
Iago Toral Quiroga f1c6f05c35 v3dv: make v3dv_image derive from vk_image
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12668>
2021-09-02 05:53:39 +00:00
Ella-0 1e921e5098 v3dv: Implement VK_EXT_pipeline_creation_feedback
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12371>
2021-08-26 21:04:42 +00:00
Ella-0 123590b88c v3dv: Implement VK_EXT_provoking_vertex
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12382>
2021-08-17 07:49:41 +00:00
Ella-0 dad0c16782 v3dv: Implement VK_EXT_pipeline_creation_cache_control
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12381>
2021-08-16 20:41:03 +00:00
Ella-0 f623072328 v3dv: implement VK_EXT_color_write_enable
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11784>
2021-08-13 22:25:23 +00:00
Ella-0 23a9339985 v3dv: Implement VK_EXT_custom_border_color
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12076>
2021-08-02 22:55:33 +00:00
Iago Toral Quiroga 0b36c2916d v3dv: expose VK_KHR_multiview
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12034>
2021-07-27 07:31:32 +00:00
Andreas Bergmeier d6dd13a62e v3dv: implement VK_EXT_physical_device_drm
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9320>
2021-07-19 06:03:02 +00:00
Iago Toral Quiroga 642812239e v3dv: expose geometry shaders
A run of dEQP-VK.*geom* has 6328 test passes and 16 failures. 14 of
these failures are related to a CTS bug affecting atomic operations
for which I submitted a CL to Khronos. Another fail looks like it might
be a case of the error threshold in CTS being slightly low. There is
only one test fail in that list that looks like it might be an actual
driver bug, but it is a variable pointers test, so it might be unrelated
to geometry shaders in the end.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>
2021-07-12 09:25:28 +02:00
Iago Toral Quiroga b7cbb38222 v3dv: expose correct subgroup size
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11620>
2021-06-29 08:43:06 +02:00
Alejandro Piñeiro 2e40f13f9a v3dv: don't use cl_packet_length for prepacked data
cl_packet_length depends on the specific hw generation packets, so it
is can't be included directly by main header.

The straight forward solution would be to allocate them dynamically,
based on the current generation. That ended to be complex and
messy. Also, even if that change between hw versions, it will not
change significantly.

So we just add some definition with the size of the packets we
prepack. We just need to be careful that this needs to be the maximum
value considering all the versions supported.

Note that on Opengl v3d does something similar, using hardcoded
values, but without a define, neither a runtime check.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
2021-06-22 11:34:06 +02:00
Alejandro Piñeiro 1bea0d76b8 v3dv: split v3dv_descriptor hw version dependant to a new source file.
As part of this, we get rid of the v3dv_xxx_descriptor structs to
v3dv_descriptor. The main reason is that in order to support several
versions, we would need to define them several times. Also, they were
somewhat an overkill even before, as their main advantage was getting
the offset for each data on the combined case. That functionality is
replaced with some new helpers.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
2021-06-22 11:34:06 +02:00
Alejandro Piñeiro 76634f9b8a v3dv: split v3dv_device hw version dependant code to a new source file
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
2021-06-22 11:34:06 +02:00
Alejandro Piñeiro 1dc8c2d9f6 v3dv: rename v3dv_pack for v3dvx_pack
For consistency, as we use use the v3dvx convention to point that it
depends on the hw version. Also on OpenGL the equivalent macro is
v3dx_pack.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11310>
2021-06-22 11:34:06 +02:00
Iago Toral Quiroga b8abedb974 v3dv: expose VK_KHR_copy_commands2
Relevant CTS tests:
dEQP-VK.api.copy_and_blit.copy_commands2.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11443>
2021-06-21 06:00:56 +00:00
Iago Toral Quiroga cf2747e7ac v3dv: implement VK_EXT_index_type_uint8
Relevant CTS tests:
dEQP-VK.pipeline.input_assembly.*.index_type_uint8.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11444>
2021-06-17 12:26:44 +00:00
Charlie d9c53c50ad v3dv: enable ASTC formats
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11336>
2021-06-17 11:33:06 +00:00
Iago Toral Quiroga d873e30d3b v3dv: expose VK_KHR_shader_non_semantic_info
This is entirely implemented in the SPIR-V frontend.

Relevant CTS tests:
dEQP-VK.spirv_assembly.instruction.compute.non_semantic_info.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11440>
2021-06-17 08:49:16 +00:00
Iago Toral Quiroga 42b351370d v3dv: handle Vulkan 1.1 feature and property queries
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11316>
2021-06-14 06:26:43 +00:00
Charlie f389676173 v3dv: enable KHR_uniform_buffer_standard_layout
We already support this memory layout. All relevant CTS tests seem to
pass

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11276>
2021-06-10 15:04:23 +01:00
Charlie c8dffda633 v3dv: enable KHR_incremental_present
All bits should already be provided by wsi/common.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11276>
2021-06-10 15:04:12 +01:00
Charlie 1c97d06a68 v3dv: enable KHR_sampler_mirror_clamp_to_edge
This is already implemented

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11276>
2021-06-10 15:03:04 +01:00
Charlie be2b11003a v3dv: enable KHR_image_format_list
There's nothing checking for mutable formats, so this needs no changes

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11276>
2021-06-10 15:03:03 +01:00
Iago Toral Quiroga f884c2e3be v3dv: implement VK_KHR_get_display_properties2
This is entirely implemented in the common WSI code, we just need to
implement the API entry points.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11287>
2021-06-10 11:01:28 +00:00
Iago Toral Quiroga d84cd611eb v3dv: expose KHR_variable_pointers
We only support the VariablePointersStorageBuffer feature for now,
which is the only one that is mandatory, and for which we seem to
be passing all the relevant tests already.

Exposing the optional VariablePointers feature would require that
we support non-constant indexing on UBO/SSBO first.

Relevant CTS tests:
dEQP-VK.*pointer*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11257>
2021-06-10 05:47:29 +00:00
Iago Toral Quiroga 4886773fc0 v3dv: implement VK_KHR_descriptor_update_template
Relevant tests:
dEQP-VK.binding_model.*.with_template.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11213>
2021-06-07 11:10:49 +00:00
Iago Toral Quiroga 017a150984 v3dv: expose VK_KHR_storage_buffer_storage_class
This extension is basically only wrapping SPV_KHR_storage_buffer_storage_class
which is entirely implemented in the SPIR-V frontend.

Relevant CTS tests:
dEQP-VK.glsl.opaque_type_indexing.ssbo_storage_buffer_decoration.*
dEQP-VK.spirv_assembly.*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11184>
2021-06-07 06:09:01 +00:00
Iago Toral Quiroga 6add9b2753 v3dv: expose KHR_relaxed_block_layout
It seems our compiler already meets the requirements and we pass
all the relevant tests for this as far as I can see.

Relevant CTS tests:
dEQP-VK.ssbo.*relaxed*

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11159>
2021-06-04 08:44:41 +00:00