summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel/intel_buffers.c
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@jbarnes-t61.(none)>2008-07-22 09:39:23 -0700
committerJesse Barnes <jbarnes@virtuousgeek.org>2008-07-22 09:39:23 -0700
commit97988ccc46c0248177cd71937021ca8cc2a7452b (patch)
tree4b673054f0eeef27d65eb0371ab3444b4868cb4e /src/mesa/drivers/dri/intel/intel_buffers.c
parentb993d539a76e7f1446890a85e4b61deec4d4162d (diff)
intel: fix buffer swaps and enable page flipping on 965
Some buffer swap intel render buffer fields (pf_num_pages & vbl_pending) are also used for page flipping, so enable the code that sets & updates them on 965. This allows buffer swaps and page flips to work on 965 and prevents hangs in LOCK_HARDWARE in the buffer swap case due to an uninitialized vbl_pending field. Fixes FDO #16118.
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_buffers.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_buffers.c54
1 files changed, 15 insertions, 39 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 2a25f079e9..348c490af0 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -197,7 +197,6 @@ intelSetBackClipRects(struct intel_context *intel)
}
}
-#ifdef I915
static void
intelUpdatePageFlipping(struct intel_context *intel,
GLint areaA, GLint areaB)
@@ -267,7 +266,6 @@ intelUpdatePageFlipping(struct intel_context *intel,
intel_flip_renderbuffers(intel_fb);
intel_draw_buffer(&intel->ctx, intel->ctx.DrawBuffer);
}
-#endif /* I915 */
/**
* This will be called whenever the currently bound window is moved/resized.
@@ -318,9 +316,7 @@ intelWindowMoved(struct intel_context *intel)
GLint areaB = driIntersectArea( drw_rect, planeB_rect );
GLuint flags = dPriv->vblFlags;
-#ifdef I915
intelUpdatePageFlipping(intel, areaA, areaB);
-#endif
/* Update vblank info
*/
@@ -645,7 +641,6 @@ intel_wait_flips(struct intel_context *intel)
static GLboolean
intelPageFlip(const __DRIdrawablePrivate * dPriv)
{
-#ifdef I915
struct intel_context *intel;
int ret;
struct intel_framebuffer *intel_fb = dPriv->driverPrivate;
@@ -698,40 +693,8 @@ intelPageFlip(const __DRIdrawablePrivate * dPriv)
intel_draw_buffer(&intel->ctx, &intel_fb->Base);
return GL_TRUE;
-#else
- return GL_FALSE;
-#endif
}
-#if 0
-void
-intelSwapBuffers(__DRIdrawablePrivate * dPriv)
-{
- if (dPriv->driverPrivate) {
- const struct gl_framebuffer *fb
- = (struct gl_framebuffer *) dPriv->driverPrivate;
- if (fb->Visual.doubleBufferMode) {
- GET_CURRENT_CONTEXT(ctx);
- if (ctx && ctx->DrawBuffer == fb) {
- _mesa_notifySwapBuffers(ctx); /* flush pending rendering */
- }
- if (intel->doPageFlip) {
- intelPageFlip(dPriv);
- }
- else {
- intelCopyBuffer(dPriv);
- }
- }
- }
- else {
- _mesa_problem(NULL,
- "dPriv has no gl_framebuffer pointer in intelSwapBuffers");
- }
-}
-#else
-/* Trunk version:
- */
-
static GLboolean
intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
{
@@ -746,8 +709,10 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
if (!dPriv->vblFlags ||
(dPriv->vblFlags & VBLANK_FLAG_NO_IRQ) ||
- intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6))
+ intelScreen->drmMinor < (intel_fb->pf_active ? 9 : 6)) {
+ printf("swap schedule failed: bad flags or drm minor\n");
return GL_FALSE;
+ }
interval = driGetVBlankInterval(dPriv);
@@ -756,6 +721,7 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
if (dPriv->vblFlags & VBLANK_FLAG_SYNC) {
swap.seqtype |= DRM_VBLANK_NEXTONMISS;
} else if (interval == 0) {
+ printf("swap schedule failed: bad interval\n");
return GL_FALSE;
}
@@ -803,6 +769,7 @@ intelScheduleSwap(__DRIdrawablePrivate * dPriv, GLboolean *missed_target)
}
ret = GL_FALSE;
+ printf("swap schedule failed: vblank swap failed\n");
}
UNLOCK_HARDWARE(intel);
@@ -832,8 +799,18 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
_mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */
if (!intelScheduleSwap(dPriv, &missed_target)) {
+ printf("schedule swap failed, trying to wait manually\n");
driWaitForVBlank(dPriv, &missed_target);
+ /*
+ * Update each buffer's vbl_pending so we don't get too out of
+ * sync
+ */
+ intel_get_renderbuffer(&intel_fb->Base,
+ BUFFER_BACK_LEFT)->vbl_pending =
+ intel_get_renderbuffer(&intel_fb->Base,
+ BUFFER_FRONT_LEFT)->vbl_pending =
+ dPriv->vblSeq;
if (!intelPageFlip(dPriv)) {
intelCopyBuffer(dPriv, NULL);
}
@@ -854,7 +831,6 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv)
fprintf(stderr, "%s: drawable has no context!\n", __FUNCTION__);
}
}
-#endif
void
intelCopySubBuffer(__DRIdrawablePrivate * dPriv, int x, int y, int w, int h)