diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstva.h b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstva.h index b3c4f5cee9..0736fc9934 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstva.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstva.h @@ -32,6 +32,12 @@ typedef enum GST_VA_FEATURE_AUTO, } GstVaFeature; +enum +{ + /* jpeg decoder in i965 driver cannot create surfaces with fourcc */ + GST_VA_HACK_SURFACE_NO_FOURCC = 1 << 0, +}; + #include #include #include diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c index fb26ef7052..29e106a661 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.c @@ -951,6 +951,8 @@ struct _GstVaAllocator GstVideoInfo info; guint usage_hint; + guint32 hacks; + GstVaSurfaceCopy *copy; GstVaMemoryPool pool; @@ -1556,7 +1558,8 @@ gst_va_allocator_try (GstAllocator * allocator) self->fourcc = 0; self->rt_format = gst_va_chroma_from_video_format (self->img_format); } else { - self->fourcc = gst_va_fourcc_from_video_format (self->surface_format); + if (G_LIKELY (!(self->hacks & GST_VA_HACK_SURFACE_NO_FOURCC))) + self->fourcc = gst_va_fourcc_from_video_format (self->surface_format); self->rt_format = gst_va_chroma_from_video_format (self->surface_format); } @@ -1641,6 +1644,17 @@ gst_va_allocator_get_format (GstAllocator * allocator, GstVideoInfo * info, return TRUE; } +void +gst_va_allocator_set_hacks (GstAllocator * allocator, guint32 hacks) +{ + GstVaAllocator *self; + + g_return_if_fail (GST_IS_VA_ALLOCATOR (allocator)); + self = GST_VA_ALLOCATOR (allocator); + + self->hacks = hacks; +} + /*============ Utilities =====================================================*/ VASurfaceID diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.h b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.h index 79f84c0e2a..f6d883c680 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/va/gstvaallocator.h @@ -101,6 +101,9 @@ gboolean gst_va_allocator_get_format (GstAllocator * alloca GstVideoInfo * info, guint * usage_hint, GstVaFeature * use_derived); +GST_VA_API +void gst_va_allocator_set_hacks (GstAllocator * allocator, + guint32 hack); GST_VA_API VASurfaceID gst_va_memory_get_surface (GstMemory * mem); diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c index 957bf07fec..fdd469f4c8 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.c @@ -228,6 +228,7 @@ _create_allocator (GstVaBaseDec * base, GstCaps * caps) GArray *surface_formats = gst_va_decoder_get_surface_formats (base->decoder); allocator = gst_va_allocator_new (base->display, surface_formats); + gst_va_allocator_set_hacks (allocator, base->hacks); } return allocator; diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h index 048d7ac5b2..cfe5a3a759 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h +++ b/subprojects/gst-plugins-bad/sys/va/gstvabasedec.h @@ -83,6 +83,8 @@ struct _GstVaBaseDec GstVideoConverter *convert; gboolean need_negotiation; + + guint32 hacks; }; struct _GstVaBaseDecClass