<div id="geary-body" dir="auto"><div>I forgot to mention, this patch depends on a virglrenderer MR that hasn't been merged yet. So it shouldn't be merged before the MR has landed.</div><div><br></div><div><a href="https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests/25">https://gitlab.freedesktop.org/virgl/virglrenderer/merge_requests/25</a></div><div><br></div></div><div id="geary-quote" dir="auto"><br>On Tue, Aug 14, 2018 at 3:02 PM, Erik Faye-Lund <erik.faye-lund@collabora.com> wrote:<br><blockquote type="cite"><div class="plaintext" style="white-space: pre-wrap;">Instead of doing conservative guesses, we should report the max levels
based on the max sizes we get from GL on the host.

Signed-off-by: Erik Faye-Lund <<a href="mailto:erik.faye-lund@collabora.com">erik.faye-lund@collabora.com</a>>
---
 src/gallium/drivers/virgl/virgl_hw.h     | 3 +++
 src/gallium/drivers/virgl/virgl_screen.c | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/src/gallium/drivers/virgl/virgl_hw.h b/src/gallium/drivers/virgl/virgl_hw.h
index b56f554b00..787452d328 100644
--- a/src/gallium/drivers/virgl/virgl_hw.h
+++ b/src/gallium/drivers/virgl/virgl_hw.h
@@ -347,6 +347,9 @@ struct virgl_caps_v2 {
         uint32_t max_compute_shared_memory_size;
         uint32_t max_compute_grid_size[3];
         uint32_t max_compute_block_size[3];
+        uint32_t max_texture_2d_size;
+        uint32_t max_texture_3d_size;
+        uint32_t max_texture_cube_size;
 };
 
 union virgl_caps {
diff --git a/src/gallium/drivers/virgl/virgl_screen.c b/src/gallium/drivers/virgl/virgl_screen.c
index 0ac976acbd..86063c66aa 100644
--- a/src/gallium/drivers/virgl/virgl_screen.c
+++ b/src/gallium/drivers/virgl/virgl_screen.c
@@ -24,6 +24,7 @@
 #include "util/u_format.h"
 #include "util/u_format_s3tc.h"
 #include "util/u_video.h"
+#include "util/u_math.h"
 #include "util/os_time.h"
 #include "pipe/p_defines.h"
 #include "pipe/p_screen.h"
@@ -72,10 +73,16 @@ virgl_get_param(struct pipe_screen *screen, enum pipe_cap param)
    case PIPE_CAP_TEXTURE_SWIZZLE:
       return 1;
    case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
+      if (vscreen->caps.caps.v2.max_texture_2d_size)
+         return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_2d_size);
       return 15; /* 16K x 16K */
    case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
+      if (vscreen->caps.caps.v2.max_texture_3d_size)
+         return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_3d_size);
       return 9; /* 256 x 256 x 256 */
    case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
+      if (vscreen->caps.caps.v2.max_texture_cube_size)
+         return 1 + util_logbase2(vscreen->caps.caps.v2.max_texture_cube_size);
       return 13; /* 4K x 4K */
    case PIPE_CAP_BLEND_EQUATION_SEPARATE:
       return 1;
<div>-- 
</div>2.17.1

_______________________________________________
mesa-dev mailing list
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
</div></blockquote></div>