[Mesa-dev] [PATCH] panfrost: Remove support for legacy kernels

Alyssa Rosenzweig alyssa at rosenzweig.io
Sun Mar 31 19:16:54 UTC 2019


Previously, there was minimal support for interoperating with legacy
kernels (reusing kernel modules originally designed for proprietary
legacy userspaces, rather than for upstream-friendly free software
stacks). Now that the Panfrost kernel is stabilising, this commit drops
the legacy code path.

Panfrost users need to use a modern, mainline kernel supporting the
Panfrost kernel driver from this commit forward.

Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
Cc: Tomeu Vizoso <tomeu.vizoso at collabora.com>
Cc: Rob Herring <robh at kernel.org>
---
 src/gallium/drivers/panfrost/.gitignore            |  1 -
 src/gallium/drivers/panfrost/meson.build           | 10 ----------
 src/gallium/drivers/panfrost/pan_drm.c             |  1 -
 src/gallium/drivers/panfrost/pan_public.h          |  2 +-
 src/gallium/drivers/panfrost/pan_screen.c          | 14 ++------------
 src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c    | 11 +----------
 .../winsys/panfrost/drm/panfrost_drm_public.h      |  2 +-
 .../winsys/panfrost/drm/panfrost_drm_winsys.c      |  6 +++---
 8 files changed, 8 insertions(+), 39 deletions(-)

diff --git a/src/gallium/drivers/panfrost/.gitignore b/src/gallium/drivers/panfrost/.gitignore
index 9d2c2c18bef..e69de29bb2d 100644
--- a/src/gallium/drivers/panfrost/.gitignore
+++ b/src/gallium/drivers/panfrost/.gitignore
@@ -1 +0,0 @@
-nondrm
diff --git a/src/gallium/drivers/panfrost/meson.build b/src/gallium/drivers/panfrost/meson.build
index e3569e73468..371a11a934b 100644
--- a/src/gallium/drivers/panfrost/meson.build
+++ b/src/gallium/drivers/panfrost/meson.build
@@ -62,16 +62,6 @@ compile_args_panfrost = [
   '-Wno-pointer-arith'
 ]
 
