From 32877118c3d24ca4a7bfbcfaff2ff49c0d0ff5b5 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 17 Oct 2016 18:37:31 +0200 Subject: [PATCH] MetaOnscreenNative: fix mirror mode with stage views Using the view's MetaMonitorInfo to find all the crtcs which should be configured to display a given onscreen doesn't work unfortunately. The association runs only the other way around, i.e. we need to go through each crtc and find the ones corresponding to our monitor info. https://bugzilla.gnome.org/show_bug.cgi?id=773115 --- src/backends/native/meta-renderer-native.c | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index b4c93c422..67bd635b9 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -466,16 +466,19 @@ meta_onscreen_native_set_crtc_modes (MetaOnscreenNative *onscreen_native) monitor_info = meta_renderer_view_get_monitor_info (view); if (monitor_info) { - int i; + unsigned int i; - for (i = 0; i < monitor_info->n_outputs; i++) + for (i = 0; i < monitor_manager->n_crtcs; i++) { - MetaOutput *output = monitor_info->outputs[i]; - int x = output->crtc->rect.x - monitor_info->rect.x; - int y = output->crtc->rect.y - monitor_info->rect.y; + MetaCRTC *crtc = &monitor_manager->crtcs[i]; + int x = crtc->rect.x - monitor_info->rect.x; + int y = crtc->rect.y - monitor_info->rect.y; + + if (crtc->logical_monitor != monitor_info) + continue; meta_monitor_manager_kms_apply_crtc_mode (monitor_manager_kms, - output->crtc, + crtc, x, y, next_fb_id); } @@ -530,16 +533,19 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen) monitor_info = meta_renderer_view_get_monitor_info (view); if (monitor_info) { - int i; + unsigned int i; - for (i = 0; i < monitor_info->n_outputs; i++) + for (i = 0; i < monitor_manager->n_crtcs; i++) { - MetaOutput *output = monitor_info->outputs[i]; - int x = output->crtc->rect.x - monitor_info->rect.x; - int y = output->crtc->rect.y - monitor_info->rect.y; + MetaCRTC *crtc = &monitor_manager->crtcs[i]; + int x = crtc->rect.x - monitor_info->rect.x; + int y = crtc->rect.y - monitor_info->rect.y; + + if (crtc->logical_monitor != monitor_info) + continue; meta_onscreen_native_flip_crtc (onscreen_native, flip_closure, - output->crtc, x, y, + crtc, x, y, &fb_in_use); } }