gallium: minor cleanups to pipe interface
authorKeith Whitwell <keith@tungstengraphics.com>
Tue, 22 Jan 2008 14:38:36 +0000 (14:38 +0000)
committerJosé Fonseca <jrfonseca@tungstengraphics.com>
Sat, 26 Jan 2008 01:32:13 +0000 (10:32 +0900)
- Remove put/get tile, just have users call put_tile_raw, etc directly.
- Remove surface_data call, just map it locally.

src/mesa/pipe/failover/fo_context.c
src/mesa/pipe/i915simple/i915_surface.c
src/mesa/pipe/i965simple/brw_surface.c
src/mesa/pipe/p_context.h
src/mesa/pipe/softpipe/sp_surface.c
src/mesa/pipe/softpipe/sp_tile_cache.c
src/mesa/pipe/util/p_tile.c
src/mesa/state_tracker/st_texture.c

index 3799c4dfb0afb8167d5a2300ff8c29682cc9579b..cf6c9fed502b95e024d81452695146a90058e6b8 100644 (file)
@@ -140,7 +140,6 @@ struct pipe_context *failover_create( struct pipe_context *hw,
 #endif
    failover->pipe.get_tex_surface = hw->get_tex_surface;
 
-   failover->pipe.surface_data = hw->surface_data;
    failover->pipe.surface_copy = hw->surface_copy;
    failover->pipe.surface_fill = hw->surface_fill;
    failover->pipe.texture_create = hw->texture_create;
index 8ef02b99cd1942080f047af37b7ce81da5eacab7..1bdaba773f1c39d197cf2a6d53dff41e09930dcd 100644 (file)
@@ -77,27 +77,6 @@ i915_get_tex_surface(struct pipe_context *pipe,
 }
 
 
-/* Upload data to a rectangular sub-region.  Lots of choices how to do this:
- *
- * - memcpy by span to current destination
- * - upload data as new buffer and blit
- *
- * Currently always memcpy.
- */
-static void
-i915_surface_data(struct pipe_context *pipe,
-                 struct pipe_surface *dst,
-                 unsigned dstx, unsigned dsty,
-                 const void *src, unsigned src_pitch,
-                 unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
-   pipe_copy_rect(pipe_surface_map(dst),
-                  dst->cpp, dst->pitch,
-                  dstx, dsty, width, height, src, src_pitch, srcx, srcy);
-
-   pipe_surface_unmap(dst);
-}
-
 
 /* Assumes all values are within bounds -- no checking at this level -
  * do it higher up if required.
@@ -204,10 +183,7 @@ void
 i915_init_surface_functions(struct i915_context *i915)
 {
    i915->pipe.get_tex_surface = i915_get_tex_surface;
-   i915->pipe.get_tile = pipe_get_tile_raw;
-   i915->pipe.put_tile = pipe_put_tile_raw;
 
-   i915->pipe.surface_data = i915_surface_data;
    i915->pipe.surface_copy = i915_surface_copy;
    i915->pipe.surface_fill = i915_surface_fill;
 }
index 252aec7d29cf67802b6152bd7e9885fe11e9770b..eb7835836ee210b7891ffd6952e4d0ca0783fa4b 100644 (file)
@@ -203,10 +203,6 @@ void
 brw_init_surface_functions(struct brw_context *brw)
 {
    brw->pipe.get_tex_surface = brw_get_tex_surface;
-   brw->pipe.get_tile = pipe_get_tile_raw;
-   brw->pipe.put_tile = pipe_put_tile_raw;
-
-   brw->pipe.surface_data  = brw_surface_data;
    brw->pipe.surface_copy  = brw_surface_copy;
    brw->pipe.surface_fill  = brw_surface_fill;
 }
index 37464c88a13393b474bd1d975042bd1a61712892..0dda06c53babd472dba927ea066c0467e4370de9 100644 (file)
@@ -78,9 +78,6 @@ struct pipe_context {
                             unsigned indexSize,
                             unsigned mode, unsigned start, unsigned count);
 
-   /** Clear a surface to given value (no scissor; clear whole surface) */
-   void (*clear)(struct pipe_context *pipe, struct pipe_surface *ps,
-                 unsigned clearValue);
 
    /**
     * Query objects
@@ -176,33 +173,9 @@ struct pipe_context {
                               const struct pipe_vertex_element * );
 
 
-   /** Get a surface which is a "view" into a texture */
-   struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
-                                           struct pipe_texture *texture,
-                                           unsigned face, unsigned level,
-                                           unsigned zslice);
-
-   /** Get a block of raw pixel data from a surface */
-   void (*get_tile)(struct pipe_context *pipe,
-                    struct pipe_surface *ps,
-                    uint x, uint y, uint w, uint h,
-                    void *p, int dst_stride);
-   /** Put a block of raw pixel data into a surface */
-   void (*put_tile)(struct pipe_context *pipe,
-                    struct pipe_surface *ps,
-                    uint x, uint y, uint w, uint h,
-                    const void *p, int src_stride);
-
-
    /*
     * Surface functions
     */
