mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-21 07:46:38 +00:00
vkswapper: add srgb formats to our list of formats
intel returns them for their surface formats.
This commit is contained in:
parent
61d1b31136
commit
e4377e5c8f
1 changed files with 27 additions and 8 deletions
|
@ -93,12 +93,16 @@ _vk_format_to_video_format (VkFormat format)
|
||||||
switch (format) {
|
switch (format) {
|
||||||
/* double check endianess */
|
/* double check endianess */
|
||||||
case VK_FORMAT_R8G8B8A8_UNORM:
|
case VK_FORMAT_R8G8B8A8_UNORM:
|
||||||
|
case VK_FORMAT_R8G8B8A8_SRGB:
|
||||||
return GST_VIDEO_FORMAT_RGBA;
|
return GST_VIDEO_FORMAT_RGBA;
|
||||||
case VK_FORMAT_R8G8B8_UNORM:
|
case VK_FORMAT_R8G8B8_UNORM:
|
||||||
|
case VK_FORMAT_R8G8B8_SRGB:
|
||||||
return GST_VIDEO_FORMAT_RGB;
|
return GST_VIDEO_FORMAT_RGB;
|
||||||
case VK_FORMAT_B8G8R8A8_UNORM:
|
case VK_FORMAT_B8G8R8A8_UNORM:
|
||||||
|
case VK_FORMAT_B8G8R8A8_SRGB:
|
||||||
return GST_VIDEO_FORMAT_BGRA;
|
return GST_VIDEO_FORMAT_BGRA;
|
||||||
case VK_FORMAT_B8G8R8_UNORM:
|
case VK_FORMAT_B8G8R8_UNORM:
|
||||||
|
case VK_FORMAT_B8G8R8_SRGB:
|
||||||
return GST_VIDEO_FORMAT_BGR;
|
return GST_VIDEO_FORMAT_BGR;
|
||||||
default:
|
default:
|
||||||
return GST_VIDEO_FORMAT_UNKNOWN;
|
return GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
|
@ -106,16 +110,32 @@ _vk_format_to_video_format (VkFormat format)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VkFormat
|
static VkFormat
|
||||||
_vk_format_from_video_format (GstVideoFormat v_format)
|
_vk_format_from_video_info (GstVideoInfo * v_info)
|
||||||
{
|
{
|
||||||
switch (v_format) {
|
switch (GST_VIDEO_INFO_FORMAT (v_info)) {
|
||||||
case GST_VIDEO_FORMAT_RGBA:
|
case GST_VIDEO_FORMAT_RGBA:
|
||||||
|
if (GST_VIDEO_INFO_COLORIMETRY (v_info).transfer ==
|
||||||
|
GST_VIDEO_TRANSFER_SRGB)
|
||||||
|
return VK_FORMAT_R8G8B8A8_SRGB;
|
||||||
|
else
|
||||||
return VK_FORMAT_R8G8B8A8_UNORM;
|
return VK_FORMAT_R8G8B8A8_UNORM;
|
||||||
case GST_VIDEO_FORMAT_RGB:
|
case GST_VIDEO_FORMAT_RGB:
|
||||||
|
if (GST_VIDEO_INFO_COLORIMETRY (v_info).transfer ==
|
||||||
|
GST_VIDEO_TRANSFER_SRGB)
|
||||||
|
return VK_FORMAT_R8G8B8_SRGB;
|
||||||
|
else
|
||||||
return VK_FORMAT_R8G8B8_UNORM;
|
return VK_FORMAT_R8G8B8_UNORM;
|
||||||
case GST_VIDEO_FORMAT_BGRA:
|
case GST_VIDEO_FORMAT_BGRA:
|
||||||
|
if (GST_VIDEO_INFO_COLORIMETRY (v_info).transfer ==
|
||||||
|
GST_VIDEO_TRANSFER_SRGB)
|
||||||
|
return VK_FORMAT_B8G8R8A8_SRGB;
|
||||||
|
else
|
||||||
return VK_FORMAT_B8G8R8A8_UNORM;
|
return VK_FORMAT_B8G8R8A8_UNORM;
|
||||||
case GST_VIDEO_FORMAT_BGR:
|
case GST_VIDEO_FORMAT_BGR:
|
||||||
|
if (GST_VIDEO_INFO_COLORIMETRY (v_info).transfer ==
|
||||||
|
GST_VIDEO_TRANSFER_SRGB)
|
||||||
|
return VK_FORMAT_B8G8R8_SRGB;
|
||||||
|
else
|
||||||
return VK_FORMAT_B8G8R8_UNORM;
|
return VK_FORMAT_B8G8R8_UNORM;
|
||||||
default:
|
default:
|
||||||
return VK_FORMAT_UNDEFINED;
|
return VK_FORMAT_UNDEFINED;
|
||||||
|
@ -629,8 +649,7 @@ _allocate_swapchain (GstVulkanSwapper * swapper, GstCaps * caps,
|
||||||
preTransform = swapper->surf_props.currentTransform;
|
preTransform = swapper->surf_props.currentTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
format =
|
format = _vk_format_from_video_info (&swapper->v_info);
|
||||||
_vk_format_from_video_format (GST_VIDEO_INFO_FORMAT (&swapper->v_info));
|
|
||||||
color_space = _vk_color_space_from_video_info (&swapper->v_info);
|
color_space = _vk_color_space_from_video_info (&swapper->v_info);
|
||||||
|
|
||||||
if ((swapper->surf_props.supportedCompositeAlpha &
|
if ((swapper->surf_props.supportedCompositeAlpha &
|
||||||
|
|
Loading…
Reference in a new issue