[mutter] wayland/eglstream: Don't build skeleton when disabled
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/eglstream: Don't build skeleton when disabled
- Date: Tue, 6 Nov 2018 18:08:25 +0000 (UTC)
commit 417c00b8fa33a5fce9d56cfda17f833ff0c49c43
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Tue Nov 6 17:09:03 2018 +0100
wayland/eglstream: Don't build skeleton when disabled
Instead of calling no-op functions when EGLStream support isn't enabled,
make it clear at the call site that EGLStream support is optional.
src/Makefile.am | 9 +++++++--
src/wayland/meta-wayland-buffer.c | 16 ++++++++++++++++
src/wayland/meta-wayland-buffer.h | 4 ++++
src/wayland/meta-wayland-egl-stream.c | 10 ++--------
src/wayland/meta-wayland.c | 2 ++
5 files changed, 31 insertions(+), 10 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 66aa02649..b4f22de0d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -408,8 +408,6 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \
wayland/meta-wayland-data-device.c \
wayland/meta-wayland-data-device.h \
wayland/meta-wayland-data-device-private.h \
- wayland/meta-wayland-egl-stream.c \
- wayland/meta-wayland-egl-stream.h \
wayland/meta-wayland-input-device.c \
wayland/meta-wayland-input-device.h \
wayland/meta-wayland-pointer-gestures.c \
@@ -491,6 +489,13 @@ libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \
wayland/meta-xwayland-grab-keyboard.c \
wayland/meta-xwayland-grab-keyboard.h \
$(NULL)
+
+if HAVE_WAYLAND_EGLSTREAM
+libmutter_@LIBMUTTER_API_VERSION@_la_SOURCES += \
+ wayland/meta-wayland-egl-stream.c \
+ wayland/meta-wayland-egl-stream.h \
+ $(NULL)
+endif
endif
if HAVE_NATIVE_BACKEND
diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c
index 3971df31d..9fee02d52 100644
--- a/src/wayland/meta-wayland-buffer.c
+++ b/src/wayland/meta-wayland-buffer.c
@@ -108,7 +108,9 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
EGLDisplay egl_display = cogl_egl_context_get_egl_display (cogl_context);
+#ifdef HAVE_WAYLAND_EGLSTREAM
MetaWaylandEglStream *stream;
+#endif
MetaWaylandDmaBufBuffer *dma_buf;
if (wl_shm_buffer_get (buffer->resource) != NULL)
@@ -125,6 +127,7 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
return TRUE;
}
+#ifdef HAVE_WAYLAND_EGLSTREAM
stream = meta_wayland_egl_stream_new (buffer, NULL);
if (stream)
{
@@ -141,6 +144,7 @@ meta_wayland_buffer_realize (MetaWaylandBuffer *buffer)
return TRUE;
}
+#endif /* HAVE_WAYLAND_EGLSTREAM */
dma_buf = meta_wayland_dma_buf_from_buffer (buffer);
if (dma_buf)
@@ -320,6 +324,7 @@ egl_image_buffer_attach (MetaWaylandBuffer *buffer,
return TRUE;
}
+#ifdef HAVE_WAYLAND_EGLSTREAM
static gboolean
egl_stream_buffer_attach (MetaWaylandBuffer *buffer,
GError **error)
@@ -333,6 +338,7 @@ egl_stream_buffer_attach (MetaWaylandBuffer *buffer,
return TRUE;
}
+#endif /* HAVE_WAYLAND_EGLSTREAM */
gboolean
meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
@@ -355,8 +361,10 @@ meta_wayland_buffer_attach (MetaWaylandBuffer *buffer,
return shm_buffer_attach (buffer, error);
case META_WAYLAND_BUFFER_TYPE_EGL_IMAGE:
return egl_image_buffer_attach (buffer, error);
+#ifdef HAVE_WAYLAND_EGLSTREAM
case META_WAYLAND_BUFFER_TYPE_EGL_STREAM:
return egl_stream_buffer_attach (buffer, error);
+#endif
case META_WAYLAND_BUFFER_TYPE_DMA_BUF:
return meta_wayland_dma_buf_buffer_attach (buffer, error);
case META_WAYLAND_BUFFER_TYPE_UNKNOWN:
@@ -376,10 +384,14 @@ meta_wayland_buffer_get_texture (MetaWaylandBuffer *buffer)
CoglSnippet *
meta_wayland_buffer_create_snippet (MetaWaylandBuffer *buffer)
{
+#ifdef HAVE_WAYLAND_EGLSTREAM
if (!buffer->egl_stream.stream)
return NULL;
return meta_wayland_egl_stream_create_snippet ();
+#else
+ return NULL;
+#endif /* HAVE_WAYLAND_EGLSTREAM */
}
gboolean
@@ -448,7 +460,9 @@ meta_wayland_buffer_process_damage (MetaWaylandBuffer *buffer,
res = process_shm_buffer_damage (buffer, region, &error);
break;
case META_WAYLAND_BUFFER_TYPE_EGL_IMAGE:
+#ifdef HAVE_WAYLAND_EGLSTREAM
case META_WAYLAND_BUFFER_TYPE_EGL_STREAM:
+#endif
case META_WAYLAND_BUFFER_TYPE_DMA_BUF:
res = TRUE;
break;
@@ -473,7 +487,9 @@ meta_wayland_buffer_finalize (GObject *object)
MetaWaylandBuffer *buffer = META_WAYLAND_BUFFER (object);
g_clear_pointer (&buffer->texture, cogl_object_unref);
+#ifdef HAVE_WAYLAND_EGLSTREAM
g_clear_object (&buffer->egl_stream.stream);
+#endif
g_clear_object (&buffer->dma_buf.dma_buf);
G_OBJECT_CLASS (meta_wayland_buffer_parent_class)->finalize (object);
diff --git a/src/wayland/meta-wayland-buffer.h b/src/wayland/meta-wayland-buffer.h
index f1e03bcbd..3709c85ff 100644
--- a/src/wayland/meta-wayland-buffer.h
+++ b/src/wayland/meta-wayland-buffer.h
@@ -38,7 +38,9 @@ typedef enum _MetaWaylandBufferType
META_WAYLAND_BUFFER_TYPE_UNKNOWN,
META_WAYLAND_BUFFER_TYPE_SHM,
META_WAYLAND_BUFFER_TYPE_EGL_IMAGE,
+#ifdef HAVE_WAYLAND_EGLSTREAM
META_WAYLAND_BUFFER_TYPE_EGL_STREAM,
+#endif
META_WAYLAND_BUFFER_TYPE_DMA_BUF,
} MetaWaylandBufferType;
@@ -54,9 +56,11 @@ struct _MetaWaylandBuffer
MetaWaylandBufferType type;
+#ifdef HAVE_WAYLAND_EGLSTREAM
struct {
MetaWaylandEglStream *stream;
} egl_stream;
+#endif
struct {
MetaWaylandDmaBufBuffer *dma_buf;
diff --git a/src/wayland/meta-wayland-egl-stream.c b/src/wayland/meta-wayland-egl-stream.c
index 546f5eab4..3f8908e67 100644
--- a/src/wayland/meta-wayland-egl-stream.c
+++ b/src/wayland/meta-wayland-egl-stream.c
@@ -26,6 +26,8 @@
#include "wayland/meta-wayland-egl-stream.h"
+#include <dlfcn.h>
+
#include "backends/meta-backend-private.h"
#include "backends/meta-egl-ext.h"
#include "backends/meta-egl.h"
@@ -34,10 +36,6 @@
#include "wayland/meta-wayland-buffer.h"
#include "wayland/meta-wayland-private.h"
-#ifdef HAVE_WAYLAND_EGLSTREAM
-
-#include <dlfcn.h>
-
#include "wayland-eglstream-controller-server-protocol.h"
static struct wl_interface *wl_eglstream_controller_interface_ptr = NULL;
@@ -86,12 +84,9 @@ bind_eglstream_controller (struct wl_client *client,
NULL);
}
-#endif /* HAVE_WAYLAND_EGLSTREAM */
-
gboolean
meta_wayland_eglstream_controller_init (MetaWaylandCompositor *compositor)
{
-#ifdef HAVE_WAYLAND_EGLSTREAM
/*
* wl_eglstream_controller_interface is provided by
* libnvidia-egl-wayland.so.1
@@ -127,7 +122,6 @@ fail:
dlclose(lib);
g_debug ("WL: Unable to initialize wl_eglstream_controller.");
-#endif
return FALSE;
}
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index a72bc7fdd..25b49918f 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -398,7 +398,9 @@ meta_wayland_init (void)
meta_xwayland_global_filter,
compositor);
+#ifdef HAVE_WAYLAND_EGLSTREAM
meta_wayland_eglstream_controller_init (compositor);
+#endif
if (meta_should_autostart_x11_display ())
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]