- if (fence) {
- /* if there hasn't been any rendering submitted yet, we might not
- * have actually created a fence
- */
- if (!ctx->last_fence || ctx->batch->needs_out_fence_fd) {
- ctx->batch->needs_flush = true;
- fd_gmem_render_noop(ctx->batch);
- fd_batch_reset(ctx->batch);
- }
- fd_fence_ref(pctx->screen, fence, ctx->last_fence);
- }
+ if (fencep)
+ fd_fence_ref(pctx->screen, fencep, fence);
+
+ fd_fence_ref(pctx->screen, &fence, NULL);