diff options
author | Chad Versace <[email protected]> | 2016-11-14 16:13:51 -0800 |
---|---|---|
committer | Chad Versace <[email protected]> | 2017-10-18 00:23:38 -0700 |
commit | 053d4c328fa48838572857bd53d07d7680070d52 (patch) | |
tree | 0c32868e451d5e2f1bfb93a60afb4e89b3a4554c /src/intel/Android.vulkan.mk | |
parent | 9775894f102535a79186985124087ac859b5ca44 (diff) |
anv: Implement VK_ANDROID_native_buffer (v9)
This implementation is correct (afaict), but takes two shortcuts
regarding the import/export of Android sync fds.
Shortcut 1. When Android calls vkAcquireImageANDROID to import a sync
fd into a VkSemaphore or VkFence, the driver instead simply blocks on
the sync fd, then puts the VkSemaphore or VkFence into the signalled
state. Thanks to implicit sync, this produces correct behavior (with
extra latency overhead, perhaps) despite its ugliness.
Shortcut 2. When Android calls vkQueueSignalReleaseImageANDROID to export
a collection of wait semaphores as a sync fd, the driver instead
submits the semaphores to the queue, then returns sync fd -1, which
informs the caller that no additional synchronization is needed.
Again, thanks to implicit sync, this produces correct behavior (with
extra batch submission overhead) despite its ugliness.
I chose to take the shortcuts instead of properly importing/exporting
the sync fds for two reasons:
Reason 1. I've already tested this patch with dEQP and with demos
apps. It works. I wanted to get the tested patches into the tree now,
and polish the implementation afterwards.
Reason 2. I want to run this on a 3.18 kernel (gasp!). In 3.18, i915
supports neither Android's sync_fence, nor upstream's sync_file, nor
drm_syncobj. Again, I tested these patches on Android with a 3.18
kernel and they work.
I plan to quickly follow-up with patches that remove the shortcuts and
properly import/export the sync fds.
Non-Testing
===========
I did not test at all using the Android.mk buildsystem. I may have broke
it. Please test and review that.
Testing
=======
I tested with 64-bit ARC++ on a Skylake Chromebook and a 3.18 kernel.
The following pass (as of patchset v9):
- a little spinning cube demo APK
- several Sascha demos
- dEQP-VK.info.*
- dEQP-VK.api.wsi.android.*
(except dEQP-VK.api.wsi.android.swapchain.*.image_usage, because
dEQP wants to create swapchains with VK_IMAGE_USAGE_STORAGE_BIT)
- dEQP-VK.api.smoke.*
- dEQP-VK.api.info.instance.*
- dEQP-VK.api.info.device.*
v2:
- Reject VkNativeBufferANDROID if the dma-buf's size is too small for
the VkImage.
- Stop abusing VkNativeBufferANDROID by passing it to vkAllocateMemory
during vkCreateImage. Instead, directly import its dma-buf during
vkCreateImage with anv_bo_cache_import(). [for jekstrand]
- Rebase onto Tapani's VK_EXT_debug_report changes.
- Drop `CPPFLAGS += $(top_srcdir)/include/android`. The dir does not
exist.
v3:
- Delete duplicate #include "anv_private.h". [per Tapani]
- Try to fix the Android-IA build in Android.vulkan.mk by following
Tapani's example.
v4:
- Unset EXEC_OBJECT_ASYNC and set EXEC_OBJECT_WRITE on the imported
gralloc buffer, just as we do for all other winsys buffers in
anv_wsi.c. [found by Tapani]
v5:
- Really fix the Android-IA build by ensuring that Android.vulkan.mk
uses Mesa' vulkan.h and not Android's. Insert -I$(MESA_TOP)/include
before -Iframeworks/native/vulkan/include. [for Tapani]
- In vkAcquireImageANDROID, submit signal operations to the
VkSemaphore and VkFence. [for zhou]
v6:
- Drop copy-paste duplication in vkGetSwapchainGrallocUsageANDROID().
[found by zhou]
- Improve comments in vkGetSwapchainGrallocUsageANDROID().
v7:
- Fix vkGetSwapchainGrallocUsageANDROID() to inspect its
VkImageUsageFlags parameter. [for tfiga]
- This fix regresses dEQP-VK.api.wsi.android.swapchain.*.image_usage
because dEQP wants to create swapchains with
VK_IMAGE_USAGE_STORAGE_BIT.
v8:
- Drop unneeded goto in vkAcquireImageANDROID. [for tfiga]
v8.1: (minor changes)
- Drop errant hunks added by rerere in anv_device.c.
- Drop explicit mention of VK_ANDROID_native_buffer in
anv_entrypoints_gen.py. [for jekstrand]
v9:
- Isolate as much Android code as possible, moving it from anv_image.c
to anv_android.c. Connect the files with anv_image_from_gralloc().
Remove VkNativeBufferANDROID params from all anv_image.c
funcs. [for krh]
- Replace some intel_loge() with vk_errorf() in anv_android.c.
- Use © in copyright line. [for krh]
Reviewed-by: Tapani Pälli <[email protected]> (v5)
Reviewed-by: Kristian H. Kristensen <[email protected]> (v9)
Reviewed-by: Jason Ekstrand <[email protected]> (v9)
Cc: zhoucm1 <[email protected]>
Cc: Tomasz Figa <[email protected]>
Diffstat (limited to 'src/intel/Android.vulkan.mk')
-rw-r--r-- | src/intel/Android.vulkan.mk | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk index ee98e30c355..b9a0446f724 100644 --- a/src/intel/Android.vulkan.mk +++ b/src/intel/Android.vulkan.mk @@ -28,6 +28,7 @@ VK_ENTRYPOINTS_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/vulkan/anv_entrypoints_ge VK_EXTENSIONS_SCRIPT := $(MESA_PYTHON2) $(LOCAL_PATH)/vulkan/anv_extensions.py VULKAN_COMMON_INCLUDES := \ + $(MESA_TOP)/include \ $(MESA_TOP)/src/mapi \ $(MESA_TOP)/src/gallium/auxiliary \ $(MESA_TOP)/src/gallium/include \ @@ -36,7 +37,8 @@ VULKAN_COMMON_INCLUDES := \ $(MESA_TOP)/src/vulkan/util \ $(MESA_TOP)/src/intel \ $(MESA_TOP)/include/drm-uapi \ - $(MESA_TOP)/src/intel/vulkan + $(MESA_TOP)/src/intel/vulkan \ + frameworks/native/vulkan/include # libmesa_anv_entrypoints with header and dummy.c # @@ -243,7 +245,8 @@ LOCAL_MODULE_CLASS := SHARED_LIBRARIES LOCAL_LDFLAGS += -Wl,--build-id=sha1 LOCAL_SRC_FILES := \ - $(VULKAN_GEM_FILES) + $(VULKAN_GEM_FILES) \ + $(VULKAN_ANDROID_FILES) LOCAL_C_INCLUDES := \ $(VULKAN_COMMON_INCLUDES) \ |