summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/i965simple/brw_surface.c
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-12-15 16:44:29 -0700
committerBrian <brian.paul@tungstengraphics.com>2007-12-15 16:44:29 -0700
commit263e8f057290961c9dd603ffa69f25a7a253301a (patch)
tree3798e5a3ddf1012fb8ab5fa1f6355a4a801d4032 /src/mesa/pipe/i965simple/brw_surface.c
parentbccc4c5c0116987041dec2327ddb43eff1bcfadf (diff)
Use tile functions in new p_tile.[ch]
This removes quite a bit of code duplicated in the drivers.
Diffstat (limited to 'src/mesa/pipe/i965simple/brw_surface.c')
-rw-r--r--src/mesa/pipe/i965simple/brw_surface.c92
1 files changed, 5 insertions, 87 deletions
diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c
index b0d2fec8e0..96f17e434f 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"
/*
@@ -321,10 +239,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;