anv/android: setup gralloc1 usage from gralloc0 usage manually
authorTapani Pälli <tapani.palli@intel.com>
Thu, 23 Jan 2020 07:48:47 +0000 (09:48 +0200)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 28 Jan 2020 12:46:25 +0000 (14:46 +0200)
This cuts away dependency to libgrallocusage.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3532>

src/intel/Android.vulkan.mk
src/intel/vulkan/anv_android.c

index 134f4183eec1939899d50c5f2b1dc67fd28de991..c5280b0bf04213b362c023b4147c31e81e23c69e 100644 (file)
@@ -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)
index 7e4047696f945cca82237c1c076d9911f1c035d8..d50a02949620b4df0cb8165373c01e195dd0138d 100644 (file)
@@ -25,7 +25,6 @@
 
 #if ANDROID_API_LEVEL >= 26
 #include <hardware/gralloc1.h>
-#include <grallocusage/GrallocUsageConversion.h>
 #endif
 
 #include <hardware/hardware.h>
@@ -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;
 }