diff options
author | Brian <brian.paul@tungstengraphics.com> | 2007-11-06 10:05:01 -0700 |
---|---|---|
committer | Brian <brian.paul@tungstengraphics.com> | 2007-11-06 10:05:01 -0700 |
commit | 0800342296fb9eeb6bac8f24965441dff0e71812 (patch) | |
tree | 5504fd8dee435c45217af74211e8ec581048eee0 /src/mesa | |
parent | e2feb80a90f3e9300c70a4a4eb3e966131f5c313 (diff) |
Remove last of core Mesa dependencies in intel_swapbuffers.c
Use the "dummyContext" pointer (for now) instead of GET_CURRENT_CONTEXT().
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_context.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_screen.h | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c | 45 |
3 files changed, 17 insertions, 44 deletions
diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c index 85ccb1bc2a..ed6448646a 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_context.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_context.c @@ -181,6 +181,9 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) intel->first_swap_fence = NULL; } + if (intel->intelScreen->dummyContext == intel) + intel->intelScreen->dummyContext = NULL; + st_destroy_context(intel->st); free(intel); } @@ -210,9 +213,10 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, assert(draw_fb->stfb); assert(read_fb->stfb); - /* this is a hack so we have a valid context when the region allocation - is done. Need a per-screen context? */ - intel->intelScreen->dummyctxptr = intel; + /* This is for situations in which we need a rendering context but + * there may not be any currently bound. + */ + intel->intelScreen->dummyContext = intel; st_make_current(intel->st, draw_fb->stfb, read_fb->stfb); diff --git a/src/mesa/drivers/dri/intel_winsys/intel_screen.h b/src/mesa/drivers/dri/intel_winsys/intel_screen.h index 1d24ff7ff7..3bcbc22963 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_screen.h +++ b/src/mesa/drivers/dri/intel_winsys/intel_screen.h @@ -69,7 +69,11 @@ struct intel_screen struct _DriBufferPool *staticPool; /** for the X screen/framebuffer */ boolean havePools; - struct intel_context *dummyctxptr; + /** + * Temporary(?) context to use for SwapBuffers or other situations in + * which we need a rendering context, but none is currently bound. + */ + struct intel_context *dummyContext; }; diff --git a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c index 8e0f1113b8..9fcb2dac27 100644 --- a/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c +++ b/src/mesa/drivers/dri/intel_winsys/intel_swapbuffers.c @@ -31,7 +31,6 @@ #include "intel_batchbuffer.h" #include "intel_reg.h" #include "intel_winsys.h" -#include "context.h" #include "pipe/p_context.h" #include "state_tracker/st_public.h" @@ -39,39 +38,6 @@ #include "state_tracker/st_cb_fbo.h" - -/** Cast wrapper */ -static INLINE struct intel_context * -intel_context_mesa(GLcontext * ctx) -{ - return (struct intel_context *) ctx->DriverCtx; -} - - -/** XXX temporary - want to get rid of this */ -static struct intel_context * -intelScreenContext(struct intel_screen *intelScreen) -{ - /* - * This should probably change to have the screen allocate a dummy - * context at screen creation. For now just use the current context. - */ - - GET_CURRENT_CONTEXT(ctx); - if (ctx == NULL) { - /* need a context for the first time makecurrent is called (for hw lock - when allocating priv buffers) */ - if (intelScreen->dummyctxptr == NULL) { - _mesa_problem(NULL, "No current context in intelScreenContext\n"); - return NULL; - } - return intelScreen->dummyctxptr; - } - - return intel_context_mesa(ctx); -} - - /** * Display a colorbuffer surface in an X window. * Used for SwapBuffers and flushing front buffer rendering. @@ -86,18 +52,17 @@ intelDisplaySurface(__DRIdrawablePrivate *dPriv, const drm_clip_rect_t *rect) { struct intel_screen *intelScreen = intel_screen(dPriv->driScreenPriv); - struct intel_context *intel; + struct intel_context *intel = intelScreen->dummyContext; DBG(SWAP, "%s\n", __FUNCTION__); - assert(dPriv); - - intel = intelScreenContext(intelScreen); - if (!intel) + if (!intel) { + /* XXX this is where some kind of extra/meta context could be useful */ return; + } if (intel->last_swap_fence) { - driFenceFinish(intel->last_swap_fence, DRM_FENCE_TYPE_EXE, GL_TRUE); + driFenceFinish(intel->last_swap_fence, DRM_FENCE_TYPE_EXE, TRUE); driFenceUnReference(intel->last_swap_fence); intel->last_swap_fence = NULL; } |