[gnome-flashback] crtc: move GfCrtcConfig field to instance private
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] crtc: move GfCrtcConfig field to instance private
- Date: Sat, 11 Jul 2020 18:42:50 +0000 (UTC)
commit 1e6e3c5e4bcc524e118eb92d06f371f9340a37e7
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Jul 10 12:29:50 2020 +0300
crtc: move GfCrtcConfig field to instance private
Based on mutter commit:
https://gitlab.gnome.org/GNOME/mutter/-/commit/092c5304a94282ba93de
backends/gf-crtc-private.h | 5 +++--
backends/gf-crtc.c | 33 +++++++++++++++++++++++++++------
backends/gf-logical-monitor.c | 6 +++++-
backends/gf-monitor-manager-xrandr.c | 6 +++---
backends/gf-monitor-manager.c | 4 ++--
backends/gf-monitor-normal.c | 17 +++++++++++++----
backends/gf-monitor-tiled.c | 5 ++---
backends/gf-monitor.c | 8 +++++---
backends/gf-output-xrandr.c | 4 ++--
9 files changed, 62 insertions(+), 26 deletions(-)
---
diff --git a/backends/gf-crtc-private.h b/backends/gf-crtc-private.h
index b3ec5e1..4edcf1e 100644
--- a/backends/gf-crtc-private.h
+++ b/backends/gf-crtc-private.h
@@ -47,8 +47,6 @@ struct _GfCrtc
{
GObject parent;
- GfCrtcConfig *config;
-
gpointer driver_private;
GDestroyNotify driver_notify;
};
@@ -98,6 +96,9 @@ void gf_crtc_set_config (GfCrtc *self,
void gf_crtc_unset_config (GfCrtc *self);
+
+const GfCrtcConfig *gf_crtc_get_config (GfCrtc *self);
+
G_END_DECLS
#endif
diff --git a/backends/gf-crtc.c b/backends/gf-crtc.c
index 8dc4830..9fe4ec7 100644
--- a/backends/gf-crtc.c
+++ b/backends/gf-crtc.c
@@ -28,6 +28,8 @@ typedef struct
GfGpu *gpu;
GfMonitorTransform all_transforms;
+
+ GfCrtcConfig *config;
} GfCrtcPrivate;
enum
@@ -49,13 +51,15 @@ static void
gf_crtc_finalize (GObject *object)
{
GfCrtc *crtc;
+ GfCrtcPrivate *priv;
crtc = GF_CRTC (object);
+ priv = gf_crtc_get_instance_private (crtc);
if (crtc->driver_notify)
crtc->driver_notify (crtc);
- g_clear_pointer (&crtc->config, g_free);
+ g_clear_pointer (&priv->config, g_free);
G_OBJECT_CLASS (gf_crtc_parent_class)->finalize (object);
}
@@ -211,25 +215,42 @@ gf_crtc_get_all_transforms (GfCrtc *self)
}
void
-gf_crtc_set_config (GfCrtc *crtc,
+gf_crtc_set_config (GfCrtc *self,
GfRectangle *layout,
GfCrtcMode *mode,
GfMonitorTransform transform)
{
+ GfCrtcPrivate *priv;
GfCrtcConfig *config;
- gf_crtc_unset_config (crtc);
+ priv = gf_crtc_get_instance_private (self);
+
+ gf_crtc_unset_config (self);
config = g_new0 (GfCrtcConfig, 1);
config->layout = *layout;
config->mode = mode;
config->transform = transform;
- crtc->config = config;
+ priv->config = config;
}
void
-gf_crtc_unset_config (GfCrtc *crtc)
+gf_crtc_unset_config (GfCrtc *self)
{
- g_clear_pointer (&crtc->config, g_free);
+ GfCrtcPrivate *priv;
+
+ priv = gf_crtc_get_instance_private (self);
+
+ g_clear_pointer (&priv->config, g_free);
+}
+
+const GfCrtcConfig *
+gf_crtc_get_config (GfCrtc *self)
+{
+ GfCrtcPrivate *priv;
+
+ priv = gf_crtc_get_instance_private (self);
+
+ return priv->config;
}
diff --git a/backends/gf-logical-monitor.c b/backends/gf-logical-monitor.c
index ffe214a..262f113 100644
--- a/backends/gf-logical-monitor.c
+++ b/backends/gf-logical-monitor.c
@@ -89,10 +89,14 @@ static GfMonitorTransform
derive_monitor_transform (GfMonitor *monitor)
{
GfOutput *main_output;
+ GfCrtc *crtc;
+ const GfCrtcConfig *crtc_config;
GfMonitorTransform transform;
main_output = gf_monitor_get_main_output (monitor);
- transform = gf_output_get_assigned_crtc (main_output)->config->transform;
+ crtc = gf_output_get_assigned_crtc (main_output);
+ crtc_config = gf_crtc_get_config (crtc);
+ transform = crtc_config->transform;
return gf_monitor_crtc_to_logical_transform (monitor, transform);
}
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
index 588487f..d05f13a 100644
--- a/backends/gf-monitor-manager-xrandr.c
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -424,10 +424,10 @@ apply_crtc_assignments (GfMonitorManager *manager,
{
GfCrtcAssignment *crtc_assignment = crtcs[i];
GfCrtc *crtc = crtc_assignment->crtc;
- GfCrtcConfig *crtc_config;
+ const GfCrtcConfig *crtc_config;
int x2, y2;
- crtc_config = crtc->config;
+ crtc_config = gf_crtc_get_config (crtc);
if (crtc_config == NULL)
continue;
@@ -453,7 +453,7 @@ apply_crtc_assignments (GfMonitorManager *manager,
{
GfCrtc *crtc = l->data;
- if (!crtc->config)
+ if (!gf_crtc_get_config (crtc))
continue;
xrandr_set_crtc_config (xrandr,
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index 1e8734e..97dc464 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -1102,7 +1102,7 @@ gf_monitor_manager_handle_get_resources (GfDBusDisplayConfig *skeleton,
{
GfCrtc *crtc = l->data;
GVariantBuilder transforms;
- GfCrtcConfig *crtc_config;
+ const GfCrtcConfig *crtc_config;
g_variant_builder_init (&transforms, G_VARIANT_TYPE ("au"));
for (j = 0; j <= GF_MONITOR_TRANSFORM_FLIPPED_270; j++)
@@ -1111,7 +1111,7 @@ gf_monitor_manager_handle_get_resources (GfDBusDisplayConfig *skeleton,
g_variant_builder_add (&transforms, "u", j);
}
- crtc_config = crtc->config;
+ crtc_config = gf_crtc_get_config (crtc);
if (crtc_config != NULL)
{
diff --git a/backends/gf-monitor-normal.c b/backends/gf-monitor-normal.c
index c4d97de..6819569 100644
--- a/backends/gf-monitor-normal.c
+++ b/backends/gf-monitor-normal.c
@@ -87,8 +87,15 @@ generate_modes (GfMonitorNormal *normal)
gf_monitor_set_preferred_mode (monitor, mode);
crtc = gf_output_get_assigned_crtc (output);
- if (crtc && crtc->config && crtc_mode == crtc->config->mode)
- gf_monitor_set_current_mode (monitor, mode);
+
+ if (crtc != NULL)
+ {
+ const GfCrtcConfig *crtc_config;
+
+ crtc_config = gf_crtc_get_config (crtc);
+ if (crtc_config && crtc_mode == crtc_config->mode)
+ gf_monitor_set_current_mode (monitor, mode);
+ }
}
}
@@ -108,13 +115,15 @@ gf_monitor_normal_derive_layout (GfMonitor *monitor,
{
GfOutput *output;
GfCrtc *crtc;
+ const GfCrtcConfig *crtc_config;
output = gf_monitor_get_main_output (monitor);
crtc = gf_output_get_assigned_crtc (output);
+ crtc_config = gf_crtc_get_config (crtc);
- g_return_if_fail (crtc->config);
+ g_return_if_fail (crtc_config);
- *layout = crtc->config->layout;
+ *layout = crtc_config->layout;
}
static void
diff --git a/backends/gf-monitor-tiled.c b/backends/gf-monitor-tiled.c
index 4d750f3..5b64e5c 100644
--- a/backends/gf-monitor-tiled.c
+++ b/backends/gf-monitor-tiled.c
@@ -661,7 +661,7 @@ gf_monitor_tiled_derive_layout (GfMonitor *monitor,
{
GfOutput *output;
GfCrtc *crtc;
- GfCrtcConfig *crtc_config;
+ const GfCrtcConfig *crtc_config;
output = l->data;
crtc = gf_output_get_assigned_crtc (output);
@@ -669,8 +669,7 @@ gf_monitor_tiled_derive_layout (GfMonitor *monitor,
if (!crtc)
continue;
- crtc_config = crtc->config;
-
+ crtc_config = gf_crtc_get_config (crtc);
g_return_if_fail (crtc_config);
min_x = MIN (crtc_config->layout.x, min_x);
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index deaa526..3e23c36 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -208,7 +208,7 @@ is_current_mode_known (GfMonitor *monitor)
output = gf_monitor_get_main_output (monitor);
crtc = gf_output_get_assigned_crtc (output);
- return gf_monitor_is_active (monitor) == (crtc && crtc->config);
+ return gf_monitor_is_active (monitor) == (crtc && gf_crtc_get_config (crtc));
}
static gboolean
@@ -548,14 +548,16 @@ gf_monitor_is_mode_assigned (GfMonitor *monitor,
GfOutput *output;
GfMonitorCrtcMode *monitor_crtc_mode;
GfCrtc *crtc;
+ const GfCrtcConfig *crtc_config;
output = l->data;
monitor_crtc_mode = &mode->crtc_modes[i];
crtc = gf_output_get_assigned_crtc (output);
+ crtc_config = crtc ? gf_crtc_get_config (crtc) : NULL;
if (monitor_crtc_mode->crtc_mode &&
- (!crtc || !crtc->config ||
- crtc->config->mode != monitor_crtc_mode->crtc_mode))
+ (!crtc || !crtc_config ||
+ crtc_config->mode != monitor_crtc_mode->crtc_mode))
return FALSE;
else if (!monitor_crtc_mode->crtc_mode && crtc)
return FALSE;
diff --git a/backends/gf-output-xrandr.c b/backends/gf-output-xrandr.c
index 33affae..7608ac7 100644
--- a/backends/gf-output-xrandr.c
+++ b/backends/gf-output-xrandr.c
@@ -100,11 +100,11 @@ output_set_underscanning_xrandr (GfOutput *output,
if (underscanning)
{
GfCrtc *crtc;
- GfCrtcConfig *crtc_config;
+ const GfCrtcConfig *crtc_config;
uint32_t border_value;
crtc = gf_output_get_assigned_crtc (output);
- crtc_config = crtc->config;
+ crtc_config = gf_crtc_get_config (crtc);
prop = XInternAtom (xdisplay, "underscan hborder", False);
border_value = crtc_config->mode->width * 0.05;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]