const int nbox = dPriv->numClipRects;
const drm_clip_rect_t *pbox = dPriv->pClipRects;
const int pitch = frontRegion->pitch;
+ const int srcpitch = backRegion->pitch;
const int cpp = frontRegion->cpp;
int BR13, CMD;
int i;
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
ASSERT(frontRegion);
ASSERT(backRegion);
- ASSERT(frontRegion->pitch == backRegion->pitch);
+// ASSERT(frontRegion->pitch == backRegion->pitch);
ASSERT(frontRegion->cpp == backRegion->cpp);
+ DBG("copy buffer, front pitch %d back pitch %d\n",
+ frontRegion->pitch, backRegion->pitch);
+
if (cpp == 2) {
BR13 = (pitch * cpp) | (0xCC << 16) | (1 << 24);
CMD = XY_SRC_COPY_BLT_CMD;
OUT_RELOC(frontRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_WRITE,
DRM_BO_MASK_MEM | DRM_BO_FLAG_WRITE, 0);
OUT_BATCH((pbox->y1 << 16) | pbox->x1);
- OUT_BATCH(BR13 & 0xffff);
+ OUT_BATCH((srcpitch * cpp) & 0xffff);
OUT_RELOC(backRegion->buffer, DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ,
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ, 0);
__DRIdrawablePrivate * driReadPriv)
{
+#if 0
+ if (driDrawPriv) {
+ fprintf(stderr, "x %d, y %d, width %d, height %d\n",
+ driDrawPriv->x, driDrawPriv->y, driDrawPriv->w, driDrawPriv->h);
+ }
+#endif
+
if (driContextPriv) {
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
+ /* 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;
/* XXX FBO temporary fix-ups! */
/* if the renderbuffers don't have regions, init them from the context */
}
_mesa_make_current(&intel->ctx, &intel_fb->Base, readFb);
+ intel->intelScreen->dummyctxptr = &intel->ctx;
/* The drawbuffer won't always be updated by _mesa_make_current:
*/
break;
default:
_mesa_problem(ctx,
- "Unexpected format in intel_alloc_renderbuffer_storage");
+ "Unexpected format (%x) in intel_alloc_renderbuffer_storage", internalFormat);
return GL_FALSE;
}
return irb;
}
+struct gl_renderbuffer *
+intel_new_renderbuffer_fb(GLcontext * ctx, GLuint intFormat)
+{
+ struct intel_renderbuffer *irb;
+
+ irb = CALLOC_STRUCT(intel_renderbuffer);
+ if (!irb) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "creating renderbuffer");
+ return NULL;
+ }
+
+ _mesa_init_renderbuffer(&irb->Base, 0);
+ irb->Base.ClassID = INTEL_RB_CLASS;
+ irb->Base.InternalFormat = intFormat;
+
+ /* intel-specific methods */
+ irb->Base.Delete = intel_delete_renderbuffer;
+ irb->Base.AllocStorage = intel_alloc_renderbuffer_storage;
+ irb->Base.GetPointer = intel_get_pointer;
+ /* span routines set in alloc_storage function */
+
+ return &irb->Base;
+}
/**
* Create a new renderbuffer object.
}
return region;
}
-
+
/* Create intel_region structs to describe the static front,back,depth
* buffers created by the xserver.
intelScreen->rotated.pitch /
intelScreen->cpp, intelScreen->height);
-
+#if 0
intelScreen->back_region =
intel_recreate_static(intelScreen,
intelScreen->back_region,
intelScreen->cpp,
intelScreen->depth.pitch / intelScreen->cpp,
intelScreen->height);
+#endif
}
/**
intelScreen->rotatedWidth = sarea->virtualX;
intelScreen->rotatedHeight = sarea->virtualY;
- if (0)
+ if (1)
intelPrintSAREA(sarea);
}
&intel_fb->color_rb[0]->Base);
}
+#if 0
if (mesaVis->doubleBufferMode) {
intel_fb->color_rb[1]
= intel_create_renderbuffer(rgbFormat,
_mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
}
}
-
if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
/* combined depth/stencil buffer */
struct intel_renderbuffer *depthStencilRb
_mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
}
+#else
+ 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;
+
+ intel_fb->color_rb[2]
+ = intel_new_renderbuffer_fb(NULL, rgbFormat);
+ _mesa_reference_renderbuffer(&tmp_rb, &intel_fb->color_rb[2]->Base);
+ }
+ }
+ if (mesaVis->depthBits == 24 && mesaVis->stencilBits == 8) {
+ /* combined depth/stencil buffer */
+ struct intel_renderbuffer *depthStencilRb
+ = intel_new_renderbuffer_fb(NULL, GL_DEPTH24_STENCIL8_EXT);
+ /* note: bind RB to two attachment points */
+ _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH,
+ &depthStencilRb->Base);
+ _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_STENCIL,
+ &depthStencilRb->Base);
+ }
+ else if (mesaVis->depthBits == 16) {
+ /* just 16-bit depth buffer, no hw stencil */
+ struct intel_renderbuffer *depthRb
+ = intel_new_renderbuffer_fb(NULL, GL_DEPTH_COMPONENT16);
+ _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base);
+ }
+
+#endif
+
/* now add any/all software-based renderbuffers we may need */
_mesa_add_soft_renderbuffers(&intel_fb->Base,
GL_FALSE, /* never sw color */
* context at screen creation. For now just use the current context.
*/
- GET_CURRENT_CONTEXT(ctx);
+/* GET_CURRENT_CONTEXT(ctx);
if (ctx == NULL) {
_mesa_problem(NULL, "No current context in intelScreenContext\n");
return NULL;
}
return intel_context(ctx);
+*/
+ if (intelScreen->dummyctxptr == NULL) {
+ _mesa_problem(NULL, "No current context in intelScreenContext\n");
+ return NULL;
+ }
+ return intelScreen->dummyctxptr;
+
}