summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Marte <miguelmarte@gmail.com>2007-03-18 11:08:29 -0600
committerBrian <brian@yutani.localnet.net>2007-03-18 11:08:29 -0600
commitc41d6ab6f062ebce1076ca79f9ad0c7368a0e2d0 (patch)
tree7fe15a35087c152d67846436814ce342ab98bef2
parent441f038748975d4e14ca3da7098045dd1013e531 (diff)
screen offset changes, bug 9965
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.c31
-rw-r--r--src/mesa/drivers/dri/unichrome/via_context.h5
-rw-r--r--src/mesa/drivers/dri/unichrome/via_ioctl.c24
-rw-r--r--src/mesa/drivers/dri/unichrome/via_span.c4
-rw-r--r--src/mesa/drivers/dri/unichrome/via_state.c18
5 files changed, 36 insertions, 46 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c
index 89533421b4..4d25d328e3 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.c
+++ b/src/mesa/drivers/dri/unichrome/via_context.c
@@ -768,9 +768,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
drawable);
}
- draw_buffer->drawXoff = (GLuint)(((drawable->x * bytePerPixel) & 0x1f) /
- bytePerPixel);
- draw_buffer->drawX = drawable->x - draw_buffer->drawXoff;
+ draw_buffer->drawX = drawable->x;
draw_buffer->drawY = drawable->y;
draw_buffer->drawW = drawable->w;
draw_buffer->drawH = drawable->h;
@@ -782,9 +780,7 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
readable);
}
- read_buffer->drawXoff = (GLuint)(((readable->x * bytePerPixel) & 0x1f) /
- bytePerPixel);
- read_buffer->drawX = readable->x - read_buffer->drawXoff;
+ read_buffer->drawX = readable->x;
read_buffer->drawY = readable->y;
read_buffer->drawW = readable->w;
read_buffer->drawH = readable->h;
@@ -795,13 +791,24 @@ void viaXMesaWindowMoved(struct via_context *vmesa)
draw_buffer->drawX * bytePerPixel);
vmesa->front.origMap = (vmesa->front.map +
- draw_buffer->drawY * vmesa->front.pitch +
- draw_buffer->drawX * bytePerPixel);
+ draw_buffer->drawY * vmesa->front.pitch +
+ draw_buffer->drawX * bytePerPixel);
+
+ vmesa->back.orig = (vmesa->back.offset +
+ draw_buffer->drawY * vmesa->back.pitch +
+ draw_buffer->drawX * bytePerPixel);
- vmesa->back.orig = vmesa->back.offset;
- vmesa->depth.orig = vmesa->depth.offset;
- vmesa->back.origMap = vmesa->back.map;
- vmesa->depth.origMap = vmesa->depth.map;
+ vmesa->back.origMap = (vmesa->back.map +
+ draw_buffer->drawY * vmesa->back.pitch +
+ draw_buffer->drawX * bytePerPixel);
+
+ vmesa->depth.orig = (vmesa->depth.offset +
+ draw_buffer->drawY * vmesa->depth.pitch +
+ draw_buffer->drawX * bytePerPixel);
+
+ vmesa->depth.origMap = (vmesa->depth.map +
+ draw_buffer->drawY * vmesa->depth.pitch +
+ draw_buffer->drawX * bytePerPixel);
viaCalcViewport(vmesa->glCtx);
}
diff --git a/src/mesa/drivers/dri/unichrome/via_context.h b/src/mesa/drivers/dri/unichrome/via_context.h
index 77161a8d5d..fecd2782fb 100644
--- a/src/mesa/drivers/dri/unichrome/via_context.h
+++ b/src/mesa/drivers/dri/unichrome/via_context.h
@@ -104,11 +104,6 @@ struct via_renderbuffer {
int drawW;
int drawH;
- int drawXoff; /* drawX is 32byte aligned - this is
- * the delta to the real origin, in
- * pixel units.
- */
-
__DRIdrawablePrivate *dPriv;
};
diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c
index 5d102de93e..4a733fb00c 100644
--- a/src/mesa/drivers/dri/unichrome/via_ioctl.c
+++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c
@@ -187,7 +187,7 @@ static void viaFillBuffer(struct via_context *vmesa,
int w = pbox[i].x2 - pbox[i].x1;
int h = pbox[i].y2 - pbox[i].y1;
- int offset = (buffer->orig +
+ int offset = (buffer->offset +
y * buffer->pitch +
x * bytePerPixel);
@@ -276,7 +276,7 @@ static void viaClear(GLcontext *ctx, GLbitfield mask)
/* flip top to bottom */
cy = dPriv->h - cy - ch;
- cx += vrb->drawX + vrb->drawXoff;
+ cx += vrb->drawX;
cy += vrb->drawY;
if (!all) {
@@ -359,8 +359,8 @@ static void viaDoSwapBuffers(struct via_context *vmesa,
GLint w = b->x2 - b->x1;
GLint h = b->y2 - b->y1;
- GLuint src = back->orig + y * back->pitch + x * bytePerPixel;
- GLuint dest = front->orig + y * front->pitch + x * bytePerPixel;
+ GLuint src = back->offset + y * back->pitch + x * bytePerPixel;
+ GLuint dest = front->offset + y * front->pitch + x * bytePerPixel;
viaBlit(vmesa,
bytePerPixel << 3,
@@ -747,7 +747,7 @@ static void via_emit_cliprect(struct via_context *vmesa,
: HC_HDBFM_RGB565);
GLuint pitch = buffer->pitch;
- GLuint offset = buffer->orig;
+ GLuint offset = buffer->offset;
if (0)
fprintf(stderr, "emit cliprect for box %d,%d %d,%d\n",
@@ -768,7 +768,7 @@ static void via_emit_cliprect(struct via_context *vmesa,
vb[4] = (HC_SubA_HDBBasL << 24) | (offset & 0xFFFFFF);
vb[5] = (HC_SubA_HDBBasH << 24) | ((offset & 0xFF000000) >> 24);
- vb[6] = (HC_SubA_HSPXYOS << 24) | ((31 - buffer->drawXoff) << HC_HSPXOS_SHIFT);
+ vb[6] = (HC_SubA_HSPXYOS << 24);
vb[7] = (HC_SubA_HDBFM << 24) | HC_HDBLoc_Local | format | pitch;
}
@@ -887,22 +887,18 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags)
struct via_renderbuffer *const vrb =
(struct via_renderbuffer *) dPriv->driverPrivate;
-
for (i = 0; i < vmesa->numClipRects; i++) {
drm_clip_rect_t b;
- b.x1 = pbox[i].x1 - (vrb->drawX + vrb->drawXoff);
- b.x2 = pbox[i].x2 - (vrb->drawX + vrb->drawXoff);
- b.y1 = pbox[i].y1 - vrb->drawY;
- b.y2 = pbox[i].y2 - vrb->drawY;
+ b.x1 = pbox[i].x1;
+ b.x2 = pbox[i].x2;
+ b.y1 = pbox[i].y1;
+ b.y2 = pbox[i].y2;
if (vmesa->scissor &&
!intersect_rect(&b, &b, &vmesa->scissorRect))
continue;
- b.x1 += vrb->drawXoff;
- b.x2 += vrb->drawXoff;
-
via_emit_cliprect(vmesa, &b);
if (fire_buffer(vmesa) != 0) {
diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c
index f1ed98036b..3a16dadd23 100644
--- a/src/mesa/drivers/dri/unichrome/via_span.c
+++ b/src/mesa/drivers/dri/unichrome/via_span.c
@@ -46,7 +46,7 @@
GLuint pitch = vrb->pitch; \
GLuint height = dPriv->h; \
GLint p = 0; \
- char *buf = (char *)(vrb->origMap + vrb->drawXoff * vrb->bpp); \
+ char *buf = (char *)(vrb->origMap); \
(void) p;
/* ================================================================
@@ -82,7 +82,7 @@
__DRIdrawablePrivate *dPriv = vrb->dPriv; \
GLuint depth_pitch = vrb->pitch; \
GLuint height = dPriv->h; \
- char *buf = (char *)(vrb->map + (vrb->drawXoff * vrb->bpp/8))
+ char *buf = (char *)(vrb->map)
#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS
diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c
index 30b9dc289a..bccdbe9326 100644
--- a/src/mesa/drivers/dri/unichrome/via_state.c
+++ b/src/mesa/drivers/dri/unichrome/via_state.c
@@ -500,10 +500,8 @@ void viaEmitState(struct via_context *vmesa)
OUT_RING( HC_HEADER2 );
OUT_RING( (HC_ParaType_NotTex << 16) );
- OUT_RING( (HC_SubA_HSPXYOS << 24) |
- (((32- vrb->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
- OUT_RING( (HC_SubA_HSPXYOS << 24) |
- (((32 - vrb->drawXoff) & 0x1f) << HC_HSPXOS_SHIFT));
+ OUT_RING( (HC_SubA_HSPXYOS << 24) );
+ OUT_RING( (HC_SubA_HSPXYOS << 24) );
ADVANCE_RING();
}
@@ -712,12 +710,8 @@ static void viaColorMask(GLcontext *ctx,
}
-/* =============================================================
- */
-
-/* Using drawXoff like this is incorrect outside of locked regions.
- * This hardware just isn't capable of private back buffers without
+/* This hardware just isn't capable of private back buffers without
* glitches and/or a hefty locking scheme.
*/
void viaCalcViewport(GLcontext *ctx)
@@ -729,12 +723,10 @@ void viaCalcViewport(GLcontext *ctx)
const GLfloat *v = ctx->Viewport._WindowMap.m;
GLfloat *m = vmesa->ViewportMatrix.m;
- /* See also via_translate_vertex.
- */
m[MAT_SX] = v[MAT_SX];
- m[MAT_TX] = v[MAT_TX] + SUBPIXEL_X + vrb->drawXoff;
+ m[MAT_TX] = v[MAT_TX] + vrb->drawX + SUBPIXEL_X;
m[MAT_SY] = - v[MAT_SY];
- m[MAT_TY] = - v[MAT_TY] + dPriv->h + SUBPIXEL_Y;
+ m[MAT_TY] = - v[MAT_TY] + vrb->drawY + SUBPIXEL_Y + vrb->drawH;
m[MAT_SZ] = v[MAT_SZ] * (1.0 / vmesa->depth_max);
m[MAT_TZ] = v[MAT_TZ] * (1.0 / vmesa->depth_max);
}