backends/native: Don't set discarded framebuffer as current

When a swap failed with EACCES (possibly due to VT switching), don't
mark the framebuffer as 'in use', so that it'll be cleaned up properly
and not set as current.

https://bugzilla.gnome.org/show_bug.cgi?id=773629
This commit is contained in:
Jonas Ådahl 2016-11-17 20:17:15 +08:00
parent 68d690225a
commit ad784501a6
3 changed files with 29 additions and 16 deletions

View File

@ -1546,7 +1546,7 @@ get_crtc_connectors (MetaMonitorManager *manager,
*connectors = (uint32_t *) g_array_free (connectors_array, FALSE); *connectors = (uint32_t *) g_array_free (connectors_array, FALSE);
} }
void gboolean
meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms, meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms,
MetaCRTC *crtc, MetaCRTC *crtc,
int x, int x,
@ -1571,9 +1571,14 @@ meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms,
x, y, x, y,
connectors, n_connectors, connectors, n_connectors,
mode) != 0) 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); g_free (connectors);
return TRUE;
} }
static void static void
@ -1622,7 +1627,8 @@ meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms,
int x, int x,
int y, int y,
uint32_t fb_id, uint32_t fb_id,
GClosure *flip_closure) GClosure *flip_closure,
gboolean *fb_in_use)
{ {
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms); MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_kms);
uint32_t *connectors; uint32_t *connectors;
@ -1649,14 +1655,21 @@ meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms,
} }
if (manager_kms->page_flips_not_supported) if (manager_kms->page_flips_not_supported)
meta_monitor_manager_kms_apply_crtc_mode (manager_kms, {
if (meta_monitor_manager_kms_apply_crtc_mode (manager_kms,
crtc, crtc,
x, y, x, y,
fb_id); fb_id))
{
*fb_in_use = TRUE;
return FALSE;
}
}
if (ret != 0) if (ret != 0)
return FALSE; return FALSE;
*fb_in_use = TRUE;
g_closure_ref (flip_closure); g_closure_ref (flip_closure);
return TRUE; return TRUE;

View File

@ -39,7 +39,7 @@ GType meta_monitor_manager_kms_get_type (void);
typedef void (*MetaKmsFlipCallback) (void *user_data); typedef void (*MetaKmsFlipCallback) (void *user_data);
void meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms, gboolean meta_monitor_manager_kms_apply_crtc_mode (MetaMonitorManagerKms *manager_kms,
MetaCRTC *crtc, MetaCRTC *crtc,
int x, int x,
int y, int y,
@ -53,7 +53,8 @@ gboolean meta_monitor_manager_kms_flip_crtc (MetaMonitorManagerKms *manager_kms,
int x, int x,
int y, int y,
uint32_t fb_id, 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); void meta_monitor_manager_kms_wait_for_flip (MetaMonitorManagerKms *manager_kms);

View File

@ -457,10 +457,9 @@ meta_onscreen_native_flip_crtc (MetaOnscreenNative *onscreen_native,
crtc, crtc,
x, y, x, y,
onscreen_native->gbm.next_fb_id, onscreen_native->gbm.next_fb_id,
flip_closure)) flip_closure,
fb_in_use))
onscreen_native->pending_flips++; onscreen_native->pending_flips++;
*fb_in_use = TRUE;
} }
static void static void