panfrost: Stop forcing depth to nr_samples
authorBoris Brezillon <boris.brezillon@collabora.com>
Tue, 17 Nov 2020 19:44:52 +0000 (20:44 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Wed, 25 Nov 2020 15:21:10 +0000 (16:21 +0100)
Those are two different things, and the fact that Midgard use the same
offset in the texture descriptor for both things is just an
implementation detail.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7653>

src/gallium/drivers/panfrost/pan_context.c
src/panfrost/lib/midgard.xml
src/panfrost/lib/pan_texture.c

index 990cce8..fed929a 100644 (file)
@@ -994,15 +994,9 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
         }
 
         /* MSAA only supported for 2D textures (and 2D texture arrays via an
-         * extension currently unimplemented */
+         * extension currently unimplemented) */
 
-        if (so->base.target == PIPE_TEXTURE_2D) {
-                assert(depth == 1);
-                depth = texture->nr_samples;
-        } else {
-                /* MSAA only supported for 2D textures */
-                assert(texture->nr_samples <= 1);
-        }
+        assert(texture->nr_samples <= 1 || so->base.target == PIPE_TEXTURE_2D);
 
         enum mali_texture_dimension type =
                 panfrost_translate_texture_dimension(so->base.target);
index 18fa4bb..f4d0b00 100644 (file)
   <struct name="Midgard Texture" size="8">
     <field name="Width" size="16" start="0:0" type="uint" modifier="minus(1)"/>
     <field name="Height" size="16" start="0:16" type="uint" modifier="minus(1)"/>
-    <field name="Depth" size="16" start="1:0" type="uint" modifier="minus(1)"/>
+    <field name="Depth" size="16" start="1:0" type="uint" modifier="minus(1)" default="1"/>
+    <field name="Sample count" size="16" start="1:0" type="uint" modifier="minus(1)" default="1"/>
     <field name="Array size" size="16" start="1:16" type="uint" modifier="minus(1)"/>
     <field name="Format" size="22" start="2:0" type="uint"/>
     <field name="Dimension" size="2" start="2:22" type="Texture Dimension"/>
index c28b361..8fb10d8 100644 (file)
@@ -392,7 +392,10 @@ panfrost_new_texture(
         pan_pack(out, MIDGARD_TEXTURE, cfg) {
                 cfg.width = u_minify(width, first_level);
                 cfg.height = u_minify(height, first_level);
-                cfg.depth = u_minify(depth, first_level);
+                if (dim == MALI_TEXTURE_DIMENSION_3D)
+                        cfg.depth = u_minify(depth, first_level);
+                else
+                        cfg.sample_count = MAX2(1, nr_samples);
                 cfg.array_size = array_size;
                 cfg.format = panfrost_pipe_format_v6[format].hw;
                 cfg.dimension = dim;