Eric Engestrom
8b319c6db8
radv: reformat according to its .clang-format
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23253 >
2023-06-16 19:59:52 +00:00
Dave Airlie
5deb476095
radv: align video images internal width/height inside the driver.
...
Due to how the decoders work, they will write garbage data into
the padding, and later using the image for sampling with linear
images will use the garbage to create broken results. Let the
user specify the image size and align it up in the driver, so
sampling of the image later has the correct w/h.
cc: mesa-stable
Reviewed-by: Lynne <dev@lynne.ee >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23227 >
2023-05-30 02:53:32 +00:00
Chia-I Wu
6aee7848bb
radv: improve externalMemoryFeatures for android ahb
...
VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT should always be set, as
required by the spec.
VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT should be set when
radv_ahb_format_for_vk_format knowns the format. That is,
radv_create_ahb_memory should at least know how to call
AHardwareBuffer_allocate.
VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT is always set. We can't know
if gralloc can allocate the format/flags/usage combo or not (gralloc
might use a private format for the combo).
Fixed
dEQP-VK.api.external.memory.android_hardware_buffer.image_formats.*.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22619 >
2023-05-11 22:18:03 +00:00
Chia-I Wu
47b37651f8
vulkan: add vk_image_format_to_ahb_format
...
There should be no functional change.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22619 >
2023-05-11 22:18:03 +00:00
Chia-I Wu
380180516c
anv,hasvk,radv: do not fall back to AHARDWAREBUFFER_FORMAT_BLOB
...
When allocating a VkDeviceMemory exportable as AHB, it seems incorrect
to fall back to AHARDWAREBUFFER_FORMAT_BLOB when the image has no known
AHB format. We should fail the allocation instead.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22619 >
2023-05-11 22:18:03 +00:00
Chia-I Wu
50e703f347
vulkan: add vk_ahb_format_to_image_format
...
There should be no functional change.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22619 >
2023-05-11 22:18:02 +00:00
Faith Ekstrand
b16cfe23ef
vulkan,anv,hasvk,radv: Unify Android hardware buffer creation
...
Reviewed-by: Lina Versace <lina@kiwitree.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22038 >
2023-03-31 14:57:03 +00:00
Faith Ekstrand
d75f797246
radv: Set vk_image.ahardware_buffer_format
...
Reviewed-by: Lina Versace <lina@kiwitree.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22038 >
2023-03-31 14:57:03 +00:00
Faith Ekstrand
41f88be282
vulkan,anv,hasvk,radv: Add a common vk_image_usage_to_ahb_usage helper
...
Reviewed-by: Lina Versace <lina@kiwitree.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22038 >
2023-03-31 14:57:03 +00:00
Yonggang Luo
09061e2fe9
vulkan: Use static_assert for check HWVULKAN_DISPATCH_MAGIC == ICD_LOADER_MAGIC
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21210 >
2023-02-10 07:21:31 +00:00
Friedrich Vock
d816859ede
radv: Use internal allocation helpers for internal allocations
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17331 >
2023-01-11 06:55:04 +00:00
Bas Nieuwenhuizen
f27f06d72c
radv: Add a 32bit memory type.
...
Got to put the commandbuffers & uploadbuffers there. With DGC
those can be allocated by the application.
Excluding it from all other buffers/images to avoid using the
precious 32bit address space.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17269 >
2022-07-15 14:45:13 +00:00
Eric Engestrom
9035408d62
radv: use updated tokens from vk.xml
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342 >
2022-07-12 15:53:11 +00:00
Konstantin Seurer
1727310ea1
radv: Use vk_buffer
...
Use vk_buffer as a base for radv_buffer and
replace manual handling of VK_WHOLE_SIZE with
vk_buffer_range.
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16764 >
2022-05-30 17:43:58 +00:00
Jason Ekstrand
c56f3dcbaa
radv: Use vk_image as the base for radv_image
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16376 >
2022-05-17 18:14:55 +00:00
Jason Ekstrand
b2073f5e5d
radv: Move QueueSignalReleaseImageANDROID to common code
...
This is mostly a copy+paste job but with a few syntax changes to make it
follow more closely with other common Vulkan code.
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14372 >
2022-01-05 16:36:10 +00:00
Jason Ekstrand
dfb1e1777c
anv,radv,v3dv: Move AcquireImageANDROID to common code
...
All three implementations are identical.
Reviewed-by: Eric Engestrom <eric@engestrom.ch >
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com >
Tested-by: Tapani Pälli <tapani.palli@intel.com >
Tested-by: Roman Stratiienko <r.stratiienko@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14372 >
2022-01-05 16:36:10 +00:00
Bas Nieuwenhuizen
46c59e8fd6
radv: Remove dependencies on vk_common entrypoints.
...
Fixes: 91fe0b5629 ("radv: Delete lots of sync code.")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14366 >
2021-12-31 17:49:10 +01:00
Bas Nieuwenhuizen
91fe0b5629
radv: Delete lots of sync code.
...
This make things all fall back to the common synchronization functions
which will switch things to the new submission path and to use
vk_fence and vk_semaphore.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
radv: Use common AcquireNextImage2KHR.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
radv: Use common functions for Metro Exodus layer.
Needs to be squashed with the big "switch the world" deletion patch
but kept it separate for review.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13974 >
2021-12-31 15:14:19 +00:00
Bas Nieuwenhuizen
66713d33fe
radv: Remove android build warning.
...
Shadowed variable.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13164 >
2021-11-09 20:51:14 +00:00
Samuel Pitoiset
4765edb4e0
radv: fix build errors with Android
...
Fixes: 49c3a88fad ("radv: implement VK_KHR_format_feature_flags2")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5518
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13450 >
2021-10-25 06:45:47 +00:00
Samuel Pitoiset
49c3a88fad
radv: implement VK_KHR_format_feature_flags2
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13194 >
2021-10-12 10:20:47 +00:00
Yiwei Zhang
8ebf0d1105
radv/anv android: rename buffer usage camera mask
...
AHARDWAREBUFFER_USAGE_CAMERA_MASK enum is defined later and gets
included in the stub headers.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org >
Reviewed-by: Chia-I Wu <olvaffe@gmail.com >
Reviewed-by: Ryan Neph <ryanneph@google.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13255 >
2021-10-09 00:42:32 +00:00
Jason Ekstrand
7a2516568d
radv: Switch to the new common 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: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13045 >
2021-10-07 20:51:36 +00:00
Bas Nieuwenhuizen
c6b8702eb4
radv: Fix Android build for common functions.
...
Fixes: 9fc16b66d0 ("radv: use common vkGetPhysicalDevice{Image}FormatProperties()")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5328
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12764 >
2021-10-03 00:36:58 +00:00
Bas Nieuwenhuizen
8025b4120f
radv/winsys: Return vulkan errors for buffer creation.
...
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10570 >
2021-07-05 17:27:51 +00:00
Samuel Pitoiset
2019014df9
radv: fix fd leak in vkAcquireImageANDROID()
...
Copied from ANV.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4915
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11518 >
2021-06-30 08:14:03 +02:00
Yiwei Zhang
ec1968dcc9
radv: fix build errors after commit 8b7ff784
...
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org >
Reviewed-by: Roman Stratiienko <r.stratiienko@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11373 >
2021-06-16 19:55:48 +00:00
Yiwei Zhang
c8e90a022e
radv: fix AHB leak upon exportable allocation
...
A successful AHardwareBuffer_allocate itself will increase a refcount on
the newly allocated AHB. For the import case, the implementation must
acquire a reference on the AHB. So if we layer the exportable allocation
on top of AHB allocation and AHB import, we must release an AHB
reference to avoid leak.
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org >
Reviewed-by: Tapani Pälli <tapani.palli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10940 >
2021-05-25 06:31:25 +00:00
Bas Nieuwenhuizen
59c501ca35
radv: Format.
...
Using
find ./src/amd/vulkan -regex '.*/.*\.\(c\|h\|cpp\)' | xargs -P8 -n1 clang-format --style=file -i
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10091 >
2021-04-10 03:31:58 +02:00
Samuel Pitoiset
e02b1577d0
radv/winsys: remove the radv_amdgpu_winsys_bo::ws indirection
...
This saves a 64-bit pointer from radv_amdgpu_winsys_bo and it's
also common to pass a winsys pointer as the first parameter.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8859 >
2021-02-08 08:45:38 +01:00
Mauro Rossi
b45c8a8671
android: radv: fix building error in radv_android.c
...
Fixes the following building error:
external/mesa/src/amd/vulkan/radv_android.c:752:77: error: too few arguments to function call, expected 4, have 3
VkResult result = radv_image_create_layout(device, create_info, mem->image);
~~~~~~~~~~~~~~~~~~~~~~~~ ^
external/mesa/src/amd/vulkan/radv_private.h:2175:1: note: 'radv_image_create_layout' declared here
VkResult
^
1 error generated.
Fixes: 7f7da82dbb ("radv: Add image layout with drm format modifiers.")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8899 >
2021-02-07 21:47:37 +01:00
Kristian H. Kristensen
db504c464f
radv/android: Remove unused variable
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6112 >
2020-08-05 18:08:07 +00:00
Mauro Rossi
80c135e6a6
radv: fix build on Android 7 (v2)
...
Fixes the following building error:
external/mesa/src/amd/vulkan/radv_android.c:28:10: fatal error:
'vndk/hardware_buffer.h' file not found
^~~~~~~~~~~~~~~~~~~~~~~~
(v2) use the existing preprocessor condition #if ANDROID_API_LEVEL >= 26
Fixes: f36b527 "radv/android: Add android hardware buffer queries."
Reported-and-tested-by: youling 257 <youling257@gmail.com >
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6051 >
2020-07-30 17:10:31 +00:00
Bas Nieuwenhuizen
ffb8020f6e
radv: Use correct semaphore handle type for Android import.
...
Coincidentally got a bugreport of a game that is broken without the import
fix below, but it turns out I made a copy-paste error as well ..
In good news it is clearly tested now.
Fixes: ad15149958 "radv: Set handle types in Android semaphore/fence import."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5783 >
2020-07-08 14:21:16 +00:00
Bas Nieuwenhuizen
ad15149958
radv: Set handle types in Android semaphore/fence import.
...
Seems like we forgot to set it all this time ...
Fixes: b1444c9ccb "radv: Implement VK_ANDROID_native_buffer."
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5759 >
2020-07-06 13:40:49 +00:00
Eric Engestrom
405bffefe1
radv: replace all dup() with os_dupfd_cloexec()
...
Signed-off-by: Eric Engestrom <eric@engestrom.ch >
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5369 >
2020-06-18 02:09:56 +00:00
Bas Nieuwenhuizen
be784cc77b
radv: Implement vkGetSwapchainGrallocUsage2ANDROID.
...
This was implemented in version 6 of the VK_ANDROID_native_buffer
extension and we only implement version 5. However, the Android
Vulkan loader only checks whether vkGetInstanceProcAddr for the
function is not NULL.
This all went wrong when we switched to the layer code from ANV.
Because the function may now be different per device, it adds fallback
functions that dispatch to the dispatch table. So if we didn't implement
the function we still returned a pointer to the dispatch function,
which made the Android Vulkan loader believe it was supported.
Dispatch functions:
https://gitlab.freedesktop.org/mesa/mesa/-/blob/d555794f3032594dbef3623052103900138d2356/src/amd/vulkan/radv_entrypoints_gen.py#L328
Fixes: d555794f30 "radv: update entrypoints generation from ANV"
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2936
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5198 >
2020-05-25 15:34:44 +00:00
Bas Nieuwenhuizen
2e44bfc14f
radv: Fix RGBX Android<->Vulkan format correspondence.
...
This is correct per the Vulkan spec format equivalence table.
Fixes: f36b52740a "radv/android: Add android hardware buffer queries."
Reviewed-by: Eric Anholt <eric@anholt.net >
2019-12-11 11:40:13 +01:00
Bas Nieuwenhuizen
e92b9c5f4f
radv: Check the size of the imported buffer.
...
This is a security feature to disallow malicious apps from passing
a buffer that is too small.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
dad047a56a
radv: Expose image handle compat types for Android handles.
...
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
1b0ceba925
radv: Allow Android image binding.
...
Using delayed layout of images.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
83a012b603
radv/android: Add android hardware buffer import/export.
...
Support does not include images yet.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
adad61239c
radv: Deal with Android external formats.
...
To abstract things a bit, this adds a helper function in radv_android.c.
However, this means we have to link in radv_android.c on non-android as
well, which means some scaffolding changes.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
041fc7beb8
radv: Derive android usage from create flags.
...
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
f36b52740a
radv/android: Add android hardware buffer queries.
...
Derived from the Intel code.
For the internal format we just use the internal Vulkan format,
as we have Vulkan formats for all android formats we care about.
For the ycbcr properties we just do something. I do not have a real
clue what would be recommended.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-10-10 17:02:34 +00:00
Bas Nieuwenhuizen
9701cb1034
radv: Use bo metadata for imported image tiling on Android.
...
This way we handle linear images etc. correctly.
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-06-04 18:32:45 +00:00
Bas Nieuwenhuizen
8139efbbbd
radv: Use given stride for images imported from Android.
...
Handled similarly as radeonsi. I checked the offsets are actually used.
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-05-06 15:36:39 +00:00
Samuel Pitoiset
d58b11e709
radv: get rid of bunch of KHR suffixes
...
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Acked-by: Eric Engestrom <eric.engestrom@intel.com >
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2019-01-09 12:26:48 +01:00
Bas Nieuwenhuizen
3bf48741e1
radv/android: Use buffer metadata to determine scanout compat.
...
These days we don't always allocate scanout compatible textures anymore.
That does mean we have to fix the radv android WSI though.
Fixes: b1444c9ccb "radv: Implement VK_ANDROID_native_buffer."
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
2018-12-04 01:21:38 +01:00