mirror of
https://github.com/brl/mutter.git
synced 2024-12-24 12:02:04 +00:00
onscreen/native: Remove a goto in DisplayLink fallback
At first glance the `goto` looks like a loop, or potentially an infinite loop. It's not a loop because the mode has changed at that point to `META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY`. But we can make it more obvious and avoid the need for a goto. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2240>
This commit is contained in:
parent
35fa75a085
commit
6673fbcf68
@ -597,20 +597,6 @@ import_shared_framebuffer (CoglOnscreen *onscreen,
|
||||
|
||||
g_warn_if_fail (secondary_gpu_state->import_status ==
|
||||
META_SHARED_FRAMEBUFFER_IMPORT_STATUS_NONE);
|
||||
|
||||
/*
|
||||
* Fall back. If META_SHARED_FRAMEBUFFER_IMPORT_STATUS_NONE is
|
||||
* in effect, we have COPY_MODE_PRIMARY prepared already, so we
|
||||
* simply retry with that path. Import status cannot be FAILED,
|
||||
* because we should not retry if failed once.
|
||||
*
|
||||
* If import status is OK, that is unexpected and we do not
|
||||
* have the fallback path prepared which means this output cannot
|
||||
* work anymore.
|
||||
*/
|
||||
secondary_gpu_state->renderer_gpu_data->secondary.copy_mode =
|
||||
META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY;
|
||||
|
||||
secondary_gpu_state->import_status =
|
||||
META_SHARED_FRAMEBUFFER_IMPORT_STATUS_FAILED;
|
||||
return FALSE;
|
||||
@ -993,13 +979,18 @@ update_secondary_gpu_state_post_swap_buffers (CoglOnscreen *onscreen,
|
||||
renderer_gpu_data =
|
||||
meta_renderer_native_get_gpu_data (renderer_native,
|
||||
secondary_gpu_state->gpu_kms);
|
||||
retry:
|
||||
switch (renderer_gpu_data->secondary.copy_mode)
|
||||
{
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_ZERO:
|
||||
if (!import_shared_framebuffer (onscreen,
|
||||
secondary_gpu_state))
|
||||
goto retry;
|
||||
if (import_shared_framebuffer (onscreen, secondary_gpu_state))
|
||||
break;
|
||||
|
||||
/* The fallback was prepared in pre_swap_buffers */
|
||||
renderer_gpu_data->secondary.copy_mode =
|
||||
META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY;
|
||||
G_GNUC_FALLTHROUGH;
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
|
||||
/* Done before eglSwapBuffers. */
|
||||
break;
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_SECONDARY_GPU:
|
||||
copy_shared_framebuffer_gpu (onscreen,
|
||||
@ -1007,9 +998,6 @@ retry:
|
||||
renderer_gpu_data,
|
||||
egl_context_changed);
|
||||
break;
|
||||
case META_SHARED_FRAMEBUFFER_COPY_MODE_PRIMARY:
|
||||
/* Done before eglSwapBuffers. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user