Mesa (master): panfrost: Only clamp the LOD to disable mipmapping when needed

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Feb 4 15:06:13 UTC 2020


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

Author: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Date:   Tue Feb  4 08:57:52 2020 +0100

panfrost: Only clamp the LOD to disable mipmapping when needed

Otherwise, we may be incrementing max_lod over the limit, causing a
DATA_INVALID_FAULT.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3692>

---

 src/gallium/drivers/panfrost/pan_context.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index c32254adf81..585fefa7066 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1801,16 +1801,17 @@ panfrost_create_sampler_state(
          * essentially -- remember these are fixed point numbers, so
          * epsilon=1/256) */
 
-        if (cso->min_mip_filter == PIPE_TEX_MIPFILTER_NONE)
+        if (cso->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) {
                 sampler_descriptor.max_lod = sampler_descriptor.min_lod;
 
-        /* Enforce that there is something in the middle by adding epsilon*/
+                /* Enforce that there is something in the middle by adding epsilon*/
 
-        if (sampler_descriptor.min_lod == sampler_descriptor.max_lod)
-                sampler_descriptor.max_lod++;
+                if (sampler_descriptor.min_lod == sampler_descriptor.max_lod)
+                        sampler_descriptor.max_lod++;
 
-        /* Sanity check */
-        assert(sampler_descriptor.max_lod > sampler_descriptor.min_lod);
+                /* Sanity check */
+                assert(sampler_descriptor.max_lod > sampler_descriptor.min_lod);
+        }
 
         so->hw = sampler_descriptor;
 



More information about the mesa-commit mailing list