-   void (*surface_data)(struct pipe_context *pipe,
-                       struct pipe_surface *dest,
-                       unsigned destx, unsigned desty,
-                       const void *src, unsigned src_stride,
-                       unsigned srcx, unsigned srcy,
-                       unsigned width, unsigned height);
 
    void (*surface_copy)(struct pipe_context *pipe,
                        struct pipe_surface *dest,
@@ -218,6 +191,10 @@ struct pipe_context {
                        unsigned width, unsigned height,
                        unsigned value);
 
+   void (*clear)(struct pipe_context *pipe, 
+                struct pipe_surface *ps,
+                unsigned clearValue);
+
 
    /*
     * Texture functions
@@ -228,6 +205,11 @@ struct pipe_context {
    void (*texture_release)(struct pipe_context *pipe,
                           struct pipe_texture **pt);
 
+   /** Get a surface which is a "view" into a texture */
+   struct pipe_surface *(*get_tex_surface)(struct pipe_context *pipe,
+                                           struct pipe_texture *texture,
+                                           unsigned face, unsigned level,
+                                           unsigned zslice);
 
    /* Flush rendering:
     */
index e11570550737dd85417d181d6e743044d5412961..5978ee48bd4a56df6b3ca4e09646f77a992af272 100644 (file)
 #include "sp_surface.h"
 
 
-/* Upload data to a rectangular sub-region.  Lots of choices how to do this:
- *
- * - memcpy by span to current destination
- * - upload data as new buffer and blit
- *
- * Currently always memcpy.
- */
-static void
-sp_surface_data(struct pipe_context *pipe,
-               struct pipe_surface *dst,
-               unsigned dstx, unsigned dsty,
-               const void *src, unsigned src_pitch,
-               unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
-   pipe_copy_rect(pipe_surface_map(dst),
-                  dst->cpp,
-                  dst->pitch,
-                  dstx, dsty, width, height, src, src_pitch, srcx, srcy);
-
-   pipe_surface_unmap(dst);
-}
 
 /* Assumes all values are within bounds -- no checking at this level -
  * do it higher up if required.
@@ -174,10 +153,6 @@ sp_surface_fill(struct pipe_context *pipe,
 void
 sp_init_surface_functions(struct softpipe_context *sp)
 {
-   sp->pipe.get_tile = pipe_get_tile_raw;
-   sp->pipe.put_tile = pipe_put_tile_raw;
-
-   sp->pipe.surface_data = sp_surface_data;
    sp->pipe.surface_copy = sp_surface_copy;
    sp->pipe.surface_fill = sp_surface_fill;
 }
index bc7e8d01e41703a7b9dfa49d8fe1ec0896d10336..451e157abf9acfb34b80cdc7fef2bba8d0262aa4 100644 (file)
@@ -329,7 +329,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe,
    for (y = 0; y < h; y += TILE_SIZE) {
       for (x = 0; x < w; x += TILE_SIZE) {
          if (is_clear_flag_set(tc->clear_flags, x, y)) {
-            pipe->put_tile(pipe, ps,
+            pipe_put_tile_raw(pipe, ps,
                            x, y, TILE_SIZE, TILE_SIZE,
                            tc->tile.data.color32, 0/*STRIDE*/);
 
