etnaviv: update logic to determine uniform limits
authorChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 14 Aug 2019 09:39:13 +0000 (11:39 +0200)
committerChristian Gmeiner <christian.gmeiner@gmail.com>
Wed, 14 Aug 2019 10:29:56 +0000 (12:29 +0200)
Taken 1:1 from the header file.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach l.stach@pengutronix.de
src/gallium/drivers/etnaviv/etnaviv_screen.c

index 28b577bc3a545ee025812247495c75c046d59377..e392f575e712c0f183ad36e71e6ed588b3f46062 100644 (file)
@@ -529,14 +529,36 @@ etna_screen_query_dmabuf_modifiers(struct pipe_screen *pscreen,
 static void
 etna_determine_uniform_limits(struct etna_screen *screen)
 {
-   /* from QueryShaderCaps in kernel driver */
-   if (screen->model < chipModel_GC4000) {
-      screen->specs.max_vs_uniforms = 168;
+   /* values for the non unified case are taken from
+    * gcmCONFIGUREUNIFORMS in the Vivante kernel driver file
+    * drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h.
+    */
+   if (screen->model == chipModel_GC2000 &&
+       (screen->revision == 0x5118 || screen->revision == 0x5140)) {
+      screen->specs.max_vs_uniforms = 256;
       screen->specs.max_ps_uniforms = 64;
-   } else {
+   } else if (screen->specs.num_constants == 320) {
+      screen->specs.max_vs_uniforms = 256;
+      screen->specs.max_ps_uniforms = 64;
+   } else if (screen->specs.num_constants > 256 &&
+              screen->model == chipModel_GC1000) {
+      /* All GC1000 series chips can only support 64 uniforms for ps on non-unified const mode. */
+      screen->specs.max_vs_uniforms = 256;
+      screen->specs.max_ps_uniforms = 64;
+   } else if (screen->specs.num_constants > 256) {
       screen->specs.max_vs_uniforms = 256;
       screen->specs.max_ps_uniforms = 256;
    }
+    else if (screen->specs.num_constants == 256)
+    {
+      screen->specs.max_vs_uniforms = 256;
+      screen->specs.max_ps_uniforms = 256;
+    }
+    else
+    {
+      screen->specs.max_vs_uniforms = 168;
+      screen->specs.max_ps_uniforms = 64;
+    }
 }
 
 static bool