[virglrenderer-devel] [PATCH] renderer: fix resource checking of mip-map level

Rob Herring robh at kernel.org
Mon Aug 1 12:48:23 UTC 2016


Commit ad4f0f194167 ("renderer: reject large LOD values") causes a
regression with Android.

According to Rob Clark, "last mip-map level is basically the number of
times you could half the width+height (round up to 1) until it is 1x1.
So something like 1x512 would have last_level=8."

Cc: Marc-André Lureau <marcandre.lureau at redhat.com>
Cc: Rob Clark <robdclark at gmail.com>
Signed-off-by: Rob Herring <robh at kernel.org>
---
 src/vrend_renderer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index dd98cc7..ab85498 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -4030,7 +4030,7 @@ static int check_resource_valid(struct vrend_renderer_resource_create_args *args
       /* buffer and rect textures can't have mipmaps */
       if (args->target == PIPE_BUFFER || args->target == PIPE_TEXTURE_RECT)
          return -1;
-      if (args->last_level > (floor(log2(MAX2(args->width, args->width))) + 1))
+      if (args->last_level > (floor(log2(MAX2(args->width, args->height))) + 1))
          return -1;
    }
    if (args->flags != 0 && args->flags != VIRGL_RESOURCE_Y_0_TOP)
-- 
2.9.2



More information about the virglrenderer-devel mailing list