diff options
Diffstat (limited to 'src/mesa/pipe/i965simple/brw_surface.c')
-rw-r--r-- | src/mesa/pipe/i965simple/brw_surface.c | 127 |
1 files changed, 21 insertions, 106 deletions
diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c index b0d2fec8e0..d0e7229d5c 100644 --- a/src/mesa/pipe/i965simple/brw_surface.c +++ b/src/mesa/pipe/i965simple/brw_surface.c @@ -32,89 +32,7 @@ #include "pipe/p_util.h" #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" - -#include "pipe/softpipe/sp_rgba_tile.h" /* XXX TEMPORARY */ - - -#define CLIP_TILE \ - do { \ - if (x >= ps->width) \ - return; \ - if (y >= ps->height) \ - return; \ - if (x + w > ps->width) \ - w = ps->width - x; \ - if (y + h > ps->height) \ - h = ps->height -y; \ - } while(0) - - -/* - * XXX note: same as code in sp_surface.c - */ -static void -brw_get_tile(struct pipe_context *pipe, - struct pipe_surface *ps, - uint x, uint y, uint w, uint h, - void *p, int dst_stride) -{ - const uint cpp = ps->cpp; - const uint w0 = w; - const ubyte *pSrc; - ubyte *pDest; - uint i; - - assert(ps->map); - - CLIP_TILE; - - if (dst_stride == 0) { - dst_stride = w0 * cpp; - } - - pSrc = ps->map + ps->offset + (y * ps->pitch + x) * cpp; - pDest = (ubyte *) p; - - for (i = 0; i < h; i++) { - memcpy(pDest, pSrc, w0 * cpp); - pDest += dst_stride; - pSrc += ps->pitch * cpp; - } -} - - -/* - * XXX note: same as code in sp_surface.c - */ -static void -brw_put_tile(struct pipe_context *pipe, - struct pipe_surface *ps, - uint x, uint y, uint w, uint h, - const void *p, int src_stride) -{ - const uint cpp = ps->cpp; - const uint w0 = w; - const ubyte *pSrc; - ubyte *pDest; - uint i; - - assert(ps->map); - - CLIP_TILE; - - if (src_stride == 0) { - src_stride = w0 * cpp; - } - - pSrc = (const ubyte *) p; - pDest = ps->map + ps->offset + (y * ps->pitch + x) * cpp; - - for (i = 0; i < h; i++) { - memcpy(pDest, pSrc, w0 * cpp); - pDest += ps->pitch * cpp; - pSrc += src_stride; - } -} +#include "pipe/util/p_tile.h" /* @@ -157,21 +75,19 @@ brw_get_tex_surface(struct pipe_context *pipe, return ps; } -/* - * XXX Move this into core Mesa? - */ + static void -_mesa_copy_rect(ubyte * dst, - unsigned cpp, - unsigned dst_pitch, - unsigned dst_x, - unsigned dst_y, - unsigned width, - unsigned height, - const ubyte * src, - unsigned src_pitch, - unsigned src_x, - unsigned src_y) +copy_rect(ubyte * dst, + unsigned cpp, + unsigned dst_pitch, + unsigned dst_x, + unsigned dst_y, + unsigned width, + unsigned height, + const ubyte *src, + unsigned src_pitch, + unsigned src_x, + unsigned src_y) { unsigned i; @@ -208,10 +124,9 @@ brw_surface_data(struct pipe_context *pipe, const void *src, unsigned src_pitch, unsigned srcx, unsigned srcy, unsigned width, unsigned height) { - _mesa_copy_rect(pipe_surface_map(dst) + dst->offset, - dst->cpp, - dst->pitch, - dstx, dsty, width, height, src, src_pitch, srcx, srcy); + copy_rect(pipe_surface_map(dst) + dst->offset, + dst->cpp, dst->pitch, + dstx, dsty, width, height, src, src_pitch, srcx, srcy); pipe_surface_unmap(dst); } @@ -231,7 +146,7 @@ brw_surface_copy(struct pipe_context *pipe, assert(dst->cpp == src->cpp); if (0) { - _mesa_copy_rect(pipe_surface_map(dst) + dst->offset, + copy_rect(pipe_surface_map(dst) + dst->offset, dst->cpp, dst->pitch, dstx, dsty, @@ -321,10 +236,10 @@ void brw_init_surface_functions(struct brw_context *brw) { brw->pipe.get_tex_surface = brw_get_tex_surface; - brw->pipe.get_tile = brw_get_tile; - brw->pipe.put_tile = brw_put_tile; - brw->pipe.get_tile_rgba = softpipe_get_tile_rgba; - brw->pipe.put_tile_rgba = softpipe_put_tile_rgba; + brw->pipe.get_tile = pipe_get_tile_raw; + brw->pipe.put_tile = pipe_put_tile_raw; + brw->pipe.get_tile_rgba = pipe_get_tile_rgba; + brw->pipe.put_tile_rgba = pipe_put_tile_rgba; brw->pipe.surface_data = brw_surface_data; brw->pipe.surface_copy = brw_surface_copy; |