Remove mapping fields from struct pipe_surface.
[mesa.git] / src / mesa / pipe / i915simple / i915_surface.c
index 79e74e114373c758d111f1e4caf73acd6fa88efd..4e1b0929eed421b1462df2a148af17650aa8ceab 100644 (file)
@@ -171,10 +171,10 @@ i915_surface_copy(struct pipe_context *pipe,
 /* Fill a rectangular sub-region.  Need better logic about when to
  * push buffers into AGP - will currently do so whenever possible.
  */
-static ubyte *
-get_pointer(struct pipe_surface *dst, unsigned x, unsigned y)
+static void *
+get_pointer(struct pipe_surface *dst, void *dst_map, unsigned x, unsigned y)
 {
-   return dst->map + (y * dst->pitch + x) * dst->cpp;
+   return (char *)dst_map + (y * dst->pitch + x) * dst->cpp;
 }
 
 
@@ -186,12 +186,11 @@ i915_surface_fill(struct pipe_context *pipe,
 {
    if (0) {
       unsigned i, j;
-
-      (void)pipe_surface_map(dst);
+      void *dst_map = pipe_surface_map(dst);
 
       switch (dst->cpp) {
       case 1: {
-        ubyte *row = get_pointer(dst, dstx, dsty);
+        ubyte *row = get_pointer(dst, dst_map, dstx, dsty);
         for (i = 0; i < height; i++) {
            memset(row, value, width);
            row += dst->pitch;
@@ -199,7 +198,7 @@ i915_surface_fill(struct pipe_context *pipe,
       }
         break;
       case 2: {
-        ushort *row = (ushort *) get_pointer(dst, dstx, dsty);
+        ushort *row = get_pointer(dst, dst_map, dstx, dsty);
         for (i = 0; i < height; i++) {
            for (j = 0; j < width; j++)
               row[j] = (ushort) value;
@@ -208,7 +207,7 @@ i915_surface_fill(struct pipe_context *pipe,
       }
         break;
       case 4: {
-        unsigned *row = (unsigned *) get_pointer(dst, dstx, dsty);
+        unsigned *row = get_pointer(dst, dst_map, dstx, dsty);
         for (i = 0; i < height; i++) {
            for (j = 0; j < width; j++)
               row[j] = value;
@@ -220,6 +219,8 @@ i915_surface_fill(struct pipe_context *pipe,
         assert(0);
         break;
       }
+
+      pipe_surface_unmap( dst );
    }
    else {
       i915_fill_blit( i915_context(pipe),