Remove last of core Mesa dependencies in intel_swapbuffers.c

Use the "dummyContext" pointer (for now) instead of GET_CURRENT_CONTEXT().
This commit is contained in:
Brian 2007-11-06 10:05:01 -07:00
parent e2feb80a90
commit 0800342296
3 changed files with 17 additions and 44 deletions

View file

@ -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);

View file

@ -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;
};

View file

@ -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;
}