* flush method returns a fence even if there are no commands to flush.
*/
struct pipe_screen *screen = drawable->screen->base.screen;
- struct pipe_fence_handle *fence;
+ struct pipe_fence_handle *oldest_fence, *new_fence = NULL;
- fence = swap_fences_pop_front(drawable);
- if (fence) {
- (void) screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
- screen->fence_reference(screen, &fence, NULL);
- }
+ st->flush(st, flush_flags, &new_fence);
- st->flush(st, flush_flags, &fence);
+ oldest_fence = swap_fences_pop_front(drawable);
+ if (oldest_fence) {
+ screen->fence_finish(screen, NULL, oldest_fence, PIPE_TIMEOUT_INFINITE);
+ screen->fence_reference(screen, &oldest_fence, NULL);
+ }
- if (fence) {
- swap_fences_push_back(drawable, fence);
- screen->fence_reference(screen, &fence, NULL);
+ if (new_fence) {
+ swap_fences_push_back(drawable, new_fence);
+ screen->fence_reference(screen, &new_fence, NULL);
}
}
else if (flags & (__DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT)) {