mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
logical-monitor: Don't duplicate output list
Just use the monitor list and the output lists of each monitor. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
@ -36,7 +36,6 @@ meta_logical_monitor_new (MetaMonitor *monitor,
|
||||
GList *outputs;
|
||||
GList *l;
|
||||
gboolean is_presentation;
|
||||
int i;
|
||||
|
||||
g_assert (meta_monitor_is_active (monitor));
|
||||
|
||||
@ -59,20 +58,15 @@ meta_logical_monitor_new (MetaMonitor *monitor,
|
||||
|
||||
is_presentation = TRUE;
|
||||
outputs = meta_monitor_get_outputs (monitor);
|
||||
for (l = outputs, i = 0; l; l = l->next, i++)
|
||||
for (l = outputs; l; l = l->next)
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
|
||||
output->crtc->logical_monitor = logical_monitor;
|
||||
|
||||
if (i <= META_MAX_OUTPUTS_PER_MONITOR)
|
||||
logical_monitor->outputs[i] = output;
|
||||
else
|
||||
g_warning ("Couldn't add all outputs to monitor");
|
||||
|
||||
is_presentation = is_presentation && output->is_presentation;
|
||||
}
|
||||
logical_monitor->n_outputs = MIN (i, META_MAX_OUTPUTS_PER_MONITOR);
|
||||
|
||||
logical_monitor->is_presentation = is_presentation;
|
||||
|
||||
logical_monitor->monitors = g_list_append (logical_monitor->monitors,
|
||||
@ -85,30 +79,29 @@ void
|
||||
meta_logical_monitor_add_monitor (MetaLogicalMonitor *logical_monitor,
|
||||
MetaMonitor *monitor)
|
||||
{
|
||||
GList *outputs;
|
||||
GList *l;
|
||||
gboolean is_presentation;
|
||||
int i;
|
||||
|
||||
is_presentation = logical_monitor->is_presentation;
|
||||
logical_monitor->monitors = g_list_append (logical_monitor->monitors,
|
||||
monitor);
|
||||
|
||||
outputs = meta_monitor_get_outputs (monitor);
|
||||
for (l = outputs, i = logical_monitor->n_outputs; l; l = l->next, i++)
|
||||
for (l = logical_monitor->monitors; l; l = l->next)
|
||||
{
|
||||
MetaOutput *output = l->data;
|
||||
MetaMonitor *monitor = l->data;
|
||||
GList *outputs;
|
||||
GList *l_output;
|
||||
|
||||
output->crtc->logical_monitor = logical_monitor;
|
||||
outputs = meta_monitor_get_outputs (monitor);
|
||||
for (l_output = outputs; l_output; l_output = l_output->next)
|
||||
{
|
||||
MetaOutput *output = l_output->data;
|
||||
|
||||
if (i <= META_MAX_OUTPUTS_PER_MONITOR)
|
||||
logical_monitor->outputs[i] = output;
|
||||
else
|
||||
g_warning ("Couldn't add all outputs to monitor");
|
||||
|
||||
is_presentation = is_presentation && output->is_presentation;
|
||||
is_presentation = is_presentation && output->is_presentation;
|
||||
output->crtc->logical_monitor = logical_monitor;
|
||||
}
|
||||
}
|
||||
logical_monitor->n_outputs = MIN (i, META_MAX_OUTPUTS_PER_MONITOR);
|
||||
|
||||
logical_monitor->is_presentation = is_presentation;
|
||||
}
|
||||
|
||||
@ -124,6 +117,12 @@ meta_logical_monitor_make_primary (MetaLogicalMonitor *logical_monitor)
|
||||
logical_monitor->is_primary = TRUE;
|
||||
}
|
||||
|
||||
GList *
|
||||
meta_logical_monitor_get_monitors (MetaLogicalMonitor *logical_monitor)
|
||||
{
|
||||
return logical_monitor->monitors;
|
||||
}
|
||||
|
||||
static void
|
||||
meta_logical_monitor_init (MetaLogicalMonitor *logical_monitor)
|
||||
{
|
||||
|
@ -55,9 +55,6 @@ struct _MetaLogicalMonitor
|
||||
*/
|
||||
glong winsys_id;
|
||||
|
||||
int n_outputs;
|
||||
MetaOutput *outputs[META_MAX_OUTPUTS_PER_MONITOR];
|
||||
|
||||
GList *monitors;
|
||||
};
|
||||
|
||||
@ -78,4 +75,6 @@ gboolean meta_logical_monitor_is_primary (MetaLogicalMonitor *logical_monitor);
|
||||
|
||||
void meta_logical_monitor_make_primary (MetaLogicalMonitor *logical_monitor);
|
||||
|
||||
GList * meta_logical_monitor_get_monitors (MetaLogicalMonitor *logical_monitor);
|
||||
|
||||
#endif /* META_LOGICAL_MONITOR_H */
|
||||
|
@ -968,20 +968,14 @@ meta_renderer_native_create_surface_egl_device (MetaRendererNative *renderer_nat
|
||||
CoglRenderer *cogl_renderer = cogl_display->renderer;
|
||||
CoglRendererEGL *egl_renderer = cogl_renderer->winsys;
|
||||
EGLDisplay egl_display = egl_renderer->edpy;
|
||||
MetaMonitor *monitor;
|
||||
MetaOutput *output;
|
||||
EGLConfig egl_config;
|
||||
EGLStreamKHR egl_stream;
|
||||
EGLSurface egl_surface;
|
||||
EGLint num_layers;
|
||||
EGLOutputLayerEXT output_layer;
|
||||
EGLAttrib output_attribs[] = {
|
||||
/*
|
||||
* An "logical_monitor" may have multiple outputs/crtcs in case its tiled,
|
||||
* but as far as I can tell, EGL only allows you to pass one crtc_id, so
|
||||
* lets pass the first one.
|
||||
*/
|
||||
EGL_DRM_CRTC_EXT, logical_monitor->outputs[0]->crtc->crtc_id,
|
||||
EGL_NONE,
|
||||
};
|
||||
EGLAttrib output_attribs[3];
|
||||
EGLint stream_attribs[] = {
|
||||
EGL_STREAM_FIFO_LENGTH_KHR, 1,
|
||||
EGL_CONSUMER_AUTO_ACQUIRE_EXT, EGL_FALSE,
|
||||
@ -997,6 +991,18 @@ meta_renderer_native_create_surface_egl_device (MetaRendererNative *renderer_nat
|
||||
if (egl_stream == EGL_NO_STREAM_KHR)
|
||||
return FALSE;
|
||||
|
||||
monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
|
||||
/*
|
||||
* An "logical_monitor" may have multiple outputs/crtcs in case its tiled,
|
||||
* but as far as I can tell, EGL only allows you to pass one crtc_id, so
|
||||
* lets pass the first one.
|
||||
*/
|
||||
output_attribs[0] = EGL_DRM_CRTC_EXT;
|
||||
output_attribs[1] = output->crtc->crtc_id;
|
||||
output_attribs[2] = EGL_NONE;
|
||||
|
||||
if (!meta_egl_get_output_layers (egl, egl_display,
|
||||
output_attribs,
|
||||
&output_layer, 1, &num_layers,
|
||||
@ -1394,11 +1400,14 @@ meta_renderer_native_get_logical_monitor_transform (MetaRenderer *renderer
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
MetaMonitorManagerKms *monitor_manager_kms =
|
||||
META_MONITOR_MANAGER_KMS (monitor_manager);
|
||||
MetaMonitor *monitor;
|
||||
MetaOutput *output;
|
||||
|
||||
g_assert (logical_monitor->n_outputs > 0);
|
||||
monitor = meta_logical_monitor_get_monitors (logical_monitor)->data;
|
||||
output = meta_monitor_get_main_output (monitor);
|
||||
|
||||
return meta_monitor_manager_kms_get_view_transform (monitor_manager_kms,
|
||||
logical_monitor->outputs[0]->crtc);
|
||||
output->crtc);
|
||||
}
|
||||
|
||||
static CoglOnscreen *
|
||||
|
Reference in New Issue
Block a user