wayland: Fix building without native backend

Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/1026

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3480>
This commit is contained in:
Bilal Elmoussaoui 2024-01-03 10:52:08 +01:00
parent cebde5c2d1
commit 5964ccb385
3 changed files with 30 additions and 19 deletions

View File

@ -25,9 +25,9 @@
#include <glib.h> #include <glib.h>
#include <gio/gio.h> #include <gio/gio.h>
#if defined(HAVE_NATIVE_BACKEND) && defined(HAVE_WAYLAND) #ifdef HAVE_WAYLAND
#include <systemd/sd-login.h> #include <systemd/sd-login.h>
#endif /* HAVE_WAYLAND && HAVE_NATIVE_BACKEND */ #endif
#include "backends/meta-monitor-manager-private.h" #include "backends/meta-monitor-manager-private.h"
#include "backends/meta-virtual-monitor.h" #include "backends/meta-virtual-monitor.h"

View File

@ -148,28 +148,13 @@ G_DEFINE_TYPE (MetaWaylandDmaBufManager, meta_wayland_dma_buf_manager,
static GQuark quark_dma_buf_surface_feedback; static GQuark quark_dma_buf_surface_feedback;
#ifdef HAVE_NATIVE_BACKEND
static gboolean static gboolean
should_send_modifiers (MetaBackend *backend) should_send_modifiers_native (MetaBackend *backend)
{ {
MetaRendererNative *renderer_native; MetaRendererNative *renderer_native;
MetaGpuKms *gpu_kms; MetaGpuKms *gpu_kms;
if (!META_IS_BACKEND_NATIVE (backend))
{
MetaEgl *egl = meta_backend_get_egl (backend);
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);
return meta_egl_has_extensions (egl,
egl_display,
NULL,
"EGL_EXT_image_dma_buf_import_modifiers",
NULL);
}
renderer_native = META_RENDERER_NATIVE (meta_backend_get_renderer (backend)); renderer_native = META_RENDERER_NATIVE (meta_backend_get_renderer (backend));
gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native); gpu_kms = meta_renderer_native_get_primary_gpu (renderer_native);
if (!gpu_kms) if (!gpu_kms)
@ -177,7 +162,30 @@ should_send_modifiers (MetaBackend *backend)
return meta_renderer_native_send_modifiers (renderer_native); return meta_renderer_native_send_modifiers (renderer_native);
} }
#endif
static gboolean
should_send_modifiers (MetaBackend *backend)
{
MetaEgl *egl = meta_backend_get_egl (backend);
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_NATIVE_BACKEND
if (META_IS_BACKEND_NATIVE (backend))
return should_send_modifiers_native (backend);
#endif
return meta_egl_has_extensions (egl,
egl_display,
NULL,
"EGL_EXT_image_dma_buf_import_modifiers",
NULL);
}
#ifdef HAVE_NATIVE_BACKEND
static gboolean static gboolean
should_send_modifiers_scanout_tranches (MetaBackend *backend) should_send_modifiers_scanout_tranches (MetaBackend *backend)
{ {
@ -189,6 +197,7 @@ should_send_modifiers_scanout_tranches (MetaBackend *backend)
renderer_native = META_RENDERER_NATIVE (meta_backend_get_renderer (backend)); renderer_native = META_RENDERER_NATIVE (meta_backend_get_renderer (backend));
return meta_renderer_native_has_addfb2 (renderer_native); return meta_renderer_native_has_addfb2 (renderer_native);
} }
#endif
static gint static gint
compare_tranches (gconstpointer a, compare_tranches (gconstpointer a,

View File

@ -189,6 +189,7 @@ emit_frame_callbacks_for_stage_view (MetaWaylandCompositor *compositor,
} }
} }
#ifdef HAVE_NATIVE_BACKEND
static gboolean static gboolean
frame_callback_source_dispatch (GSource *source, frame_callback_source_dispatch (GSource *source,
GSourceFunc callback, GSourceFunc callback,
@ -279,6 +280,7 @@ ensure_source_for_stage_view (MetaWaylandCompositor *compositor,
return source; return source;
} }
#endif /* HAVE_NATIVE_BACKEND */
static void static void
on_after_update (ClutterStage *stage, on_after_update (ClutterStage *stage,