kmsro: Add freedreno renderonly support
authorJonathan Marek <jonathan@marek.ca>
Mon, 28 Jan 2019 02:05:33 +0000 (21:05 -0500)
committerRob Clark <robdclark@gmail.com>
Mon, 28 Jan 2019 23:25:27 +0000 (18:25 -0500)
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
meson.build
src/gallium/winsys/kmsro/drm/Makefile.am
src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
src/gallium/winsys/kmsro/drm/meson.build

index 4a81cd0553256e01fdbec0bc3bd97463ee65c095..d975b0dbf4be5dce360ceabeb48e863d6a6dc168 100644 (file)
@@ -209,8 +209,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)
-  error('kmsro driver requires one or more renderonly drivers (vc4, etnaviv)')
+if with_gallium_kmsro and not (with_gallium_vc4 or with_gallium_etnaviv or with_gallium_freedreno)
+  error('kmsro driver requires one or more renderonly drivers (vc4, etnaviv, freedreno)')
 endif
 if with_gallium_tegra and not with_gallium_nouveau
   error('tegra driver requires nouveau driver')
index 0092206539c3a680757c2d83f4f0243ecf76f692..8c51839b0644838f491f4f9c444f52508f537245 100644 (file)
@@ -37,6 +37,10 @@ if HAVE_GALLIUM_VC4
 AM_CFLAGS += -DGALLIUM_VC4
 endif
 
+if HAVE_GALLIUM_FREEDRENO
+AM_CFLAGS += -DGALLIUM_FREEDRENO
+endif
+
 noinst_LTLIBRARIES = libkmsrodrm.la
 
 libkmsrodrm_la_SOURCES = $(C_SOURCES)
index e086c0858f057a2e5342f44e7808adb06bbb185d..36d4e412486834906d86a49bf5cf063be5ac3234 100644 (file)
@@ -28,6 +28,7 @@
 #include "kmsro_drm_public.h"
 #include "vc4/drm/vc4_drm_public.h"
 #include "etnaviv/drm/etnaviv_drm_public.h"
+#include "freedreno/drm/freedreno_drm_public.h"
 #include "xf86drm.h"
 
 #include "pipe/p_screen.h"
@@ -69,5 +70,17 @@ struct pipe_screen *kmsro_drm_screen_create(int fd)
    }
 #endif
 
+#if defined(GALLIUM_FREEDRENO)
+   ro.gpu_fd = drmOpenWithType("msm", NULL, DRM_NODE_RENDER);
+   if (ro.gpu_fd >= 0) {
+      ro.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
+      screen = fd_drm_screen_create(ro.gpu_fd, &ro);
+      if (!screen)
+         close(ro.gpu_fd);
+
+      return screen;
+   }
+#endif
+
    return screen;
 }
index e8c350e081bcb42c72882909a8db70aca5361cc1..5ea53dd44bfcb2d1e763cb98735103c3ee009559 100644 (file)
@@ -25,6 +25,9 @@ endif
 if with_gallium_vc4
   kmsro_c_args += '-DGALLIUM_VC4'
 endif
+if with_gallium_freedreno
+  kmsro_c_args += '-DGALLIUM_FREEDRENO'
+endif
 
 libkmsrowinsys = static_library(
   'kmsrowinsys',