1
0
Fork 0

logical-monitor: Track whether the logical monitor is transformed

Keep track of the logical monitor transform. When a logical monitor is
transformed, all of its monitors are also transformed in the same way.
A logical monitor can either be transformed on the CRTC level, or using
an offscreen intermediate buffer. In both cases will the logical
monitor be transformed, but only in the latter will the view be
transformed.

MetaCrtcs::transform currently does not represent whether the CRTC is
configured to be transformed or not; only when the backend can handle
it does it correctly correspond to the actual CRTC configuration. This
is intended to change with MetaMonitorConfigManager.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-03-17 16:33:18 +08:00
parent 2091df3856
commit d38c4c1f2d
5 changed files with 20 additions and 9 deletions

View file

@ -92,6 +92,16 @@ meta_logical_monitor_new (MetaMonitorManager *monitor_manager,
return logical_monitor;
}
static MetaMonitorTransform
derive_monitor_transform (MetaMonitor *monitor)
{
MetaOutput *main_output;
main_output = meta_monitor_get_main_output (monitor);
return main_output->crtc->transform;
}
MetaLogicalMonitor *
meta_logical_monitor_new_derived (MetaMonitorManager *monitor_manager,
MetaMonitor *monitor,
@ -102,6 +112,7 @@ meta_logical_monitor_new_derived (MetaMonitorManager *monitor_manager,
MetaOutput *main_output;
MetaMonitorMode *monitor_mode;
int scale;
MetaMonitorTransform transform;
logical_monitor = g_object_new (META_TYPE_LOGICAL_MONITOR, NULL);
@ -110,10 +121,13 @@ meta_logical_monitor_new_derived (MetaMonitorManager *monitor_manager,
monitor,
monitor_mode);
transform = derive_monitor_transform (monitor);
main_output = meta_monitor_get_main_output (monitor);
logical_monitor->number = monitor_number;
logical_monitor->winsys_id = main_output->winsys_id;
logical_monitor->scale = scale;
logical_monitor->transform = transform;
logical_monitor->in_fullscreen = -1;
logical_monitor->rect = *layout;

View file

@ -41,6 +41,7 @@ struct _MetaLogicalMonitor
gboolean is_presentation; /* XXX: not yet used */
gboolean in_fullscreen;
int scale;
MetaMonitorTransform transform;
/* The primary or first output for this monitor, 0 if we can't figure out.
It can be matched to a winsys_id of a MetaOutput.

View file

@ -2734,17 +2734,13 @@ meta_monitor_manager_get_monitor_matrix (MetaMonitorManager *manager,
MetaLogicalMonitor *logical_monitor,
gfloat matrix[6])
{
MetaMonitor *main_monitor;
MetaOutput *main_output;
MetaMonitorTransform transform;
gfloat viewport[9];
if (!calculate_viewport_matrix (manager, logical_monitor, viewport))
return FALSE;
main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
main_output = meta_monitor_get_main_output (main_monitor);
transform = main_output->crtc->transform;
transform = logical_monitor->transform;
multiply_matrix (viewport, transform_matrices[transform],
matrix);
return TRUE;

View file

@ -1686,10 +1686,10 @@ calculate_view_transform (MetaMonitorManager *monitor_manager,
if (meta_monitor_manager_is_transform_handled (monitor_manager,
main_output->crtc,
main_output->crtc->transform))
logical_monitor->transform))
return META_MONITOR_TRANSFORM_NORMAL;
else
return main_output->crtc->transform;
return logical_monitor->transform;
}
static MetaRendererView *

View file

@ -59,10 +59,10 @@ calculate_view_transform (MetaMonitorManager *monitor_manager,
if (meta_monitor_manager_is_transform_handled (monitor_manager,
main_output->crtc,
main_output->crtc->transform))
logical_monitor->transform))
return META_MONITOR_TRANSFORM_NORMAL;
else
return main_output->crtc->transform;
return logical_monitor->transform;
}
static MetaRendererView *