mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
va: allocator: try to create surface without fourcc but chroma only
There are, in VPP, surfaces that doesn't support 4:2:2 fourccs but it supports the chroma. So this patch gives that opportunity to the driver. This patch also simplifiies gst_va_video_surface_format_from_image_format() to just an iterator for surfaces available formats. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
This commit is contained in:
parent
482a7d7d7e
commit
20e493981b
2 changed files with 15 additions and 18 deletions
|
@ -885,7 +885,7 @@ gst_va_allocator_alloc (GstAllocator * allocator,
|
|||
{
|
||||
GstVaAllocator *self;
|
||||
GstVaMemory *mem;
|
||||
GstVideoFormat format;
|
||||
GstVideoFormat format, img_format;
|
||||
VAImage image = { 0, };
|
||||
VASurfaceID surface;
|
||||
guint32 fourcc, rt_format;
|
||||
|
@ -894,20 +894,22 @@ gst_va_allocator_alloc (GstAllocator * allocator,
|
|||
|
||||
self = GST_VA_ALLOCATOR (allocator);
|
||||
|
||||
format =
|
||||
gst_va_video_surface_format_from_image_format (GST_VIDEO_INFO_FORMAT
|
||||
(¶ms->info), self->surface_formats);
|
||||
img_format = GST_VIDEO_INFO_FORMAT (¶ms->info);
|
||||
|
||||
format = gst_va_video_surface_format_from_image_format (img_format,
|
||||
self->surface_formats);
|
||||
if (format == GST_VIDEO_FORMAT_UNKNOWN) {
|
||||
GST_ERROR_OBJECT (allocator, "Unsupported format: %s",
|
||||
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (¶ms->info)));
|
||||
return NULL;
|
||||
/* try a surface without fourcc but rt_format only */
|
||||
fourcc = 0;
|
||||
rt_format = gst_va_chroma_from_video_format (img_format);
|
||||
} else {
|
||||
fourcc = gst_va_fourcc_from_video_format (format);
|
||||
rt_format = gst_va_chroma_from_video_format (format);
|
||||
}
|
||||
|
||||
fourcc = gst_va_fourcc_from_video_format (format);
|
||||
rt_format = gst_va_chroma_from_video_format (format);
|
||||
if (fourcc == 0 || rt_format == 0) {
|
||||
GST_ERROR_OBJECT (allocator, "Unsupported format: %s",
|
||||
gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (¶ms->info)));
|
||||
if (rt_format == 0) {
|
||||
GST_ERROR_OBJECT (allocator, "Unsupported image format: %s",
|
||||
gst_video_format_to_string (img_format));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ gst_va_video_surface_format_from_image_format (GstVideoFormat image_format,
|
|||
GArray * surface_formats)
|
||||
{
|
||||
GstVideoFormat surface_format;
|
||||
guint i, image_chroma, surface_chroma;
|
||||
guint i, image_chroma;
|
||||
|
||||
if (image_format == GST_VIDEO_FORMAT_UNKNOWN)
|
||||
return GST_VIDEO_FORMAT_UNKNOWN;
|
||||
|
@ -227,11 +227,6 @@ gst_va_video_surface_format_from_image_format (GstVideoFormat image_format,
|
|||
|
||||
if (surface_format == image_format)
|
||||
return surface_format;
|
||||
|
||||
surface_chroma = gst_va_chroma_from_video_format (surface_format);
|
||||
|
||||
if (surface_chroma == image_chroma)
|
||||
return surface_format;
|
||||
}
|
||||
|
||||
return GST_VIDEO_FORMAT_UNKNOWN;
|
||||
|
|
Loading…
Reference in a new issue