diff options
author | Roland Scheidegger <[email protected]> | 2007-07-11 14:20:39 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2007-07-11 14:20:39 +0200 |
commit | 43e24ff50773575d28763d899a4f25bb430418b5 (patch) | |
tree | a2b082dc9302d2d39589100c9134b3b4cb73e1d9 /src | |
parent | 1278514ff48b262ee0a4f2ac698c6df648b326a0 (diff) |
some fixes, fake frontbuffer
still doesn't work quite right (resize).
Fake frontbuffer doesn't copy in real frontbuffer.
Don't even think about doing rotation/page flip/triple buffering for now...
More cleanups needed (fake cliprects etc.)
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i915tex/i915_vtbl.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_blit.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_buffers.c | 23 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_context.c | 18 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_screen.c | 14 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i915tex/intel_state.c | 24 |
6 files changed, 59 insertions, 40 deletions
diff --git a/src/mesa/drivers/dri/i915tex/i915_vtbl.c b/src/mesa/drivers/dri/i915tex/i915_vtbl.c index f80e8d6327f..51aff688402 100644 --- a/src/mesa/drivers/dri/i915tex/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915tex/i915_vtbl.c @@ -463,6 +463,7 @@ i915_state_draw_region(struct intel_context *intel, * Set stride/cpp values */ if (color_region) { +// fprintf(stderr, "color pitch %d\n", color_region->pitch); state->Buffer[I915_DESTREG_CBUFADDR0] = _3DSTATE_BUF_INFO_CMD; state->Buffer[I915_DESTREG_CBUFADDR1] = (BUF_3D_ID_COLOR_BACK | @@ -471,6 +472,7 @@ i915_state_draw_region(struct intel_context *intel, } if (depth_region) { +// fprintf(stderr, "depth pitch %d\n", depth_region->pitch); state->Buffer[I915_DESTREG_DBUFADDR0] = _3DSTATE_BUF_INFO_CMD; state->Buffer[I915_DESTREG_DBUFADDR1] = (BUF_3D_ID_DEPTH | diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c index b4fc1691e6b..d6651f62be1 100644 --- a/src/mesa/drivers/dri/i915tex/intel_blit.c +++ b/src/mesa/drivers/dri/i915tex/intel_blit.c @@ -82,9 +82,11 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, if (dPriv && dPriv->numClipRects) { struct intel_framebuffer *intel_fb = dPriv->driverPrivate; const struct intel_region *frontRegion - = intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT); + = intelScreen->front_region; const struct intel_region *backRegion - = intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT); + = intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT ? + intel_get_rb_region(&intel_fb->Base, BUFFER_FRONT_LEFT) : + intel_get_rb_region(&intel_fb->Base, BUFFER_BACK_LEFT); const int nbox = dPriv->numClipRects; const drm_clip_rect_t *pbox = dPriv->pClipRects; const int pitch = frontRegion->pitch; @@ -100,7 +102,7 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, // ASSERT(frontRegion->pitch == backRegion->pitch); ASSERT(frontRegion->cpp == backRegion->cpp); - DBG("copy buffer, front pitch %d back pitch %d\n", + DBG("front pitch %d back pitch %d\n", frontRegion->pitch, backRegion->pitch); if (cpp == 2) { @@ -138,6 +140,11 @@ intelCopyBuffer(const __DRIdrawablePrivate * dPriv, continue; } + DBG("box x1 x2 y1 y2 %d %d %d %d\n", + box.x1, box.x2, box.y1, box.y2); + + /* XXX should make sure only the minimum area based on + old draw buffer and new front clip rects is copied */ sbox.x1 = box.x1 - dPriv->x; sbox.y1 = box.y1 - dPriv->y; @@ -417,9 +424,8 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask) b = *box; } - if (0) - _mesa_printf("clear %d,%d..%d,%d, mask %x\n", - b.x1, b.y1, b.x2, b.y2, mask); + DBG("clear %d,%d..%d,%d, mask %x\n", + b.x1, b.y1, b.x2, b.y2, mask); /* Loop over all renderbuffers */ for (buf = 0; buf < BUFFER_COUNT && clearMask; buf++) { diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c index e8dd7cd5240..fbaa4ee4f31 100644 --- a/src/mesa/drivers/dri/i915tex/intel_buffers.c +++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c @@ -930,7 +930,7 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) GLboolean missed_target; struct intel_framebuffer *intel_fb = dPriv->driverPrivate; int64_t ust; - + _mesa_notifySwapBuffers(ctx); /* flush pending rendering comands */ if (screen->current_rotation != 0 || @@ -956,6 +956,16 @@ intelSwapBuffers(__DRIdrawablePrivate * dPriv) intel_fb->swap_ust = ust; } + if (dPriv && intel->lastStamp != dPriv->lastStamp) { + /* XXX this doesn't appear to work quite right. + And in any case, it will never get called with single buffered + rendering here... + And if it's only a window move (not resize), don't need to do anything. */ + if (INTEL_DEBUG & DEBUG_LOCK) + _mesa_printf("doing defered drawable update\n"); + intelWindowMoved(intel); + intel->lastStamp = dPriv->lastStamp; + } } else { /* XXX this shouldn't be an error but we can't handle it for now */ @@ -1068,21 +1078,12 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) * And set up cliprects. */ if (fb->Name == 0) { + intelSetPrivbufClipRects(intel); /* drawing to window system buffer */ if (front) { -#if 0 - intelSetFrontClipRects(intel); -#else - intelSetPrivbufClipRects(intel); -#endif colorRegion = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); } else { -#if 0 - intelSetBackClipRects(intel); -#else - intelSetPrivbufClipRects(intel); -#endif colorRegion = intel_get_rb_region(fb, BUFFER_BACK_LEFT); } } diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c index 028e57e5ab6..76426e3c882 100644 --- a/src/mesa/drivers/dri/i915tex/intel_context.c +++ b/src/mesa/drivers/dri/i915tex/intel_context.c @@ -282,18 +282,22 @@ intelFlush(GLcontext * ctx) * Check if we need to rotate/warp the front color buffer to the * rotated screen. We generally need to do this when we get a glFlush * or glFinish after drawing to the front color buffer. + * If no rotation, just copy the private fake front buffer to the real one. */ static void -intelCheckFrontRotate(GLcontext * ctx) +intelCheckFrontUpdate(GLcontext * ctx) { struct intel_context *intel = intel_context(ctx); if (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT) { intelScreenPrivate *screen = intel->intelScreen; + __DRIdrawablePrivate *dPriv = intel->driDrawable; if (screen->current_rotation != 0) { - __DRIdrawablePrivate *dPriv = intel->driDrawable; intelRotateWindow(intel, dPriv, BUFFER_BIT_FRONT_LEFT); } + else { + intelCopyBuffer(dPriv, NULL); + } } } @@ -305,7 +309,7 @@ static void intelglFlush(GLcontext * ctx) { intelFlush(ctx); - intelCheckFrontRotate(ctx); + intelCheckFrontUpdate(ctx); } void @@ -319,7 +323,7 @@ intelFinish(GLcontext * ctx) driFenceUnReference(intel->batch->last_fence); intel->batch->last_fence = NULL; } - intelCheckFrontRotate(ctx); + intelCheckFrontUpdate(ctx); } @@ -724,8 +728,10 @@ intelContendedLock(struct intel_context *intel, GLuint flags) /* Drawable changed? */ if (dPriv && intel->lastStamp != dPriv->lastStamp) { - intelWindowMoved(intel); - intel->lastStamp = dPriv->lastStamp; + if (INTEL_DEBUG & DEBUG_LOCK) + _mesa_printf("drawable change detected but defering update\n"); +/* intelWindowMoved(intel); + intel->lastStamp = dPriv->lastStamp;*/ } } diff --git a/src/mesa/drivers/dri/i915tex/intel_screen.c b/src/mesa/drivers/dri/i915tex/intel_screen.c index a5a9c796254..82b65ea8420 100644 --- a/src/mesa/drivers/dri/i915tex/intel_screen.c +++ b/src/mesa/drivers/dri/i915tex/intel_screen.c @@ -172,6 +172,7 @@ intel_recreate_static(intelScreenPrivate *intelScreen, static void intel_recreate_static_regions(intelScreenPrivate *intelScreen) { +/* this is the real front buffer which is only used for blitting to */ intelScreen->front_region = intel_recreate_static(intelScreen, intelScreen->front_region, @@ -601,6 +602,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, _mesa_initialize_framebuffer(&intel_fb->Base, mesaVis); +#if 0 /* setup the hardware-based renderbuffers */ { intel_fb->color_rb[0] @@ -615,7 +617,6 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, &intel_fb->color_rb[0]->Base); } -#if 0 if (mesaVis->doubleBufferMode) { intel_fb->color_rb[1] = intel_create_renderbuffer(rgbFormat, @@ -672,11 +673,22 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, } #else + { + /* fake frontbuffer */ + /* XXX allocation should only happen in the unusual case + it's actually needed */ + intel_fb->color_rb[0] + = intel_new_renderbuffer_fb(NULL, rgbFormat); + _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_FRONT_LEFT, + &intel_fb->color_rb[0]->Base); + } + if (mesaVis->doubleBufferMode) { intel_fb->color_rb[1] = intel_new_renderbuffer_fb(NULL, rgbFormat); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_BACK_LEFT, &intel_fb->color_rb[1]->Base); + if (screen->third.handle) { struct gl_renderbuffer *tmp_rb = NULL; diff --git a/src/mesa/drivers/dri/i915tex/intel_state.c b/src/mesa/drivers/dri/i915tex/intel_state.c index 271511037e9..b2773990e4b 100644 --- a/src/mesa/drivers/dri/i915tex/intel_state.c +++ b/src/mesa/drivers/dri/i915tex/intel_state.c @@ -205,25 +205,17 @@ intelCalcViewport(GLcontext * ctx) GLfloat *m = intel->ViewportMatrix.m; GLfloat yScale, yBias; - if (ctx->DrawBuffer->Name) { - /* User created FBO */ - struct intel_renderbuffer *irb + struct intel_renderbuffer *irb = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[0][0]); - if (irb && !irb->RenderToTexture) { - /* y=0=top */ - yScale = -1.0; - yBias = irb->Base.Height; - } - else { - /* y=0=bottom */ - yScale = 1.0; - yBias = 0.0; - } + if (irb && !irb->RenderToTexture) { + /* y=0=top */ + yScale = -1.0; + yBias = irb->Base.Height; } else { - /* window buffer, y=0=top */ - yScale = -1.0; - yBias = (intel->driDrawable) ? intel->driDrawable->h : 0.0F; + /* y=0=bottom */ + yScale = 1.0; + yBias = 0.0; } m[MAT_SX] = v[MAT_SX]; |