From 104744f4dfce026ebaf8c5c6c9b1eba905dd40be Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tapani=20P=C3=A4lli?= Date: Thu, 23 Jan 2020 09:48:47 +0200 Subject: [PATCH] anv/android: setup gralloc1 usage from gralloc0 usage manually MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This cuts away dependency to libgrallocusage. Signed-off-by: Tapani Pälli Acked-by: Lionel Landwerlin Reviewed-by: Kristian H. Kristensen Part-of: --- src/intel/Android.vulkan.mk | 4 ---- src/intel/vulkan/anv_android.c | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/intel/Android.vulkan.mk b/src/intel/Android.vulkan.mk index 134f4183eec..c5280b0bf04 100644 --- a/src/intel/Android.vulkan.mk +++ b/src/intel/Android.vulkan.mk @@ -329,9 +329,5 @@ else libexpat endif -ifeq ($(shell test $(PLATFORM_SDK_VERSION) -ge 27; echo $$?), 0) -LOCAL_STATIC_LIBRARIES += libgrallocusage -endif - include $(MESA_COMMON_MK) include $(BUILD_SHARED_LIBRARY) diff --git a/src/intel/vulkan/anv_android.c b/src/intel/vulkan/anv_android.c index 7e4047696f9..d50a0294962 100644 --- a/src/intel/vulkan/anv_android.c +++ b/src/intel/vulkan/anv_android.c @@ -25,7 +25,6 @@ #if ANDROID_API_LEVEL >= 26 #include -#include #endif #include @@ -634,7 +633,6 @@ setup_gralloc0_usage(VkFormat format, VkImageUsageFlags imageUsage, return VK_SUCCESS; } - #if ANDROID_API_LEVEL >= 26 VkResult anv_GetSwapchainGrallocUsage2ANDROID( VkDevice device_h, @@ -660,8 +658,23 @@ VkResult anv_GetSwapchainGrallocUsage2ANDROID( if (result != VK_SUCCESS) return result; - android_convertGralloc0To1Usage(grallocUsage, grallocProducerUsage, - grallocConsumerUsage); + /* Setup gralloc1 usage flags from gralloc0 flags. */ + + if (grallocUsage & GRALLOC_USAGE_HW_RENDER) { + *grallocProducerUsage |= GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET; + *grallocConsumerUsage |= GRALLOC1_CONSUMER_USAGE_CLIENT_TARGET; + } + + if (grallocUsage & GRALLOC_USAGE_HW_TEXTURE) { + *grallocConsumerUsage |= GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE; + } + + if (grallocUsage & (GRALLOC_USAGE_HW_FB | + GRALLOC_USAGE_HW_COMPOSER | + GRALLOC_USAGE_EXTERNAL_DISP)) { + *grallocProducerUsage |= GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET; + *grallocConsumerUsage |= GRALLOC1_CONSUMER_USAGE_HWCOMPOSER; + } return VK_SUCCESS; } -- 2.30.2