Commit 02cc3593 authored by Daniel Stone's avatar Daniel Stone

egl/wayland: Use linux-dmabuf interface for buffers

When available, use the zwp_linux_dambuf_v1 interface to create buffers,
which allows multiple planes and buffer modifiers to be used.
Reviewed-by: 's avatarEmil Velikov <emil.velikov@collabora.com>
parent cfaca574
......@@ -88,6 +88,7 @@ LIBOMXIL_BELLAGIO_REQUIRED=0.0
LIBVA_REQUIRED=0.38.0
VDPAU_REQUIRED=1.1
WAYLAND_REQUIRED=1.11
WAYLAND_PROTOCOLS_REQUIRED=1.8
XCB_REQUIRED=1.9.3
XCBDRI2_REQUIRED=1.8
XCBGLX_REQUIRED=1.8.1
......@@ -1686,7 +1687,9 @@ for plat in $platforms; do
case "$plat" in
wayland)
PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED])
PKG_CHECK_MODULES([WAYLAND], [wayland-client >= $WAYLAND_REQUIRED wayland-server >= $WAYLAND_REQUIRED wayland-protocols >= $WAYLAND_PROTOCOLS_REQUIRED])
ac_wayland_protocols_pkgdatadir=`$PKG_CONFIG --variable=pkgdatadir wayland-protocols`
AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, $ac_wayland_protocols_pkgdatadir)
if test "x$WAYLAND_SCANNER" = "x:"; then
AC_MSG_ERROR([wayland-scanner is needed to compile the wayland platform])
......
......@@ -21,6 +21,8 @@
include Makefile.sources
BUILT_SOURCES =
AM_CFLAGS = \
-I$(top_srcdir)/include \
-I$(top_srcdir)/src/egl/main \
......@@ -61,11 +63,27 @@ endif
endif
if HAVE_PLATFORM_WAYLAND
WL_DMABUF_XML = $(WAYLAND_PROTOCOLS_DATADIR)/unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml
drivers/dri2/linux-dmabuf-unstable-v1-protocol.c: $(WL_DMABUF_XML)
$(MKDIR_GEN)
$(AM_V_GEN)$(WAYLAND_SCANNER) code < $< > $@
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h: $(WL_DMABUF_XML)
$(MKDIR_GEN)
$(AM_V_GEN)$(WAYLAND_SCANNER) client-header < $< > $@
BUILT_SOURCES += \
drivers/dri2/linux-dmabuf-unstable-v1-protocol.c \
drivers/dri2/linux-dmabuf-unstable-v1-client-protocol.h
AM_CFLAGS += $(WAYLAND_CFLAGS)
libEGL_common_la_LIBADD += $(WAYLAND_LIBS)
libEGL_common_la_LIBADD += $(LIBDRM_LIBS)
libEGL_common_la_LIBADD += $(top_builddir)/src/egl/wayland/wayland-drm/libwayland-drm.la
dri2_backend_FILES += drivers/dri2/platform_wayland.c
libEGL_common_la_LIBADD += $(top_builddir)/src/util/libmesautil.la
dri2_backend_FILES += drivers/dri2/platform_wayland.c \
drivers/dri2/linux-dmabuf-unstable-v1-protocol.c
endif
if HAVE_PLATFORM_DRM
......@@ -85,6 +103,7 @@ endif
AM_CFLAGS += \
-I$(top_srcdir)/src/loader \
-I$(top_builddir)/src/egl/drivers/dri2 \
-I$(top_srcdir)/src/egl/drivers/dri2 \
-I$(top_srcdir)/src/gbm/backends/dri \
-I$(top_srcdir)/src/egl/wayland/wayland-egl \
......@@ -118,7 +137,7 @@ g_egldispatchstubs.h: $(GLVND_GEN_DEPS)
$(top_srcdir)/src/egl/generate/egl.xml \
$(top_srcdir)/src/egl/generate/egl_other.xml > $@
BUILT_SOURCES = g_egldispatchstubs.c g_egldispatchstubs.h
BUILT_SOURCES += g_egldispatchstubs.c g_egldispatchstubs.h
CLEANFILES = $(BUILT_SOURCES)
if USE_LIBGLVND
......
linux-dmabuf-unstable-v1-client-protocol.h
linux-dmabuf-unstable-v1-protocol.c
......@@ -53,6 +53,7 @@
#ifdef HAVE_WAYLAND_PLATFORM
#include "wayland-drm.h"
#include "wayland-drm-client-protocol.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#endif
#ifdef HAVE_X11_PLATFORM
......@@ -62,6 +63,7 @@
#include "egl_dri2.h"
#include "loader/loader.h"
#include "util/u_atomic.h"
#include "util/u_vector.h"
/* The kernel header drm_fourcc.h defines the DRM formats below. We duplicate
* some of the definitions here so that building Mesa won't bleeding-edge
......@@ -938,11 +940,16 @@ dri2_display_destroy(_EGLDisplay *disp)
case _EGL_PLATFORM_WAYLAND:
if (dri2_dpy->wl_drm)
wl_drm_destroy(dri2_dpy->wl_drm);
if (dri2_dpy->wl_dmabuf)
zwp_linux_dmabuf_v1_destroy(dri2_dpy->wl_dmabuf);
if (dri2_dpy->wl_shm)
wl_shm_destroy(dri2_dpy->wl_shm);
wl_registry_destroy(dri2_dpy->wl_registry);
wl_event_queue_destroy(dri2_dpy->wl_queue);
wl_proxy_wrapper_destroy(dri2_dpy->wl_dpy_wrapper);
u_vector_finish(&dri2_dpy->wl_modifiers.argb8888);
u_vector_finish(&dri2_dpy->wl_modifiers.xrgb8888);
u_vector_finish(&dri2_dpy->wl_modifiers.rgb565);
if (dri2_dpy->own_device) {
wl_display_disconnect(dri2_dpy->wl_dpy);
}
......
......@@ -45,6 +45,8 @@
#ifdef HAVE_WAYLAND_PLATFORM
#include <wayland-client.h>
#include "wayland-egl-priv.h"
/* forward declarations of protocol elements */
struct zwp_linux_dmabuf_v1;
#endif
#include <GL/gl.h>
......@@ -73,6 +75,8 @@
#include "eglimage.h"
#include "eglsync.h"
#include "util/u_vector.h"
struct wl_buffer;
struct dri2_egl_driver
......@@ -212,6 +216,12 @@ struct dri2_egl_display
struct wl_drm *wl_drm;
struct wl_shm *wl_shm;
struct wl_event_queue *wl_queue;
struct zwp_linux_dmabuf_v1 *wl_dmabuf;
struct {
struct u_vector xrgb8888;
struct u_vector argb8888;
struct u_vector rgb565;
} wl_modifiers;
bool authenticated;
int formats;
uint32_t capabilities;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment