From c76efb96b405e43e3261d1dc9e8812fdb2cfbac8 Mon Sep 17 00:00:00 2001 From: Michel Dänzer Date: Thu, 10 Jan 2008 17:44:04 +0100 Subject: Remove mapping fields from struct pipe_surface. It's now the responsibility of surface users to keep track of their mappings. --- src/mesa/pipe/i965simple/brw_surface.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/mesa/pipe/i965simple/brw_surface.c') diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c index d0e7229d5c..850423bdd5 100644 --- a/src/mesa/pipe/i965simple/brw_surface.c +++ b/src/mesa/pipe/i965simple/brw_surface.c @@ -171,10 +171,10 @@ brw_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 @@ brw_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 @@ brw_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 @@ brw_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 @@ brw_surface_fill(struct pipe_context *pipe, assert(0); break; } + + pipe_surface_unmap( dst ); } else { brw_fill_blit(brw_context(pipe), -- cgit v1.2.3