monitor-tiled: Derive the dimension from what was configured

Previously, the size of the logical monitor was derived directly from
the tiling information. This works fine until we add transformations,
or set modes with a dimension different from the resulting resolution
when tiled. Fix this by traversing the assigned CRTC rects, as these
are already transformed by the configuration system.

https://bugzilla.gnome.org/show_bug.cgi?id=779745
This commit is contained in:
Jonas Ådahl 2017-03-08 15:53:24 +08:00
parent 4f386e5131
commit 4cfcd4bce0

View File

@ -702,11 +702,12 @@ meta_monitor_tiled_derive_dimensions (MetaMonitor *monitor,
MetaMonitorPrivate *monitor_priv = MetaMonitorPrivate *monitor_priv =
meta_monitor_get_instance_private (monitor); meta_monitor_get_instance_private (monitor);
GList *l; GList *l;
int width; int min_x, min_y, max_x, max_y;
int height;
width = 0; min_x = INT_MAX;
height = 0; min_y = INT_MAX;
max_x = 0;
max_y = 0;
for (l = monitor_priv->outputs; l; l = l->next) for (l = monitor_priv->outputs; l; l = l->next)
{ {
MetaOutput *output = l->data; MetaOutput *output = l->data;
@ -714,15 +715,14 @@ meta_monitor_tiled_derive_dimensions (MetaMonitor *monitor,
if (!output->crtc) if (!output->crtc)
continue; continue;
if (output->tile_info.loc_v_tile == 0) min_x = MIN (output->crtc->rect.x, min_x);
width += output->crtc->rect.width; min_y = MIN (output->crtc->rect.y, min_y);
max_x = MAX (output->crtc->rect.x + output->crtc->rect.width, max_x);
if (output->tile_info.loc_h_tile == 0) max_y = MAX (output->crtc->rect.y + output->crtc->rect.height, max_y);
height += output->crtc->rect.height;
} }
*out_width = width; *out_width = max_x - min_x;
*out_height = height; *out_height = max_y - min_y;
} }
static void static void