[Lima] [PATCH 8/9] kmsro: Add lima renderonly support

Qiang Yu yuq825 at gmail.com
Sat Mar 16 01:28:53 UTC 2019


From: Rob Herring <robh at kernel.org>

Enable using lima for KMS renderonly. This still needs KMS driver
name mapping to kmsro to be used automatically.

Signed-off-by: Rob Herring <robh at kernel.org>
Signed-off-by: Qiang Yu <yuq825 at gmail.com>
---
 meson.build                                     |  4 ++--
 src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c | 11 +++++++++++
 src/gallium/winsys/kmsro/drm/meson.build        |  3 +++
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 98bbe756b39..318c4d59478 100644
--- a/meson.build
+++ b/meson.build
@@ -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')
diff --git a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
index 7752474f8aa..0bb8d437cd6 100644
--- a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
+++ b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
@@ -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"
@@ -105,7 +106,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;
 }
diff --git a/src/gallium/winsys/kmsro/drm/meson.build b/src/gallium/winsys/kmsro/drm/meson.build
index 51246b68e34..02064025b4d 100644
--- a/src/gallium/winsys/kmsro/drm/meson.build
+++ b/src/gallium/winsys/kmsro/drm/meson.build
@@ -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
-- 
2.17.1



More information about the lima mailing list