if (--ctx->bind_count == 0) {
if (ctx->st && ctx->st == st_get_current()) {
st_flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
- st_make_current(NULL, NULL, NULL);
+ st_make_current(NULL, NULL, NULL, NULL);
}
}
}
ctx->r_stamp = driReadPriv->lastStamp - 1;
}
- st_make_current(ctx->st, draw->stfb, read->stfb);
+ /* DRI co-state tracker currently overrides flush_frontbuffer.
+ * When this is fixed, will need to pass the drawable in the
+ * fourth parameter here so that when Mesa calls
+ * flush_frontbuffer directly (in front-buffer rendering), it
+ * will have access to the drawable argument:
+ */
+ st_make_current(ctx->st, draw->stfb, read->stfb, NULL);
if (__dri1_api_hooks) {
dri1_update_drawables(ctx, draw, read);
ctx->pipe->priv);
}
} else {
- st_make_current(NULL, NULL, NULL);
+ st_make_current(NULL, NULL, NULL, NULL);
}
return GL_TRUE;
if (gctx) {
ok = egl_g3d_realloc_context(dpy, &gctx->base);
if (ok) {
+ /* XXX: need to pass the winsys argument for
+ * flush_frontbuffer in the fourth parameter here:
+ */
ok = gctx->stapi->st_make_current(gctx->st_ctx,
- gctx->draw.st_fb, gctx->read.st_fb);
+ gctx->draw.st_fb,
+ gctx->read.st_fb,
+ NULL);
if (ok) {
egl_g3d_validate_context(dpy, &gctx->base);
if (gdraw->base.Type == EGL_WINDOW_BIT) {
}
}
else if (old_gctx) {
- ok = old_gctx->stapi->st_make_current(NULL, NULL, NULL);
+ ok = old_gctx->stapi->st_make_current(NULL, NULL, NULL, NULL);
old_gctx->base.WindowRenderBuffer = EGL_NONE;
}
ST_PUBLIC(st_get_framebuffer_texture, int, struct st_framebuffer *stfb, uint surfIndex, struct pipe_texture **texture)
ST_PUBLIC(st_framebuffer_private, void *, struct st_framebuffer *stfb)
ST_PUBLIC(st_unreference_framebuffer, void, struct st_framebuffer *stfb)
-ST_PUBLIC(st_make_current, GLboolean, struct st_context *st, struct st_framebuffer *draw, struct st_framebuffer *read)
+ST_PUBLIC(st_make_current, GLboolean, struct st_context *st, struct st_framebuffer *draw, struct st_framebuffer *read, void *winsys_drawable_handle)
ST_PUBLIC(st_get_current, struct st_context *, void)
ST_PUBLIC(st_flush, void, struct st_context *st, uint pipeFlushFlags, struct pipe_fence_handle **fence)
ST_PUBLIC(st_finish, void, struct st_context *st)
c->xm_buffer = drawBuffer;
c->xm_read_buffer = readBuffer;
- st_make_current(c->st, drawBuffer->stfb, readBuffer->stfb);
+ st_make_current(c->st, drawBuffer->stfb, readBuffer->stfb,
+ &drawBuffer->ws);
xmesa_check_and_update_buffer_size(c, drawBuffer);
if (readBuffer != drawBuffer)
}
else {
/* Detach */
- st_make_current( NULL, NULL, NULL );
+ st_make_current( NULL, NULL, NULL, NULL );
}
return GL_TRUE;
boolean st_make_current(struct vg_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read)
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle)
{
vg_set_current_context(st);
if (st) {
st->draw_buffer = draw;
+
+ /* VG state tracker doesn't seem to do front-buffer rendering
+ * (no calls to flush_frontbuffer). If it ever did start doing
+ * that, it would need to pass this value down in the
+ * flush_frontbuffer call:
+ */
+ st->pipe->priv = winsys_drawable_handle;
}
return VG_TRUE;
}
PUBLIC
boolean st_make_current(struct vg_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read);
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle);
PUBLIC
struct vg_context *st_get_current(void);
/* Unbind current if deleting current context. */
if (curctx == ctx)
- st_make_current( NULL, NULL, NULL );
+ st_make_current( NULL, NULL, NULL, NULL );
st_destroy_context(ctx->st);
FREE(ctx);
}
if (hdc == NULL || dhglrc == 0) {
- return st_make_current( NULL, NULL, NULL );
+ return st_make_current( NULL, NULL, NULL, NULL );
}
pipe_mutex_lock( stw_dev->ctx_mutex );
/* pass to stw_flush_frontbuffer as context_private */
ctx->st->pipe->priv = hdc;
- if(!st_make_current( ctx->st, fb->stfb, fb->stfb ))
+ if(!st_make_current( ctx->st, fb->stfb, fb->stfb, hdc ))
goto fail;
success:
GLboolean
st_make_current(struct st_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read)
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle )
{
/* Call this periodically to detect when the user has begun using
* GL rendering from multiple threads.
_glapi_check_multithread();
if (st) {
- if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base))
+ if (!_mesa_make_current(st->ctx, &draw->Base, &read->Base)) {
+ st->pipe->priv = NULL;
return GL_FALSE;
+ }
_mesa_check_init_viewport(st->ctx, draw->InitWidth, draw->InitHeight);
+ st->pipe->priv = winsys_drawable_handle;
return GL_TRUE;
}
PUBLIC
GLboolean st_make_current(struct st_context *st,
struct st_framebuffer *draw,
- struct st_framebuffer *read);
+ struct st_framebuffer *read,
+ void *winsys_drawable_handle);
PUBLIC
struct st_context *st_get_current(void);