Skip to content
Snippets Groups Projects
Commit 4a9bb444 authored by Roman Kiryanov's avatar Roman Kiryanov
Browse files

Set suggestedYcbcrModel to RGB_IDENTITY for RGB formats


The YCBCR_601 model should be applied only for
YUV formats.

Bug: 131176903
Test: CtsGraphicsTestCases \
Test:     android.graphics.cts.BasicVulkanGpuTest# \
Test:     testBasicBufferImportAndRenderingExternalFormat\
Test:     [AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM]
Change-Id: I4701464e99928d62aa6e0382daff002d2cd90003
Merged-In: I1888238a890bcbc685b63b996790d8de5f55b412
Signed-off-by: default avatarRoman Kiryanov <rkir@google.com>
parent f78f995b
No related branches found
No related tags found
No related merge requests found
......@@ -101,7 +101,10 @@ VkResult getAndroidHardwareBufferPropertiesANDROID(
ahbFormatProps->samplerYcbcrConversionComponents.b = VK_COMPONENT_SWIZZLE_IDENTITY;
ahbFormatProps->samplerYcbcrConversionComponents.a = VK_COMPONENT_SWIZZLE_IDENTITY;
ahbFormatProps->suggestedYcbcrModel = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601;
ahbFormatProps->suggestedYcbcrModel =
android_format_is_yuv(desc.format) ?
VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 :
VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY;
ahbFormatProps->suggestedYcbcrRange = VK_SAMPLER_YCBCR_RANGE_ITU_FULL;
ahbFormatProps->suggestedXChromaOffset = VK_CHROMA_LOCATION_MIDPOINT;
......
......@@ -78,6 +78,18 @@ android_format_from_vk(VkFormat vk_format)
}
}
static inline bool
android_format_is_yuv(unsigned android_format)
{
switch (android_format) {
case HAL_PIXEL_FORMAT_NV12_Y_TILED_INTEL:
return true;
default:
return false;
}
}
static inline VkImageAspectFlags
vk_format_aspects(VkFormat format)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment