diff --git a/sys/va/gstvaallocator.c b/sys/va/gstvaallocator.c index 7bf3d76fc1..a065a7b385 100644 --- a/sys/va/gstvaallocator.c +++ b/sys/va/gstvaallocator.c @@ -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;