va: filter: remove unsupported formats because driver's bugs
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Thu, 1 Apr 2021 05:59:45 +0000 (07:59 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 7 Apr 2021 11:06:59 +0000 (11:06 +0000)
Add a way to filter out video formats from caps because of unresolved
bugs in drivers. In this case for media-driver (iHD) where some RGB32
formats are not handled correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2129>

sys/va/gstvafilter.c

index 4a14fdf..afd1f58 100644 (file)
@@ -239,6 +239,29 @@ gst_va_filter_ensure_config_attributes (GstVaFilter * self,
   return TRUE;
 }
 
+/* There are formats that are not handled correctly by driver */
+static gboolean
+format_is_accepted (GstVaFilter * self, GstVideoFormat format)
+{
+  /* https://github.com/intel/media-driver/issues/690
+   * https://github.com/intel/media-driver/issues/644 */
+  if (!gst_va_display_is_implementation (self->display,
+          GST_VA_IMPLEMENTATION_INTEL_IHD))
+    return TRUE;
+
+  switch (format) {
+    case GST_VIDEO_FORMAT_ARGB:
+    case GST_VIDEO_FORMAT_xRGB:
+    case GST_VIDEO_FORMAT_ABGR:
+    case GST_VIDEO_FORMAT_xBGR:
+      return FALSE;
+    default:
+      break;
+  }
+
+  return TRUE;
+}
+
 static gboolean
 gst_va_filter_ensure_surface_attributes (GstVaFilter * self)
 {
@@ -259,7 +282,8 @@ gst_va_filter_ensure_surface_attributes (GstVaFilter * self)
     switch (attribs[i].type) {
       case VASurfaceAttribPixelFormat:
         format = gst_va_video_format_from_va_fourcc (attribs[i].value.value.i);
-        if (format != GST_VIDEO_FORMAT_UNKNOWN)
+        if (format != GST_VIDEO_FORMAT_UNKNOWN
+            && format_is_accepted (self, format))
           g_array_append_val (surface_formats, format);
         break;
       case VASurfaceAttribMinWidth: