From b2f9de98d0a4985338fbd750fc855276d9ca4c5a Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Thu, 15 Feb 2018 15:27:26 +0800 Subject: [PATCH] renderer-native: Swap then await earlier flips. Rendering the next frame (which mostly happens as part of the flush done in swap buffers) is a task that the GPU can complete independently of the CPU having to wait for previous page flips. So reverse their order to get the GPU started earlier, with the aim of greater GPU-CPU parallelism. (cherry picked from commit 6e415353e311655be9936b9dfb9e23c80ef1eae6) --- src/backends/native/meta-renderer-native.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c index 8175a6b21..1fc593ad5 100644 --- a/src/backends/native/meta-renderer-native.c +++ b/src/backends/native/meta-renderer-native.c @@ -1854,18 +1854,18 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen, frame_info = g_queue_peek_tail (&onscreen->pending_frame_infos); frame_info->global_frame_counter = renderer_native->frame_counter; - /* - * Wait for the flip callback before continuing, as we might have started the - * animation earlier due to the animation being driven by some other monitor. - */ - wait_for_pending_flips (onscreen); - update_secondary_gpu_state_pre_swap_buffers (onscreen); parent_vtable->onscreen_swap_buffers_with_damage (onscreen, rectangles, n_rectangles); + /* + * Wait for the flip callback before continuing, as we might have started the + * animation earlier due to the animation being driven by some other monitor. + */ + wait_for_pending_flips (onscreen); + renderer_gpu_data = meta_renderer_native_get_gpu_data (renderer_native, render_gpu); switch (renderer_gpu_data->mode)