From: Brian Date: Tue, 6 Nov 2007 17:05:01 +0000 (-0700) Subject: Remove last of core Mesa dependencies in intel_swapbuffers.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0800342296fb9eeb6bac8f24965441dff0e71812;p=mesa.git Remove last of core Mesa dependencies in intel_swapbuffers.c Use the "dummyContext" pointer (for now) instead of GET_CURRENT_CONTEXT(). --- diff --git a/src/mesa/drivers/dri/intel_winsys/intel_context.c b/src/mesa/drivers/dri/intel_winsys/intel_context.c index 85ccb1bc2a9..ed6448646a4 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 1d24ff7ff79..3bcbc229631 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 8e0f1113b82..9fcb2dac273 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; }