screen offset changes, bug 9965
authorMiguel Marte <miguelmarte@gmail.com>
Sun, 18 Mar 2007 17:08:29 +0000 (11:08 -0600)
committerBrian <brian@yutani.localnet.net>
Sun, 18 Mar 2007 17:08:29 +0000 (11:08 -0600)
src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_context.h
src/mesa/drivers/dri/unichrome/via_ioctl.c
src/mesa/drivers/dri/unichrome/via_span.c
src/mesa/drivers/dri/unichrome/via_state.c

index 89533421b46e38878dee9b637fdbd5eaa83e61e9..4d25d328e333d96d68ed80ae735db4c4f9f8d261 100644 (file)
@@ -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);
 }
index 77161a8d5df34dbc0825dfe0821052c573f99e39..fecd2782fbaae98afc5597dcfb07be94cf199458 100644 (file)
@@ -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;
 };
 
index 5d102de93edb5aed6d5d2457b7b54e3acd1a5d8a..4a733fb00c23a0f13218da633531600a66384f5e 100644 (file)
@@ -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) {
index f1ed98036bf0c19b0a0d283d5faa80e1317be848..3a16dadd238e0fba4b80a23f4b862ba4fa3b5dbc 100644 (file)
@@ -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 
 
index 30b9dc289a74d570446a92acc2f68011bbcbcdde..bccdbe93264d7081d946fe4c63c5ee8f48be9697 100644 (file)
@@ -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);
 }