wayland: Don't filter out unrecognised DRM formats

There is no requirement for a base DRM format to be supported by libgstvideo
in order to be uploaded to.

The linux-dmabuf-v1 format events are DRM_FORMAT codes and don't need to
be converted before use with `gst_video_dma_drm_fourcc_to_string`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8279>
This commit is contained in:
Colin Kinloch 2025-01-10 11:29:44 +00:00 committed by GStreamer Marge Bot
parent 705b142134
commit edf157beb5
6 changed files with 32 additions and 52 deletions

View file

@ -13,6 +13,6 @@ variables:
LINT_TAG: '2024-02-20.0'
ABI_CHECK_TAG: '2025-01-08.1'
ABI_CHECK_TAG: '2025-01-29.0'
WINDOWS_TAG: '2025-01-11.0'

View file

@ -811,13 +811,11 @@ gst_gtk_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
modifiers = gst_wl_display_get_dmabuf_modifiers (priv->display);
for (i = 0; i < formats->len; i++) {
fmt = g_array_index (formats, uint32_t, i);
gfmt = gst_wl_dmabuf_format_to_video_format (fmt);
mod = g_array_index (modifiers, guint64, i);
if (gfmt != GST_VIDEO_FORMAT_UNKNOWN) {
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value, gst_wl_dmabuf_format_to_string (fmt, mod));
gst_value_list_append_and_take_value (&dmabuf_list, &value);
}
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value, gst_video_dma_drm_fourcc_to_string (fmt,
mod));
gst_value_list_append_and_take_value (&dmabuf_list, &value);
}
gst_structure_take_value (gst_caps_get_structure (caps, 1), "drm-format",

View file

@ -596,13 +596,11 @@ gst_wayland_sink_get_caps (GstBaseSink * bsink, GstCaps * filter)
modifiers = gst_wl_display_get_dmabuf_modifiers (self->display);
for (i = 0; i < formats->len; i++) {
fmt = g_array_index (formats, uint32_t, i);
gfmt = gst_wl_dmabuf_format_to_video_format (fmt);
mod = g_array_index (modifiers, guint64, i);
if (gfmt != GST_VIDEO_FORMAT_UNKNOWN) {
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value, gst_wl_dmabuf_format_to_string (fmt, mod));
gst_value_list_append_and_take_value (&dmabuf_list, &value);
}
g_value_init (&value, G_TYPE_STRING);
g_value_take_string (&value, gst_video_dma_drm_fourcc_to_string (fmt,
mod));
gst_value_list_append_and_take_value (&dmabuf_list, &value);
}
gst_structure_take_value (gst_caps_get_structure (caps, 1), "drm-format",

View file

@ -204,39 +204,35 @@ dmabuf_modifier (void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
{
GstWlDisplay *self = data;
guint64 modifier = (guint64) modifier_hi << 32 | modifier_lo;
GstVideoFormat gst_format = gst_wl_dmabuf_format_to_video_format (format);
static uint32_t last_format = 0;
GstWlDisplayPrivate *priv = gst_wl_display_get_instance_private (self);
if (gst_wl_dmabuf_format_to_video_format (format) != GST_VIDEO_FORMAT_UNKNOWN) {
GstVideoFormat gst_format = gst_wl_dmabuf_format_to_video_format (format);
const guint32 fourcc = gst_video_dma_drm_fourcc_from_format (gst_format);
/*
* Ignore unsupported formats along with implicit modifiers. Implicit
* modifiers have been source of garbled output for many many years and it
* was decided that we prefer disabling zero-copy over risking a bad output.
*/
if (format == DRM_FORMAT_INVALID || modifier == DRM_FORMAT_MOD_INVALID)
return;
/*
* Ignore unsupported formats along with implicit modifiers. Implicit
* modifiers have been source of garbled output for many many years and it
* was decided that we prefer disabling zero-copy over risking a bad output.
*/
if (fourcc == DRM_FORMAT_INVALID || modifier == DRM_FORMAT_MOD_INVALID)
return;
if (last_format == 0) {
GST_INFO ("===== All DMA Formats With Modifiers =====");
GST_INFO ("| Gst Format | DRM Format |");
}
if (last_format != format) {
GST_INFO ("|-----------------------------------------");
last_format = format;
}
GST_INFO ("| %-12s | %-23s |",
(modifier == 0) ? gst_video_format_to_string (gst_format) : "",
gst_video_dma_drm_fourcc_to_string (fourcc, modifier));
g_array_append_val (priv->dmabuf_formats, format);
g_array_append_val (priv->dmabuf_modifiers, modifier);
if (last_format == 0) {
GST_INFO ("===== All DMA Formats With Modifiers =====");
GST_INFO ("| Gst Format | DRM Format |");
}
if (last_format != format) {
GST_INFO ("|-----------------------------------------");
last_format = format;
}
GST_INFO ("| %-12s | %-23s |",
(modifier == 0) ? gst_video_format_to_string (gst_format) : "",
gst_video_dma_drm_fourcc_to_string (format, modifier));
g_array_append_val (priv->dmabuf_formats, format);
g_array_append_val (priv->dmabuf_modifiers, modifier);
}
static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {

View file

@ -152,12 +152,3 @@ gst_wl_shm_format_to_string (enum wl_shm_format wl_format)
return gst_video_format_to_string
(gst_wl_shm_format_to_video_format (wl_format));
}
gchar *
gst_wl_dmabuf_format_to_string (guint wl_format, guint64 modifier)
{
GstVideoFormat gst_format = gst_wl_dmabuf_format_to_video_format (wl_format);
const guint32 fourcc = gst_video_dma_drm_fourcc_from_format (gst_format);
return gst_video_dma_drm_fourcc_to_string (fourcc, modifier);
}

View file

@ -64,7 +64,4 @@ GstVideoFormat gst_wl_dmabuf_format_to_video_format (guint wl_format);
GST_WL_API
const gchar *gst_wl_shm_format_to_string (enum wl_shm_format wl_format);
GST_WL_API
gchar * gst_wl_dmabuf_format_to_string (guint wl_format, guint64 modifier);
G_END_DECLS