gallium: plumb winsys-drawable-handle through to state tracker

The state trackers need this value so that they can supply it
as the "void *" argument to flush_frontbuffer.

Fixes single-buffer rendering.
This commit is contained in:
Keith Whitwell 2010-03-10 09:22:02 +00:00
parent 155fbcb0ed
commit 3e38dbe3d3
9 changed files with 42 additions and 16 deletions

View file

@ -128,7 +128,7 @@ dri_unbind_context(__DRIcontext * cPriv)
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);
}
}
}
@ -161,7 +161,13 @@ dri_make_current(__DRIcontext * cPriv,
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);
@ -170,7 +176,7 @@ dri_make_current(__DRIcontext * cPriv,
ctx->pipe->priv);
}
} else {
st_make_current(NULL, NULL, NULL);
st_make_current(NULL, NULL, NULL, NULL);
}
return GL_TRUE;

View file

@ -892,8 +892,13 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
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) {
@ -905,7 +910,7 @@ egl_g3d_make_current(_EGLDriver *drv, _EGLDisplay *dpy,
}
}
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;
}

View file

@ -9,7 +9,7 @@ ST_PUBLIC(st_get_framebuffer_surface, int, struct st_f
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)

View file

@ -1020,7 +1020,8 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
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)
@ -1031,7 +1032,7 @@ GLboolean XMesaMakeCurrent2( XMesaContext c, XMesaBuffer drawBuffer,
}
else {
/* Detach */
st_make_current( NULL, NULL, NULL );
st_make_current( NULL, NULL, NULL, NULL );
}
return GL_TRUE;

View file

@ -376,11 +376,19 @@ void st_unreference_framebuffer(struct st_framebuffer *stfb)
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;
}

View file

@ -101,7 +101,8 @@ void st_unreference_framebuffer(struct st_framebuffer *stfb);
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);

View file

@ -226,7 +226,7 @@ DrvDeleteContext(
/* 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);
@ -317,7 +317,7 @@ stw_make_current(
}
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 );
@ -352,7 +352,7 @@ stw_make_current(
/* 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:

View file

@ -272,7 +272,8 @@ void st_destroy_context( struct st_context *st )
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.
@ -280,10 +281,13 @@ st_make_current(struct st_context *st,
_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;
}

View file

@ -105,7 +105,8 @@ void st_unreference_framebuffer( struct st_framebuffer *stfb );
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);