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.)
* 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 |
}
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 |
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;
// 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) {
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;
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++) {
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 ||
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 */
* 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);
}
}
* 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);
+ }
}
}
intelglFlush(GLcontext * ctx)
{
intelFlush(ctx);
- intelCheckFrontRotate(ctx);
+ intelCheckFrontUpdate(ctx);
}
void
driFenceUnReference(intel->batch->last_fence);
intel->batch->last_fence = NULL;
}
- intelCheckFrontRotate(ctx);
+ intelCheckFrontUpdate(ctx);
}
/* 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;*/
}
}
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,
_mesa_initialize_framebuffer(&intel_fb->Base, mesaVis);
+#if 0
/* setup the hardware-based renderbuffers */
{
intel_fb->color_rb[0]
&intel_fb->color_rb[0]->Base);
}
-#if 0
if (mesaVis->doubleBufferMode) {
intel_fb->color_rb[1]
= intel_create_renderbuffer(rgbFormat,
}
#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;
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];