driDrawable information now isn't used in most parts of the driver.
makecurrent only updates fb information when the context is new
(driDrawable is still updated by the dri common code).
const struct intel_region *frontRegion
= intelScreen->front_region;
const struct intel_region *backRegion
- = intel->ctx.DrawBuffer->_ColorDrawBufferMask[0] == BUFFER_BIT_FRONT_LEFT ?
+ = intel_fb->Base._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 backWidth = intel_fb->Base.Width;
ASSERT(intel_fb->Base.Name == 0); /* Not a user-created FBO */
ASSERT(frontRegion);
ASSERT(backRegion);
-// ASSERT(frontRegion->pitch == backRegion->pitch);
ASSERT(frontRegion->cpp == backRegion->cpp);
DBG("front pitch %d back pitch %d\n",
LOCK_HARDWARE(intel);
if (intel->numClipRects) {
+ assert(intel->numClipRects == 1);
GLint cx, cy, cw, ch;
drm_clip_rect_t clear;
int i;
if (fb->Name == 0) {
/* clearing a window */
-
/* flip top to bottom */
- clear.x1 = cx + intel->drawX;
- clear.y1 = intel->driDrawable->y + intel->driDrawable->h - cy - ch;
+ clear.x1 = cx;
+ clear.y1 = intel->pClipRects->y2 - cy - ch;
clear.x2 = clear.x1 + cw;
clear.y2 = clear.y1 + ch;
}
* Update the following fields for rendering to a user-created FBO:
* intel->numClipRects
* intel->pClipRects
- * intel->drawX
- * intel->drawY
*/
static void
intelSetRenderbufferClipRects(struct intel_context *intel)
intel->fboRect.y2 = intel->ctx.DrawBuffer->Height;
intel->numClipRects = 1;
intel->pClipRects = &intel->fboRect;
- intel->drawX = 0;
- intel->drawY = 0;
}
/**
static void
intelSetPrivbufClipRects(struct intel_context *intel)
{
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- if (!dPriv)
+ if (!intel->ctx.DrawBuffer) {
+ fprintf(stderr, "%s: DrawBuffer not set!\n", __FUNCTION__);
return;
+ }
intel->fakeClipRect.x1 = 0;
intel->fakeClipRect.y1 = 0;
- intel->fakeClipRect.x2 = dPriv->w;
- intel->fakeClipRect.y2 = dPriv->h;
+ intel->fakeClipRect.x2 = intel->ctx.DrawBuffer->Width;
+ intel->fakeClipRect.y2 = intel->ctx.DrawBuffer->Height;
intel->numClipRects = 1;
intel->pClipRects = &intel->fakeClipRect;
- intel->drawX = 0;
- intel->drawY = 0;
}
int i;
GLenum format, type;
- int xOrig, yOrig;
int origNumClipRects;
drm_clip_rect_t *origRects;
/* save current drawing origin and cliprects (restored at end) */
- xOrig = intel->drawX;
- yOrig = intel->drawY;
origNumClipRects = intel->numClipRects;
origRects = intel->pClipRects;
fullRect.y1 = 0;
fullRect.x2 = screen->rotatedWidth;
fullRect.y2 = screen->rotatedHeight;
- intel->drawX = 0;
- intel->drawY = 0;
intel->numClipRects = 1;
intel->pClipRects = &fullRect;
intel_batchbuffer_flush(intel->batch);
/* restore original drawing origin and cliprects */
- intel->drawX = xOrig;
- intel->drawY = yOrig;
intel->numClipRects = origNumClipRects;
intel->pClipRects = origRects;
if (!havePools)
return GL_FALSE;
-
+
if (!_mesa_initialize_context(&intel->ctx,
mesaVis, shareCtx,
functions, (void *) intel))
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv)
{
+ GLuint updatebufsize = GL_FALSE;
#if 0
if (driDrawPriv) {
}
}
- /* set GLframebuffer size to match window, if needed */
- driUpdateFramebufferSize(&intel->ctx, driDrawPriv);
+ /* only update GLframebuffer size to match window
+ if here for the first time */
+ if (intel->ctx.FirstTimeCurrent) {
+ updatebufsize = GL_TRUE;
+ driUpdateFramebufferSize(&intel->ctx, driDrawPriv);
- if (driReadPriv != driDrawPriv) {
- driUpdateFramebufferSize(&intel->ctx, driReadPriv);
+ if (driReadPriv != driDrawPriv) {
+ driUpdateFramebufferSize(&intel->ctx, driReadPriv);
+ }
}
_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:
*/
- if (intel->ctx.DrawBuffer == &intel_fb->Base) {
+ if (updatebufsize && intel->ctx.DrawBuffer == &intel_fb->Base) {
if (intel->driDrawable != driDrawPriv) {
intel_fb->vblank_flags = (intel->intelScreen->irq_active != 0)
/* These refer to the current drawing buffer:
*/
- int drawX, drawY; /**< origin of drawing area within region */
GLuint numClipRects; /**< cliprects for drawing */
drm_clip_rect_t *pClipRects;
drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */
ASSERT(irb);
+ DBG("freeing renderbuffer\n");
+
if (irb->PairedStencil || irb->PairedDepth) {
intel_unpair_depth_stencil(ctx, irb);
}
batch.cliprects = intel->pClipRects;
batch.num_cliprects = ignore_cliprects ? 0 : intel->numClipRects;
batch.DR1 = 0;
- batch.DR4 = ((((GLuint) intel->drawX) & 0xffff) |
- (((GLuint) intel->drawY) << 16));
+ batch.DR4 = 0; /* still need this ? */
DBG("%s: 0x%x..0x%x DR4: %x cliprects: %d\n",
__FUNCTION__,
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
+ if (intel->numClipRects) {
+ assert(intel->numClipRects == 1);
+ drm_clip_rect_t *box = intel->pClipRects;
drm_clip_rect_t dest_rect;
- GLint nbox = dPriv->numClipRects;
+ GLint nbox = intel->numClipRects;
GLint srcx = 0, srcy = 0;
GLint orig_screen_x1, orig_screen_y2;
GLuint i;
- orig_screen_x1 = dPriv->x + dstx;
- orig_screen_y2 = dPriv->y + (dPriv->h - dsty);
+ orig_screen_x1 = dstx;
+ orig_screen_y2 = box->y2 - dsty;
/* Do scissoring in GL coordinates:
*/
/* Convert from GL to hardware coordinates:
*/
- dsty = dPriv->y + (dPriv->h - dsty - height);
- dstx = dPriv->x + dstx;
+ dsty = box->y2 - dsty - height;
+ dstx = dstx;
dest_rect.x1 = dstx;
dest_rect.y1 = dsty;
drm_clip_rect_t rect;
int box_w, box_h;
GLint px, py;
- GLuint stipple[32];
+ GLuint stipple[32];
if (!intel_intersect_cliprects(&rect, &dest_rect, &box[i]))
continue;
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
-
-
- srcy = dPriv->h - srcy - height; /* convert from gl to hardware coords */
-
- srcx += dPriv->x;
- srcy += dPriv->y;
+ if (intel->numClipRects) {
+ int bufHeight = intel->pClipRects->y2;
+ assert (intel->numClipRects == 1);
+ srcy = bufHeight - srcy - height; /* convert from gl to hardware coords */
/* Clip against the source region. This is the only source
* clipping we do. XXX: Just set the texcord wrap mode to clamp
intel_meta_draw_quad(intel,
dstx,
dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (dsty + height * ctx->Pixel.ZoomY),
- dPriv->h - (dsty), 0, /* XXX: what z value? */
+ bufHeight - (dsty + height * ctx->Pixel.ZoomY),
+ bufHeight - (dsty), 0, /* XXX: what z value? */
0x00ff00ff,
srcx, srcx + width, srcy, srcy + height);
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- drm_clip_rect_t *box = dPriv->pClipRects;
+ if (intel->numClipRects) {
+ assert(intel->numClipRects == 1);
+ drm_clip_rect_t *box = intel->pClipRects;
drm_clip_rect_t dest_rect;
- GLint nbox = dPriv->numClipRects;
+ GLint nbox = intel->numClipRects;
GLint delta_x = 0;
GLint delta_y = 0;
GLuint i;
}
/* Convert from GL to hardware coordinates:
+ * cliprect should be size of buffer
*/
- dsty = dPriv->h - dsty - height;
- srcy = dPriv->h - srcy - height;
- dstx += dPriv->x;
- dsty += dPriv->y;
- srcx += dPriv->x;
- srcy += dPriv->y;
+ dsty = box->y2 - dsty - height;
+ srcy = box->y2 - srcy - height;
/* Clip against the source region. This is the only source
* clipping we do. Dst is clipped with cliprects below.
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
+ if (intel->numClipRects) {
+ assert(intel->numClipRects == 1);
+ int bufHeight = intel->pClipRects->y2;
+
GLint srcx, srcy;
GLint dstx, dsty;
dstx = x;
- dsty = dPriv->h - (y + height);
+ dsty = bufHeight - (y + height);
srcx = 0; /* skiprows/pixels already done */
srcy = 0;
*/
intel_meta_draw_quad(intel,
dstx, dstx + width * ctx->Pixel.ZoomX,
- dPriv->h - (y + height * ctx->Pixel.ZoomY),
- dPriv->h - (y),
+ bufHeight - (y + height * ctx->Pixel.ZoomY),
+ bufHeight - (y),
-ctx->Current.RasterPos[2] * .5,
0x00ff00ff,
srcx, srcx + width, srcy + height, srcy);
src_offset = (GLuint) _mesa_image_address(2, unpack, pixels, width, height,
format, type, 0, 0, 0);
+ /* don't need a lock as cliprects shouldn't change */
intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
+ if (intel->numClipRects) {
+ assert(intel->numClipRects == 1);
+ int nbox = intel->numClipRects;
+ drm_clip_rect_t *box = intel->pClipRects;
drm_clip_rect_t rect;
drm_clip_rect_t dest_rect;
struct _DriBufferObject *src_buffer =
intel_bufferobj_buffer(intel, src, INTEL_READ);
int i;
- dest_rect.x1 = dPriv->x + x;
- dest_rect.y1 = dPriv->y + dPriv->h - (y + height);
+ dest_rect.x1 = x;
+ dest_rect.y1 = box->y2 - (y + height);
dest_rect.x2 = dest_rect.x1 + width;
dest_rect.y2 = dest_rect.y1 + height;
fence = intel_batchbuffer_flush(intel->batch);
driFenceReference(fence);
}
- UNLOCK_HARDWARE(intel);
if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW, GL_FALSE);
struct intel_context *intel = intel_context(ctx);
intelScreenPrivate *screen = intel->intelScreen;
GLint pitch = pack->RowLength ? pack->RowLength : width;
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
int textureFormat;
GLenum glTextureFormat;
int destFormat, depthFormat, destPitch;
LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
+ if (intel->numClipRects) {
intel->vtbl.install_meta_state(intel);
intel->vtbl.meta_no_depth_write(intel);
intel->vtbl.meta_no_stencil_write(intel);
return GL_TRUE;
}
- y = dPriv->h - y - height;
- x += dPriv->x;
- y += dPriv->y;
+ y = intel->pClipRects->y2 - y - height;
/* Set the frontbuffer up as a large rectangular texture.
dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height,
format, type, 0, 0, 0);
-
- /* Although the blits go on the command buffer, need to do this and
- * fire with lock held to guarentee cliprects are correct.
- */
+ /* reading from priv buffer, cliprects should not change */
intelFlush(&intel->ctx);
- LOCK_HARDWARE(intel);
- if (intel->driDrawable->numClipRects) {
+ if (intel->numClipRects) {
+ assert (intel->numClipRects == 1);
GLboolean all = (width * height * src->cpp == dst->Base.Size &&
x == 0 && dst_offset == 0);
struct _DriBufferObject *dst_buffer =
intel_bufferobj_buffer(intel, dst, all ? INTEL_WRITE_FULL :
INTEL_WRITE_PART);
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- int nbox = dPriv->numClipRects;
- drm_clip_rect_t *box = dPriv->pClipRects;
+ int nbox = intel->numClipRects;
+ drm_clip_rect_t *box = intel->pClipRects;
drm_clip_rect_t rect;
drm_clip_rect_t src_rect;
int i;
- src_rect.x1 = dPriv->x + x;
- src_rect.y1 = dPriv->y + dPriv->h - (y + height);
+ src_rect.x1 = x;
+ src_rect.y1 = box->y2 - (y + height);
src_rect.x2 = src_rect.x1 + width;
src_rect.y2 = src_rect.y1 + height;
driFenceReference(fence);
}
- UNLOCK_HARDWARE(intel);
if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
struct intel_renderbuffer *irb = intel_renderbuffer(rb); \
const GLint yScale = irb->RenderToTexture ? 1 : -1; \
const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
- GLubyte *buf = (GLubyte *) irb->pfMap \
- + (intel->drawY * irb->pfPitch + intel->drawX) * irb->region->cpp;\
+ GLubyte *buf = (GLubyte *) irb->pfMap; \
GLuint p; \
assert(irb->pfMap);\
(void) p;
do { \
int _nc = intel->numClipRects; \
while ( _nc-- ) { \
- int minx = intel->pClipRects[_nc].x1 - intel->drawX; \
- int miny = intel->pClipRects[_nc].y1 - intel->drawY; \
- int maxx = intel->pClipRects[_nc].x2 - intel->drawX; \
- int maxy = intel->pClipRects[_nc].y2 - intel->drawY;
+ int minx = intel->pClipRects[_nc].x1; \
+ int miny = intel->pClipRects[_nc].y1; \
+ int maxx = intel->pClipRects[_nc].x2; \
+ int maxy = intel->pClipRects[_nc].y2;
const GLuint pitch = irb->pfPitch/***XXX region->pitch*/; /* in pixels */ \
const GLint yScale = irb->RenderToTexture ? 1 : -1; \
const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
- char *buf = (char *) irb->pfMap/*XXX use region->map*/ + \
- (intel->drawY * pitch + intel->drawX) * irb->region->cpp;
-
+ char *buf = (char *) irb->pfMap/*XXX use region->map*/ ;
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
}
intelFlush(ctx);
+ /* XXX still need the lock ? */
LOCK_HARDWARE(intel);
{
GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
dstx += x - orig_x;
dsty += y - orig_y;
- if (ctx->ReadBuffer->Name == 0) {
- /* reading from a window, adjust x, y */
- __DRIdrawablePrivate *dPriv = intel->driDrawable;
- GLuint window_y;
- /* window_y = position of window on screen if y=0=bottom */
- window_y = intel->intelScreen->height - (dPriv->y + dPriv->h);
- y = window_y + y;
- x += dPriv->x;
- }
- else {
- /* reading from a FBO */
- /* invert Y */
- y = ctx->ReadBuffer->Height - y - 1;
- }
+ /* invert Y */
+ y = ctx->ReadBuffer->Height - y - 1;
/* A bit of fiddling to get the blitter to work with -ve