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: Roman Kiryanov <rkir@google.com>
diff --git a/system/vulkan_enc/AndroidHardwareBuffer.cpp b/system/vulkan_enc/AndroidHardwareBuffer.cpp
index 516791b..6bc1484 100644
--- a/system/vulkan_enc/AndroidHardwareBuffer.cpp
+++ b/system/vulkan_enc/AndroidHardwareBuffer.cpp
@@ -101,7 +101,10 @@
         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;
diff --git a/system/vulkan_enc/vk_format_info.h b/system/vulkan_enc/vk_format_info.h
index 0337f95..c70f45f 100644
--- a/system/vulkan_enc/vk_format_info.h
+++ b/system/vulkan_enc/vk_format_info.h
@@ -78,6 +78,18 @@
    }
 }
 
+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)
 {