[gnome-flashback] crtc-mode: move away fields from public GfCrtcMode struct
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] crtc-mode: move away fields from public GfCrtcMode struct
- Date: Sat, 11 Jul 2020 18:43:10 +0000 (UTC)
commit 99ff84ead63b9eecfa193033f06ce37e33acfea1
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Fri Jul 10 15:25:25 2020 +0300
crtc-mode: move away fields from public GfCrtcMode struct
Based on mutter commits:
https://gitlab.gnome.org/GNOME/mutter/-/commit/4b37c2e446f0b613927f
https://gitlab.gnome.org/GNOME/mutter/-/commit/e089e53b24ecf377e833
backends/Makefile.am | 2 +
backends/gf-crtc-mode-info-private.h | 71 +++++++++++++++
backends/gf-crtc-mode-info.c | 51 +++++++++++
backends/gf-crtc-mode-private.h | 47 +++-------
backends/gf-crtc-mode.c | 169 ++++++++++++++++++++++++++++++++---
backends/gf-gpu-xrandr.c | 26 ++++--
backends/gf-monitor-config-manager.c | 10 ++-
backends/gf-monitor-manager-xrandr.c | 22 +++--
backends/gf-monitor-manager.c | 13 +--
backends/gf-monitor-normal.c | 12 ++-
backends/gf-monitor-tiled.c | 22 +++--
backends/gf-monitor.c | 6 +-
backends/gf-output-xrandr.c | 8 +-
13 files changed, 375 insertions(+), 84 deletions(-)
---
diff --git a/backends/Makefile.am b/backends/Makefile.am
index d99849b..ea2f949 100644
--- a/backends/Makefile.am
+++ b/backends/Makefile.am
@@ -25,6 +25,8 @@ libbackends_la_SOURCES = \
gf-backend-x11.c \
gf-backend.c \
gf-backend.h \
+ gf-crtc-mode-info-private.h \
+ gf-crtc-mode-info.c \
gf-crtc-mode-private.h \
gf-crtc-mode.c \
gf-crtc-private.h \
diff --git a/backends/gf-crtc-mode-info-private.h b/backends/gf-crtc-mode-info-private.h
new file mode 100644
index 0000000..5731515
--- /dev/null
+++ b/backends/gf-crtc-mode-info-private.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2017-2020 Red Hat
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GF_CRTC_MODE_INFO_PRIVATE_H
+#define GF_CRTC_MODE_INFO_PRIVATE_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* Same as KMS mode flags and X11 randr flags */
+typedef enum
+{
+ GF_CRTC_MODE_FLAG_NONE = 0,
+
+ GF_CRTC_MODE_FLAG_PHSYNC = (1 << 0),
+ GF_CRTC_MODE_FLAG_NHSYNC = (1 << 1),
+ GF_CRTC_MODE_FLAG_PVSYNC = (1 << 2),
+ GF_CRTC_MODE_FLAG_NVSYNC = (1 << 3),
+ GF_CRTC_MODE_FLAG_INTERLACE = (1 << 4),
+ GF_CRTC_MODE_FLAG_DBLSCAN = (1 << 5),
+ GF_CRTC_MODE_FLAG_CSYNC = (1 << 6),
+ GF_CRTC_MODE_FLAG_PCSYNC = (1 << 7),
+ GF_CRTC_MODE_FLAG_NCSYNC = (1 << 8),
+ GF_CRTC_MODE_FLAG_HSKEW = (1 << 9),
+ GF_CRTC_MODE_FLAG_BCAST = (1 << 10),
+ GF_CRTC_MODE_FLAG_PIXMUX = (1 << 11),
+ GF_CRTC_MODE_FLAG_DBLCLK = (1 << 12),
+ GF_CRTC_MODE_FLAG_CLKDIV2 = (1 << 13),
+
+ GF_CRTC_MODE_FLAG_MASK = 0x3fff
+} GfCrtcModeFlag;
+
+typedef struct
+{
+ grefcount ref_count;
+
+ int width;
+ int height;
+ float refresh_rate;
+ GfCrtcModeFlag flags;
+} GfCrtcModeInfo;
+
+#define GF_TYPE_CRTC_MODE_INFO (gf_crtc_mode_info_get_type ())
+
+GType gf_crtc_mode_info_get_type (void);
+
+GfCrtcModeInfo *gf_crtc_mode_info_new (void);
+
+GfCrtcModeInfo *gf_crtc_mode_info_ref (GfCrtcModeInfo *self);
+
+void gf_crtc_mode_info_unref (GfCrtcModeInfo *self);
+
+G_END_DECLS
+
+#endif
diff --git a/backends/gf-crtc-mode-info.c b/backends/gf-crtc-mode-info.c
new file mode 100644
index 0000000..e090074
--- /dev/null
+++ b/backends/gf-crtc-mode-info.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2017-2020 Red Hat
+ * Copyright (C) 2020 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+#include "gf-crtc-mode-info-private.h"
+
+G_DEFINE_BOXED_TYPE (GfCrtcModeInfo,
+ gf_crtc_mode_info,
+ gf_crtc_mode_info_ref,
+ gf_crtc_mode_info_unref)
+
+GfCrtcModeInfo *
+gf_crtc_mode_info_new (void)
+{
+ GfCrtcModeInfo *self;
+
+ self = g_new0 (GfCrtcModeInfo, 1);
+ g_ref_count_init (&self->ref_count);
+
+ return self;
+}
+
+GfCrtcModeInfo *
+gf_crtc_mode_info_ref (GfCrtcModeInfo *self)
+{
+ g_ref_count_inc (&self->ref_count);
+
+ return self;
+}
+
+void
+gf_crtc_mode_info_unref (GfCrtcModeInfo *self)
+{
+ if (g_ref_count_dec (&self->ref_count))
+ g_free (self);
+}
diff --git a/backends/gf-crtc-mode-private.h b/backends/gf-crtc-mode-private.h
index d8996f2..98eb752 100644
--- a/backends/gf-crtc-mode-private.h
+++ b/backends/gf-crtc-mode-private.h
@@ -22,50 +22,23 @@
#include <glib-object.h>
#include <stdint.h>
-G_BEGIN_DECLS
-
-/* Same as KMS mode flags and X11 randr flags */
-typedef enum
-{
- GF_CRTC_MODE_FLAG_NONE = 0,
+#include "gf-crtc-mode-info-private.h"
- GF_CRTC_MODE_FLAG_PHSYNC = (1 << 0),
- GF_CRTC_MODE_FLAG_NHSYNC = (1 << 1),
- GF_CRTC_MODE_FLAG_PVSYNC = (1 << 2),
- GF_CRTC_MODE_FLAG_NVSYNC = (1 << 3),
- GF_CRTC_MODE_FLAG_INTERLACE = (1 << 4),
- GF_CRTC_MODE_FLAG_DBLSCAN = (1 << 5),
- GF_CRTC_MODE_FLAG_CSYNC = (1 << 6),
- GF_CRTC_MODE_FLAG_PCSYNC = (1 << 7),
- GF_CRTC_MODE_FLAG_NCSYNC = (1 << 8),
- GF_CRTC_MODE_FLAG_HSKEW = (1 << 9),
- GF_CRTC_MODE_FLAG_BCAST = (1 << 10),
- GF_CRTC_MODE_FLAG_PIXMUX = (1 << 11),
- GF_CRTC_MODE_FLAG_DBLCLK = (1 << 12),
- GF_CRTC_MODE_FLAG_CLKDIV2 = (1 << 13),
+G_BEGIN_DECLS
- GF_CRTC_MODE_FLAG_MASK = 0x3fff
-} GfCrtcModeFlag;
+#define GF_TYPE_CRTC_MODE (gf_crtc_mode_get_type ())
+G_DECLARE_DERIVABLE_TYPE (GfCrtcMode, gf_crtc_mode, GF, CRTC_MODE, GObject)
-struct _GfCrtcMode
+struct _GfCrtcModeClass
{
- GObject parent;
-
- /* The low-level ID of this mode, used to apply back configuration */
- uint64_t mode_id;
- char *name;
+ GObjectClass parent_class;
+};
- int width;
- int height;
- float refresh_rate;
- GfCrtcModeFlag flags;
+uint64_t gf_crtc_mode_get_id (GfCrtcMode *self);
- gpointer driver_private;
- GDestroyNotify driver_notify;
-};
+const char *gf_crtc_mode_get_name (GfCrtcMode *self);
-#define GF_TYPE_CRTC_MODE (gf_crtc_mode_get_type ())
-G_DECLARE_FINAL_TYPE (GfCrtcMode, gf_crtc_mode, GF, CRTC_MODE, GObject)
+const GfCrtcModeInfo *gf_crtc_mode_get_info (GfCrtcMode *self);
G_END_DECLS
diff --git a/backends/gf-crtc-mode.c b/backends/gf-crtc-mode.c
index f7d58d8..ec8f77e 100644
--- a/backends/gf-crtc-mode.c
+++ b/backends/gf-crtc-mode.c
@@ -19,34 +19,183 @@
#include "config.h"
#include "gf-crtc-mode-private.h"
-G_DEFINE_TYPE (GfCrtcMode, gf_crtc_mode, G_TYPE_OBJECT)
+typedef struct
+{
+ uint64_t id;
+ char *name;
+ GfCrtcModeInfo *info;
+} GfCrtcModePrivate;
+
+enum
+{
+ PROP_0,
+
+ PROP_ID,
+ PROP_NAME,
+ PROP_INFO,
+
+ LAST_PROP
+};
+
+static GParamSpec *crtc_mode_properties[LAST_PROP] = { NULL };
+
+G_DEFINE_TYPE_WITH_PRIVATE (GfCrtcMode, gf_crtc_mode, G_TYPE_OBJECT)
static void
gf_crtc_mode_finalize (GObject *object)
{
- GfCrtcMode *crtc_mode;
-
- crtc_mode = GF_CRTC_MODE (object);
+ GfCrtcMode *self;
+ GfCrtcModePrivate *priv;
- if (crtc_mode->driver_notify)
- crtc_mode->driver_notify (crtc_mode);
+ self = GF_CRTC_MODE (object);
+ priv = gf_crtc_mode_get_instance_private (self);
- g_clear_pointer (&crtc_mode->name, g_free);
+ g_clear_pointer (&priv->name, g_free);
+ g_clear_pointer (&priv->info, gf_crtc_mode_info_unref);
G_OBJECT_CLASS (gf_crtc_mode_parent_class)->finalize (object);
}
static void
-gf_crtc_mode_class_init (GfCrtcModeClass *crtc_mode_class)
+gf_crtc_mode_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GfCrtcMode *self;
+ GfCrtcModePrivate *priv;
+
+ self = GF_CRTC_MODE (object);
+ priv = gf_crtc_mode_get_instance_private (self);
+
+ switch (property_id)
+ {
+ case PROP_ID:
+ g_value_set_uint64 (value, priv->id);
+ break;
+
+ case PROP_NAME:
+ g_value_set_string (value, priv->name);
+ break;
+
+ case PROP_INFO:
+ g_value_set_boxed (value, priv->info);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_crtc_mode_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GfCrtcMode *self;
+ GfCrtcModePrivate *priv;
+
+ self = GF_CRTC_MODE (object);
+ priv = gf_crtc_mode_get_instance_private (self);
+
+ switch (property_id)
+ {
+ case PROP_ID:
+ priv->id = g_value_get_uint64 (value);
+ break;
+
+ case PROP_NAME:
+ priv->name = g_value_dup_string (value);
+ break;
+
+ case PROP_INFO:
+ priv->info = gf_crtc_mode_info_ref (g_value_get_boxed (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ break;
+ }
+}
+
+static void
+gf_crtc_mode_class_init (GfCrtcModeClass *self_class)
{
GObjectClass *object_class;
- object_class = G_OBJECT_CLASS (crtc_mode_class);
+ object_class = G_OBJECT_CLASS (self_class);
object_class->finalize = gf_crtc_mode_finalize;
+ object_class->get_property = gf_crtc_mode_get_property;
+ object_class->set_property = gf_crtc_mode_set_property;
+
+ crtc_mode_properties[PROP_ID] =
+ g_param_spec_uint64 ("id",
+ "id",
+ "CRTC mode id",
+ 0,
+ UINT64_MAX,
+ 0,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ crtc_mode_properties[PROP_NAME] =
+ g_param_spec_string ("name",
+ "name",
+ "Name of CRTC mode",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ crtc_mode_properties[PROP_INFO] =
+ g_param_spec_boxed ("info",
+ "info",
+ "GfCrtcModeInfo",
+ GF_TYPE_CRTC_MODE_INFO,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS);
+
+ g_object_class_install_properties (object_class,
+ LAST_PROP,
+ crtc_mode_properties);
}
static void
-gf_crtc_mode_init (GfCrtcMode *crtc_mode)
+gf_crtc_mode_init (GfCrtcMode *self)
+{
+}
+
+uint64_t
+gf_crtc_mode_get_id (GfCrtcMode *self)
+{
+ GfCrtcModePrivate *priv;
+
+ priv = gf_crtc_mode_get_instance_private (self);
+
+ return priv->id;
+}
+
+const char *
+gf_crtc_mode_get_name (GfCrtcMode *self)
{
+ GfCrtcModePrivate *priv;
+
+ priv = gf_crtc_mode_get_instance_private (self);
+
+ return priv->name;
+}
+
+const GfCrtcModeInfo *
+gf_crtc_mode_get_info (GfCrtcMode *self)
+{
+ GfCrtcModePrivate *priv;
+
+ priv = gf_crtc_mode_get_instance_private (self);
+
+ return priv->info;
}
diff --git a/backends/gf-gpu-xrandr.c b/backends/gf-gpu-xrandr.c
index 1403f0c..de9cdee 100644
--- a/backends/gf-gpu-xrandr.c
+++ b/backends/gf-gpu-xrandr.c
@@ -141,19 +141,31 @@ gf_gpu_xrandr_read_current (GfGpu *gpu,
for (i = 0; i < (guint) resources->nmode; i++)
{
XRRModeInfo *xmode;
+ GfCrtcModeInfo *crtc_mode_info;
+ char *crtc_mode_name;
GfCrtcMode *mode;
xmode = &resources->modes[i];
- mode = g_object_new (GF_TYPE_CRTC_MODE, NULL);
- mode->mode_id = xmode->id;
- mode->width = xmode->width;
- mode->height = xmode->height;
- mode->refresh_rate = (xmode->dotClock / ((gfloat) xmode->hTotal * xmode->vTotal));
- mode->flags = xmode->modeFlags;
- mode->name = get_xmode_name (xmode);
+ crtc_mode_info = gf_crtc_mode_info_new ();
+ crtc_mode_name = get_xmode_name (xmode);
+
+ crtc_mode_info->width = xmode->width;
+ crtc_mode_info->height = xmode->height;
+ crtc_mode_info->refresh_rate = (xmode->dotClock /
+ ((float) xmode->hTotal * xmode->vTotal));
+ crtc_mode_info->flags = xmode->modeFlags;
+
+ mode = g_object_new (GF_TYPE_CRTC_MODE,
+ "id", xmode->id,
+ "name", crtc_mode_name,
+ "info", crtc_mode_info,
+ NULL);
modes = g_list_append (modes, mode);
+
+ gf_crtc_mode_info_unref (crtc_mode_info);
+ g_free (crtc_mode_name);
}
gf_gpu_take_modes (gpu, modes);
diff --git a/backends/gf-monitor-config-manager.c b/backends/gf-monitor-config-manager.c
index e167dc5..c7112e7 100644
--- a/backends/gf-monitor-config-manager.c
+++ b/backends/gf-monitor-config-manager.c
@@ -679,6 +679,7 @@ assign_monitor_crtc (GfMonitor *monitor,
float scale;
float width, height;
GfCrtcMode *crtc_mode;
+ const GfCrtcModeInfo *crtc_mode_info;
GfRectangle crtc_layout;
GfCrtcAssignment *crtc_assignment;
GfOutputAssignment *output_assignment;
@@ -730,16 +731,17 @@ assign_monitor_crtc (GfMonitor *monitor,
}
crtc_mode = monitor_crtc_mode->crtc_mode;
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
if (gf_monitor_transform_is_rotated (crtc_transform))
{
- width = crtc_mode->height / scale;
- height = crtc_mode->width / scale;
+ width = crtc_mode_info->height / scale;
+ height = crtc_mode_info->width / scale;
}
else
{
- width = crtc_mode->width / scale;
- height = crtc_mode->height / scale;
+ width = crtc_mode_info->width / scale;
+ height = crtc_mode_info->height / scale;
}
crtc_layout.x = (int) roundf (x_offset + (crtc_x / scale));
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
index e5648d2..07e1fad 100644
--- a/backends/gf-monitor-manager-xrandr.c
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -489,12 +489,13 @@ apply_crtc_assignments (GfMonitorManager *manager,
if (crtc_assignment->mode != NULL)
{
- GfCrtcMode *mode;
+ GfCrtcMode *crtc_mode;
xcb_randr_output_t *output_ids;
guint j, n_output_ids;
xcb_randr_rotation_t rotation;
+ xcb_randr_mode_t mode;
- mode = crtc_assignment->mode;
+ crtc_mode = crtc_assignment->mode;
n_output_ids = crtc_assignment->outputs->len;
output_ids = g_new0 (xcb_randr_output_t, n_output_ids);
@@ -515,6 +516,8 @@ apply_crtc_assignments (GfMonitorManager *manager,
}
rotation = gf_monitor_transform_to_xrandr (crtc_assignment->transform);
+ mode = gf_crtc_mode_get_id (crtc_mode);
+
if (!xrandr_set_crtc_config (xrandr,
crtc,
save_timestamp,
@@ -522,13 +525,20 @@ apply_crtc_assignments (GfMonitorManager *manager,
XCB_CURRENT_TIME,
crtc_assignment->layout.x,
crtc_assignment->layout.y,
- (xcb_randr_mode_t) mode->mode_id,
+ mode,
rotation,
output_ids, n_output_ids))
{
+ const GfCrtcModeInfo *crtc_mode_info;
+
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
+
g_warning ("Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform
%u failed\n",
- (guint) gf_crtc_get_id (crtc), (guint) (mode->mode_id),
- mode->width, mode->height, (gdouble) mode->refresh_rate,
+ (unsigned) gf_crtc_get_id (crtc),
+ (unsigned) mode,
+ crtc_mode_info->width,
+ crtc_mode_info->height,
+ (double) crtc_mode_info->refresh_rate,
crtc_assignment->layout.x,
crtc_assignment->layout.y,
crtc_assignment->transform);
@@ -539,7 +549,7 @@ apply_crtc_assignments (GfMonitorManager *manager,
gf_crtc_set_config (crtc,
&crtc_assignment->layout,
- mode,
+ crtc_mode,
crtc_assignment->transform);
g_free (output_ids);
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index 97dc464..5b452af 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -1282,14 +1282,17 @@ gf_monitor_manager_handle_get_resources (GfDBusDisplayConfig *skeleton,
for (l = combined_modes, i = 0; l; l = l->next, i++)
{
GfCrtcMode *mode = l->data;
+ const GfCrtcModeInfo *crtc_mode_info;
+
+ crtc_mode_info = gf_crtc_mode_get_info (mode);
g_variant_builder_add (&mode_builder, "(uxuudu)",
i, /* ID */
- (gint64) mode->mode_id,
- (guint32) mode->width,
- (guint32) mode->height,
- (gdouble) mode->refresh_rate,
- (guint32) mode->flags);
+ (int64_t) gf_crtc_mode_get_id (mode),
+ (uint32_t) crtc_mode_info->width,
+ (uint32_t) crtc_mode_info->height,
+ (double) crtc_mode_info->refresh_rate,
+ (uint32_t) crtc_mode_info->flags);
}
if (!gf_monitor_manager_get_max_screen_size (manager,
diff --git a/backends/gf-monitor-normal.c b/backends/gf-monitor-normal.c
index 6819569..3afcbd9 100644
--- a/backends/gf-monitor-normal.c
+++ b/backends/gf-monitor-normal.c
@@ -37,28 +37,32 @@ generate_modes (GfMonitorNormal *normal)
GfMonitor *monitor;
GfOutput *output;
const GfOutputInfo *output_info;
+ GfCrtcMode *preferred_mode;
GfCrtcModeFlag preferred_mode_flags;
guint i;
monitor = GF_MONITOR (normal);
output = gf_monitor_get_main_output (monitor);
output_info = gf_output_get_info (output);
- preferred_mode_flags = output_info->preferred_mode->flags;
+ preferred_mode = output_info->preferred_mode;
+ preferred_mode_flags = gf_crtc_mode_get_info (preferred_mode)->flags;
for (i = 0; i < output_info->n_modes; i++)
{
GfCrtcMode *crtc_mode;
+ const GfCrtcModeInfo *crtc_mode_info;
GfMonitorMode *mode;
gboolean replace;
GfCrtc *crtc;
crtc_mode = output_info->modes[i];
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
mode = g_new0 (GfMonitorMode, 1);
mode->monitor = monitor;
mode->spec = gf_monitor_create_spec (monitor,
- crtc_mode->width,
- crtc_mode->height,
+ crtc_mode_info->width,
+ crtc_mode_info->height,
crtc_mode);
mode->id = gf_monitor_mode_spec_generate_id (&mode->spec);
@@ -74,7 +78,7 @@ generate_modes (GfMonitorNormal *normal)
* otherwise take the first one in the list. This guarantees that the
* preferred mode is always added.
*/
- replace = crtc_mode->flags == preferred_mode_flags;
+ replace = crtc_mode_info->flags == preferred_mode_flags;
if (!gf_monitor_add_mode (monitor, mode, replace))
{
diff --git a/backends/gf-monitor-tiled.c b/backends/gf-monitor-tiled.c
index 5b64e5c..8342dd0 100644
--- a/backends/gf-monitor-tiled.c
+++ b/backends/gf-monitor-tiled.c
@@ -54,11 +54,13 @@ is_crtc_mode_tiled (GfOutput *output,
GfCrtcMode *crtc_mode)
{
const GfOutputInfo *output_info;
+ const GfCrtcModeInfo *crtc_mode_info;
output_info = gf_output_get_info (output);
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
- return (crtc_mode->width == (int) output_info->tile_info.tile_w &&
- crtc_mode->height == (int) output_info->tile_info.tile_h);
+ return (crtc_mode_info->width == (int) output_info->tile_info.tile_w &&
+ crtc_mode_info->height == (int) output_info->tile_info.tile_h);
}
static GfCrtcMode *
@@ -66,10 +68,12 @@ find_tiled_crtc_mode (GfOutput *output,
GfCrtcMode *reference_crtc_mode)
{
const GfOutputInfo *output_info;
+ const GfCrtcModeInfo *reference_crtc_mode_info;
GfCrtcMode *crtc_mode;
guint i;
output_info = gf_output_get_info (output);
+ reference_crtc_mode_info = gf_crtc_mode_get_info (reference_crtc_mode);
crtc_mode = output_info->preferred_mode;
if (is_crtc_mode_tiled (output, crtc_mode))
@@ -77,15 +81,18 @@ find_tiled_crtc_mode (GfOutput *output,
for (i = 0; i < output_info->n_modes; i++)
{
+ const GfCrtcModeInfo *crtc_mode_info;
+
crtc_mode = output_info->modes[i];
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
if (!is_crtc_mode_tiled (output, crtc_mode))
continue;
- if (crtc_mode->refresh_rate != reference_crtc_mode->refresh_rate)
+ if (crtc_mode_info->refresh_rate != reference_crtc_mode_info->refresh_rate)
continue;
- if (crtc_mode->flags != reference_crtc_mode->flags)
+ if (crtc_mode_info->flags != reference_crtc_mode_info->flags)
continue;
return crtc_mode;
@@ -195,6 +202,7 @@ create_untiled_monitor_mode (GfMonitorTiled *tiled,
GfMonitor *monitor;
GList *outputs;
GfMonitorModeTiled *mode;
+ const GfCrtcModeInfo *crtc_mode_info;
GList *l;
guint i;
@@ -208,9 +216,11 @@ create_untiled_monitor_mode (GfMonitorTiled *tiled,
mode->is_tiled = FALSE;
mode->parent.monitor = monitor;
+
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
mode->parent.spec = gf_monitor_create_spec (monitor,
- crtc_mode->width,
- crtc_mode->height,
+ crtc_mode_info->width,
+ crtc_mode_info->height,
crtc_mode);
mode->parent.id = gf_monitor_mode_spec_generate_id (&mode->parent.spec);
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index 3e23c36..fc11f6b 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -606,9 +606,11 @@ gf_monitor_create_spec (GfMonitor *monitor,
GfCrtcMode *crtc_mode)
{
const GfOutputInfo *output_info;
+ const GfCrtcModeInfo *crtc_mode_info;
GfMonitorModeSpec spec;
output_info = gf_monitor_get_main_output_info (monitor);
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_mode);
if (gf_monitor_transform_is_rotated (output_info->panel_orientation_transform))
{
@@ -621,8 +623,8 @@ gf_monitor_create_spec (GfMonitor *monitor,
spec.width = width;
spec.height = height;
- spec.refresh_rate = crtc_mode->refresh_rate;
- spec.flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS;
+ spec.refresh_rate = crtc_mode_info->refresh_rate;
+ spec.flags = crtc_mode_info->flags & HANDLED_CRTC_MODE_FLAGS;
return spec;
}
diff --git a/backends/gf-output-xrandr.c b/backends/gf-output-xrandr.c
index cbf2679..d4a7094 100644
--- a/backends/gf-output-xrandr.c
+++ b/backends/gf-output-xrandr.c
@@ -108,13 +108,15 @@ output_set_underscanning_xrandr (GfOutput *output,
{
GfCrtc *crtc;
const GfCrtcConfig *crtc_config;
+ const GfCrtcModeInfo *crtc_mode_info;
uint32_t border_value;
crtc = gf_output_get_assigned_crtc (output);
crtc_config = gf_crtc_get_config (crtc);
+ crtc_mode_info = gf_crtc_mode_get_info (crtc_config->mode);
prop = XInternAtom (xdisplay, "underscan hborder", False);
- border_value = crtc_config->mode->width * 0.05;
+ border_value = crtc_mode_info->width * 0.05;
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
(XID) gf_output_get_id (output),
@@ -123,7 +125,7 @@ output_set_underscanning_xrandr (GfOutput *output,
1, &border_value);
prop = XInternAtom (xdisplay, "underscan vborder", False);
- border_value = crtc_config->mode->height * 0.05;
+ border_value = crtc_mode_info->height * 0.05;
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
(XID) gf_output_get_id (output),
@@ -524,7 +526,7 @@ output_info_init_modes (GfOutputInfo *output_info,
{
GfCrtcMode *mode = l->data;
- if (xrandr_output->modes[j] == (XID) mode->mode_id)
+ if (xrandr_output->modes[j] == (XID) gf_crtc_mode_get_id (mode))
{
output_info->modes[n_actual_modes] = mode;
n_actual_modes += 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]