};
static void
+dmabuf_format (void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
+ uint32_t format)
+{
+}
+
+static void
+dmabuf_modifier (void *data, struct zwp_linux_dmabuf_v1 *zwp_linux_dmabuf,
+ uint32_t format, uint32_t modifier_hi, uint32_t modifier_lo)
+{
+ GstVaapiDisplayWaylandPrivate *const priv = data;
+ GstDRMFormat drm_format = {
+ .format = format,
+ .modifier = (guint64) modifier_hi << 32 | modifier_lo
+ };
+
+ if (gst_vaapi_video_format_from_drm_format (format) ==
+ GST_VIDEO_FORMAT_UNKNOWN) {
+ GST_LOG ("ignoring unknown format 0x%x with modifier 0x%" G_GINT64_MODIFIER
+ "x", format, drm_format.modifier);
+ return;
+ }
+
+ GST_LOG ("got format 0x%x (%s) with modifier 0x%" G_GINT64_MODIFIER "x",
+ format, gst_video_format_to_string (gst_vaapi_video_format_from_drm_format
+ (format)), drm_format.modifier);
+
+ g_array_append_val (priv->dmabuf_formats, drm_format);
+}
+
+static const struct zwp_linux_dmabuf_v1_listener dmabuf_listener = {
+ dmabuf_format,
+ dmabuf_modifier,
+};
+
+
+static void
registry_handle_global (void *data,
struct wl_registry *registry,
uint32_t id, const char *interface, uint32_t version)
priv->output = wl_registry_bind (registry, id, &wl_output_interface, 1);
wl_output_add_listener (priv->output, &output_listener, priv);
}
+ } else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0) {
+ priv->dmabuf =
+ wl_registry_bind (registry, id, &zwp_linux_dmabuf_v1_interface, 3);
+ zwp_linux_dmabuf_v1_add_listener (priv->dmabuf, &dmabuf_listener, priv);
}
}
g_clear_pointer (&priv->compositor, wl_compositor_destroy);
g_clear_pointer (&priv->registry, wl_registry_destroy);
+ g_array_unref (priv->dmabuf_formats);
+
if (priv->wl_display) {
if (!priv->use_foreign_display)
wl_display_disconnect (priv->wl_display);
display->priv = priv;
priv->event_fd = -1;
+ priv->dmabuf_formats = g_array_new (FALSE, FALSE, sizeof (GstDRMFormat));
}
static void
#define GST_VAAPI_DISPLAY_WAYLAND_PRIV_H
#include "xdg-shell-client-protocol.h"
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include <gst/vaapi/gstvaapidisplay_wayland.h>
#include "gstvaapidisplay_priv.h"
#define GST_VAAPI_DISPLAY_WL_DISPLAY(display) \
GST_VAAPI_DISPLAY_WAYLAND_GET_PRIVATE(display)->wl_display
+typedef struct _GstDRMFormat GstDRMFormat;
+
+struct _GstDRMFormat {
+ guint format;
+ guint64 modifier;
+};
+
struct _GstVaapiDisplayWaylandPrivate
{
gchar *display_name;
struct wl_shell *wl_shell;
struct xdg_wm_base *xdg_wm_base;
struct wl_output *output;
+ struct zwp_linux_dmabuf_v1 *dmabuf;
struct wl_registry *registry;
+ GArray *dmabuf_formats;
guint width;
guint height;
guint phys_width;
command: [ wayland_scanner_bin, 'private-code', '@INPUT@', '@OUTPUT@' ],
input: xdg_shell_xml_spec,
output: 'xdg-shell-client-protocol.c')
+ dmabuf_xml_spec = join_paths(wayland_protocols_basedir, 'unstable', 'linux-dmabuf', 'linux-dmabuf-unstable-v1.xml')
+ dmabuf_header = custom_target('vaapi-dmabuf-client-header',
+ command: [ wayland_scanner_bin, 'client-header', '@INPUT@', '@OUTPUT@' ],
+ input: dmabuf_xml_spec,
+ output: 'linux-dmabuf-unstable-v1-client-protocol.h')
+ dmabuf_code = custom_target('vaapi-dmabuf-client-code',
+ command: [ wayland_scanner_bin, 'private-code', '@INPUT@', '@OUTPUT@' ],
+ input: dmabuf_xml_spec,
+ output: 'linux-dmabuf-unstable-v1-client-protocol.c')
gstlibvaapi_sources += [
'gstvaapidisplay_wayland.c',
'gstvaapiwindow_wayland.c',
xdg_shell_header,
xdg_shell_code,
+ dmabuf_header,
+ dmabuf_code,
]
gstlibvaapi_headers += [
'gstvaapidisplay_wayland.h',