mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
backends: Move MetaOutput::crtc field into private struct
No functional changes. This is only done so that changes to reference
counting can done more reliably.
https://bugzilla.gnome.org/show_bug.cgi?id=786929
(cherry picked from commit 1200182d70
)
This commit is contained in:
parent
a41d84db00
commit
7d01aec48d
@ -100,11 +100,12 @@ static MetaMonitorTransform
|
|||||||
derive_monitor_transform (MetaMonitor *monitor)
|
derive_monitor_transform (MetaMonitor *monitor)
|
||||||
{
|
{
|
||||||
MetaOutput *main_output;
|
MetaOutput *main_output;
|
||||||
|
MetaMonitorTransform transform;
|
||||||
|
|
||||||
main_output = meta_monitor_get_main_output (monitor);
|
main_output = meta_monitor_get_main_output (monitor);
|
||||||
|
transform = meta_output_get_assigned_crtc (main_output)->transform;
|
||||||
|
|
||||||
return meta_monitor_crtc_to_logical_transform (monitor,
|
return meta_monitor_crtc_to_logical_transform (monitor, transform);
|
||||||
main_output->crtc->transform);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaLogicalMonitor *
|
MetaLogicalMonitor *
|
||||||
@ -157,10 +158,12 @@ meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor,
|
|||||||
for (l_output = outputs; l_output; l_output = l_output->next)
|
for (l_output = outputs; l_output; l_output = l_output->next)
|
||||||
{
|
{
|
||||||
MetaOutput *output = l_output->data;
|
MetaOutput *output = l_output->data;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
is_presentation = is_presentation && output->is_presentation;
|
is_presentation = is_presentation && output->is_presentation;
|
||||||
if (output->crtc)
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
output->crtc->logical_monitor = logical_monitor;
|
if (crtc)
|
||||||
|
crtc->logical_monitor = logical_monitor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,7 +223,7 @@ foreach_crtc (MetaMonitor *monitor,
|
|||||||
ForeachCrtcData *data = user_data;
|
ForeachCrtcData *data = user_data;
|
||||||
|
|
||||||
data->func (data->logical_monitor,
|
data->func (data->logical_monitor,
|
||||||
monitor_crtc_mode->output->crtc,
|
meta_output_get_assigned_crtc (monitor_crtc_mode->output),
|
||||||
data->user_data);
|
data->user_data);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -486,7 +486,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
||||||
|
|
||||||
output->is_dirty = TRUE;
|
output->is_dirty = TRUE;
|
||||||
output->crtc = crtc;
|
meta_output_assign_crtc (output, crtc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -531,7 +531,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->crtc = NULL;
|
meta_output_unassign_crtc (output);
|
||||||
output->is_primary = FALSE;
|
output->is_primary = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1041,6 +1041,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
|||||||
GVariantBuilder crtcs, modes, clones, properties;
|
GVariantBuilder crtcs, modes, clones, properties;
|
||||||
GBytes *edid;
|
GBytes *edid;
|
||||||
char *edid_file;
|
char *edid_file;
|
||||||
|
MetaCrtc *crtc;
|
||||||
int crtc_index;
|
int crtc_index;
|
||||||
|
|
||||||
g_variant_builder_init (&crtcs, G_VARIANT_TYPE ("au"));
|
g_variant_builder_init (&crtcs, G_VARIANT_TYPE ("au"));
|
||||||
@ -1134,8 +1135,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
|||||||
output->tile_info.tile_h));
|
output->tile_info.tile_h));
|
||||||
}
|
}
|
||||||
|
|
||||||
crtc_index = output->crtc ? g_list_index (combined_crtcs, output->crtc)
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
: -1;
|
crtc_index = crtc ? g_list_index (combined_crtcs, crtc) : -1;
|
||||||
g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
|
g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
|
||||||
i, /* ID */
|
i, /* ID */
|
||||||
(gint64)output->winsys_id,
|
(gint64)output->winsys_id,
|
||||||
@ -2903,11 +2904,7 @@ meta_monitor_manager_get_monitor_for_connector (MetaMonitorManager *manager,
|
|||||||
|
|
||||||
if (meta_monitor_is_active (monitor) &&
|
if (meta_monitor_is_active (monitor) &&
|
||||||
g_str_equal (connector, meta_monitor_get_connector (monitor)))
|
g_str_equal (connector, meta_monitor_get_connector (monitor)))
|
||||||
{
|
return meta_monitor_get_logical_monitor (monitor)->number;
|
||||||
MetaOutput *main_output = meta_monitor_get_main_output (monitor);
|
|
||||||
|
|
||||||
return main_output->crtc->logical_monitor->number;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -204,10 +204,12 @@ gboolean
|
|||||||
meta_monitor_is_active (MetaMonitor *monitor)
|
meta_monitor_is_active (MetaMonitor *monitor)
|
||||||
{
|
{
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
output = meta_monitor_get_main_output (monitor);
|
output = meta_monitor_get_main_output (monitor);
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
return output->crtc && output->crtc->current_mode;
|
return crtc && crtc->current_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@ -493,6 +495,7 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
|
|||||||
for (i = 0; i < output->n_modes; i++)
|
for (i = 0; i < output->n_modes; i++)
|
||||||
{
|
{
|
||||||
MetaCrtcMode *crtc_mode = output->modes[i];
|
MetaCrtcMode *crtc_mode = output->modes[i];
|
||||||
|
MetaCrtc *crtc;
|
||||||
MetaMonitorMode *mode;
|
MetaMonitorMode *mode;
|
||||||
gboolean replace;
|
gboolean replace;
|
||||||
|
|
||||||
@ -526,7 +529,9 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
|
|||||||
|
|
||||||
if (crtc_mode == output->preferred_mode)
|
if (crtc_mode == output->preferred_mode)
|
||||||
monitor_priv->preferred_mode = mode;
|
monitor_priv->preferred_mode = mode;
|
||||||
if (output->crtc && crtc_mode == output->crtc->current_mode)
|
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
if (crtc && crtc_mode == crtc->current_mode)
|
||||||
monitor_priv->current_mode = mode;
|
monitor_priv->current_mode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,13 +573,15 @@ meta_monitor_normal_derive_layout (MetaMonitor *monitor,
|
|||||||
MetaRectangle *layout)
|
MetaRectangle *layout)
|
||||||
{
|
{
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
output = meta_monitor_get_main_output (monitor);
|
output = meta_monitor_get_main_output (monitor);
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
*layout = (MetaRectangle) {
|
*layout = (MetaRectangle) {
|
||||||
.x = output->crtc->rect.x,
|
.x = crtc->rect.x,
|
||||||
.y = output->crtc->rect.y,
|
.y = crtc->rect.y,
|
||||||
.width = output->crtc->rect.width,
|
.width = crtc->rect.width,
|
||||||
.height = output->crtc->rect.height
|
.height = crtc->rect.height
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -764,12 +771,13 @@ is_monitor_mode_assigned (MetaMonitor *monitor,
|
|||||||
{
|
{
|
||||||
MetaOutput *output = l->data;
|
MetaOutput *output = l->data;
|
||||||
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
MetaMonitorCrtcMode *monitor_crtc_mode = &mode->crtc_modes[i];
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
if (monitor_crtc_mode->crtc_mode &&
|
if (monitor_crtc_mode->crtc_mode &&
|
||||||
(!output->crtc ||
|
(!crtc || crtc->current_mode != monitor_crtc_mode->crtc_mode))
|
||||||
output->crtc->current_mode != monitor_crtc_mode->crtc_mode))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
else if (!monitor_crtc_mode->crtc_mode && output->crtc)
|
else if (!monitor_crtc_mode->crtc_mode && crtc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1217,14 +1225,16 @@ meta_monitor_tiled_derive_layout (MetaMonitor *monitor,
|
|||||||
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;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
if (!output->crtc)
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
if (!crtc)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
min_x = MIN (output->crtc->rect.x, min_x);
|
min_x = MIN (crtc->rect.x, min_x);
|
||||||
min_y = MIN (output->crtc->rect.y, min_y);
|
min_y = MIN (crtc->rect.y, min_y);
|
||||||
max_x = MAX (output->crtc->rect.x + output->crtc->rect.width, max_x);
|
max_x = MAX (crtc->rect.x + crtc->rect.width, max_x);
|
||||||
max_y = MAX (output->crtc->rect.y + output->crtc->rect.height, max_y);
|
max_y = MAX (crtc->rect.y + crtc->rect.height, max_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
*layout = (MetaRectangle) {
|
*layout = (MetaRectangle) {
|
||||||
@ -1318,10 +1328,14 @@ meta_monitor_get_spec (MetaMonitor *monitor)
|
|||||||
MetaLogicalMonitor *
|
MetaLogicalMonitor *
|
||||||
meta_monitor_get_logical_monitor (MetaMonitor *monitor)
|
meta_monitor_get_logical_monitor (MetaMonitor *monitor)
|
||||||
{
|
{
|
||||||
MetaOutput *output = meta_monitor_get_main_output (monitor);
|
MetaOutput *output;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
if (output->crtc)
|
output = meta_monitor_get_main_output (monitor);
|
||||||
return output->crtc->logical_monitor;
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
|
if (crtc)
|
||||||
|
return crtc->logical_monitor;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,13 @@
|
|||||||
|
|
||||||
#include "backends/meta-output.h"
|
#include "backends/meta-output.h"
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaOutput, meta_output, G_TYPE_OBJECT)
|
typedef struct _MetaOutputPrivate
|
||||||
|
{
|
||||||
|
/* The CRTC driving this output, NULL if the output is not enabled */
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
} MetaOutputPrivate;
|
||||||
|
|
||||||
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaOutput, meta_output, G_TYPE_OBJECT)
|
||||||
|
|
||||||
MetaGpu *
|
MetaGpu *
|
||||||
meta_output_get_gpu (MetaOutput *output)
|
meta_output_get_gpu (MetaOutput *output)
|
||||||
@ -29,6 +35,33 @@ meta_output_get_gpu (MetaOutput *output)
|
|||||||
return output->gpu;
|
return output->gpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_output_assign_crtc (MetaOutput *output,
|
||||||
|
MetaCrtc *crtc)
|
||||||
|
{
|
||||||
|
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||||
|
|
||||||
|
g_assert (crtc);
|
||||||
|
|
||||||
|
priv->crtc = crtc;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
meta_output_unassign_crtc (MetaOutput *output)
|
||||||
|
{
|
||||||
|
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||||
|
|
||||||
|
priv->crtc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
MetaCrtc *
|
||||||
|
meta_output_get_assigned_crtc (MetaOutput *output)
|
||||||
|
{
|
||||||
|
MetaOutputPrivate *priv = meta_output_get_instance_private (output);
|
||||||
|
|
||||||
|
return priv->crtc;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_output_finalize (GObject *object)
|
meta_output_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
|
@ -64,9 +64,6 @@ struct _MetaOutput
|
|||||||
|
|
||||||
MetaGpu *gpu;
|
MetaGpu *gpu;
|
||||||
|
|
||||||
/* The CRTC driving this output, NULL if the output is not enabled */
|
|
||||||
MetaCrtc *crtc;
|
|
||||||
|
|
||||||
/* The low-level ID of this output, used to apply back configuration */
|
/* The low-level ID of this output, used to apply back configuration */
|
||||||
glong winsys_id;
|
glong winsys_id;
|
||||||
char *name;
|
char *name;
|
||||||
@ -122,4 +119,11 @@ G_DECLARE_FINAL_TYPE (MetaOutput, meta_output, META, OUTPUT, GObject)
|
|||||||
|
|
||||||
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
MetaGpu * meta_output_get_gpu (MetaOutput *output);
|
||||||
|
|
||||||
|
void meta_output_assign_crtc (MetaOutput *output,
|
||||||
|
MetaCrtc *crtc);
|
||||||
|
|
||||||
|
void meta_output_unassign_crtc (MetaOutput *output);
|
||||||
|
|
||||||
|
MetaCrtc * meta_output_get_assigned_crtc (MetaOutput *output);
|
||||||
|
|
||||||
#endif /* META_OUTPUT_H */
|
#endif /* META_OUTPUT_H */
|
||||||
|
@ -291,6 +291,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
data->in_cursor_renderer_native;
|
data->in_cursor_renderer_native;
|
||||||
MetaCursorRendererNativePrivate *priv =
|
MetaCursorRendererNativePrivate *priv =
|
||||||
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
|
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
|
||||||
|
MetaCrtc *crtc;
|
||||||
MetaMonitorTransform transform;
|
MetaMonitorTransform transform;
|
||||||
ClutterRect scaled_crtc_rect;
|
ClutterRect scaled_crtc_rect;
|
||||||
float scale;
|
float scale;
|
||||||
@ -330,6 +331,8 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
crtc = meta_output_get_assigned_crtc (monitor_crtc_mode->output);
|
||||||
|
|
||||||
if (priv->has_hw_cursor &&
|
if (priv->has_hw_cursor &&
|
||||||
clutter_rect_intersection (&scaled_crtc_rect,
|
clutter_rect_intersection (&scaled_crtc_rect,
|
||||||
&data->in_local_cursor_rect,
|
&data->in_local_cursor_rect,
|
||||||
@ -340,7 +343,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
float crtc_cursor_x, crtc_cursor_y;
|
float crtc_cursor_x, crtc_cursor_y;
|
||||||
|
|
||||||
set_crtc_cursor (data->in_cursor_renderer_native,
|
set_crtc_cursor (data->in_cursor_renderer_native,
|
||||||
monitor_crtc_mode->output->crtc,
|
crtc,
|
||||||
data->in_cursor_sprite);
|
data->in_cursor_sprite);
|
||||||
|
|
||||||
gpu_kms = META_GPU_KMS (meta_monitor_get_gpu (monitor));
|
gpu_kms = META_GPU_KMS (meta_monitor_get_gpu (monitor));
|
||||||
@ -350,7 +353,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
crtc_cursor_y = (data->in_local_cursor_rect.origin.y -
|
crtc_cursor_y = (data->in_local_cursor_rect.origin.y -
|
||||||
scaled_crtc_rect.origin.y) * scale;
|
scaled_crtc_rect.origin.y) * scale;
|
||||||
drmModeMoveCursor (kms_fd,
|
drmModeMoveCursor (kms_fd,
|
||||||
monitor_crtc_mode->output->crtc->crtc_id,
|
crtc->crtc_id,
|
||||||
roundf (crtc_cursor_x),
|
roundf (crtc_cursor_x),
|
||||||
roundf (crtc_cursor_y));
|
roundf (crtc_cursor_y));
|
||||||
|
|
||||||
@ -358,8 +361,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
set_crtc_cursor (data->in_cursor_renderer_native,
|
set_crtc_cursor (data->in_cursor_renderer_native, crtc, NULL);
|
||||||
monitor_crtc_mode->output->crtc, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -105,8 +105,10 @@ get_crtc_drm_connectors (MetaGpu *gpu,
|
|||||||
for (l = meta_gpu_get_outputs (gpu); l; l = l->next)
|
for (l = meta_gpu_get_outputs (gpu); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaOutput *output = l->data;
|
MetaOutput *output = l->data;
|
||||||
|
MetaCrtc *assigned_crtc;
|
||||||
|
|
||||||
if (output->crtc == crtc)
|
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
if (assigned_crtc == crtc)
|
||||||
g_array_append_val (connectors_array, output->winsys_id);
|
g_array_append_val (connectors_array, output->winsys_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,8 +188,10 @@ meta_gpu_kms_is_crtc_active (MetaGpuKms *gpu_kms,
|
|||||||
for (l = meta_gpu_get_outputs (gpu); l; l = l->next)
|
for (l = meta_gpu_get_outputs (gpu); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaOutput *output = l->data;
|
MetaOutput *output = l->data;
|
||||||
|
MetaCrtc *assigned_crtc;
|
||||||
|
|
||||||
if (output->crtc == crtc)
|
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
if (assigned_crtc == crtc)
|
||||||
{
|
{
|
||||||
connected_crtc_found = TRUE;
|
connected_crtc_found = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -188,7 +188,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j);
|
MetaOutput *output = g_ptr_array_index (crtc_info->outputs, j);
|
||||||
|
|
||||||
output->is_dirty = TRUE;
|
output->is_dirty = TRUE;
|
||||||
output->crtc = crtc;
|
meta_output_assign_crtc (output, crtc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->crtc = NULL;
|
meta_output_unassign_crtc (output);
|
||||||
output->is_primary = FALSE;
|
output->is_primary = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,11 +64,13 @@ typedef struct _MetaOutputKms
|
|||||||
void
|
void
|
||||||
meta_output_kms_set_underscan (MetaOutput *output)
|
meta_output_kms_set_underscan (MetaOutput *output)
|
||||||
{
|
{
|
||||||
if (!output->crtc)
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
if (!crtc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta_crtc_kms_set_underscan (output->crtc,
|
meta_crtc_kms_set_underscan (crtc, output->is_underscanning);
|
||||||
output->is_underscanning);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -600,14 +602,14 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
|||||||
|
|
||||||
if (crtc->crtc_id == output_kms->current_encoder->crtc_id)
|
if (crtc->crtc_id == output_kms->current_encoder->crtc_id)
|
||||||
{
|
{
|
||||||
output->crtc = crtc;
|
meta_output_assign_crtc (output, crtc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
output->crtc = NULL;
|
meta_output_unassign_crtc (output);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (old_output)
|
if (old_output)
|
||||||
|
@ -2089,6 +2089,7 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen,
|
|||||||
EGLDisplay egl_display = renderer_gpu_data->egl_display;
|
EGLDisplay egl_display = renderer_gpu_data->egl_display;
|
||||||
MetaMonitor *monitor;
|
MetaMonitor *monitor;
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
|
MetaCrtc *crtc;
|
||||||
EGLConfig egl_config;
|
EGLConfig egl_config;
|
||||||
EGLStreamKHR egl_stream;
|
EGLStreamKHR egl_stream;
|
||||||
EGLSurface egl_surface;
|
EGLSurface egl_surface;
|
||||||
@ -2112,6 +2113,7 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen,
|
|||||||
|
|
||||||
monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||||
output = meta_monitor_get_main_output (monitor);
|
output = meta_monitor_get_main_output (monitor);
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* An "logical_monitor" may have multiple outputs/crtcs in case its tiled,
|
* An "logical_monitor" may have multiple outputs/crtcs in case its tiled,
|
||||||
@ -2119,7 +2121,7 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen,
|
|||||||
* lets pass the first one.
|
* lets pass the first one.
|
||||||
*/
|
*/
|
||||||
output_attribs[0] = EGL_DRM_CRTC_EXT;
|
output_attribs[0] = EGL_DRM_CRTC_EXT;
|
||||||
output_attribs[1] = output->crtc->crtc_id;
|
output_attribs[1] = crtc->crtc_id;
|
||||||
output_attribs[2] = EGL_NONE;
|
output_attribs[2] = EGL_NONE;
|
||||||
|
|
||||||
if (!meta_egl_get_output_layers (egl, egl_display,
|
if (!meta_egl_get_output_layers (egl, egl_display,
|
||||||
@ -2717,12 +2719,10 @@ calculate_view_transform (MetaMonitorManager *monitor_manager,
|
|||||||
{
|
{
|
||||||
MetaMonitor *main_monitor;
|
MetaMonitor *main_monitor;
|
||||||
MetaOutput *main_output;
|
MetaOutput *main_output;
|
||||||
MetaMonitorTransform crtc_transform;
|
MetaCrtc *crtc;
|
||||||
main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||||
main_output = meta_monitor_get_main_output (main_monitor);
|
main_output = meta_monitor_get_main_output (main_monitor);
|
||||||
crtc_transform =
|
crtc = meta_output_get_assigned_crtc (main_output);
|
||||||
meta_monitor_logical_to_crtc_transform (main_monitor,
|
|
||||||
logical_monitor->transform);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pick any monitor and output and check; all CRTCs of a logical monitor will
|
* Pick any monitor and output and check; all CRTCs of a logical monitor will
|
||||||
@ -2730,11 +2730,11 @@ calculate_view_transform (MetaMonitorManager *monitor_manager,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if (meta_monitor_manager_is_transform_handled (monitor_manager,
|
if (meta_monitor_manager_is_transform_handled (monitor_manager,
|
||||||
main_output->crtc,
|
crtc,
|
||||||
crtc_transform))
|
crtc->transform))
|
||||||
return META_MONITOR_TRANSFORM_NORMAL;
|
return META_MONITOR_TRANSFORM_NORMAL;
|
||||||
else
|
else
|
||||||
return crtc_transform;
|
return crtc->transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaRendererView *
|
static MetaRendererView *
|
||||||
|
@ -225,8 +225,10 @@ is_crtc_assignment_changed (MetaCrtc *crtc,
|
|||||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
for (j = 0; j < crtc_info->outputs->len; j++)
|
||||||
{
|
{
|
||||||
MetaOutput *output = ((MetaOutput**) crtc_info->outputs->pdata)[j];
|
MetaOutput *output = ((MetaOutput**) crtc_info->outputs->pdata)[j];
|
||||||
|
MetaCrtc *assigned_crtc;
|
||||||
|
|
||||||
if (output->crtc != crtc)
|
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
if (assigned_crtc != crtc)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,6 +245,7 @@ is_output_assignment_changed (MetaOutput *output,
|
|||||||
MetaOutputInfo **output_infos,
|
MetaOutputInfo **output_infos,
|
||||||
unsigned int n_output_infos)
|
unsigned int n_output_infos)
|
||||||
{
|
{
|
||||||
|
MetaCrtc *assigned_crtc;
|
||||||
gboolean output_is_found = FALSE;
|
gboolean output_is_found = FALSE;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
@ -265,8 +268,10 @@ is_output_assignment_changed (MetaOutput *output,
|
|||||||
output_is_found = TRUE;
|
output_is_found = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
if (!output_is_found)
|
if (!output_is_found)
|
||||||
return output->crtc != NULL;
|
return assigned_crtc != NULL;
|
||||||
|
|
||||||
for (i = 0; i < n_crtc_infos; i++)
|
for (i = 0; i < n_crtc_infos; i++)
|
||||||
{
|
{
|
||||||
@ -279,7 +284,7 @@ is_output_assignment_changed (MetaOutput *output,
|
|||||||
((MetaOutput**) crtc_info->outputs->pdata)[j];
|
((MetaOutput**) crtc_info->outputs->pdata)[j];
|
||||||
|
|
||||||
if (crtc_info_output == output &&
|
if (crtc_info_output == output &&
|
||||||
crtc_info->crtc == output->crtc)
|
crtc_info->crtc == assigned_crtc)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -455,7 +460,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
||||||
|
|
||||||
output->is_dirty = TRUE;
|
output->is_dirty = TRUE;
|
||||||
output->crtc = crtc;
|
meta_output_assign_crtc (output, crtc);
|
||||||
|
|
||||||
output_ids[j] = output->winsys_id;
|
output_ids[j] = output->winsys_id;
|
||||||
}
|
}
|
||||||
@ -521,7 +526,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->crtc = NULL;
|
meta_output_unassign_crtc (output);
|
||||||
output->is_primary = FALSE;
|
output->is_primary = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,10 +97,13 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
|||||||
* make the border configurable. */
|
* make the border configurable. */
|
||||||
if (underscanning)
|
if (underscanning)
|
||||||
{
|
{
|
||||||
|
MetaCrtc *crtc;
|
||||||
uint32_t border_value;
|
uint32_t border_value;
|
||||||
|
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
prop = XInternAtom (xdisplay, "underscan hborder", False);
|
prop = XInternAtom (xdisplay, "underscan hborder", False);
|
||||||
border_value = output->crtc->current_mode->width * 0.05;
|
border_value = crtc->current_mode->width * 0.05;
|
||||||
|
|
||||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||||
(XID) output->winsys_id,
|
(XID) output->winsys_id,
|
||||||
@ -109,7 +112,7 @@ output_set_underscanning_xrandr (MetaOutput *output,
|
|||||||
1, &border_value);
|
1, &border_value);
|
||||||
|
|
||||||
prop = XInternAtom (xdisplay, "underscan vborder", False);
|
prop = XInternAtom (xdisplay, "underscan vborder", False);
|
||||||
border_value = output->crtc->current_mode->height * 0.05;
|
border_value = crtc->current_mode->height * 0.05;
|
||||||
|
|
||||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||||
(XID) output->winsys_id,
|
(XID) output->winsys_id,
|
||||||
@ -737,14 +740,14 @@ output_get_crtcs (MetaOutput *output,
|
|||||||
}
|
}
|
||||||
output->n_possible_crtcs = n_actual_crtcs;
|
output->n_possible_crtcs = n_actual_crtcs;
|
||||||
|
|
||||||
output->crtc = NULL;
|
meta_output_unassign_crtc (output);
|
||||||
for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
|
for (l = meta_gpu_get_crtcs (gpu); l; l = l->next)
|
||||||
{
|
{
|
||||||
MetaCrtc *crtc = l->data;
|
MetaCrtc *crtc = l->data;
|
||||||
|
|
||||||
if ((XID) crtc->crtc_id == xrandr_output->crtc)
|
if ((XID) crtc->crtc_id == xrandr_output->crtc)
|
||||||
{
|
{
|
||||||
output->crtc = crtc;
|
meta_output_assign_crtc (output, crtc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ draw_crtc (MetaMonitor *monitor,
|
|||||||
CoglTexture *texture = data->texture;
|
CoglTexture *texture = data->texture;
|
||||||
MetaLogicalMonitor *logical_monitor = data->logical_monitor;
|
MetaLogicalMonitor *logical_monitor = data->logical_monitor;
|
||||||
MetaOutput *output = monitor_crtc_mode->output;
|
MetaOutput *output = monitor_crtc_mode->output;
|
||||||
MetaCrtc *crtc = output->crtc;
|
MetaCrtc *crtc;
|
||||||
MetaRendererView *renderer_view = META_RENDERER_VIEW (data->view);
|
MetaRendererView *renderer_view = META_RENDERER_VIEW (data->view);
|
||||||
MetaMonitorTransform view_transform;
|
MetaMonitorTransform view_transform;
|
||||||
MetaMonitorTransform layout_transform = META_MONITOR_TRANSFORM_NORMAL;
|
MetaMonitorTransform layout_transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||||
@ -129,6 +129,8 @@ draw_crtc (MetaMonitor *monitor,
|
|||||||
texture_width = cogl_texture_get_width (texture);
|
texture_width = cogl_texture_get_width (texture);
|
||||||
texture_height = cogl_texture_get_height (texture);
|
texture_height = cogl_texture_get_height (texture);
|
||||||
|
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
clutter_stage_view_get_layout (data->view, &view_layout);
|
clutter_stage_view_get_layout (data->view, &view_layout);
|
||||||
sample_x = crtc->rect.x - view_layout.x;
|
sample_x = crtc->rect.x - view_layout.x;
|
||||||
sample_y = crtc->rect.y - view_layout.y;
|
sample_y = crtc->rect.y - view_layout.y;
|
||||||
|
@ -50,24 +50,22 @@ calculate_view_transform (MetaMonitorManager *monitor_manager,
|
|||||||
{
|
{
|
||||||
MetaMonitor *main_monitor;
|
MetaMonitor *main_monitor;
|
||||||
MetaOutput *main_output;
|
MetaOutput *main_output;
|
||||||
MetaMonitorTransform crtc_transform;
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
main_monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||||
main_output = meta_monitor_get_main_output (main_monitor);
|
main_output = meta_monitor_get_main_output (main_monitor);
|
||||||
crtc_transform =
|
crtc = meta_output_get_assigned_crtc (main_output);
|
||||||
meta_monitor_logical_to_crtc_transform (main_monitor,
|
|
||||||
logical_monitor->transform);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Pick any monitor and output and check; all CRTCs of a logical monitor will
|
* Pick any monitor and output and check; all CRTCs of a logical monitor will
|
||||||
* always have the same transform assigned to them.
|
* always have the same transform assigned to them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (meta_monitor_manager_is_transform_handled (monitor_manager,
|
if (meta_monitor_manager_is_transform_handled (monitor_manager,
|
||||||
main_output->crtc,
|
crtc,
|
||||||
crtc_transform))
|
crtc->transform))
|
||||||
return META_MONITOR_TRANSFORM_NORMAL;
|
return META_MONITOR_TRANSFORM_NORMAL;
|
||||||
else
|
else
|
||||||
return crtc_transform;
|
return crtc->transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MetaRendererView *
|
static MetaRendererView *
|
||||||
|
@ -209,7 +209,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
||||||
|
|
||||||
output->is_dirty = TRUE;
|
output->is_dirty = TRUE;
|
||||||
output->crtc = crtc;
|
meta_output_assign_crtc (output, crtc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
output->crtc = NULL;
|
meta_output_unassign_crtc (output);
|
||||||
output->is_primary = FALSE;
|
output->is_primary = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -449,22 +449,24 @@ check_current_monitor_mode (MetaMonitor *monitor,
|
|||||||
CheckMonitorModeData *data = user_data;
|
CheckMonitorModeData *data = user_data;
|
||||||
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
MetaMonitorManager *monitor_manager = data->monitor_manager;
|
||||||
MetaOutput *output;
|
MetaOutput *output;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
output = output_from_winsys_id (monitor_manager,
|
output = output_from_winsys_id (monitor_manager,
|
||||||
data->expect_crtc_mode_iter->output);
|
data->expect_crtc_mode_iter->output);
|
||||||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
|
|
||||||
if (data->expect_crtc_mode_iter->crtc_mode == -1)
|
if (data->expect_crtc_mode_iter->crtc_mode == -1)
|
||||||
{
|
{
|
||||||
g_assert_null (output->crtc);
|
g_assert_null (crtc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MetaLogicalMonitor *logical_monitor;
|
MetaLogicalMonitor *logical_monitor;
|
||||||
|
|
||||||
g_assert_nonnull (output->crtc);
|
g_assert_nonnull (crtc);
|
||||||
g_assert (monitor_crtc_mode->crtc_mode == output->crtc->current_mode);
|
g_assert (monitor_crtc_mode->crtc_mode == crtc->current_mode);
|
||||||
|
|
||||||
logical_monitor = output->crtc->logical_monitor;
|
logical_monitor = crtc->logical_monitor;
|
||||||
g_assert_nonnull (logical_monitor);
|
g_assert_nonnull (logical_monitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,6 +555,7 @@ check_logical_monitor (MonitorTestCase *test_case,
|
|||||||
for (l_output = outputs; l_output; l_output = l_output->next)
|
for (l_output = outputs; l_output; l_output = l_output->next)
|
||||||
{
|
{
|
||||||
MetaOutput *output = l_output->data;
|
MetaOutput *output = l_output->data;
|
||||||
|
MetaCrtc *crtc;
|
||||||
|
|
||||||
if (output->is_primary)
|
if (output->is_primary)
|
||||||
{
|
{
|
||||||
@ -560,8 +563,8 @@ check_logical_monitor (MonitorTestCase *test_case,
|
|||||||
primary_output = output;
|
primary_output = output;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_assert (!output->crtc ||
|
crtc = meta_output_get_assigned_crtc (output);
|
||||||
output->crtc->logical_monitor == logical_monitor);
|
g_assert (!crtc || crtc->logical_monitor == logical_monitor);
|
||||||
g_assert_cmpint (logical_monitor->is_presentation,
|
g_assert_cmpint (logical_monitor->is_presentation,
|
||||||
==,
|
==,
|
||||||
output->is_presentation);
|
output->is_presentation);
|
||||||
@ -983,7 +986,8 @@ create_monitor_test_setup (MonitorTestCase *test_case,
|
|||||||
|
|
||||||
output = g_object_new (META_TYPE_OUTPUT, NULL);
|
output = g_object_new (META_TYPE_OUTPUT, NULL);
|
||||||
|
|
||||||
output->crtc = crtc;
|
if (crtc)
|
||||||
|
meta_output_assign_crtc (output, crtc);
|
||||||
output->winsys_id = i;
|
output->winsys_id = i;
|
||||||
output->name = (is_laptop_panel ? g_strdup_printf ("eDP-%d",
|
output->name = (is_laptop_panel ? g_strdup_printf ("eDP-%d",
|
||||||
++n_laptop_panels)
|
++n_laptop_panels)
|
||||||
|
Loading…
Reference in New Issue
Block a user