diff options
author | Roland Scheidegger <[email protected]> | 2014-07-01 15:37:56 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2014-07-02 01:55:59 +0200 |
commit | a7ee842acd30578f4170f69124c3986ee35a6df8 (patch) | |
tree | ffc49d15843e795dea644faae82ebc6e0a1eacb1 /src/gallium/drivers/llvmpipe/lp_surface.c | |
parent | a4d0758d9d3383cf1411a65e76180f5302cfc3cd (diff) |
llvmpipe: get rid of llvmpipe_get_texture_tile_linear
Because the layout is always linear this didn't really do much any longer -
at some point this triggered per-tile swizzled->linear conversion. The x/y
coords were ignored too.
Apart from triggering conversion, this also invoked alloc_image_data(), which
could only actually trigger mapping of display target resources. So, instead
just call resource_map in the callers (which also gives the ability to unmap
again). Note that mapping/unmapping of display target resources still isn't
really all that clean (map/unmap may be unmatched, and all such mappings use
the same pointer thus usage flags are a lie).
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_surface.c')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_surface.c | 86 |
1 files changed, 15 insertions, 71 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_surface.c b/src/gallium/drivers/llvmpipe/lp_surface.c index 09ca39dd357..08f968f7f0a 100644 --- a/src/gallium/drivers/llvmpipe/lp_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_surface.c @@ -35,22 +35,6 @@ #include "lp_query.h" -/** - * Adjust x, y, width, height to lie on tile bounds. - */ -static void -adjust_to_tile_bounds(unsigned x, unsigned y, unsigned width, unsigned height, - unsigned *x_tile, unsigned *y_tile, - unsigned *w_tile, unsigned *h_tile) -{ - *x_tile = x & ~(TILE_SIZE - 1); - *y_tile = y & ~(TILE_SIZE - 1); - *w_tile = ((x + width + TILE_SIZE - 1) & ~(TILE_SIZE - 1)) - *x_tile; - *h_tile = ((y + height + TILE_SIZE - 1) & ~(TILE_SIZE - 1)) - *y_tile; -} - - - static void lp_resource_copy(struct pipe_context *pipe, struct pipe_resource *dst, unsigned dst_level, @@ -64,7 +48,6 @@ lp_resource_copy(struct pipe_context *pipe, unsigned width = src_box->width; unsigned height = src_box->height; unsigned depth = src_box->depth; - unsigned z; llvmpipe_flush_resource(pipe, dst, dst_level, @@ -94,61 +77,16 @@ lp_resource_copy(struct pipe_context *pipe, src_box->width, src_box->height, src_box->depth); */ - for (z = 0; z < src_box->depth; z++){ - - /* set src tiles to linear layout */ - { - unsigned tx, ty, tw, th; - unsigned x, y; + /* make sure display target resources (which cannot have levels/layers) are mapped */ + if (src_tex->dt) + (void) llvmpipe_resource_map(src, src_level, 0, LP_TEX_USAGE_READ); + if (dst_tex->dt) + /* + * Could set this to WRITE_ALL if complete dst is covered but it gets + * ignored anyway. + */ + (void) llvmpipe_resource_map(dst, dst_level, 0, LP_TEX_USAGE_READ_WRITE); - adjust_to_tile_bounds(src_box->x, src_box->y, width, height, - &tx, &ty, &tw, &th); - - for (y = 0; y < th; y += TILE_SIZE) { - for (x = 0; x < tw; x += TILE_SIZE) { - (void) llvmpipe_get_texture_tile_linear(src_tex, - src_box->z + z, src_level, - LP_TEX_USAGE_READ, - tx + x, ty + y); - } - } - } - - /* set dst tiles to linear layout */ - { - unsigned tx, ty, tw, th; - unsigned x, y; - enum lp_texture_usage usage; - - adjust_to_tile_bounds(dstx, dsty, width, height, &tx, &ty, &tw, &th); - - for (y = 0; y < th; y += TILE_SIZE) { - boolean contained_y = ty + y >= dsty && - ty + y + TILE_SIZE <= dsty + height ? - TRUE : FALSE; - - for (x = 0; x < tw; x += TILE_SIZE) { - boolean contained_x = tx + x >= dstx && - tx + x + TILE_SIZE <= dstx + width ? - TRUE : FALSE; - - /* - * Set the usage mode to WRITE_ALL for the tiles which are - * completely contained by the dest rectangle. - */ - if (contained_y && contained_x) - usage = LP_TEX_USAGE_WRITE_ALL; - else - usage = LP_TEX_USAGE_READ_WRITE; - - (void) llvmpipe_get_texture_tile_linear(dst_tex, - dstz + z, dst_level, - usage, - tx + x, ty + y); - } - } - } - } /* copy */ { @@ -171,6 +109,12 @@ lp_resource_copy(struct pipe_context *pipe, src_box->x, src_box->y, 0); } } + + if (src_tex->dt) + llvmpipe_resource_unmap(src, 0, 0); + if (dst_tex->dt) + llvmpipe_resource_unmap(dst, 0, 0); + } |