diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-06-07 17:07:13 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-06-10 06:47:18 -0700 |
commit | d89e0716a15982528990efc888ad01bb2918e6e1 (patch) | |
tree | 771ec2fadafaa9f3d5267608ade74d0852aeade7 /src/gallium/drivers | |
parent | 416fc3b5ef8606408fd28ff0a2326e9e58a92632 (diff) |
panfrost: Fix stride check when mipmapping
Now that we support custom strides on mipmapped textures (theoretically,
at least), extend the stride check to support mipmaps. Fixes incorrect
strides of linear windows in Weston.
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Tomeu Vizoso <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_context.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index b08f50291fb..13bb4e1e74a 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1994,15 +1994,23 @@ panfrost_create_sampler_view( /* Check if we need to set a custom stride by computing the "expected" * stride and comparing it to what the BO actually wants. Only applies - * to linear textures TODO: Mipmap? */ + * to linear textures, since tiled/compressed textures have strict + * alignment requirements for their strides as it is */ - unsigned actual_stride = prsrc->bo->slices[0].stride; + unsigned first_level = template->u.tex.first_level; + unsigned last_level = template->u.tex.last_level; - if (prsrc->bo->layout == PAN_LINEAR && - template->u.tex.last_level == 0 && - template->u.tex.first_level == 0 && - (texture->width0 * bytes_per_pixel) != actual_stride) { - usage2_layout |= MALI_TEX_MANUAL_STRIDE; + if (prsrc->bo->layout == PAN_LINEAR) { + for (unsigned l = first_level; l <= last_level; ++l) { + unsigned actual_stride = prsrc->bo->slices[l].stride; + unsigned width = u_minify(texture->width0, l); + unsigned comp_stride = width * bytes_per_pixel; + + if (comp_stride != actual_stride) { + usage2_layout |= MALI_TEX_MANUAL_STRIDE; + break; + } + } } struct mali_texture_descriptor texture_descriptor = { |