panfrost: Respect box->width in tiled stores

This fixes a regression uploading partial tiled textures introduced
sometime during the cubemap series.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig
2019-04-03 03:36:38 +00:00
parent 3b38a7e505
commit c0183e8eed
3 changed files with 6 additions and 4 deletions

View File

@@ -414,7 +414,8 @@ panfrost_transfer_map(struct pipe_context *pctx,
return NULL; return NULL;
/* TODO: Reads */ /* TODO: Reads */
transfer->map = malloc(ALIGN(box->width, 16) * ALIGN(box->height, 16) * bytes_per_pixel); /* TODO: Only allocate "just" enough, shortening the stride */
transfer->map = malloc(transfer->base.stride * box->height);
return transfer->map; return transfer->map;
} else { } else {
@@ -440,6 +441,7 @@ panfrost_tile_texture(struct panfrost_screen *screen, struct panfrost_resource *
trans->base.box.height, trans->base.box.height,
util_format_get_blocksize(rsrc->base.format), util_format_get_blocksize(rsrc->base.format),
bo->slices[level].stride, bo->slices[level].stride,
u_minify(rsrc->base.width0, level),
trans->map, trans->map,
bo->cpu bo->cpu
+ bo->slices[level].offset + bo->slices[level].offset

View File

@@ -149,12 +149,12 @@ swizzle_bpp4_align16(int width, int height, int source_stride, int block_pitch,
void void
panfrost_texture_swizzle(unsigned off_x, panfrost_texture_swizzle(unsigned off_x,
unsigned off_y, unsigned off_y,
int width, int height, int bytes_per_pixel, int source_stride, int width, int height, int bytes_per_pixel, int source_stride, int dest_width,
const uint8_t *pixels, const uint8_t *pixels,
uint8_t *ldest) uint8_t *ldest)
{ {
/* Calculate maximum size, overestimating a bit */ /* Calculate maximum size, overestimating a bit */
int block_pitch = ALIGN(width, 16) >> 4; int block_pitch = ALIGN(dest_width, 16) >> 4;
/* Use fast path if available */ /* Use fast path if available */
if (!(off_x || off_y)) { if (!(off_x || off_y)) {

View File

@@ -32,7 +32,7 @@ panfrost_generate_space_filler_indices(void);
void void
panfrost_texture_swizzle(unsigned off_x, unsigned off_y, panfrost_texture_swizzle(unsigned off_x, unsigned off_y,
int width, int height, int bytes_per_pixel, int source_stride, int width, int height, int bytes_per_pixel, int source_stride, int dest_width,
const uint8_t *pixels, const uint8_t *pixels,
uint8_t *ldest); uint8_t *ldest);