anv/android: setup gralloc1 usage from gralloc0 usage manually

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>
This commit is contained in:
Tapani Pälli 2020-01-23 09:48:47 +02:00
parent 03a0d39366
commit 104744f4df
2 changed files with 17 additions and 8 deletions

View 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)

View 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;
}