From: Tomeu Vizoso Date: Tue, 4 Feb 2020 07:57:52 +0000 (+0100) Subject: panfrost: Only clamp the LOD to disable mipmapping when needed X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64541dd69875d043d90525769901d18fdde4b68b;p=mesa.git 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 Reviewed-by: Alyssa Rosenzweig Part-of: --- 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;