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
This commit is contained in:
Jonas Ådahl 2020-04-01 11:13:22 +02:00
parent 33450700dc
commit 9ed463b488
4 changed files with 29 additions and 0 deletions

View File

@ -32,6 +32,7 @@
#include "backends/meta-renderer-view.h" #include "backends/meta-renderer-view.h"
#include "backends/meta-crtc.h"
#include "backends/meta-renderer.h" #include "backends/meta-renderer.h"
#include "clutter/clutter-mutter.h" #include "clutter/clutter-mutter.h"
#include "compositor/region-utils.h" #include "compositor/region-utils.h"
@ -41,6 +42,7 @@ enum
PROP_0, PROP_0,
PROP_TRANSFORM, PROP_TRANSFORM,
PROP_CRTC,
PROP_LAST PROP_LAST
}; };
@ -52,6 +54,8 @@ struct _MetaRendererView
ClutterStageViewCogl parent; ClutterStageViewCogl parent;
MetaMonitorTransform transform; MetaMonitorTransform transform;
MetaCrtc *crtc;
}; };
G_DEFINE_TYPE (MetaRendererView, meta_renderer_view, G_DEFINE_TYPE (MetaRendererView, meta_renderer_view,
@ -63,6 +67,12 @@ meta_renderer_view_get_transform (MetaRendererView *view)
return view->transform; return view->transform;
} }
MetaCrtc *
meta_renderer_view_get_crtc (MetaRendererView *view)
{
return view->crtc;
}
static void static void
meta_renderer_view_get_offscreen_transformation_matrix (ClutterStageView *view, meta_renderer_view_get_offscreen_transformation_matrix (ClutterStageView *view,
CoglMatrix *matrix) CoglMatrix *matrix)
@ -161,6 +171,9 @@ meta_renderer_view_get_property (GObject *object,
case PROP_TRANSFORM: case PROP_TRANSFORM:
g_value_set_uint (value, view->transform); g_value_set_uint (value, view->transform);
break; break;
case PROP_CRTC:
g_value_set_object (value, view->crtc);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -180,6 +193,9 @@ meta_renderer_view_set_property (GObject *object,
case PROP_TRANSFORM: case PROP_TRANSFORM:
meta_renderer_view_set_transform (view, g_value_get_uint (value)); meta_renderer_view_set_transform (view, g_value_get_uint (value));
break; break;
case PROP_CRTC:
view->crtc = g_value_get_object (value);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
@ -218,5 +234,14 @@ meta_renderer_view_class_init (MetaRendererViewClass *klass)
G_PARAM_CONSTRUCT_ONLY | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS); 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); g_object_class_install_properties (object_class, PROP_LAST, obj_props);
} }

View File

@ -28,4 +28,6 @@ G_DECLARE_FINAL_TYPE (MetaRendererView, meta_renderer_view,
MetaMonitorTransform meta_renderer_view_get_transform (MetaRendererView *view); MetaMonitorTransform meta_renderer_view_get_transform (MetaRendererView *view);
MetaCrtc *meta_renderer_view_get_crtc (MetaRendererView *view);
#endif /* META_RENDERER_VIEW_H */ #endif /* META_RENDERER_VIEW_H */

View File

@ -3249,6 +3249,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
"name", meta_output_get_name (output), "name", meta_output_get_name (output),
"stage", meta_backend_get_stage (backend), "stage", meta_backend_get_stage (backend),
"layout", &view_layout, "layout", &view_layout,
"crtc", crtc,
"scale", scale, "scale", scale,
"framebuffer", onscreen, "framebuffer", onscreen,
"offscreen", offscreen, "offscreen", offscreen,

View File

@ -219,6 +219,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
"name", meta_output_get_name (output), "name", meta_output_get_name (output),
"stage", meta_backend_get_stage (backend), "stage", meta_backend_get_stage (backend),
"layout", &view_layout, "layout", &view_layout,
"crtc", crtc,
"framebuffer", COGL_FRAMEBUFFER (fake_onscreen), "framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
"offscreen", COGL_FRAMEBUFFER (offscreen), "offscreen", COGL_FRAMEBUFFER (offscreen),
"transform", view_transform, "transform", view_transform,