summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-02-16 12:21:28 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2020-02-28 12:20:18 +0100
commita8031bcb0e343be48c07abe52c9907dcfa53fdea (patch)
tree7145de6cc9dd23f74a20b4c29e568d830d3b45fb /gst-libs
parentae0261023af502bf71eb906b59b60f9b73973c91 (diff)
libs: display: force RGBA image format for i965 driver
Since commit 32bf6f1e GLTextureUpload is broken because i965 doesn't report properly RGBA support. It could be possible to use RGBx but GLTextureUpload only regotiates RGBA. The simplest fix to this regression is adding synthetically the RGBA format in the internal format map.
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.c29
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.h5
2 files changed, 32 insertions, 2 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c
index a048a42f..ca235d94 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.c
@@ -652,7 +652,7 @@ ensure_image_formats (GstVaapiDisplay * display)
GstVaapiDisplayPrivate *const priv = GST_VAAPI_DISPLAY_GET_PRIVATE (display);
VAImageFormat *formats = NULL;
VAStatus status;
- gint i, n;
+ gint i, n, max_images;
gboolean success = FALSE;
GST_VAAPI_DISPLAY_LOCK (display);
@@ -666,7 +666,8 @@ ensure_image_formats (GstVaapiDisplay * display)
goto cleanup;
/* VA image formats */
- formats = g_new (VAImageFormat, vaMaxNumImageFormats (priv->display));
+ max_images = vaMaxNumImageFormats (priv->display);
+ formats = g_new (VAImageFormat, max_images);
if (!formats)
goto cleanup;
@@ -675,6 +676,29 @@ ensure_image_formats (GstVaapiDisplay * display)
if (!vaapi_check_status (status, "vaQueryImageFormats()"))
goto cleanup;
+ /* XXX(victor): Force RGBA in i965 display formats.
+ *
+ * This is required for GLTextureUploadMeta since it only negotiates
+ * RGBA, nevertheless i965 driver only reports RGBx breaking back
+ * compatibility.
+ *
+ * Side effects are not expected since it worked before commit
+ * 32bf6f1e */
+ if (gst_vaapi_display_has_driver_quirks (display,
+ GST_VAAPI_DRIVER_QUIRK_MISSING_RGBA_IMAGE_FORMAT)) {
+ formats = g_renew (VAImageFormat, formats, max_images + 1);
+
+ formats[n].fourcc = VA_FOURCC_RGBA;
+ formats[n].byte_order = VA_LSB_FIRST;
+ formats[n].bits_per_pixel = 32;
+ formats[n].depth = 32;
+ formats[n].red_mask = 0x000000ff;
+ formats[n].green_mask = 0x0000ff00;
+ formats[n].blue_mask = 0x00ff0000;
+ formats[n].alpha_mask = 0xff000000;
+ n++;
+ }
+
GST_DEBUG ("%d image formats", n);
for (i = 0; i < n; i++)
GST_DEBUG (" %" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (formats[i].fourcc));
@@ -781,6 +805,7 @@ set_driver_quirks (GstVaapiDisplay * display)
{ "AMD", GST_VAAPI_DRIVER_QUIRK_NO_CHECK_SURFACE_PUT_IMAGE },
{ "i965", GST_VAAPI_DRIVER_QUIRK_NO_CHECK_VPP_COLOR_STD },
{ "iHD", GST_VAAPI_DRIVER_QUIRK_NO_RGBYUV_VPP_COLOR_PRIMARY },
+ { "i965", GST_VAAPI_DRIVER_QUIRK_MISSING_RGBA_IMAGE_FORMAT },
};
/* *INDENT-ON* */
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.h b/gst-libs/gst/vaapi/gstvaapidisplay.h
index ecbe0709..0d0a1492 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.h
@@ -101,12 +101,17 @@ typedef struct _GstVaapiDisplay GstVaapiDisplay;
* https://github.com/intel/media-driver/issues/860. Once the driver
* issue is fixed, we should remove this quirk. Also see this issue:
* https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/issues/238
+ * @GST_VAAPI_DRIVER_QUIRK_MISSING_RGBA_IMAGE_FORMAT: i965 driver doesn't
+ * report to support ARGB format, but if it's forced to create a RGBA
+ * surface, it works. Driver issue:
+ * https://github.com/intel/intel-vaapi-driver/issues/500
*/
typedef enum
{
GST_VAAPI_DRIVER_QUIRK_NO_CHECK_SURFACE_PUT_IMAGE = (1U << 0),
GST_VAAPI_DRIVER_QUIRK_NO_CHECK_VPP_COLOR_STD = (1U << 1),
GST_VAAPI_DRIVER_QUIRK_NO_RGBYUV_VPP_COLOR_PRIMARY = (1U << 2),
+ GST_VAAPI_DRIVER_QUIRK_MISSING_RGBA_IMAGE_FORMAT = (1U << 3),
} GstVaapiDriverQuirks;
/**