summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/i915/intel_context.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@temari.boston.redhat.com>2008-01-21 17:07:33 -0500
committerKristian Høgsberg <krh@redhat.com>2008-02-14 17:56:44 -0500
commitc5c73c1b605611faf0f06df9b5d08d8984388238 (patch)
tree580b84294476f8ee99e52804e526dc3aa8b250c8 /src/mesa/drivers/dri/i915/intel_context.c
parent7da5705b090d9c97a9b765d786c5e89afe9d1f25 (diff)
Hook up i915 driver to new DRI2 infrastructure.
Diffstat (limited to 'src/mesa/drivers/dri/i915/intel_context.c')
-rw-r--r--src/mesa/drivers/dri/i915/intel_context.c75
1 files changed, 43 insertions, 32 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c
index b2d9c9c591..3b6a1d5ef9 100644
--- a/src/mesa/drivers/dri/i915/intel_context.c
+++ b/src/mesa/drivers/dri/i915/intel_context.c
@@ -417,7 +417,7 @@ intelInitContext(struct intel_context *intel,
/* Dri stuff */
intel->hHWContext = driContextPriv->hHWContext;
intel->driFd = sPriv->fd;
- intel->driHwLock = (drmLock *) & sPriv->pSAREA->lock;
+ intel->driHwLock = sPriv->lock;
intel->width = intelScreen->width;
intel->height = intelScreen->height;
@@ -523,7 +523,8 @@ intelInitContext(struct intel_context *intel,
if (intel->ttm)
driInitExtensions(ctx, ttm_extensions, GL_FALSE);
- intel_recreate_static_regions(intel);
+ if (!sPriv->dri2.enabled)
+ intel_recreate_static_regions(intel);
intel->batch = intel_batchbuffer_alloc(intel);
intel->last_swap_fence = NULL;
@@ -633,7 +634,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
/* XXX FBO temporary fix-ups! */
/* if the renderbuffers don't have regions, init them from the context */
- {
+ if (!driContextPriv->driScreenPriv->dri2.enabled) {
struct intel_renderbuffer *irbDepth
= intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH);
struct intel_renderbuffer *irbStencil
@@ -709,6 +710,7 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
__DRIdrawablePrivate *dPriv = intel->driDrawable;
__DRIscreenPrivate *sPriv = intel->driScreen;
drmI830Sarea *sarea = intel->sarea;
+ int drawable_changed = 0;
drmGetLock(intel->driFd, intel->hHWContext, flags);
@@ -720,8 +722,12 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
* NOTE: This releases and regains the hw lock, so all state
* checking must be done *after* this call:
*/
- if (dPriv)
- DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
+ if (dPriv) {
+ if (sPriv->dri2.enabled)
+ drawable_changed = __driParseEvents(sPriv, dPriv);
+ else
+ DRI_VALIDATE_DRAWABLE_INFO(sPriv, dPriv);
+ }
/* If the last consumer of the texture memory wasn't us, notify the fake
* bufmgr and record the new owner. We should have the memory shared
@@ -735,42 +741,47 @@ intelContendedLock(struct intel_context *intel, GLuint flags)
intel_decode_context_reset();
}
- if (sarea->width != intel->width ||
- sarea->height != intel->height) {
- int numClipRects = intel->numClipRects;
+ if (!sPriv->dri2.enabled) {
+ if (sarea->width != intel->width ||
+ sarea->height != intel->height) {
+ int numClipRects = intel->numClipRects;
- /*
- * FIXME: Really only need to do this when drawing to a
- * common back- or front buffer.
- */
+ /*
+ * FIXME: Really only need to do this when drawing to a
+ * common back- or front buffer.
+ */
- /*
- * This will essentially drop the outstanding batchbuffer on the floor.
- */
- intel->numClipRects = 0;
+ /*
+ * This will essentially drop the outstanding batchbuffer on the floor.
+ */
+ intel->numClipRects = 0;
- if (intel->Fallback)
- _swrast_flush(&intel->ctx);
+ if (intel->Fallback)
+ _swrast_flush(&intel->ctx);
- INTEL_FIREVERTICES(intel);
+ INTEL_FIREVERTICES(intel);
- if (intel->batch->map != intel->batch->ptr)
- intel_batchbuffer_flush(intel->batch);
+ if (intel->batch->map != intel->batch->ptr)
+ intel_batchbuffer_flush(intel->batch);
- intel->numClipRects = numClipRects;
+ intel->numClipRects = numClipRects;
- /* force window update */
- intel->lastStamp = 0;
+ /* force window update */
+ intel->lastStamp = 0;
- intel->width = sarea->width;
- intel->height = sarea->height;
- }
+ intel->width = sarea->width;
+ intel->height = sarea->height;
+ }
- /* Drawable changed?
- */
- if (dPriv && intel->lastStamp != dPriv->lastStamp) {
- intelWindowMoved(intel);
- intel->lastStamp = dPriv->lastStamp;
+ /* Drawable changed?
+ */
+ if (dPriv && intel->lastStamp != dPriv->lastStamp) {
+ intelWindowMoved(intel);
+ intel->lastStamp = dPriv->lastStamp;
+ }
+ } else if (drawable_changed) {
+ intelWindowMoved(intel);
+ intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer);
}
}