From 41c06deb63036181df5db8e3e6011211ac874d5c Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 30 Jun 2020 16:43:32 -0400 Subject: [PATCH] panfrost: Index texture by sample This will allow MSAA to route through. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 2 ++ src/gallium/drivers/panfrost/pan_mfbd.c | 6 +++--- src/gallium/drivers/panfrost/pan_resource.c | 4 ++-- src/gallium/drivers/panfrost/pan_resource.h | 2 +- src/gallium/drivers/panfrost/pan_sfbd.c | 2 +- src/panfrost/encoder/pan_texture.c | 9 +++++++-- src/panfrost/encoder/pan_texture.h | 4 +++- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 98e67adf4f7..5514e29a426 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -980,6 +980,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, so->base.u.tex.last_level, so->base.u.tex.first_layer, so->base.u.tex.last_layer, + texture->nr_samples, prsrc->cubemap_stride, panfrost_translate_swizzle_4(composed_swizzle), prsrc->bo->gpu, @@ -1006,6 +1007,7 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so, so->base.u.tex.last_level, so->base.u.tex.first_layer, so->base.u.tex.last_layer, + texture->nr_samples, prsrc->cubemap_stride, panfrost_translate_swizzle_4(user_swizzle), prsrc->bo->gpu, diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c index 41f21128198..274fff45aaa 100644 --- a/src/gallium/drivers/panfrost/pan_mfbd.c +++ b/src/gallium/drivers/panfrost/pan_mfbd.c @@ -211,7 +211,7 @@ panfrost_mfbd_set_cbuf( assert(surf->u.tex.last_layer == first_layer); int stride = rsrc->slices[level].stride; - mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer); + mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer, 0); rt->format = panfrost_mfbd_format(surf); @@ -274,7 +274,7 @@ panfrost_mfbd_set_zsbuf( unsigned first_layer = surf->u.tex.first_layer; assert(surf->u.tex.last_layer == first_layer); - mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer); + mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer, 0); if (rsrc->layout == MALI_TEXTURE_AFBC) { /* The only Z/S format we can compress is Z24S8 or variants @@ -336,7 +336,7 @@ panfrost_mfbd_set_zsbuf( struct panfrost_resource *stencil = rsrc->separate_stencil; struct panfrost_slice stencil_slice = stencil->slices[level]; - fbx->ds_linear.stencil = panfrost_get_texture_address(stencil, level, first_layer); + fbx->ds_linear.stencil = panfrost_get_texture_address(stencil, level, first_layer, 0); fbx->ds_linear.stencil_stride = stencil_slice.stride; } diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index d0879ba00c9..a8362bee8a9 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -891,10 +891,10 @@ panfrost_generate_mipmap( mali_ptr panfrost_get_texture_address( struct panfrost_resource *rsrc, - unsigned level, unsigned face) + unsigned level, unsigned face, unsigned sample) { bool is_3d = rsrc->base.target == PIPE_TEXTURE_3D; - return rsrc->bo->gpu + panfrost_texture_offset(rsrc->slices, is_3d, rsrc->cubemap_stride, level, face); + return rsrc->bo->gpu + panfrost_texture_offset(rsrc->slices, is_3d, rsrc->cubemap_stride, level, face, sample); } /* Given a resource that has already been allocated, hint that it should use a diff --git a/src/gallium/drivers/panfrost/pan_resource.h b/src/gallium/drivers/panfrost/pan_resource.h index c6226cbe272..392e988a182 100644 --- a/src/gallium/drivers/panfrost/pan_resource.h +++ b/src/gallium/drivers/panfrost/pan_resource.h @@ -94,7 +94,7 @@ pan_transfer(struct pipe_transfer *p) mali_ptr panfrost_get_texture_address( struct panfrost_resource *rsrc, - unsigned level, unsigned face); + unsigned level, unsigned face, unsigned sample); void panfrost_resource_screen_init(struct pipe_screen *screen); diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c index 7579c4608f9..769fbd79e3f 100644 --- a/src/gallium/drivers/panfrost/pan_sfbd.c +++ b/src/gallium/drivers/panfrost/pan_sfbd.c @@ -134,7 +134,7 @@ panfrost_sfbd_set_cbuf( assert(surf->u.tex.last_layer == first_layer); signed stride = rsrc->slices[level].stride; - mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer); + mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer, 0); fb->format = panfrost_sfbd_format(surf); diff --git a/src/panfrost/encoder/pan_texture.c b/src/panfrost/encoder/pan_texture.c index d51ff0dff72..54a5398e299 100644 --- a/src/panfrost/encoder/pan_texture.c +++ b/src/panfrost/encoder/pan_texture.c @@ -197,6 +197,7 @@ panfrost_emit_texture_payload( unsigned width, unsigned height, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer, + unsigned nr_samples, unsigned cube_stride, bool manual_stride, mali_ptr base, @@ -246,6 +247,7 @@ panfrost_new_texture( enum mali_texture_layout layout, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer, + unsigned nr_samples, unsigned cube_stride, unsigned swizzle, mali_ptr base, @@ -293,6 +295,7 @@ panfrost_new_texture( width, height, first_level, last_level, first_layer, last_layer, + nr_samples, cube_stride, manual_stride, base, @@ -309,6 +312,7 @@ panfrost_new_texture_bifrost( enum mali_texture_layout layout, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer, + unsigned nr_samples, unsigned cube_stride, unsigned swizzle, mali_ptr base, @@ -330,6 +334,7 @@ panfrost_new_texture_bifrost( width, height, first_level, last_level, first_layer, last_layer, + nr_samples, cube_stride, true, /* Stride explicit on Bifrost */ base, @@ -390,8 +395,8 @@ panfrost_get_layer_stride(struct panfrost_slice *slices, bool is_3d, unsigned cu * the base address of a texture to get the address to that level/face */ unsigned -panfrost_texture_offset(struct panfrost_slice *slices, bool is_3d, unsigned cube_stride, unsigned level, unsigned face) +panfrost_texture_offset(struct panfrost_slice *slices, bool is_3d, unsigned cube_stride, unsigned level, unsigned face, unsigned sample) { unsigned layer_stride = panfrost_get_layer_stride(slices, is_3d, cube_stride, level); - return slices[level].offset + (face * layer_stride); + return slices[level].offset + (face * layer_stride) + (sample * slices[level].size0); } diff --git a/src/panfrost/encoder/pan_texture.h b/src/panfrost/encoder/pan_texture.h index f84e0a484a5..e8c68c005bb 100644 --- a/src/panfrost/encoder/pan_texture.h +++ b/src/panfrost/encoder/pan_texture.h @@ -84,6 +84,7 @@ panfrost_new_texture( enum mali_texture_layout layout, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer, + unsigned nr_samples, unsigned cube_stride, unsigned swizzle, mali_ptr base, @@ -99,6 +100,7 @@ panfrost_new_texture_bifrost( enum mali_texture_layout layout, unsigned first_level, unsigned last_level, unsigned first_layer, unsigned last_layer, + unsigned nr_samples, unsigned cube_stride, unsigned swizzle, mali_ptr base, @@ -110,7 +112,7 @@ unsigned panfrost_get_layer_stride(struct panfrost_slice *slices, bool is_3d, unsigned cube_stride, unsigned level); unsigned -panfrost_texture_offset(struct panfrost_slice *slices, bool is_3d, unsigned cube_stride, unsigned level, unsigned face); +panfrost_texture_offset(struct panfrost_slice *slices, bool is_3d, unsigned cube_stride, unsigned level, unsigned face, unsigned sample); /* Formats */ -- 2.30.2