[gnome-flashback] crtc: move configured state to separate struct
- From: Alberts MuktupÄvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-flashback] crtc: move configured state to separate struct
- Date: Thu, 12 Mar 2020 20:51:11 +0000 (UTC)
commit 819d4abe76a01f5666db8e34a30aac56547d35ef
Author: Alberts MuktupÄvels <alberts muktupavels gmail com>
Date: Thu Mar 12 20:18:03 2020 +0200
crtc: move configured state to separate struct
To make it more reliable to distinguish between values that are
read from the backend implementation (which is likely to be
irrelevant for anything but the backend implementation), split out
those values (e.g. layout).
This changes the meaning of what was MetaCrtc::rect, to a
MetaCrtcConfig::layout which is the layout the CRTC has in the
global coordinate space.
Based on mutter commits:
https://gitlab.gnome.org/GNOME/mutter/-/commit/fe42d56db39f994144e
https://gitlab.gnome.org/GNOME/mutter/-/commit/9fa56176fd5c95b609c
https://gitlab.gnome.org/GNOME/mutter/-/commit/01aaced1293f360c81c
https://gitlab.gnome.org/GNOME/mutter/-/commit/d2a12ee0fabff9a7f0c
backends/gf-crtc-private.h | 24 ++++++---
backends/gf-crtc-xrandr-private.h | 35 +++++++------
backends/gf-crtc-xrandr.c | 90 +++++++++++++++++++++++++++++++---
backends/gf-crtc.c | 26 ++++++++++
backends/gf-logical-monitor.c | 2 +-
backends/gf-monitor-config-manager.c | 43 ++++++++++------
backends/gf-monitor-manager-xrandr.c | 95 ++++++++++--------------------------
backends/gf-monitor-manager.c | 50 +++++++++++++------
backends/gf-monitor-normal.c | 11 ++---
backends/gf-monitor-tiled.c | 13 +++--
backends/gf-monitor.c | 5 +-
backends/gf-output-xrandr.c | 6 ++-
12 files changed, 256 insertions(+), 144 deletions(-)
---
diff --git a/backends/gf-crtc-private.h b/backends/gf-crtc-private.h
index 570c1e7..e4aa6a8 100644
--- a/backends/gf-crtc-private.h
+++ b/backends/gf-crtc-private.h
@@ -34,6 +34,14 @@
G_BEGIN_DECLS
+typedef struct
+{
+ GfRectangle layout;
+ GfMonitorTransform transform;
+
+ GfCrtcMode *mode;
+} GfCrtcConfig;
+
struct _GfCrtc
{
GObject parent;
@@ -41,15 +49,13 @@ struct _GfCrtc
GfGpu *gpu;
glong crtc_id;
- GfRectangle rect;
- GfCrtcMode *current_mode;
- GfMonitorTransform transform;
guint all_transforms;
/* Only used to build the logical configuration
* from the HW one
*/
GfLogicalMonitor *logical_monitor;
+ GfCrtcConfig *config;
/* Used when changing configuration */
gboolean is_dirty;
@@ -79,8 +85,7 @@ typedef struct
{
GfCrtc *crtc;
GfCrtcMode *mode;
- int x;
- int y;
+ GfRectangle layout;
GfMonitorTransform transform;
GPtrArray *outputs;
} GfCrtcInfo;
@@ -91,7 +96,14 @@ G_DECLARE_FINAL_TYPE (GfCrtc, gf_crtc, GF, CRTC, GObject)
#define GF_TYPE_CRTC_MODE (gf_crtc_mode_get_type ())
G_DECLARE_FINAL_TYPE (GfCrtcMode, gf_crtc_mode, GF, CRTC_MODE, GObject)
-GfGpu *gf_crtc_get_gpu (GfCrtc *crtc);
+GfGpu *gf_crtc_get_gpu (GfCrtc *crtc);
+
+void gf_crtc_set_config (GfCrtc *crtc,
+ GfRectangle *layout,
+ GfCrtcMode *mode,
+ GfMonitorTransform transform);
+
+void gf_crtc_unset_config (GfCrtc *crtc);
G_END_DECLS
diff --git a/backends/gf-crtc-xrandr-private.h b/backends/gf-crtc-xrandr-private.h
index 05a5bd4..6e244a8 100644
--- a/backends/gf-crtc-xrandr-private.h
+++ b/backends/gf-crtc-xrandr-private.h
@@ -30,21 +30,26 @@
G_BEGIN_DECLS
-GfCrtc *gf_create_xrandr_crtc (GfGpuXrandr *gpu_xrandr,
- XRRCrtcInfo *xrandr_crtc,
- RRCrtc crtc_id,
- XRRScreenResources *resources);
-
-gboolean gf_crtc_xrandr_set_config (GfCrtc *crtc,
- xcb_randr_crtc_t xrandr_crtc,
- xcb_timestamp_t timestamp,
- int x,
- int y,
- xcb_randr_mode_t mode,
- xcb_randr_rotation_t rotation,
- xcb_randr_output_t *outputs,
- int n_outputs,
- xcb_timestamp_t *out_timestamp);
+GfCrtc *gf_create_xrandr_crtc (GfGpuXrandr *gpu_xrandr,
+ XRRCrtcInfo *xrandr_crtc,
+ RRCrtc crtc_id,
+ XRRScreenResources *resources);
+
+gboolean gf_crtc_xrandr_set_config (GfCrtc *crtc,
+ xcb_randr_crtc_t xrandr_crtc,
+ xcb_timestamp_t timestamp,
+ int x,
+ int y,
+ xcb_randr_mode_t mode,
+ xcb_randr_rotation_t rotation,
+ xcb_randr_output_t *outputs,
+ int n_outputs,
+ xcb_timestamp_t *out_timestamp);
+
+gboolean gf_crtc_xrandr_is_assignment_changed (GfCrtc *crtc,
+ GfCrtcInfo *crtc_info);
+
+GfCrtcMode *gf_crtc_xrandr_get_current_mode (GfCrtc *crtc);
G_END_DECLS
diff --git a/backends/gf-crtc-xrandr.c b/backends/gf-crtc-xrandr.c
index 1a16bfc..09f453d 100644
--- a/backends/gf-crtc-xrandr.c
+++ b/backends/gf-crtc-xrandr.c
@@ -27,9 +27,25 @@
#include <X11/Xlib-xcb.h>
+#include "gf-output-private.h"
+
#define ALL_ROTATIONS (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
#define ALL_TRANSFORMS ((1 << (GF_MONITOR_TRANSFORM_FLIPPED_270 + 1)) - 1)
+typedef struct
+{
+ GfRectangle rect;
+ GfMonitorTransform transform;
+
+ GfCrtcMode *current_mode;
+} GfCrtcXrandr;
+
+static void
+gf_crtc_destroy_notify (GfCrtc *crtc)
+{
+ g_free (crtc->driver_private);
+}
+
static GfMonitorTransform
gf_monitor_transform_from_xrandr (Rotation rotation)
{
@@ -110,19 +126,27 @@ gf_create_xrandr_crtc (GfGpuXrandr *gpu_xrandr,
{
GfCrtc *crtc;
+ GfCrtcXrandr *crtc_xrandr;
unsigned int i;
GList *modes;
crtc = g_object_new (GF_TYPE_CRTC, NULL);
+ crtc_xrandr = g_new0 (GfCrtcXrandr, 1);
+ crtc_xrandr->rect = (GfRectangle) {
+ .x = xrandr_crtc->x,
+ .y = xrandr_crtc->y,
+ .width = xrandr_crtc->width,
+ .height = xrandr_crtc->height,
+ };
+ crtc_xrandr->transform = gf_monitor_transform_from_xrandr (xrandr_crtc->rotation);
+
+ crtc->driver_private = crtc_xrandr;
+ crtc->driver_notify = (GDestroyNotify) gf_crtc_destroy_notify;
+
crtc->gpu = GF_GPU (gpu_xrandr);
crtc->crtc_id = crtc_id;
- crtc->rect.x = xrandr_crtc->x;
- crtc->rect.y = xrandr_crtc->y;
- crtc->rect.width = xrandr_crtc->width;
- crtc->rect.height = xrandr_crtc->height;
crtc->is_dirty = FALSE;
- crtc->transform = gf_monitor_transform_from_xrandr (xrandr_crtc->rotation);
crtc->all_transforms = gf_monitor_transform_from_xrandr_all (xrandr_crtc->rotations);
modes = gf_gpu_get_modes (crtc->gpu);
@@ -130,11 +154,19 @@ gf_create_xrandr_crtc (GfGpuXrandr *gpu_xrandr,
{
if (resources->modes[i].id == xrandr_crtc->mode)
{
- crtc->current_mode = g_list_nth_data (modes, i);
+ crtc_xrandr->current_mode = g_list_nth_data (modes, i);
break;
}
}
+ if (crtc_xrandr->current_mode)
+ {
+ gf_crtc_set_config (crtc,
+ &crtc_xrandr->rect,
+ crtc_xrandr->current_mode,
+ crtc_xrandr->transform);
+ }
+
return crtc;
}
@@ -193,3 +225,49 @@ gf_crtc_xrandr_set_config (GfCrtc *crtc,
return TRUE;
}
+
+gboolean
+gf_crtc_xrandr_is_assignment_changed (GfCrtc *crtc,
+ GfCrtcInfo *crtc_info)
+{
+ GfCrtcXrandr *crtc_xrandr;
+ unsigned int i;
+
+ crtc_xrandr = crtc->driver_private;
+
+ if (crtc_xrandr->current_mode != crtc_info->mode)
+ return TRUE;
+
+ if (crtc_xrandr->rect.x != crtc_info->layout.x)
+ return TRUE;
+
+ if (crtc_xrandr->rect.y != crtc_info->layout.y)
+ return TRUE;
+
+ if (crtc_xrandr->transform != crtc_info->transform)
+ return TRUE;
+
+ for (i = 0; i < crtc_info->outputs->len; i++)
+ {
+ GfOutput *output;
+ GfCrtc *assigned_crtc;
+
+ output = ((GfOutput **) crtc_info->outputs->pdata)[i];
+ assigned_crtc = gf_output_get_assigned_crtc (output);
+
+ if (assigned_crtc != crtc)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+GfCrtcMode *
+gf_crtc_xrandr_get_current_mode (GfCrtc *crtc)
+{
+ GfCrtcXrandr *crtc_xrandr;
+
+ crtc_xrandr = crtc->driver_private;
+
+ return crtc_xrandr->current_mode;
+}
diff --git a/backends/gf-crtc.c b/backends/gf-crtc.c
index 9ba8f27..884fb05 100644
--- a/backends/gf-crtc.c
+++ b/backends/gf-crtc.c
@@ -31,6 +31,8 @@ gf_crtc_finalize (GObject *object)
if (crtc->driver_notify)
crtc->driver_notify (crtc);
+ g_clear_pointer (&crtc->config, g_free);
+
G_OBJECT_CLASS (gf_crtc_parent_class)->finalize (object);
}
@@ -54,3 +56,27 @@ gf_crtc_get_gpu (GfCrtc *crtc)
{
return crtc->gpu;
}
+
+void
+gf_crtc_set_config (GfCrtc *crtc,
+ GfRectangle *layout,
+ GfCrtcMode *mode,
+ GfMonitorTransform transform)
+{
+ GfCrtcConfig *config;
+
+ gf_crtc_unset_config (crtc);
+
+ config = g_new0 (GfCrtcConfig, 1);
+ config->layout = *layout;
+ config->mode = mode;
+ config->transform = transform;
+
+ crtc->config = config;
+}
+
+void
+gf_crtc_unset_config (GfCrtc *crtc)
+{
+ g_clear_pointer (&crtc->config, g_free);
+}
diff --git a/backends/gf-logical-monitor.c b/backends/gf-logical-monitor.c
index c4181d3..69fcb24 100644
--- a/backends/gf-logical-monitor.c
+++ b/backends/gf-logical-monitor.c
@@ -92,7 +92,7 @@ derive_monitor_transform (GfMonitor *monitor)
GfMonitorTransform transform;
main_output = gf_monitor_get_main_output (monitor);
- transform = gf_output_get_assigned_crtc (main_output)->transform;
+ transform = gf_output_get_assigned_crtc (main_output)->config->transform;
return gf_monitor_crtc_to_logical_transform (monitor, transform);
}
diff --git a/backends/gf-monitor-config-manager.c b/backends/gf-monitor-config-manager.c
index 26f9091..7edf448 100644
--- a/backends/gf-monitor-config-manager.c
+++ b/backends/gf-monitor-config-manager.c
@@ -665,6 +665,11 @@ assign_monitor_crtc (GfMonitor *monitor,
GfMonitorTransform transform;
GfMonitorTransform crtc_transform;
int crtc_x, crtc_y;
+ float x_offset, y_offset;
+ float scale;
+ float width, height;
+ GfCrtcMode *crtc_mode;
+ GfRectangle crtc_layout;
GfCrtcInfo *crtc_info;
GfOutputInfo *output_info;
GfMonitorConfig *first_monitor_config;
@@ -694,29 +699,37 @@ assign_monitor_crtc (GfMonitor *monitor,
gf_monitor_calculate_crtc_pos (monitor, mode, output, crtc_transform,
&crtc_x, &crtc_y);
+ x_offset = data->logical_monitor_config->layout.x;
+ y_offset = data->logical_monitor_config->layout.y;
+ scale = data->logical_monitor_config->scale;
+ crtc_mode = monitor_crtc_mode->crtc_mode;
+
+ if (gf_monitor_transform_is_rotated (crtc_transform))
+ {
+ width = crtc_mode->height / scale;
+ height = crtc_mode->width / scale;
+ }
+ else
+ {
+ width = crtc_mode->width / scale;
+ height = crtc_mode->height / scale;
+ }
+
+ crtc_layout.x = (int) roundf (x_offset + (crtc_x / scale));
+ crtc_layout.y = (int) roundf (y_offset + (crtc_y / scale));
+ crtc_layout.width = (int) roundf (width);
+ crtc_layout.height = (int) roundf (height);
+
crtc_info = g_slice_new0 (GfCrtcInfo);
*crtc_info = (GfCrtcInfo) {
.crtc = crtc,
- .mode = monitor_crtc_mode->crtc_mode,
- .x = crtc_x,
- .y = crtc_y,
+ .mode = crtc_mode,
+ .layout = crtc_layout,
.transform = crtc_transform,
.outputs = g_ptr_array_new ()
};
g_ptr_array_add (crtc_info->outputs, output);
- /*
- * Currently, GfCrtcInfo are deliberately offset incorrectly to carry over
- * logical monitor location inside the GfCrtc struct, when in fact this
- * depends on the framebuffer configuration. This will eventually be negated
- * when setting the actual KMS mode.
- *
- * TODO: Remove this hack when we don't need to rely on GfCrtc to pass
- * logical monitor state.
- */
- crtc_info->x += data->logical_monitor_config->layout.x;
- crtc_info->y += data->logical_monitor_config->layout.y;
-
/*
* Only one output can be marked as primary (due to Xrandr limitation),
* so only mark the main output of the first monitor in the logical monitor
diff --git a/backends/gf-monitor-manager-xrandr.c b/backends/gf-monitor-manager-xrandr.c
index b3609ef..ac78321 100644
--- a/backends/gf-monitor-manager-xrandr.c
+++ b/backends/gf-monitor-manager-xrandr.c
@@ -211,39 +211,14 @@ is_crtc_assignment_changed (GfCrtc *crtc,
for (i = 0; i < n_crtc_infos; i++)
{
GfCrtcInfo *crtc_info = crtc_infos[i];
- guint j;
if (crtc_info->crtc != crtc)
continue;
- if (crtc->current_mode != crtc_info->mode)
- return TRUE;
-
- if (crtc->rect.x != crtc_info->x)
- return TRUE;
-
- if (crtc->rect.y != crtc_info->y)
- return TRUE;
-
- if (crtc->transform != crtc_info->transform)
- return TRUE;
-
- for (j = 0; j < crtc_info->outputs->len; j++)
- {
- GfOutput *output;
- GfCrtc *assigned_crtc;
-
- output = ((GfOutput**) crtc_info->outputs->pdata)[j];
- assigned_crtc = gf_output_get_assigned_crtc (output);
-
- if (assigned_crtc != crtc)
- return TRUE;
- }
-
- return FALSE;
+ return gf_crtc_xrandr_is_assignment_changed (crtc, crtc_info);
}
- return crtc->current_mode != NULL;
+ return !!gf_crtc_xrandr_get_current_mode (crtc);
}
static gboolean
@@ -416,16 +391,8 @@ apply_crtc_assignments (GfMonitorManager *manager,
if (crtc_info->mode == NULL)
continue;
- if (gf_monitor_transform_is_rotated (crtc_info->transform))
- {
- width = MAX (width, crtc_info->x + crtc_info->mode->height);
- height = MAX (height, crtc_info->y + crtc_info->mode->width);
- }
- else
- {
- width = MAX (width, crtc_info->x + crtc_info->mode->width);
- height = MAX (height, crtc_info->y + crtc_info->mode->height);
- }
+ width = MAX (width, crtc_info->layout.x + crtc_info->layout.width);
+ height = MAX (height, crtc_info->layout.y + crtc_info->layout.height);
}
/* Second disable all newly disabled CRTCs, or CRTCs that in the previous
@@ -437,10 +404,17 @@ apply_crtc_assignments (GfMonitorManager *manager,
{
GfCrtcInfo *crtc_info = crtcs[i];
GfCrtc *crtc = crtc_info->crtc;
+ GfCrtcConfig *crtc_config;
+ int x2, y2;
+
+ crtc_config = crtc->config;
+ if (crtc_config == NULL)
+ continue;
+
+ x2 = crtc_config->layout.x + crtc_config->layout.width;
+ y2 = crtc_config->layout.y + crtc_config->layout.height;
- if (crtc_info->mode == NULL ||
- crtc->rect.x + crtc->rect.width > width ||
- crtc->rect.y + crtc->rect.height > height)
+ if (crtc_info->mode == NULL || x2 > width || y2 > height)
{
xrandr_set_crtc_config (xrandr,
crtc,
@@ -451,11 +425,7 @@ apply_crtc_assignments (GfMonitorManager *manager,
XCB_RANDR_ROTATION_ROTATE_0,
NULL, 0);
- crtc->rect.x = 0;
- crtc->rect.y = 0;
- crtc->rect.width = 0;
- crtc->rect.height = 0;
- crtc->current_mode = NULL;
+ gf_crtc_unset_config (crtc);
}
}
@@ -470,7 +440,7 @@ apply_crtc_assignments (GfMonitorManager *manager,
continue;
}
- if (crtc->current_mode == NULL)
+ if (!crtc->config)
continue;
xrandr_set_crtc_config (xrandr,
@@ -482,11 +452,7 @@ apply_crtc_assignments (GfMonitorManager *manager,
XCB_RANDR_ROTATION_ROTATE_0,
NULL, 0);
- crtc->rect.x = 0;
- crtc->rect.y = 0;
- crtc->rect.width = 0;
- crtc->rect.height = 0;
- crtc->current_mode = NULL;
+ gf_crtc_unset_config (crtc);
}
g_assert (width > 0 && height > 0);
@@ -536,7 +502,8 @@ apply_crtc_assignments (GfMonitorManager *manager,
save_timestamp,
(xcb_randr_crtc_t) crtc->crtc_id,
XCB_CURRENT_TIME,
- crtc_info->x, crtc_info->y,
+ crtc_info->layout.x,
+ crtc_info->layout.y,
(xcb_randr_mode_t) mode->mode_id,
rotation,
output_ids, n_output_ids))
@@ -544,29 +511,17 @@ apply_crtc_assignments (GfMonitorManager *manager,
g_warning ("Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform
%u failed\n",
(guint) (crtc->crtc_id), (guint) (mode->mode_id),
mode->width, mode->height, (gdouble) mode->refresh_rate,
- crtc_info->x, crtc_info->y, crtc_info->transform);
+ crtc_info->layout.x, crtc_info->layout.y,
+ crtc_info->transform);
g_free (output_ids);
continue;
}
- if (gf_monitor_transform_is_rotated (crtc_info->transform))
- {
- width = mode->height;
- height = mode->width;
- }
- else
- {
- width = mode->width;
- height = mode->height;
- }
-
- crtc->rect.x = crtc_info->x;
- crtc->rect.y = crtc_info->y;
- crtc->rect.width = width;
- crtc->rect.height = height;
- crtc->current_mode = mode;
- crtc->transform = crtc_info->transform;
+ gf_crtc_set_config (crtc,
+ &crtc_info->layout,
+ mode,
+ crtc_info->transform);
g_free (output_ids);
}
diff --git a/backends/gf-monitor-manager.c b/backends/gf-monitor-manager.c
index 87be53c..d6c19cf 100644
--- a/backends/gf-monitor-manager.c
+++ b/backends/gf-monitor-manager.c
@@ -1082,29 +1082,47 @@ gf_monitor_manager_handle_get_resources (GfDBusDisplayConfig *skeleton,
{
GfCrtc *crtc = l->data;
GVariantBuilder transforms;
- gint current_mode_index;
+ GfCrtcConfig *crtc_config;
g_variant_builder_init (&transforms, G_VARIANT_TYPE ("au"));
for (j = 0; j <= GF_MONITOR_TRANSFORM_FLIPPED_270; j++)
if (crtc->all_transforms & (1 << j))
g_variant_builder_add (&transforms, "u", j);
- if (crtc->current_mode)
- current_mode_index = g_list_index (combined_modes, crtc->current_mode);
- else
- current_mode_index = -1;
+ crtc_config = crtc->config;
- g_variant_builder_add (&crtc_builder, "(uxiiiiiuaua{sv})",
- i, /* ID */
- (gint64) crtc->crtc_id,
- (gint) crtc->rect.x,
- (gint) crtc->rect.y,
- (gint) crtc->rect.width,
- (gint) crtc->rect.height,
- current_mode_index,
- (guint32) crtc->transform,
- &transforms,
- NULL /* properties */);
+ if (crtc_config != NULL)
+ {
+ int current_mode_index;
+
+ current_mode_index = g_list_index (combined_modes, crtc_config->mode);
+
+ g_variant_builder_add (&crtc_builder, "(uxiiiiiuaua{sv})",
+ i, /* ID */
+ (int64_t) crtc->crtc_id,
+ crtc_config->layout.x,
+ crtc_config->layout.y,
+ crtc_config->layout.width,
+ crtc_config->layout.height,
+ current_mode_index,
+ (uint32_t) crtc_config->transform,
+ &transforms,
+ NULL /* properties */);
+ }
+ else
+ {
+ g_variant_builder_add (&crtc_builder, "(uxiiiiiuaua{sv})",
+ i, /* ID */
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ -1,
+ (uint32_t) GF_MONITOR_TRANSFORM_NORMAL,
+ &transforms,
+ NULL /* properties */);
+ }
}
for (l = combined_outputs, i = 0; l; l = l->next, i++)
diff --git a/backends/gf-monitor-normal.c b/backends/gf-monitor-normal.c
index d46d5a3..ae9cea5 100644
--- a/backends/gf-monitor-normal.c
+++ b/backends/gf-monitor-normal.c
@@ -85,7 +85,7 @@ generate_modes (GfMonitorNormal *normal)
gf_monitor_set_preferred_mode (monitor, mode);
crtc = gf_output_get_assigned_crtc (output);
- if (crtc && crtc_mode == crtc->current_mode)
+ if (crtc && crtc->config && crtc_mode == crtc->config->mode)
gf_monitor_set_current_mode (monitor, mode);
}
}
@@ -110,12 +110,9 @@ gf_monitor_normal_derive_layout (GfMonitor *monitor,
output = gf_monitor_get_main_output (monitor);
crtc = gf_output_get_assigned_crtc (output);
- *layout = (GfRectangle) {
- .x = crtc->rect.x,
- .y = crtc->rect.y,
- .width = crtc->rect.width,
- .height = crtc->rect.height
- };
+ g_return_if_fail (crtc->config);
+
+ *layout = crtc->config->layout;
}
static void
diff --git a/backends/gf-monitor-tiled.c b/backends/gf-monitor-tiled.c
index 379f8e3..67041fa 100644
--- a/backends/gf-monitor-tiled.c
+++ b/backends/gf-monitor-tiled.c
@@ -639,6 +639,7 @@ gf_monitor_tiled_derive_layout (GfMonitor *monitor,
{
GfOutput *output;
GfCrtc *crtc;
+ GfCrtcConfig *crtc_config;
output = l->data;
crtc = gf_output_get_assigned_crtc (output);
@@ -646,10 +647,14 @@ gf_monitor_tiled_derive_layout (GfMonitor *monitor,
if (!crtc)
continue;
- min_x = MIN (crtc->rect.x, min_x);
- min_y = MIN (crtc->rect.y, min_y);
- max_x = MAX (crtc->rect.x + crtc->rect.width, max_x);
- max_y = MAX (crtc->rect.y + crtc->rect.height, max_y);
+ crtc_config = crtc->config;
+
+ g_return_if_fail (crtc_config);
+
+ min_x = MIN (crtc_config->layout.x, min_x);
+ min_y = MIN (crtc_config->layout.y, min_y);
+ max_x = MAX (crtc_config->layout.x + crtc_config->layout.width, max_x);
+ max_y = MAX (crtc_config->layout.y + crtc_config->layout.height, max_y);
}
*layout = (GfRectangle) {
diff --git a/backends/gf-monitor.c b/backends/gf-monitor.c
index 416cc3d..58ad775 100644
--- a/backends/gf-monitor.c
+++ b/backends/gf-monitor.c
@@ -206,7 +206,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->current_mode);
+ return gf_monitor_is_active (monitor) == (crtc && crtc->config);
}
static gboolean
@@ -550,7 +550,8 @@ gf_monitor_is_mode_assigned (GfMonitor *monitor,
crtc = gf_output_get_assigned_crtc (output);
if (monitor_crtc_mode->crtc_mode &&
- (!crtc || crtc->current_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 259eaf5..71ed222 100644
--- a/backends/gf-output-xrandr.c
+++ b/backends/gf-output-xrandr.c
@@ -93,12 +93,14 @@ output_set_underscanning_xrandr (GfOutput *output,
if (underscanning)
{
GfCrtc *crtc;
+ GfCrtcConfig *crtc_config;
uint32_t border_value;
crtc = gf_output_get_assigned_crtc (output);
+ crtc_config = crtc->config;
prop = XInternAtom (xdisplay, "underscan hborder", False);
- border_value = crtc->current_mode->width * 0.05;
+ border_value = crtc_config->mode->width * 0.05;
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
(XID) output->winsys_id,
@@ -107,7 +109,7 @@ output_set_underscanning_xrandr (GfOutput *output,
1, &border_value);
prop = XInternAtom (xdisplay, "underscan vborder", False);
- border_value = crtc->current_mode->height * 0.05;
+ border_value = crtc_config->mode->height * 0.05;
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
(XID) output->winsys_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]