panfrost: Include sample count in payload estimates
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 15 Jul 2020 15:39:08 +0000 (11:39 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 15 Jul 2020 22:19:37 +0000 (22:19 +0000)
Otherwise we might not reserve enough space.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5929>

src/gallium/drivers/panfrost/pan_context.c
src/panfrost/encoder/pan_texture.c
src/panfrost/encoder/pan_texture.h

index 70ef7249362d7a440d9a1cec0c6bd62a1a2e1b4f..6a0280ec53333a711b2d731417af6608e37990bf 100644 (file)
@@ -986,6 +986,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,
                                 type, prsrc->layout);
 
                 so->bo = panfrost_bo_create(device, size, 0);
@@ -1013,6 +1014,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,
                                 type, prsrc->layout);
                 size += sizeof(struct mali_texture_descriptor);
 
index c270ececd45129a0240fdee3cafabf6799e9e3f2..da436ea7318f64856a688ffe5a3ea6c8debd6170 100644 (file)
@@ -125,6 +125,7 @@ static unsigned
 panfrost_texture_num_elements(
                 unsigned first_level, unsigned last_level,
                 unsigned first_layer, unsigned last_layer,
+                unsigned nr_samples,
                 bool is_cube, bool manual_stride)
 {
         unsigned first_face  = 0, last_face = 0;
@@ -137,7 +138,7 @@ panfrost_texture_num_elements(
         unsigned levels = 1 + last_level - first_level;
         unsigned layers = 1 + last_layer - first_layer;
         unsigned faces  = 1 + last_face  - first_face;
-        unsigned num_elements = levels * layers * faces;
+        unsigned num_elements = levels * layers * faces * MAX2(nr_samples, 1);
 
         if (manual_stride)
                 num_elements *= 2;
@@ -155,6 +156,7 @@ unsigned
 panfrost_estimate_texture_payload_size(
                 unsigned first_level, unsigned last_level,
                 unsigned first_layer, unsigned last_layer,
+                unsigned nr_samples,
                 enum mali_texture_type type, enum mali_texture_layout layout)
 {
         /* Assume worst case */
@@ -163,6 +165,7 @@ panfrost_estimate_texture_payload_size(
         unsigned elements = panfrost_texture_num_elements(
                         first_level, last_level,
                         first_layer, last_layer,
+                        nr_samples,
                         type == MALI_TEX_CUBE, manual_stride);
 
         return sizeof(mali_ptr) * elements;
index e8c68c005bb51f30fe63d14513f89e6129ea1ad7..ea1a1ff0fe1fdc05f08848980abb0581cc625102 100644 (file)
@@ -72,6 +72,7 @@ unsigned
 panfrost_estimate_texture_payload_size(
                 unsigned first_level, unsigned last_level,
                 unsigned first_layer, unsigned last_layer,
+                unsigned nr_samples,
                 enum mali_texture_type type, enum mali_texture_layout layout);
 
 void