diff options
author | Daniel Stone <[email protected]> | 2019-03-18 16:07:00 +0000 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-03-20 04:20:42 +0000 |
commit | d258b787faaf9b089acd740df26bddbb64c2c630 (patch) | |
tree | 01d44535da59fa41c2a87b61905380f02c8e5e9d /src/gallium/drivers/panfrost/pan_mfbd.c | |
parent | 2be60e0c73ed1555a919c5725cc0cab119a2b6de (diff) |
panfrost: Properly align stride
Handle buffers whose width is not aligned to 16px by padding the stride
and storing it accordingly.
This does not reject imports for images whose stride is not sufficiently
aligned.
v2: make sure bo->stride is set on imported buffers, and add missing
variable definition. (Tomeu)
Tested-by: Tomeu Vizoso <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_mfbd.c')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_mfbd.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index ac7f9ed665f..6a7cd596744 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -81,9 +81,7 @@ panfrost_mfbd_set_cbuf( bool flip_y) { struct panfrost_resource *rsrc = pan_resource(surf->texture); - - signed stride = - util_format_get_stride(surf->format, surf->texture->width0); + int stride = rsrc->bo->stride; rt->format = panfrost_mfbd_format(surf); @@ -148,8 +146,7 @@ panfrost_mfbd_set_zsbuf( fbx->flags |= MALI_EXTRA_PRESENT | MALI_EXTRA_ZS | 0x1; fbx->ds_linear.depth = rsrc->bo->gpu[0]; - fbx->ds_linear.depth_stride = - util_format_get_stride(surf->format, surf->texture->width0); + fbx->ds_linear.depth_stride = rsrc->bo->stride; } else { assert(0); } @@ -273,12 +270,10 @@ panfrost_mfbd_fragment(struct panfrost_context *ctx, bool flip_y) struct panfrost_resource *rsrc = (struct panfrost_resource *) ctx->pipe_framebuffer.cbufs[0]->texture; if (rsrc->bo->has_checksum) { - int stride = util_format_get_stride(rsrc->base.format, rsrc->base.width0); - fb.unk3 |= MALI_MFBD_EXTRA; fbx.flags |= MALI_EXTRA_PRESENT; fbx.checksum_stride = rsrc->bo->checksum_stride; - fbx.checksum = rsrc->bo->gpu[0] + stride * rsrc->base.height0; + fbx.checksum = rsrc->bo->gpu[0] + rsrc->bo->stride * rsrc->base.height0; } } |