From 9ed463b48863e1adfd18bcafc0f3cdf3cef35357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 1 Apr 2020 11:13:22 +0200 Subject: [PATCH] renderer-view: Keep track of what CRTC it is associated with For the nested and native backend, it'll point to the CRTC it was created for. On the X11 CM backend, it'll be NULL, as there is only a single global stage view. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285 --- src/backends/meta-renderer-view.c | 25 +++++++++++++++++++ src/backends/meta-renderer-view.h | 2 ++ src/backends/native/meta-renderer-native.c | 1 + .../x11/nested/meta-renderer-x11-nested.c | 1 + 4 files changed, 29 insertions(+) diff --git a/src/backends/meta-renderer-view.c b/src/backends/meta-renderer-view.c index 785b29cd7..d698baba6 100644 --- a/src/backends/meta-renderer-view.c +++ b/src/backends/meta-renderer-view.c @@ -32,6 +32,7 @@ #include "backends/meta-renderer-view.h" +#include "backends/meta-crtc.h" #include "backends/meta-renderer.h" #include "clutter/clutter-mutter.h" #include "compositor/region-utils.h" @@ -41,6 +42,7 @@ enum PROP_0, PROP_TRANSFORM, + PROP_CRTC, PROP_LAST }; @@ -52,6 +54,8 @@ struct _MetaRendererView ClutterStageViewCogl parent; MetaMonitorTransform transform; + + MetaCrtc *crtc; }; G_DEFINE_TYPE (MetaRendererView, meta_renderer_view, @@ -63,6 +67,12 @@ meta_renderer_view_get_transform (MetaRendererView *view) return view->transform; } +MetaCrtc * +meta_renderer_view_get_crtc (MetaRendererView *view) +{ + return view->crtc; +} + static void meta_renderer_view_get_offscreen_transformation_matrix (ClutterStageView *view, CoglMatrix *matrix) @@ -161,6 +171,9 @@ meta_renderer_view_get_property (GObject *object, case PROP_TRANSFORM: g_value_set_uint (value, view->transform); break; + case PROP_CRTC: + g_value_set_object (value, view->crtc); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -180,6 +193,9 @@ meta_renderer_view_set_property (GObject *object, case PROP_TRANSFORM: meta_renderer_view_set_transform (view, g_value_get_uint (value)); break; + case PROP_CRTC: + view->crtc = g_value_get_object (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -218,5 +234,14 @@ meta_renderer_view_class_init (MetaRendererViewClass *klass) G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); + obj_props[PROP_CRTC] = + g_param_spec_object ("crtc", + "MetaCrtc", + "MetaCrtc", + META_TYPE_CRTC, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS); + g_object_class_install_properties (object_class, PROP_LAST, obj_props); } diff --git a/src/backends/meta-renderer-view.h b/src/backends/meta-renderer-view.h index f601de534..0e19dc2f2 100644 --- a/src/backends/meta-renderer-view.h +++ b/src/backends/meta-renderer-view.h @@ -28,4 +28,6 @@ G_DECLARE_FINAL_TYPE (MetaRendererView, meta_renderer_view, MetaMonitorTransform meta_renderer_view_get_transform (MetaRendererView *view); +MetaCrtc *meta_renderer_view_get_crtc (MetaRendererView *view); + #endif /* META_RENDERER_VIEW_H */ diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 24756c891..fad557a23 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -3249,6 +3249,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer, "name", meta_output_get_name (output), "stage", meta_backend_get_stage (backend), "layout", &view_layout, + "crtc", crtc, "scale", scale, "framebuffer", onscreen, "offscreen", offscreen, diff --git a/src/backends/x11/nested/meta-renderer-x11-nested.c b/src/backends/x11/nested/meta-renderer-x11-nested.c index cf3244d5a..92c176ee4 100644 --- a/src/backends/x11/nested/meta-renderer-x11-nested.c +++ b/src/backends/x11/nested/meta-renderer-x11-nested.c @@ -219,6 +219,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer, "name", meta_output_get_name (output), "stage", meta_backend_get_stage (backend), "layout", &view_layout, + "crtc", crtc, "framebuffer", COGL_FRAMEBUFFER (fake_onscreen), "offscreen", COGL_FRAMEBUFFER (offscreen), "transform", view_transform,