@@ -365,7 +365,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe,
       struct softpipe_cached_tile *tile = tc->entries + pos;
       if (tile->x >= 0) {
          if (tc->depth_stencil) {
-            pipe->put_tile(pipe, ps,
+            pipe_put_tile_raw(pipe, ps,
                            tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                            tile->data.depth32, 0/*STRIDE*/);
          }
@@ -414,7 +414,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
       if (tile->x != -1) {
          /* put dirty tile back in framebuffer */
          if (tc->depth_stencil) {
-            pipe->put_tile(pipe, ps,
+            pipe_put_tile_raw(pipe, ps,
                            tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                            tile->data.depth32, 0/*STRIDE*/);
          }
@@ -441,7 +441,7 @@ sp_get_cached_tile(struct softpipe_context *softpipe,
       else {
          /* get new tile data from surface */
          if (tc->depth_stencil) {
-            pipe->get_tile(pipe, ps,
+            pipe_put_tile_raw(pipe, ps,
                            tile->x, tile->y, TILE_SIZE, TILE_SIZE,
                            tile->data.depth32, 0/*STRIDE*/);
          }
index 85a863db8acc8c039f32452e651e533897af22f3..3f795a38989dc54027fec0963b344c3e26851fc7 100644 (file)
@@ -577,7 +577,7 @@ pipe_get_tile_rgba(struct pipe_context *pipe,
    if (!packed)
       return;
 
-   pipe->get_tile(pipe, ps, x, y, w, h, packed, w * ps->cpp);
+   pipe_get_tile_raw(pipe, ps, x, y, w, h, packed, w * ps->cpp);
 
    switch (ps->format) {
    case PIPE_FORMAT_A8R8G8B8_UNORM:
@@ -693,7 +693,7 @@ pipe_put_tile_rgba(struct pipe_context *pipe,
       assert(0);
    }
 
-   pipe->put_tile(pipe, ps, x, y, w, h, packed, w * ps->cpp);
+   pipe_put_tile_raw(pipe, ps, x, y, w, h, packed, w * ps->cpp);
 
    FREE(packed);
 }
index a2bdf846caf030be88375518b09e272fd75c57d0..15cc458be8a162b38384baf1d030c6e1db6db1bb 100644 (file)
@@ -201,6 +201,29 @@ st_texture_image_unmap(struct st_texture_image *stImage)
 
 
 
+/* Upload data to a rectangular sub-region.  Lots of choices how to do this:
+ *
+ * - memcpy by span to current destination
+ * - upload data as new buffer and blit
+ *
+ * Currently always memcpy.
+ */
+static void
+st_surface_data(struct pipe_context *pipe,
+               struct pipe_surface *dst,
+               unsigned dstx, unsigned dsty,
+               const void *src, unsigned src_pitch,
+               unsigned srcx, unsigned srcy, unsigned width, unsigned height)
+{
+   pipe_copy_rect(pipe_surface_map(dst),
+                  dst->cpp,
+                  dst->pitch,
+                  dstx, dsty, width, height, src, src_pitch, srcx, srcy);
+
+   pipe_surface_unmap(dst);
+}
+
+
 /* Upload data for a particular image.
  */
 void
@@ -225,12 +248,12 @@ st_texture_image_data(struct pipe_context *pipe,
 
       dst_surface = pipe->get_tex_surface(pipe, dst, face, level, i);
 
-      pipe->surface_data(pipe, dst_surface,
-                        0, 0,                             /* dstx, dsty */
-                        srcUB,
-                        src_row_pitch,
-                        0, 0,                             /* source x, y */
-                        dst->width[level], height); /* width, height */
+      st_surface_data(pipe, dst_surface,
+                     0, 0,                             /* dstx, dsty */
+                     srcUB,
+                     src_row_pitch,
+                     0, 0,                             /* source x, y */
+                     dst->width[level], height);       /* width, height */
 
       pipe_surface_reference(&dst_surface, NULL);