summaryrefslogtreecommitdiff
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorRoland Scheidegger <sroland@tungstengraphics.com>2007-07-12 21:52:02 +0200
committerRoland Scheidegger <sroland@tungstengraphics.com>2007-07-12 21:52:02 +0200
commit8b6517abfc20dc508c2a4cb1f6f22f34a8a70805 (patch)
treef45b11f5e0c06f25a5a49bc8b98ed736085805b4 /src/mesa/drivers
parent9870f7bccc55f9b1728fa8b9ed78a72ab15d7f4f (diff)
don't use driDrawable information directly, don't resize at makecurrent
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).
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_blit.c9
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_buffers.c22
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.c18
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_context.h1
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_fbo.c2
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_ioctl.c3
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c18
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_copy.c33
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_draw.c27
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_pixel_read.c26
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_span.c15
-rw-r--r--src/mesa/drivers/dri/i915tex/intel_tex_copy.c17
12 files changed, 77 insertions, 114 deletions
diff --git a/src/mesa/drivers/dri/i915tex/intel_blit.c b/src/mesa/drivers/dri/i915tex/intel_blit.c
index 3e42d79980..2a0a639315 100644
--- a/src/mesa/drivers/dri/i915tex/intel_blit.c
+++ b/src/mesa/drivers/dri/i915tex/intel_blit.c
@@ -91,7 +91,7 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
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;
@@ -108,7 +108,6 @@ intelCopyBuffer(__DRIdrawablePrivate * dPriv,
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",
@@ -405,6 +404,7 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask)
LOCK_HARDWARE(intel);
if (intel->numClipRects) {
+ assert(intel->numClipRects == 1);
GLint cx, cy, cw, ch;
drm_clip_rect_t clear;
int i;
@@ -417,10 +417,9 @@ intelClearWithBlit(GLcontext * ctx, GLbitfield mask)
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;
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_buffers.c b/src/mesa/drivers/dri/i915tex/intel_buffers.c
index 20e9521105..59b291a709 100644
--- a/src/mesa/drivers/dri/i915tex/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915tex/intel_buffers.c
@@ -128,8 +128,6 @@ intel_readbuf_region(struct intel_context *intel)
* 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)
@@ -142,8 +140,6 @@ 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;
}
/**
@@ -154,18 +150,17 @@ intelSetRenderbufferClipRects(struct intel_context *intel)
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;
}
@@ -445,7 +440,6 @@ intelRotateWindow(struct intel_context *intel,
int i;
GLenum format, type;
- int xOrig, yOrig;
int origNumClipRects;
drm_clip_rect_t *origRects;
@@ -469,8 +463,6 @@ intelRotateWindow(struct intel_context *intel,
/* save current drawing origin and cliprects (restored at end) */
- xOrig = intel->drawX;
- yOrig = intel->drawY;
origNumClipRects = intel->numClipRects;
origRects = intel->pClipRects;
@@ -481,8 +473,6 @@ intelRotateWindow(struct intel_context *intel,
fullRect.y1 = 0;
fullRect.x2 = screen->rotatedWidth;
fullRect.y2 = screen->rotatedHeight;
- intel->drawX = 0;
- intel->drawY = 0;
intel->numClipRects = 1;
intel->pClipRects = &fullRect;
@@ -565,8 +555,6 @@ intelRotateWindow(struct intel_context *intel,
intel_batchbuffer_flush(intel->batch);
/* restore original drawing origin and cliprects */
- intel->drawX = xOrig;
- intel->drawY = yOrig;
intel->numClipRects = origNumClipRects;
intel->pClipRects = origRects;
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.c b/src/mesa/drivers/dri/i915tex/intel_context.c
index 531b4adde8..451c7fd1ba 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.c
+++ b/src/mesa/drivers/dri/i915tex/intel_context.c
@@ -370,7 +370,7 @@ intelInitContext(struct intel_context *intel,
if (!havePools)
return GL_FALSE;
-
+
if (!_mesa_initialize_context(&intel->ctx,
mesaVis, shareCtx,
functions, (void *) intel))
@@ -572,6 +572,7 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driDrawPriv,
__DRIdrawablePrivate * driReadPriv)
{
+ GLuint updatebufsize = GL_FALSE;
#if 0
if (driDrawPriv) {
@@ -619,19 +620,22 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
}
}
- /* 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)
diff --git a/src/mesa/drivers/dri/i915tex/intel_context.h b/src/mesa/drivers/dri/i915tex/intel_context.h
index 7b97c564a3..f85b3a6362 100644
--- a/src/mesa/drivers/dri/i915tex/intel_context.h
+++ b/src/mesa/drivers/dri/i915tex/intel_context.h
@@ -250,7 +250,6 @@ struct intel_context
/* 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 */
diff --git a/src/mesa/drivers/dri/i915tex/intel_fbo.c b/src/mesa/drivers/dri/i915tex/intel_fbo.c
index 2dd3617f93..aeb909cce1 100644
--- a/src/mesa/drivers/dri/i915tex/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915tex/intel_fbo.c
@@ -146,6 +146,8 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
ASSERT(irb);
+ DBG("freeing renderbuffer\n");
+
if (irb->PairedStencil || irb->PairedDepth) {
intel_unpair_depth_stencil(ctx, irb);
}
diff --git a/src/mesa/drivers/dri/i915tex/intel_ioctl.c b/src/mesa/drivers/dri/i915tex/intel_ioctl.c
index 3250c6b3a9..54721c78ab 100644
--- a/src/mesa/drivers/dri/i915tex/intel_ioctl.c
+++ b/src/mesa/drivers/dri/i915tex/intel_ioctl.c
@@ -116,8 +116,7 @@ intel_batch_ioctl(struct intel_context *intel,
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__,
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c b/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c
index 65bf338589..96d3cbef5f 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_bitmap.c
@@ -195,18 +195,18 @@ do_blit_bitmap( GLcontext *ctx,
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:
*/
@@ -223,8 +223,8 @@ x if (ctx->Scissor.Enabled)
/* 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;
@@ -235,7 +235,7 @@ x if (ctx->Scissor.Enabled)
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;
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
index 9d478283e4..03c7353ee1 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_copy.c
@@ -191,14 +191,10 @@ do_texture_copypixels(GLcontext * ctx,
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
@@ -223,8 +219,8 @@ do_texture_copypixels(GLcontext * ctx,
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);
@@ -271,11 +267,11 @@ do_blit_copypixels(GLcontext * ctx,
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;
@@ -299,13 +295,10 @@ do_blit_copypixels(GLcontext * ctx,
}
/* 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.
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
index 77c67c821e..2d46c4b8c0 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_draw.c
@@ -138,13 +138,15 @@ do_texture_drawpixels(GLcontext * ctx,
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;
@@ -172,8 +174,8 @@ do_texture_drawpixels(GLcontext * ctx,
*/
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);
@@ -289,21 +291,21 @@ do_blit_drawpixels(GLcontext * ctx,
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;
@@ -327,7 +329,6 @@ do_blit_drawpixels(GLcontext * ctx,
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);
diff --git a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
index 24e49ae066..9481cb4800 100644
--- a/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
+++ b/src/mesa/drivers/dri/i915tex/intel_pixel_read.c
@@ -77,7 +77,6 @@ do_texture_readpixels(GLcontext * ctx,
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;
@@ -107,7 +106,7 @@ do_texture_readpixels(GLcontext * ctx,
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);
@@ -120,9 +119,7 @@ do_texture_readpixels(GLcontext * ctx,
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.
@@ -230,29 +227,25 @@ do_blit_readpixels(GLcontext * ctx,
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;
@@ -279,7 +272,6 @@ do_blit_readpixels(GLcontext * ctx,
driFenceReference(fence);
}
- UNLOCK_HARDWARE(intel);
if (fence) {
driFenceFinish(fence, DRM_FENCE_TYPE_EXE | DRM_I915_FENCE_TYPE_RW,
diff --git a/src/mesa/drivers/dri/i915tex/intel_span.c b/src/mesa/drivers/dri/i915tex/intel_span.c
index ab0874e4fd..368e0ec3c0 100644
--- a/src/mesa/drivers/dri/i915tex/intel_span.c
+++ b/src/mesa/drivers/dri/i915tex/intel_span.c
@@ -51,8 +51,7 @@
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;
@@ -65,10 +64,10 @@
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;
@@ -106,9 +105,7 @@
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
diff --git a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
index b85a25642a..90c2b9ebb5 100644
--- a/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/i915tex/intel_tex_copy.c
@@ -101,6 +101,7 @@ do_copy_texsubimage(struct intel_context *intel,
}
intelFlush(ctx);
+ /* XXX still need the lock ? */
LOCK_HARDWARE(intel);
{
GLuint image_offset = intel_miptree_image_offset(intelImage->mt,
@@ -117,20 +118,8 @@ do_copy_texsubimage(struct intel_context *intel,
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