diff --git a/src/backends/native/meta-monitor-manager-kms.c b/src/backends/native/meta-monitor-manager-kms.c index 2067f3126..fae195fbc 100644 --- a/src/backends/native/meta-monitor-manager-kms.c +++ b/src/backends/native/meta-monitor-manager-kms.c @@ -1546,7 +1546,7 @@ get_crtc_connectors (MetaMonitorManager *manager, *connectors = (uint32_t *) g_array_free (connectors_array, FALSE); } -void +gboolean meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms, MetaCRTC *crtc, int x, @@ -1571,9 +1571,14 @@ meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms, x, y, connectors, n_connectors, mode) != 0) - g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name); + { + g_warning ("Failed to set CRTC mode %s: %m", crtc->current_mode->name); + return FALSE; + } g_free (connectors); + + return TRUE; } static void @@ -1622,7 +1627,8 @@ meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms, int x, int y, uint32_t fb_id, - GClosure *flip_closure) + GClosure *flip_closure, + gboolean *fb_in_use) { MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms); uint32_t *connectors; @@ -1649,14 +1655,21 @@ meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms, } if (manager_kms->page_flips_not_supported) - meta_monitor_manager_kms_apply_crtc_mode (manager_kms, - crtc, - x, y, - fb_id); + { + if (meta_monitor_manager_kms_apply_crtc_mode (manager_kms, + crtc, + x, y, + fb_id)) + { + *fb_in_use = TRUE; + return FALSE; + } + } if (ret != 0) return FALSE; + *fb_in_use = TRUE; g_closure_ref (flip_closure); return TRUE; diff --git a/src/backends/native/meta-monitor-manager-kms.h b/src/backends/native/meta-monitor-manager-kms.h index 53a019ea5..96468cf75 100644 --- a/src/backends/native/meta-monitor-manager-kms.h +++ b/src/backends/native/meta-monitor-manager-kms.h @@ -39,11 +39,11 @@ GType meta_monitor_manager_kms_get_type (void); typedef void (*MetaKmsFlipCallback) (void *user_data); -void meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms, - MetaCRTC *crtc, - int x, - int y, - uint32_t fb_id); +gboolean meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms, + MetaCRTC *crtc, + int x, + int y, + uint32_t fb_id); gboolean meta_monitor_manager_kms_is_crtc_active (MetaMonitorManagerKms *manager_kms, MetaCRTC *crtc); @@ -53,7 +53,8 @@ gboolean meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms, int x, int y, uint32_t fb_id, - GClosure *flip_closure); + GClosure *flip_closure, + gboolean *fb_in_use); void meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms); diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 8a46dc424..9acf7fc0b 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -457,10 +457,9 @@ meta_onscreen_native_flip_crtc (MetaOnscreenNative *onscreen_native, crtc, x, y, onscreen_native->gbm.next_fb_id, - flip_closure)) + flip_closure, + fb_in_use)) onscreen_native->pending_flips++; - - *fb_in_use = TRUE; } static void