kmsro: Add lima renderonly support
authorRob Herring <robh@kernel.org>
Fri, 25 Jan 2019 16:39:40 +0000 (10:39 -0600)
committerQiang Yu <yuq825@gmail.com>
Thu, 11 Apr 2019 01:57:53 +0000 (09:57 +0800)
Enable using lima for KMS renderonly. This still needs KMS driver
name mapping to kmsro to be used automatically.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
meson.build
src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
src/gallium/winsys/kmsro/drm/meson.build

index ae52ac137c0df6ca364e292c0a876b70309aa1d4..0e8aa25d336259d0c90db403540534234582e3f2 100644 (file)
@@ -217,8 +217,8 @@ endif
 if with_dri_i915 and with_gallium_i915
   error('Only one i915 provider can be built')
 endif
-if with_gallium_kmsro and not (with_gallium_vc4 or with_gallium_etnaviv or with_gallium_freedreno or with_gallium_panfrost)
-  error('kmsro driver requires one or more renderonly drivers (vc4, etnaviv, freedreno, panfrost)')
+if with_gallium_kmsro and not (with_gallium_vc4 or with_gallium_etnaviv or with_gallium_freedreno or with_gallium_panfrost or with_gallium_lima)
+  error('kmsro driver requires one or more renderonly drivers (vc4, etnaviv, freedreno, panfrost, lima)')
 endif
 if with_gallium_tegra and not with_gallium_nouveau
   error('tegra driver requires nouveau driver')
index 59f2c28a2eb5777a8e3c6a0cbf336fd7671a5ae6..4869e6329f937b568d45d3a072ca74ce6d2074d1 100644 (file)
@@ -30,6 +30,7 @@
 #include "etnaviv/drm/etnaviv_drm_public.h"
 #include "freedreno/drm/freedreno_drm_public.h"
 #include "panfrost/drm/panfrost_drm_public.h"
+#include "lima/drm/lima_drm_public.h"
 #include "xf86drm.h"
 
 #include "pipe/p_screen.h"
@@ -96,7 +97,17 @@ struct pipe_screen *kmsro_drm_screen_create(int fd)
    }
 #endif
 
+#if defined(GALLIUM_LIMA)
+   ro.gpu_fd = drmOpenWithType("lima", NULL, DRM_NODE_RENDER);
+   if (ro.gpu_fd >= 0) {
+      ro.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
+      screen = lima_drm_screen_create_renderonly(&ro);
+      if (!screen)
+         close(ro.gpu_fd);
 
+      return screen;
+   }
+#endif
 
    return screen;
 }
index 51246b68e34ae84906ecbcd693f13c40cd6a78f7..02064025b4d03d7b158cc1d160d6d6f40041be18 100644 (file)
@@ -22,6 +22,9 @@ kmsro_c_args = []
 if with_gallium_etnaviv
   kmsro_c_args += '-DGALLIUM_ETNAVIV'
 endif
+if with_gallium_lima
+  kmsro_c_args += '-DGALLIUM_LIMA'
+endif
 if with_gallium_vc4
   kmsro_c_args += '-DGALLIUM_VC4'
 endif