Mesa (master): panfrost: Implement sampling from non-zero initial levels

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 17 16:00:52 UTC 2019


Module: Mesa
Branch: master
Commit: 531715431fa827cbb2eba26a6c993c104d677990
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=531715431fa827cbb2eba26a6c993c104d677990

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Wed Jun 12 15:07:09 2019 -0700

panfrost: Implement sampling from non-zero initial levels

In preparation for more complex mipmap operations. glGenerateMipmap() in
particular, as implemented by u_blitter, requires reading from non-zero
initial mip levels.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>

---

 src/gallium/drivers/panfrost/pan_context.c | 29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index d872884077f..c877ae5396e 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -948,21 +948,27 @@ panfrost_upload_tex(
         if (!view)
                 return (mali_ptr) NULL;
 
-        struct pipe_resource *tex_rsrc = view->base.texture;
-        struct panfrost_resource *rsrc = (struct panfrost_resource *) tex_rsrc;
+        struct pipe_sampler_view *pview = &view->base;
+        struct panfrost_resource *rsrc = pan_resource(pview->texture);
 
         /* Do we interleave an explicit stride with every element? */
 
         bool has_manual_stride =
                 view->hw.format.usage2 & MALI_TEX_MANUAL_STRIDE;
 
+        /* For easy access */
+
+        assert(pview->target != PIPE_BUFFER);
+        unsigned first_level = pview->u.tex.first_level;
+        unsigned last_level = pview->u.tex.last_level;
+
         /* Inject the addresses in, interleaving mip levels, cube faces, and
          * strides in that order */
 
         unsigned idx = 0;
 
-        for (unsigned l = 0; l <= tex_rsrc->last_level; ++l) {
-                for (unsigned f = 0; f < tex_rsrc->array_size; ++f) {
+        for (unsigned l = first_level; l <= last_level; ++l) {
+                for (unsigned f = 0; f < pview->texture->array_size; ++f) {
                         view->hw.payload[idx++] =
                                 panfrost_get_texture_address(rsrc, l, f);
 
@@ -2108,9 +2114,9 @@ panfrost_create_sampler_view(
         }
 
         struct mali_texture_descriptor texture_descriptor = {
-                .width = MALI_POSITIVE(texture->width0),
-                .height = MALI_POSITIVE(texture->height0),
-                .depth = MALI_POSITIVE(texture->depth0),
+                .width = MALI_POSITIVE(u_minify(texture->width0, first_level)),
+                .height = MALI_POSITIVE(u_minify(texture->height0, first_level)),
+                .depth = MALI_POSITIVE(u_minify(texture->depth0, first_level)),
                 .array_size = MALI_POSITIVE(array_size),
 
                 /* TODO: Decode */
@@ -2127,14 +2133,7 @@ panfrost_create_sampler_view(
                 .swizzle = panfrost_translate_swizzle_4(user_swizzle)
         };
 
-        /* TODO: Other base levels require adjusting dimensions / level numbers / etc */
-        assert (template->u.tex.first_level == 0);
-
-        /* Disable mipmapping for now to avoid regressions while automipmapping
-         * is being implemented. TODO: Remove me once automipmaps work */
-
-        //texture_descriptor.nr_mipmap_levels = template->u.tex.last_level - template->u.tex.first_level;
-        texture_descriptor.nr_mipmap_levels = 0;
+        //texture_descriptor.nr_mipmap_levels = last_level - first_level;
 
         so->hw = texture_descriptor;
 




More information about the mesa-commit mailing list