intel->first_swap_fence = NULL;
}
+ if (intel->intelScreen->dummyContext == intel)
+ intel->intelScreen->dummyContext = NULL;
+
st_destroy_context(intel->st);
free(intel);
}
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);
#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"
#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.
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;
}