va: allocator: export composed layer for YUY2 and UYVY

This is a result of an error reported by i965 driver which only can
export composed layer for these formats. This seems to work too with
iHD. These formats are not exposed as native surfaces in Gallium.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1529>
This commit is contained in:
Víctor Manuel Jáquez Leal 2020-08-20 13:49:33 +02:00
parent a4e535d5c1
commit 117453b947

View file

@ -476,6 +476,8 @@ gst_va_memory_dispose (GstMiniObject * mini_object)
return TRUE;
}
/* creates an exported VASurface and adds it as @buffer's memories
* qdata */
gboolean
gst_va_dmabuf_setup_buffer (GstAllocator * allocator, GstBuffer * buffer,
GstVaAllocationParams * params)
@ -505,10 +507,19 @@ gst_va_dmabuf_setup_buffer (GstAllocator * allocator, GstBuffer * buffer,
&surface, 1))
return FALSE;
/* Each layer will contain exactly one plane. For example, an NV12
* surface will be exported as two layers */
export_flags = VA_EXPORT_SURFACE_SEPARATE_LAYERS
| VA_EXPORT_SURFACE_READ_WRITE;
/* FIXME(victor): find a better way since this is just a hack for
* i965 driver */
if (fourcc == VA_FOURCC_YUY2 || fourcc == VA_FOURCC_UYVY) {
/* These are not representable as separate planes */
export_flags = VA_EXPORT_SURFACE_COMPOSED_LAYERS;
} else {
/* Each layer will contain exactly one plane. For example, an NV12
* surface will be exported as two layers */
export_flags = VA_EXPORT_SURFACE_SEPARATE_LAYERS;
}
export_flags |= VA_EXPORT_SURFACE_READ_WRITE;
if (!_export_surface_to_dmabuf (self->display, surface, export_flags, &desc))
goto failed;