renderer/native: state consistency in copy_shared_framebuffer_gpu

To mirror what happens in meta_onscreen_native_swap_buffers_with_damage(), warn
here too if next_fb is not NULL. This makes it clear to the reader of what the
expectations are inside this function.

Ensuring next_fb is NULL as the first thing in the function will make all error
paths equal: no longer some failures reset next_fb while others don't. Removing
such special cases should reduce surprises.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/810
This commit is contained in:
Pekka Paalanen 2019-12-02 14:00:56 +02:00 committed by Jonas Ådahl
parent 5b1ff5935e
commit d7c9042c78

View File

@ -1786,6 +1786,9 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
COGL_TRACE_BEGIN_SCOPED (CopySharedFramebufferSecondaryGpu,
"FB Copy (secondary GPU)");
g_warn_if_fail (secondary_gpu_state->gbm.next_fb == NULL);
g_clear_object (&secondary_gpu_state->gbm.next_fb);
if (!meta_egl_make_current (egl,
renderer_gpu_data->egl_display,
secondary_gpu_state->egl_surface,
@ -1825,7 +1828,6 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
return;
}
g_clear_object (&secondary_gpu_state->gbm.next_fb);
buffer_gbm = meta_drm_buffer_gbm_new (secondary_gpu_state->gpu_kms,
secondary_gpu_state->gbm.surface,
renderer_native->use_modifiers,