* Flush all drawing from context to the pipe also flushes the pipe.
*/
void (*flush)(struct st_context_iface *stctxi, unsigned flags,
- struct pipe_fence_handle **fence);
+ struct pipe_fence_handle **fence,
+ void (*notify_before_flush_cb) (void*),
+ void* notify_before_flush_cb_args);
/**
* Replace the texture image of a texture object at the specified level.
if (flush_flag == __BLIT_FLAG_FLUSH) {
pipe->flush_resource(pipe, dst->texture);
- ctx->st->flush(ctx->st, 0, NULL);
+ ctx->st->flush(ctx->st, 0, NULL, NULL, NULL);
} else if (flush_flag == __BLIT_FLAG_FINISH) {
screen = dri_screen(ctx->sPriv)->base.screen;
pipe->flush_resource(pipe, dst->texture);
- ctx->st->flush(ctx->st, 0, &fence);
+ ctx->st->flush(ctx->st, 0, &fence, NULL, NULL);
(void) screen->fence_finish(screen, NULL, fence, PIPE_TIMEOUT_INFINITE);
screen->fence_reference(screen, &fence, NULL);
}
* to avoid having to add code elsewhere to cope with flushing a
* partially destroyed context.
*/
- ctx->st->flush(ctx->st, 0, NULL);
+ ctx->st->flush(ctx->st, 0, NULL, NULL, NULL);
ctx->st->destroy(ctx->st);
free(ctx);
}
struct pipe_screen *screen = drawable->screen->base.screen;
struct pipe_fence_handle *new_fence = NULL;
- st->flush(st, flush_flags, &new_fence);
+ st->flush(st, flush_flags, &new_fence, args.ctx ? notify_before_flush_cb : NULL, &args);
/* throttle on the previous fence */
if (drawable->throttle_fence) {
drawable->throttle_fence = new_fence;
}
else if (flags & (__DRI2_FLUSH_DRAWABLE | __DRI2_FLUSH_CONTEXT)) {
- st->flush(st, flush_flags, NULL);
+ st->flush(st, flush_flags, NULL, NULL, NULL);
}
if (drawable) {
if (!fence)
return NULL;
- stapi->flush(stapi, 0, &fence->pipe_fence);
+ stapi->flush(stapi, 0, &fence->pipe_fence, NULL, NULL);
if (!fence->pipe_fence) {
FREE(fence);
if (fd == -1) {
/* exporting driver created fence, flush: */
- stapi->flush(stapi, ST_FLUSH_FENCE_FD, &fence->pipe_fence);
+ stapi->flush(stapi, ST_FLUSH_FENCE_FD, &fence->pipe_fence, NULL, NULL);
} else {
/* importing a foreign fence fd: */
ctx->create_fence_fd(ctx, &fence->pipe_fence, fd, PIPE_FD_TYPE_NATIVE_SYNC);
if (ctx->hud)
hud_run(ctx->hud, ctx->st->cso_context, ptex);
- ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
+ ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
drisw_copy_to_front(dPriv, ptex);
}
if (ctx->pp && drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL])
pp_run(ctx->pp, ptex, ptex, drawable->textures[ST_ATTACHMENT_DEPTH_STENCIL]);
- ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL);
+ ctx->st->flush(ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
u_box_2d(x, dPriv->h - y - h, w, h, &box);
drisw_present_texture(dPriv, ptex, &box);
}
if (xmctx && xmctx->xm_buffer == b) {
- xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL);
+ xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
}
xmesa_swap_st_framebuffer(b->stfb);
{
XMesaContext xmctx = XMesaGetCurrentContext();
- xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL);
+ xmctx->st->flush( xmctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
xmesa_copy_st_framebuffer(b->stfb,
ST_ATTACHMENT_BACK_LEFT, ST_ATTACHMENT_FRONT_LEFT,
XMesaDisplay xmdpy = xmesa_init_display(c->xm_visual->display);
struct pipe_fence_handle *fence = NULL;
- c->st->flush(c->st, ST_FLUSH_FRONT, &fence);
+ c->st->flush(c->st, ST_FLUSH_FRONT, &fence, NULL, NULL);
if (fence) {
xmdpy->screen->fence_finish(xmdpy->screen, NULL, fence,
PIPE_TIMEOUT_INFINITE);
if (old_ctx->shared) {
struct pipe_fence_handle *fence = NULL;
old_ctx->st->flush(old_ctx->st,
- ST_FLUSH_FRONT | ST_FLUSH_WAIT, &fence);
+ ST_FLUSH_FRONT | ST_FLUSH_WAIT, &fence,
+ NULL, NULL);
}
else {
- old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL);
+ old_ctx->st->flush(old_ctx->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
}
}
}
if (ctx->current_framebuffer == fb) {
/* flush current context */
- ctx->st->flush(ctx->st, ST_FLUSH_END_OF_FRAME, NULL);
+ ctx->st->flush(ctx->st, ST_FLUSH_END_OF_FRAME, NULL, NULL, NULL);
}
}
return;
if (fContext[contextID]->st) {
- fContext[contextID]->st->flush(fContext[contextID]->st, 0, NULL);
+ fContext[contextID]->st->flush(fContext[contextID]->st, 0, NULL, NULL, NULL);
fContext[contextID]->st->destroy(fContext[contextID]->st);
}
if (oldContextID > 0 && oldContextID != contextID) {
fContext[oldContextID]->st->flush(fContext[oldContextID]->st,
- ST_FLUSH_FRONT, NULL);
+ ST_FLUSH_FRONT, NULL, NULL, NULL);
}
// We need to lock and unlock framebuffers before accessing them
ERROR("%s: context not found\n", __func__);
return B_ERROR;
}
- context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
+ context->st->flush(context->st, ST_FLUSH_FRONT, NULL, NULL, NULL);
struct hgl_buffer* buffer = hgl_st_framebuffer(context->draw->stfbi);
pipe_surface* surface = buffer->surface;
static void
st_context_flush(struct st_context_iface *stctxi, unsigned flags,
- struct pipe_fence_handle **fence)
+ struct pipe_fence_handle **fence,
+ void (*before_flush_cb) (void*),
+ void* args)
{
struct st_context *st = (struct st_context *) stctxi;
unsigned pipe_flags = 0;
FLUSH_VERTICES(st->ctx, 0);
FLUSH_CURRENT(st->ctx, 0);
+ /* Notify the caller that we're ready to flush */
+ if (before_flush_cb)
+ before_flush_cb(args);
st_flush(st, fence, pipe_flags);
if ((flags & ST_FLUSH_WAIT) && fence && *fence) {