-overlay = join_paths(meson.source_root(), meson.current_source_dir(), 'nondrm/pan_nondrm.c')
-nondrm_overlay_check = run_command('ls', overlay)
-has_nondrm_overlay = nondrm_overlay_check.returncode() == 0
-
-if has_nondrm_overlay
-  files_panfrost += files('nondrm/pan_nondrm.c')
-  inc_panfrost += include_directories('nondrm/include')
-  compile_args_panfrost += '-DPAN_NONDRM_OVERLAY'
-endif
-
 midgard_nir_algebraic_c = custom_target(
   'midgard_nir_algebraic.c',
   input : 'midgard/midgard_nir_algebraic.py',
diff --git a/src/gallium/drivers/panfrost/pan_drm.c b/src/gallium/drivers/panfrost/pan_drm.c
index c30beaf2b50..4b8c197be0e 100644
--- a/src/gallium/drivers/panfrost/pan_drm.c
+++ b/src/gallium/drivers/panfrost/pan_drm.c
@@ -298,7 +298,6 @@ panfrost_drm_force_flush_fragment(struct panfrost_context *ctx,
         struct pipe_context *gallium = (struct pipe_context *) ctx;
         struct panfrost_screen *screen = pan_screen(gallium->screen);
         struct panfrost_drm *drm = (struct panfrost_drm *)screen->driver;
-        int ret;
 
         if (!screen->last_fragment_flushed) {
 		drmSyncobjWait(drm->fd, &ctx->out_sync, 1, INT64_MAX, 0, NULL);
diff --git a/src/gallium/drivers/panfrost/pan_public.h b/src/gallium/drivers/panfrost/pan_public.h
index f57fd6157f4..c7e72f94246 100644
--- a/src/gallium/drivers/panfrost/pan_public.h
+++ b/src/gallium/drivers/panfrost/pan_public.h
@@ -32,7 +32,7 @@ struct pipe_screen;
 struct renderonly;
 
 struct pipe_screen *
-panfrost_create_screen(int fd, struct renderonly *ro, bool is_drm);
+panfrost_create_screen(int fd, struct renderonly *ro);
 
 #ifdef __cplusplus
 }
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 682eb37f5c7..71c6175d069 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -63,7 +63,6 @@ DEBUG_GET_ONCE_FLAGS_OPTION(pan_debug, "PAN_MESA_DEBUG", debug_options, 0)
 int pan_debug = 0;
 
 struct panfrost_driver *panfrost_create_drm_driver(int fd);
-struct panfrost_driver *panfrost_create_nondrm_driver(int fd);
 
 const char *pan_counters_base = NULL;
 
@@ -549,7 +548,7 @@ panfrost_screen_get_compiler_options(struct pipe_screen *pscreen,
 }
 
 struct pipe_screen *
-panfrost_create_screen(int fd, struct renderonly *ro, bool is_drm)
+panfrost_create_screen(int fd, struct renderonly *ro)
 {
         struct panfrost_screen *screen = CALLOC_STRUCT(panfrost_screen);
 
@@ -567,16 +566,7 @@ panfrost_create_screen(int fd, struct renderonly *ro, bool is_drm)
                 }
         }
 
-        if (is_drm) {
-                screen->driver = panfrost_create_drm_driver(fd);
-        } else {
-#ifdef PAN_NONDRM_OVERLAY
-                screen->driver = panfrost_create_nondrm_driver(fd);
-#else
-                fprintf(stderr, "Legacy (non-DRM) operation requires out-of-tree overlay\n");
-                return NULL;
-#endif
-        }
+        screen->driver = panfrost_create_drm_driver(fd);
 
         /* Dump memory and/or performance counters iff asked for in the environment */
         const char *pantrace_base = getenv("PANTRACE_BASE");
diff --git a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
index 7752474f8aa..59f2c28a2eb 100644
--- a/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
+++ b/src/gallium/winsys/kmsro/drm/kmsro_drm_winsys.c
@@ -86,18 +86,9 @@ struct pipe_screen *kmsro_drm_screen_create(int fd)
 #if defined(GALLIUM_PANFROST)
    ro.gpu_fd = drmOpenWithType("panfrost", NULL, DRM_NODE_RENDER);
 
-   bool is_drm = true;
-   if (ro.gpu_fd < 0) {
-      /* For compatibility with legacy kernels, fallback on the non-DRM
-       * interface */
-
-      ro.gpu_fd = open("/dev/mali0", O_RDWR | O_CLOEXEC);
-      is_drm = false;
-   }
-
    if (ro.gpu_fd >= 0) {
       ro.create_for_resource = renderonly_create_kms_dumb_buffer_for_resource,
-      screen = panfrost_drm_screen_create_renderonly(&ro, is_drm);
+      screen = panfrost_drm_screen_create_renderonly(&ro);
       if (!screen)
          close(ro.gpu_fd);
 
diff --git a/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h b/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h
index 4709c429b96..8568ffd8de5 100644
--- a/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h
+++ b/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h
@@ -31,6 +31,6 @@ struct pipe_screen;
 struct renderonly;
 
 struct pipe_screen *panfrost_drm_screen_create(int drmFD);
-struct pipe_screen *panfrost_drm_screen_create_renderonly(struct renderonly *ro, bool is_drm);
+struct pipe_screen *panfrost_drm_screen_create_renderonly(struct renderonly *ro);
 
 #endif /* __PAN_DRM_PUBLIC_H__ */
diff --git a/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c b/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c
index 7d08743e23c..1852e1c662a 100644
--- a/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c
+++ b/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c
@@ -32,11 +32,11 @@
 struct pipe_screen *
 panfrost_drm_screen_create(int fd)
 {
-   return panfrost_create_screen(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL, true);
+   return panfrost_create_screen(fcntl(fd, F_DUPFD_CLOEXEC, 3), NULL);
 }
 
 struct pipe_screen *
-panfrost_drm_screen_create_renderonly(struct renderonly *ro, bool is_drm)
+panfrost_drm_screen_create_renderonly(struct renderonly *ro)
 {
-   return panfrost_create_screen(fcntl(ro->gpu_fd, F_DUPFD_CLOEXEC, 3), ro, is_drm);
+   return panfrost_create_screen(fcntl(ro->gpu_fd, F_DUPFD_CLOEXEC, 3), ro);
 }
-- 
2.20.1



More information about the mesa-dev mailing list