summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-04-03 03:36:38 +0000
committerAlyssa Rosenzweig <[email protected]>2019-04-04 03:51:43 +0000
commitc0183e8eedec8f4e023ca312456ae957c9dafbe7 (patch)
treef43e78d4ea4c90dd56a747796cb954da5b93ef39 /src
parent3b38a7e5050935ec0eed9d99c7b6a1afb997b798 (diff)
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 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/panfrost/pan_resource.c4
-rw-r--r--src/gallium/drivers/panfrost/pan_swizzle.c4
-rw-r--r--src/gallium/drivers/panfrost/pan_swizzle.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index f7df1353d68..217b27c5778 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -414,7 +414,8 @@ panfrost_transfer_map(struct pipe_context *pctx,
return NULL;
/* 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;
} else {
@@ -440,6 +441,7 @@ panfrost_tile_texture(struct panfrost_screen *screen, struct panfrost_resource *
trans->base.box.height,
util_format_get_blocksize(rsrc->base.format),
bo->slices[level].stride,
+ u_minify(rsrc->base.width0, level),
trans->map,
bo->cpu
+ bo->slices[level].offset
diff --git a/src/gallium/drivers/panfrost/pan_swizzle.c b/src/gallium/drivers/panfrost/pan_swizzle.c
index 578de655415..afc89506b33 100644
--- a/src/gallium/drivers/panfrost/pan_swizzle.c
+++ b/src/gallium/drivers/panfrost/pan_swizzle.c
@@ -149,12 +149,12 @@ swizzle_bpp4_align16(int width, int height, int source_stride, int block_pitch,
void
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,
uint8_t *ldest)
{
/* 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 */
if (!(off_x || off_y)) {
diff --git a/src/gallium/drivers/panfrost/pan_swizzle.h b/src/gallium/drivers/panfrost/pan_swizzle.h
index a4d603a0aad..6f4dadef494 100644
--- a/src/gallium/drivers/panfrost/pan_swizzle.h
+++ b/src/gallium/drivers/panfrost/pan_swizzle.h
@@ -32,7 +32,7 @@ panfrost_generate_space_filler_indices(void);
void
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,
uint8_t *ldest);