intel: Fix performance regression in Lightsmark since HiZ changes.
[mesa.git] / src / mesa / drivers / x11 / xm_buffer.c
index ea87b6dfd0a44db611e069d554ce19b4cd0382d0..84e6fcd795c37bed9ab1dc7d47b915c5207cfda4 100644 (file)
@@ -35,6 +35,7 @@
 #include "main/formats.h"
 #include "main/framebuffer.h"
 #include "main/renderbuffer.h"
+#include "swrast/s_renderbuffer.h"
 
 
 #define XMESA_RENDERBUFFER 0x1234
@@ -255,7 +256,6 @@ xmesa_alloc_front_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
    struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb);
 
    /* just clear these to be sure we don't accidentally use them */
-   xrb->origin1 = NULL;
    xrb->origin2 = NULL;
    xrb->origin3 = NULL;
    xrb->origin4 = NULL;
@@ -291,10 +291,6 @@ xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
 
    /* plus... */
    if (xrb->ximage) {
-      /* Needed by PIXELADDR1 macro */
-      xrb->width1 = xrb->ximage->bytes_per_line;
-      xrb->origin1 = (GLubyte *) xrb->ximage->data + xrb->width1 * (height - 1);
-
       /* Needed by PIXELADDR2 macro */
       xrb->width2 = xrb->ximage->bytes_per_line / 2;
       xrb->origin2 = (GLushort *) xrb->ximage->data + xrb->width2 * (height - 1);
@@ -309,8 +305,7 @@ xmesa_alloc_back_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
    }
    else {
       /* out of memory or buffer size is 0 x 0 */
-      xrb->width1 = xrb->width2 = xrb->width3 = xrb->width4 = 0;
-      xrb->origin1 = NULL;
+      xrb->width2 = xrb->width3 = xrb->width4 = 0;
       xrb->origin2 = NULL;
       xrb->origin3 = NULL;
       xrb->origin4 = NULL;
@@ -349,7 +344,7 @@ xmesa_new_renderbuffer(struct gl_context *ctx, GLuint name,
          /* This will really only happen for pixmaps.  We'll access the
           * pixmap via a temporary XImage which will be 32bpp.
           */
-         xrb->Base.Format = MESA_FORMAT_ARGB8888;
+         xrb->Base.Format = MESA_FORMAT_XRGB8888;
          break;
       case PF_8A8R8G8B:
          xrb->Base.Format = MESA_FORMAT_ARGB8888;
@@ -412,11 +407,6 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
       }
       if (b->backxrb->pixmap) {
          XMesaFreePixmap( b->display, b->backxrb->pixmap );
-         if (b->xm_visual->hpcr_clear_flag) {
-            XMesaFreePixmap( b->display,
-                             b->xm_visual->hpcr_clear_pixmap );
-            XMesaDestroyImage( b->xm_visual->hpcr_clear_ximage );
-         }
       }
    }
 
@@ -477,17 +467,6 @@ xmesa_MapRenderbuffer(struct gl_context *ctx,
             return;
          }
 
-         if (xrb->Base.Format == MESA_FORMAT_ARGB8888 ||
-             xrb->Base.Format == MESA_FORMAT_RGBA8888_REV) {
-            /* The original pixmap is RGB but we're returning an RGBA
-             * image buffer.  Fill in the A values with 0xff.
-             */
-            GLuint i, *p = (GLuint *) ximage->data;
-            for (i = 0; i < w * h; i++) {
-               p[i] |= 0xff000000;
-            }
-         }
-
          xrb->map_ximage = ximage;
 
          /* the first row of the OpenGL image is last row of the XImage */
@@ -503,8 +482,8 @@ xmesa_MapRenderbuffer(struct gl_context *ctx,
    }
 
    /* otherwise, this is an ordinary malloc-based renderbuffer */
-   _mesa_map_soft_renderbuffer(ctx, rb, x, y, w, h, mode,
-                               mapOut, rowStrideOut);
+   _swrast_map_soft_renderbuffer(ctx, rb, x, y, w, h, mode,
+                                 mapOut, rowStrideOut);
 }
 
 
@@ -550,7 +529,7 @@ xmesa_UnmapRenderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
    }
 
    /* otherwise, this is an ordinary malloc-based renderbuffer */
-   _mesa_unmap_soft_renderbuffer(ctx, rb);
+   _swrast_unmap_soft_renderbuffer(ctx, rb);
 }