[gnome-flashback] monitor-manager: connect assigned CRTCs to their outputs both ways
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] monitor-manager: connect assigned CRTCs to their outputs both ways
- Date: Sun, 14 Mar 2021 13:57:03 +0000 (UTC)
commit f4a9e95353196fb09be09423eaaf7c507bba6f74
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sun Jan 31 18:47:15 2021 +0200
monitor-manager: connect assigned CRTCs to their outputs both ways
We had a pointer from the output to the assigned CRTC, but had no way
to get the outputs an CRTC was assigned to. Add that connection.
Based on mutter commit:
https://gitlab.gnome.org/GNOME/mutter/-/commit/5edc118d62a73c5acc
backends/gf-crtc-private.h | 8 ++++++++
backends/gf-crtc.c | 37 +++++++++++++++++++++++++++++++++++++
backends/gf-output.c | 14 ++++++++++++--
3 files changed, 57 insertions(+), 2 deletions(-)
---
diff --git a/backends/gf-crtc-private.h b/backends/gf-crtc-private.h
index 0961048..816a7b7 100644
--- a/backends/gf-crtc-private.h
+++ b/backends/gf-crtc-private.h
@@ -67,6 +67,14 @@ GfGpu *gf_crtc_get_gpu (GfCrtc *self);
GfMonitorTransform gf_crtc_get_all_transforms (GfCrtc *self);
+const GList *gf_crtc_get_outputs (GfCrtc *self);
+
+void gf_crtc_assign_output (GfCrtc *self,
+ GfOutput *output);
+
+void gf_crtc_unassign_output (GfCrtc *self,
+ GfOutput *output);
+
void gf_crtc_set_config (GfCrtc *self,
GfRectangle *layout,
GfCrtcMode *mode,
diff --git a/backends/gf-crtc.c b/backends/gf-crtc.c
index 464c98e..1fc9d62 100644
--- a/backends/gf-crtc.c
+++ b/backends/gf-crtc.c
@@ -29,6 +29,8 @@ typedef struct
GfMonitorTransform all_transforms;
+ GList *outputs;
+
GfCrtcConfig *config;
} GfCrtcPrivate;
@@ -57,6 +59,7 @@ gf_crtc_finalize (GObject *object)
priv = gf_crtc_get_instance_private (crtc);
g_clear_pointer (&priv->config, g_free);
+ g_clear_pointer (&priv->outputs, g_list_free);
G_OBJECT_CLASS (gf_crtc_parent_class)->finalize (object);
}
@@ -211,6 +214,40 @@ gf_crtc_get_all_transforms (GfCrtc *self)
return priv->all_transforms;
}
+const GList *
+gf_crtc_get_outputs (GfCrtc *self)
+{
+ GfCrtcPrivate *priv;
+
+ priv = gf_crtc_get_instance_private (self);
+
+ return priv->outputs;
+}
+
+void
+gf_crtc_assign_output (GfCrtc *self,
+ GfOutput *output)
+{
+ GfCrtcPrivate *priv;
+
+ priv = gf_crtc_get_instance_private (self);
+
+ priv->outputs = g_list_append (priv->outputs, output);
+}
+
+void
+gf_crtc_unassign_output (GfCrtc *self,
+ GfOutput *output)
+{
+ GfCrtcPrivate *priv;
+
+ priv = gf_crtc_get_instance_private (self);
+
+ g_return_if_fail (g_list_find (priv->outputs, output));
+
+ priv->outputs = g_list_remove (priv->outputs, output);
+}
+
void
gf_crtc_set_config (GfCrtc *self,
GfRectangle *layout,
diff --git a/backends/gf-output.c b/backends/gf-output.c
index 86097db..b5c659b 100644
--- a/backends/gf-output.c
+++ b/backends/gf-output.c
@@ -29,6 +29,8 @@
#include "config.h"
#include "gf-output-private.h"
+#include "gf-crtc-private.h"
+
typedef struct
{
uint64_t id;
@@ -278,7 +280,7 @@ gf_output_get_name (GfOutput *self)
}
void
-gf_output_assign_crtc (GfOutput *self,
+gf_output_assign_crtc (GfOutput *self,
GfCrtc *crtc,
const GfOutputAssignment *output_assignment)
{
@@ -288,8 +290,12 @@ gf_output_assign_crtc (GfOutput *self,
g_assert (crtc);
+ gf_output_unassign_crtc (self);
+
g_set_object (&priv->crtc, crtc);
+ gf_crtc_assign_output (crtc, self);
+
priv->is_primary = output_assignment->is_primary;
priv->is_presentation = output_assignment->is_presentation;
priv->is_underscanning = output_assignment->is_underscanning;
@@ -302,7 +308,11 @@ gf_output_unassign_crtc (GfOutput *output)
priv = gf_output_get_instance_private (output);
- g_clear_object (&priv->crtc);
+ if (priv->crtc != NULL)
+ {
+ gf_crtc_unassign_output (priv->crtc, output);
+ g_clear_object (&priv->crtc);
+ }
priv->is_primary = FALSE;
priv->is_presentation = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]