gallium: minor cleanups to pipe interface

- Remove put/get tile, just have users call put_tile_raw, etc directly.
- Remove surface_data call, just map it locally.
This commit is contained in:
Keith Whitwell 2008-01-22 14:38:36 +00:00 committed by José Fonseca
parent 1e9e4341e0
commit f3aa4de034
8 changed files with 44 additions and 93 deletions

View 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;

View 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;
}

View 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;
}

View 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:
*/

View file

@ -34,27 +34,6 @@
#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;
}

View 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*/);
}

View 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);
}

View 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);