diff options
author | Xuelian Bai <xuelian.bai@samsung.com> | 2022-06-07 16:26:24 +0800 |
---|---|---|
committer | Xuelian Bai <xuelian.bai@samsung.com> | 2024-01-16 16:22:49 +0800 |
commit | 37ab09bec87e359bc57ca6a4a18d65108c5a5689 (patch) | |
tree | 29efdcec1c36471219a723d2b6c6d7c9008d9557 | |
parent | 5d3d062b67976444844f632868744f0050a845c8 (diff) | |
download | vulkan-wsi-layer-37ab09bec87e359bc57ca6a4a18d65108c5a5689.tar.gz vulkan-wsi-layer-37ab09bec87e359bc57ca6a4a18d65108c5a5689.tar.bz2 vulkan-wsi-layer-37ab09bec87e359bc57ca6a4a18d65108c5a5689.zip |
Fix red and blue inverted issue
Non-packed 8-bit formats have an inverted channel order
compared to the little endian DRM formats
1. Set supported surface format as VK_FORMAT_B8G8R8A8_*
2. Invert RGB to BGR in format map
Change-Id: Iab05870d25a309f11666083fa3d56ca54a28b391
Signed-Off-by: Xuelian Bai <xuelian.bai@samsung.com>
-rw-r--r-- | wsi/tizen/surface_properties.cpp | 4 | ||||
-rw-r--r-- | wsi/tizen/swapchain.cpp | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/wsi/tizen/surface_properties.cpp b/wsi/tizen/surface_properties.cpp index d81649e..cb55f25 100644 --- a/wsi/tizen/surface_properties.cpp +++ b/wsi/tizen/surface_properties.cpp @@ -128,7 +128,7 @@ VkResult surface_properties::get_surface_formats(VkPhysicalDevice physical_devic VkResult res = VK_SUCCESS; /* TODO: Hardcoding a list of sensible formats, may be query it from compositor later. */ - static std::array<const VkFormat, 2> formats = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_SRGB }; + static std::array<const VkFormat, 2> formats = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SRGB }; assert(surfaceFormatCount != nullptr); res = VK_SUCCESS; @@ -160,7 +160,7 @@ VkResult surface_properties::get_surface_formats_2(VkPhysicalDevice physical_dev VkResult res = VK_SUCCESS; /* TODO: Hardcoding a list of sensible formats, may be query it from compositor later. */ - static std::array<const VkFormat, 2> formats = { VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_R8G8B8A8_SRGB }; + static std::array<const VkFormat, 2> formats = { VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_SRGB }; assert(surfaceFormatCount != nullptr); res = VK_SUCCESS; diff --git a/wsi/tizen/swapchain.cpp b/wsi/tizen/swapchain.cpp index 5e3f5cd..9ddddc6 100644 --- a/wsi/tizen/swapchain.cpp +++ b/wsi/tizen/swapchain.cpp @@ -137,12 +137,13 @@ wsi_tizen_get_tbm_format(VkFormat format, VkCompositeAlphaFlagBitsKHR comp) RETURN_FORMAT(comp, RGB888, RGB888, RGB888, RGB888); /* 8 8 8 8 */ case VK_FORMAT_B8G8R8A8_UNORM: - RETURN_FORMAT(comp, XRGB8888, ARGB8888, 0, ARGB8888); + case VK_FORMAT_B8G8R8A8_SRGB: + case VK_FORMAT_UNDEFINED:/*VK_FORMAT_UNDEFINED specifies that the format is not specified.*/ + RETURN_FORMAT(comp, XRGB8888, ARGB8888, ARGB8888, ARGB8888); /* Use RGBA in every alpha bit case.*/ case VK_FORMAT_R8G8B8A8_UNORM: - case VK_FORMAT_UNDEFINED:/*VK_FORMAT_UNDEFINED specifies that the format is not specified.*/ case VK_FORMAT_R8G8B8A8_SRGB: - RETURN_FORMAT(comp, RGBA8888, RGBA8888, RGBA8888, RGBA8888); + RETURN_FORMAT(comp, XBGR8888, ABGR8888, ABGR8888, ABGR8888); case VK_FORMAT_A8B8G8R8_UNORM_PACK32: RETURN_FORMAT(comp, XBGR8888, ABGR8888, 0, ABGR8888); /* 2 10 10 10 */ |