lima: add Allwinner H5 support
authorPatrick Lerda <patrick9876@free.fr>
Sun, 12 May 2019 22:03:58 +0000 (00:03 +0200)
committerPatrick Lerda <patrick9876@free.fr>
Mon, 13 May 2019 11:32:55 +0000 (13:32 +0200)
The H5 hardware variant requires a specific plb_max_blk number. This
value can't be probed at the hardware level.

Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
src/gallium/drivers/lima/lima_screen.c

index 0eb472acebd2b9bd63bf8d3c2256903fac423f42..31478c76f34a57149328b98f603e49db36b09070 100644 (file)
@@ -348,13 +348,31 @@ lima_screen_get_compiler_options(struct pipe_screen *pscreen,
 static bool
 lima_screen_set_plb_max_blk(struct lima_screen *screen)
 {
-   if (lima_plb_max_blk)
+   if (lima_plb_max_blk) {
       screen->plb_max_blk = lima_plb_max_blk;
-   else if (screen->gpu_type == DRM_LIMA_PARAM_GPU_ID_MALI450)
+      return true;
+   }
+
+   if (screen->gpu_type == DRM_LIMA_PARAM_GPU_ID_MALI450)
       screen->plb_max_blk = 4096;
    else
       screen->plb_max_blk = 512;
 
+   drmDevicePtr devinfo;
+
+   if (drmGetDevice2(screen->fd, 0, &devinfo))
+      return false;
+
+   if (devinfo->bustype == DRM_BUS_PLATFORM && devinfo->deviceinfo.platform) {
+      char **compatible = devinfo->deviceinfo.platform->compatible;
+
+      if (compatible && *compatible)
+         if (!strcmp("allwinner,sun50i-h5-mali", *compatible))
+            screen->plb_max_blk = 2048;
+   }
+
+   drmFreeDevice(&devinfo);
+
    return true;
 }