Module: Mesa
Branch: master
Commit: 87392385b59d37cec9eee7ff3b733300d72a6789
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=87392385b59d37cec9eee7ff3b733300d72a6789

Author: Eric Anholt <[email protected]>
Date:   Wed Sep 16 09:24:27 2020 -0700

gallium/drm: Define the DRM entrypoints in drm_helper.h

This cuts even more code duplication.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6751>

---

 .../auxiliary/pipe-loader/pipe_loader_drm.c        | 105 +++----------
 src/gallium/auxiliary/target-helpers/drm_helper.h  | 165 ++++++++++++++-------
 .../auxiliary/target-helpers/drm_helper_public.h   |  77 +++-------
 src/gallium/include/frontend/drm_driver.h          |  10 --
 src/gallium/targets/pipe-loader/meson.build        |   2 +-
 src/gallium/targets/pipe-loader/pipe_i915.c        |   3 -
 src/gallium/targets/pipe-loader/pipe_kmsro.c       |   3 -
 src/gallium/targets/pipe-loader/pipe_msm.c         |   3 -
 src/gallium/targets/pipe-loader/pipe_nouveau.c     |   3 -
 src/gallium/targets/pipe-loader/pipe_r300.c        |   3 -
 src/gallium/targets/pipe-loader/pipe_r600.c        |   3 -
 src/gallium/targets/pipe-loader/pipe_radeonsi.c    |   7 -
 src/gallium/targets/pipe-loader/pipe_vmwgfx.c      |   3 -
 13 files changed, 150 insertions(+), 237 deletions(-)

diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c 
b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
index c5126f16fd4..6cfb25d99d8 100644
--- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
+++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c
@@ -66,88 +66,25 @@ struct pipe_loader_drm_device {
 static const struct pipe_loader_ops pipe_loader_drm_ops;
 
 #ifdef GALLIUM_STATIC_TARGETS
-static const struct drm_driver_descriptor driver_descriptors[] = {
-    {
-        .driver_name = "i915",
-        .create_screen = pipe_i915_create_screen,
-    },
-    {
-        .driver_name = "iris",
-        .create_screen = pipe_iris_create_screen,
-        .driconf_xml = &iris_driconf_xml,
-    },
-    {
-        .driver_name = "nouveau",
-        .create_screen = pipe_nouveau_create_screen,
-    },
-    {
-        .driver_name = "r300",
-        .create_screen = pipe_r300_create_screen,
-    },
-    {
-        .driver_name = "r600",
-        .create_screen = pipe_r600_create_screen,
-    },
-    {
-        .driver_name = "radeonsi",
-        .create_screen = pipe_radeonsi_create_screen,
-        .driconf_xml = &radeonsi_driconf_xml,
-    },
-    {
-        .driver_name = "vmwgfx",
-        .create_screen = pipe_vmwgfx_create_screen,
-    },
-    {
-        .driver_name = "kgsl",
-        .create_screen = pipe_freedreno_create_screen,
-    },
-    {
-        .driver_name = "msm",
-        .create_screen = pipe_freedreno_create_screen,
-    },
-    {
-        .driver_name = "virtio_gpu",
-        .create_screen = pipe_virgl_create_screen,
-        .driconf_xml = &virgl_driconf_xml,
-    },
-    {
-        .driver_name = "v3d",
-        .create_screen = pipe_v3d_create_screen,
-        .driconf_xml = &v3d_driconf_xml,
-    },
-    {
-        .driver_name = "vc4",
-        .create_screen = pipe_vc4_create_screen,
-        .driconf_xml = &v3d_driconf_xml,
-    },
-    {
-        .driver_name = "panfrost",
-        .create_screen = pipe_panfrost_create_screen,
-    },
-    {
-        .driver_name = "etnaviv",
-        .create_screen = pipe_etna_create_screen,
-    },
-    {
-        .driver_name = "tegra",
-        .create_screen = pipe_tegra_create_screen,
-    },
-    {
-        .driver_name = "lima",
-        .create_screen = pipe_lima_create_screen,
-    },
-    {
-        .driver_name = "zink",
-        .create_screen = pipe_zink_create_screen,
-    },
+static const struct drm_driver_descriptor *driver_descriptors[] = {
+   &i915_driver_descriptor,
+   &iris_driver_descriptor,
+   &nouveau_driver_descriptor,
+   &r300_driver_descriptor,
+   &r600_driver_descriptor,
+   &radeonsi_driver_descriptor,
+   &vmwgfx_driver_descriptor,
+   &kgsl_driver_descriptor,
+   &msm_driver_descriptor,
+   &virtio_gpu_driver_descriptor,
+   &v3d_driver_descriptor,
+   &vc4_driver_descriptor,
+   &panfrost_driver_descriptor,
+   &etnaviv_driver_descriptor,
+   &tegra_driver_descriptor,
+   &lima_driver_descriptor,
+   &zink_driver_descriptor,
 };
-
-static const struct drm_driver_descriptor default_driver_descriptor = {
-        .driver_name = "kmsro",
-        .create_screen = pipe_kmsro_create_screen,
-        .driconf_xml = &v3d_driconf_xml,
-};
-
 #endif
 
 static const struct drm_driver_descriptor *
@@ -155,10 +92,10 @@ get_driver_descriptor(const char *driver_name, struct 
util_dl_library **plib)
 {
 #ifdef GALLIUM_STATIC_TARGETS
    for (int i = 0; i < ARRAY_SIZE(driver_descriptors); i++) {
-      if (strcmp(driver_descriptors[i].driver_name, driver_name) == 0)
-         return &driver_descriptors[i];
+      if (strcmp(driver_descriptors[i]->driver_name, driver_name) == 0)
+         return driver_descriptors[i];
    }
-   return &default_driver_descriptor;
+   return &kmsro_driver_descriptor;
 #else
    *plib = pipe_loader_find_module(driver_name, PIPE_SEARCH_DIR);
    if (!*plib)
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h 
b/src/gallium/auxiliary/target-helpers/drm_helper.h
index b40ce78d6a4..15e442e009d 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper.h
@@ -7,26 +7,62 @@
 #include "frontend/drm_driver.h"
 #include "util/driconf.h"
 
-/* The static pipe loader refers to all of the pipe_*_create_screen functions
- * for all drivers, regardless of whether they are configured in this Mesa
- * build, or whether they're included in the specific gallium target.  The
- * target will include this header with the #defines for the specific drivers
- * it's including, and the disabled drivers will have their create function
- * stubbed out.
+/**
+ * Instantiate a drm_driver_descriptor struct.
  */
-#define STUB_CREATE_SCREEN(driver)                                      \
-   struct pipe_screen *                                                 \
+#define DEFINE_DRM_DRIVER_DESCRIPTOR(descriptor_name, driver, driconf, func) \
+const struct drm_driver_descriptor descriptor_name = {         \
+   .driver_name = #driver,                                     \
+   .driconf_xml = driconf,                                     \
+   .create_screen = func,                                      \
+};
+
+/* The static pipe loader refers to the *_driver_descriptor structs for all
+ * drivers, regardless of whether they are configured in this Mesa build, or
+ * whether they're included in the specific gallium target.  The target (dri,
+ * vdpau, etc.) will include this header with the #defines for the specific
+ * drivers it's including, and the disabled drivers will have a descriptor
+ * with a stub create function logging the failure.
+ *
+ * The dynamic pipe loader instead has target/pipeloader/pipe_*.c including
+ * this header in a pipe_*.so for each driver which will have one driver's
+ * GALLIUM_* defined.  We make a single driver_descriptor entrypoint that is
+ * dlsym()ed by the dynamic pipe loader.
+ */
+
+#ifdef PIPE_LOADER_DYNAMIC
+
+#define DRM_DRIVER_DESCRIPTOR(driver, driconf)                          \
+   PUBLIC DEFINE_DRM_DRIVER_DESCRIPTOR(driver_descriptor, driver, driconf, 
pipe_##driver##_create_screen)
+
+#define DRM_DRIVER_DESCRIPTOR_STUB(driver)
+
+#define DRM_DRIVER_DESCRIPTOR_ALIAS(driver, alias, driconf)
+
+#else
+
+#define DRM_DRIVER_DESCRIPTOR(driver, driconf)                          \
+   DEFINE_DRM_DRIVER_DESCRIPTOR(driver##_driver_descriptor, driver, driconf, 
pipe_##driver##_create_screen)
+
+#define DRM_DRIVER_DESCRIPTOR_STUB(driver)                              \
+   static struct pipe_screen *                                          \
    pipe_##driver##_create_screen(int fd, const struct pipe_screen_config 
*config) \
    {                                                                    \
       fprintf(stderr, #driver ": driver missing\n");                    \
       return NULL;                                                      \
-   }
+   }                                                                    \
+   DRM_DRIVER_DESCRIPTOR(driver, NULL)
+
+#define DRM_DRIVER_DESCRIPTOR_ALIAS(driver, alias, driconf) \
+   DEFINE_DRM_DRIVER_DESCRIPTOR(alias##_driver_descriptor, alias, driconf, 
pipe_##driver##_create_screen)
+
+#endif
 
 #ifdef GALLIUM_I915
 #include "i915/drm/i915_drm_public.h"
 #include "i915/i915_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_i915_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct i915_winsys *iws;
@@ -39,15 +75,15 @@ pipe_i915_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = i915_screen_create(iws);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
-
+DRM_DRIVER_DESCRIPTOR(i915, NULL)
 #else
-STUB_CREATE_SCREEN(i915)
+DRM_DRIVER_DESCRIPTOR_STUB(i915)
 #endif
 
 #ifdef GALLIUM_IRIS
 #include "iris/drm/iris_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_iris_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -59,16 +95,16 @@ pipe_iris_create_screen(int fd, const struct 
pipe_screen_config *config)
 const char *iris_driconf_xml =
       #include "iris/iris_driinfo.h"
       ;
+DRM_DRIVER_DESCRIPTOR(iris, &iris_driconf_xml)
 
 #else
-STUB_CREATE_SCREEN(iris)
-const char *iris_driconf_xml = NULL;
+DRM_DRIVER_DESCRIPTOR_STUB(iris)
 #endif
 
 #ifdef GALLIUM_NOUVEAU
 #include "nouveau/drm/nouveau_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -76,15 +112,22 @@ pipe_nouveau_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = nouveau_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(nouveau, NULL)
 
 #else
-STUB_CREATE_SCREEN(nouveau)
+DRM_DRIVER_DESCRIPTOR_STUB(nouveau)
+#endif
+
+#if defined(GALLIUM_VC4) || defined(GALLIUM_V3D)
+   const char *v3d_driconf_xml =
+      #include "v3d/v3d_driinfo.h"
+      ;
 #endif
 
 #ifdef GALLIUM_KMSRO
 #include "kmsro/drm/kmsro_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_kmsro_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -92,9 +135,14 @@ pipe_kmsro_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = kmsro_drm_screen_create(fd, config);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+#if defined(GALLIUM_VC4) || defined(GALLIUM_V3D)
+DRM_DRIVER_DESCRIPTOR(kmsro, &v3d_driconf_xml)
+#else
+DRM_DRIVER_DESCRIPTOR(kmsro, NULL)
+#endif
 
 #else
-STUB_CREATE_SCREEN(kmsro)
+DRM_DRIVER_DESCRIPTOR_STUB(kmsro)
 #endif
 
 #ifdef GALLIUM_R300
@@ -102,7 +150,7 @@ STUB_CREATE_SCREEN(kmsro)
 #include "radeon/drm/radeon_drm_public.h"
 #include "r300/r300_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_r300_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
@@ -110,9 +158,10 @@ pipe_r300_create_screen(int fd, const struct 
pipe_screen_config *config)
    rw = radeon_drm_winsys_create(fd, config, r300_screen_create);
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(r300, NULL)
 
 #else
-STUB_CREATE_SCREEN(r300)
+DRM_DRIVER_DESCRIPTOR_STUB(r300)
 #endif
 
 #ifdef GALLIUM_R600
@@ -120,7 +169,7 @@ STUB_CREATE_SCREEN(r300)
 #include "radeon/drm/radeon_drm_public.h"
 #include "r600/r600_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_r600_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct radeon_winsys *rw;
@@ -128,15 +177,16 @@ pipe_r600_create_screen(int fd, const struct 
pipe_screen_config *config)
    rw = radeon_drm_winsys_create(fd, config, r600_screen_create);
    return rw ? debug_screen_wrap(rw->screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(r600, NULL)
 
 #else
-STUB_CREATE_SCREEN(r600)
+DRM_DRIVER_DESCRIPTOR_STUB(r600)
 #endif
 
 #ifdef GALLIUM_RADEONSI
 #include "radeonsi/si_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen = radeonsi_screen_create(fd, config);
@@ -147,17 +197,17 @@ pipe_radeonsi_create_screen(int fd, const struct 
pipe_screen_config *config)
 const char *radeonsi_driconf_xml =
       #include "radeonsi/si_driinfo.h"
       ;
+DRM_DRIVER_DESCRIPTOR(radeonsi, &radeonsi_driconf_xml)
 
 #else
-STUB_CREATE_SCREEN(radeonsi)
-const char *radeonsi_driconf_xml = NULL;
+DRM_DRIVER_DESCRIPTOR_STUB(radeonsi)
 #endif
 
 #ifdef GALLIUM_VMWGFX
 #include "svga/drm/svga_drm_public.h"
 #include "svga/svga_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct svga_winsys_screen *sws;
@@ -170,33 +220,35 @@ pipe_vmwgfx_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = svga_screen_create(sws);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(vmwgfx, NULL)
 
 #else
-STUB_CREATE_SCREEN(vmwgfx)
+DRM_DRIVER_DESCRIPTOR_STUB(vmwgfx)
 #endif
 
 #ifdef GALLIUM_FREEDRENO
 #include "freedreno/drm/freedreno_drm_public.h"
 
-struct pipe_screen *
-pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config)
+static struct pipe_screen *
+pipe_msm_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = fd_drm_screen_create(fd, NULL);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
-
+DRM_DRIVER_DESCRIPTOR(msm, NULL)
 #else
-STUB_CREATE_SCREEN(freedreno)
+DRM_DRIVER_DESCRIPTOR_STUB(msm)
 #endif
+DRM_DRIVER_DESCRIPTOR_ALIAS(msm, kgsl, NULL)
 
 #ifdef GALLIUM_VIRGL
 #include "virgl/drm/virgl_drm_public.h"
 #include "virgl/virgl_public.h"
 
-struct pipe_screen *
-pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config)
+static struct pipe_screen *
+pipe_virtio_gpu_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
@@ -207,16 +259,16 @@ pipe_virgl_create_screen(int fd, const struct 
pipe_screen_config *config)
 const char *virgl_driconf_xml =
       #include "virgl/virgl_driinfo.h"
       ;
+DRM_DRIVER_DESCRIPTOR(virtio_gpu, &virgl_driconf_xml)
 
 #else
-STUB_CREATE_SCREEN(virgl)
-const char *virgl_driconf_xml = NULL;
+DRM_DRIVER_DESCRIPTOR_STUB(virtio_gpu)
 #endif
 
 #ifdef GALLIUM_VC4
 #include "vc4/drm/vc4_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -224,14 +276,15 @@ pipe_vc4_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = vc4_drm_screen_create(fd, config);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(vc4, &v3d_driconf_xml)
 #else
-STUB_CREATE_SCREEN(vc4)
+DRM_DRIVER_DESCRIPTOR_STUB(vc4)
 #endif
 
 #ifdef GALLIUM_V3D
 #include "v3d/drm/v3d_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -240,19 +293,16 @@ pipe_v3d_create_screen(int fd, const struct 
pipe_screen_config *config)
    return screen ? debug_screen_wrap(screen) : NULL;
 }
 
-const char *v3d_driconf_xml =
-      #include "v3d/v3d_driinfo.h"
-      ;
+DRM_DRIVER_DESCRIPTOR(v3d, &v3d_driconf_xml)
 
 #else
-STUB_CREATE_SCREEN(v3d)
-const char *v3d_driconf_xml = NULL;
+DRM_DRIVER_DESCRIPTOR_STUB(v3d)
 #endif
 
 #ifdef GALLIUM_PANFROST
 #include "panfrost/drm/panfrost_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -260,31 +310,33 @@ pipe_panfrost_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = panfrost_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(panfrost, NULL)
 
 #else
-STUB_CREATE_SCREEN(panfrost)
+DRM_DRIVER_DESCRIPTOR_STUB(panfrost)
 #endif
 
 #ifdef GALLIUM_ETNAVIV
 #include "etnaviv/drm/etnaviv_drm_public.h"
 
-struct pipe_screen *
-pipe_etna_create_screen(int fd, const struct pipe_screen_config *config)
+static struct pipe_screen *
+pipe_etnaviv_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
 
    screen = etna_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(etnaviv, NULL)
 
 #else
-STUB_CREATE_SCREEN(etna)
+DRM_DRIVER_DESCRIPTOR_STUB(etnaviv)
 #endif
 
 #ifdef GALLIUM_TEGRA
 #include "tegra/drm/tegra_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -293,15 +345,16 @@ pipe_tegra_create_screen(int fd, const struct 
pipe_screen_config *config)
 
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(tegra, NULL)
 
 #else
-STUB_CREATE_SCREEN(tegra)
+DRM_DRIVER_DESCRIPTOR_STUB(tegra)
 #endif
 
 #ifdef GALLIUM_LIMA
 #include "lima/drm/lima_drm_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_lima_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
@@ -309,24 +362,26 @@ pipe_lima_create_screen(int fd, const struct 
pipe_screen_config *config)
    screen = lima_drm_screen_create(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(lima, NULL)
 
 #else
-STUB_CREATE_SCREEN(lima)
+DRM_DRIVER_DESCRIPTOR_STUB(lima)
 #endif
 
 #ifdef GALLIUM_ZINK
 #include "zink/zink_public.h"
 
-struct pipe_screen *
+static struct pipe_screen *
 pipe_zink_create_screen(int fd, const struct pipe_screen_config *config)
 {
    struct pipe_screen *screen;
    screen = zink_drm_create_screen(fd);
    return screen ? debug_screen_wrap(screen) : NULL;
 }
+DRM_DRIVER_DESCRIPTOR(zink, NULL)
 
 #else
-STUB_CREATE_SCREEN(zink)
+DRM_DRIVER_DESCRIPTOR_STUB(zink)
 #endif
 
 #endif /* DRM_HELPER_H */
diff --git a/src/gallium/auxiliary/target-helpers/drm_helper_public.h 
b/src/gallium/auxiliary/target-helpers/drm_helper_public.h
index ab0fc8d1b1a..5fd3084dfdb 100644
--- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h
+++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h
@@ -4,64 +4,23 @@
 struct pipe_screen;
 struct pipe_screen_config;
 
-extern const char *iris_driconf_xml;
-extern const char *radeonsi_driconf_xml;
-extern const char *v3d_driconf_xml;
-extern const char *virgl_driconf_xml;
-
-struct pipe_screen *
-pipe_i915_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_iris_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_nouveau_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_r300_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_r600_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_radeonsi_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_vmwgfx_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_freedreno_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_virgl_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_v3d_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_vc4_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_kmsro_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_etna_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_imx_drm_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_tegra_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_lima_create_screen(int fd, const struct pipe_screen_config *config);
-
-struct pipe_screen *
-pipe_zink_create_screen(int fd, const struct pipe_screen_config *config);
-
+extern const struct drm_driver_descriptor i915_driver_descriptor;
+extern const struct drm_driver_descriptor iris_driver_descriptor;
+extern const struct drm_driver_descriptor nouveau_driver_descriptor;
+extern const struct drm_driver_descriptor r300_driver_descriptor;
+extern const struct drm_driver_descriptor r600_driver_descriptor;
+extern const struct drm_driver_descriptor radeonsi_driver_descriptor;
+extern const struct drm_driver_descriptor vmwgfx_driver_descriptor;
+extern const struct drm_driver_descriptor kgsl_driver_descriptor;
+extern const struct drm_driver_descriptor msm_driver_descriptor;
+extern const struct drm_driver_descriptor virtio_gpu_driver_descriptor;
+extern const struct drm_driver_descriptor v3d_driver_descriptor;
+extern const struct drm_driver_descriptor vc4_driver_descriptor;
+extern const struct drm_driver_descriptor panfrost_driver_descriptor;
+extern const struct drm_driver_descriptor etnaviv_driver_descriptor;
+extern const struct drm_driver_descriptor tegra_driver_descriptor;
+extern const struct drm_driver_descriptor lima_driver_descriptor;
+extern const struct drm_driver_descriptor zink_driver_descriptor;
+extern const struct drm_driver_descriptor kmsro_driver_descriptor;
 
 #endif /* _DRM_HELPER_PUBLIC_H */
diff --git a/src/gallium/include/frontend/drm_driver.h 
b/src/gallium/include/frontend/drm_driver.h
index f8d77a79721..a51d02f0e8a 100644
--- a/src/gallium/include/frontend/drm_driver.h
+++ b/src/gallium/include/frontend/drm_driver.h
@@ -36,14 +36,4 @@ struct drm_driver_descriptor
 
 extern const struct drm_driver_descriptor driver_descriptor;
 
-/**
- * Instantiate a drm_driver_descriptor struct.
- */
-#define DRM_DRIVER_DESCRIPTOR(driver_name_str, driconf, func)  \
-const struct drm_driver_descriptor driver_descriptor = {       \
-   .driver_name = driver_name_str,                             \
-   .driconf_xml = driconf,                                     \
-   .create_screen = func,                                      \
-};
-
 #endif
diff --git a/src/gallium/targets/pipe-loader/meson.build 
b/src/gallium/targets/pipe-loader/meson.build
index 445289aa912..65f782f45ed 100644
--- a/src/gallium/targets/pipe-loader/meson.build
+++ b/src/gallium/targets/pipe-loader/meson.build
@@ -73,7 +73,7 @@ foreach x : pipe_loaders
     shared_library(
       'pipe_@0@'.format(x[1]),
       'pipe_@[email protected]'.format(x[1]),
-      c_args : [pipe_loader_comp_args],
+      c_args : [pipe_loader_comp_args, '-DPIPE_LOADER_DYNAMIC=1'],
       cpp_args : [pipe_loader_comp_args],
       gnu_symbol_visibility : 'hidden',
       link_args : pipe_loader_link_args,
diff --git a/src/gallium/targets/pipe-loader/pipe_i915.c 
b/src/gallium/targets/pipe-loader/pipe_i915.c
index 14e5a5ac3cf..82daf7083e5 100644
--- a/src/gallium/targets/pipe-loader/pipe_i915.c
+++ b/src/gallium/targets/pipe-loader/pipe_i915.c
@@ -3,6 +3,3 @@
 #include "frontend/drm_driver.h"
 #include "i915/drm/i915_drm_public.h"
 #include "i915/i915_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("i915", NULL, pipe_i915_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_kmsro.c 
b/src/gallium/targets/pipe-loader/pipe_kmsro.c
index 2e9626833e3..86e82e9a94b 100644
--- a/src/gallium/targets/pipe-loader/pipe_kmsro.c
+++ b/src/gallium/targets/pipe-loader/pipe_kmsro.c
@@ -2,6 +2,3 @@
 #include "target-helpers/inline_debug_helper.h"
 #include "frontend/drm_driver.h"
 #include "kmsro/drm/kmsro_drm_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("kmsro", NULL, pipe_kmsro_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_msm.c 
b/src/gallium/targets/pipe-loader/pipe_msm.c
index 28098e830ee..807ac109bb7 100644
--- a/src/gallium/targets/pipe-loader/pipe_msm.c
+++ b/src/gallium/targets/pipe-loader/pipe_msm.c
@@ -3,6 +3,3 @@
 #include "target-helpers/inline_debug_helper.h"
 #include "frontend/drm_driver.h"
 #include "freedreno/drm/freedreno_drm_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("msm", NULL, pipe_freedreno_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_nouveau.c 
b/src/gallium/targets/pipe-loader/pipe_nouveau.c
index 5907a75cbc1..9ff6b82329f 100644
--- a/src/gallium/targets/pipe-loader/pipe_nouveau.c
+++ b/src/gallium/targets/pipe-loader/pipe_nouveau.c
@@ -3,6 +3,3 @@
 #include "target-helpers/inline_debug_helper.h"
 #include "frontend/drm_driver.h"
 #include "nouveau/drm/nouveau_drm_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("nouveau", NULL, pipe_nouveau_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_r300.c 
b/src/gallium/targets/pipe-loader/pipe_r300.c
index 8fd1899230f..81cc13a343f 100644
--- a/src/gallium/targets/pipe-loader/pipe_r300.c
+++ b/src/gallium/targets/pipe-loader/pipe_r300.c
@@ -4,6 +4,3 @@
 #include "radeon/drm/radeon_drm_public.h"
 #include "radeon/radeon_winsys.h"
 #include "r300/r300_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("r300", NULL, pipe_r300_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_r600.c 
b/src/gallium/targets/pipe-loader/pipe_r600.c
index 092f51b9d2e..3c07d6f70da 100644
--- a/src/gallium/targets/pipe-loader/pipe_r600.c
+++ b/src/gallium/targets/pipe-loader/pipe_r600.c
@@ -4,6 +4,3 @@
 #include "radeon/drm/radeon_drm_public.h"
 #include "radeon/radeon_winsys.h"
 #include "r600/r600_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("r600", NULL, pipe_r600_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_radeonsi.c 
b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
index 57177d8a723..d783f44aae3 100644
--- a/src/gallium/targets/pipe-loader/pipe_radeonsi.c
+++ b/src/gallium/targets/pipe-loader/pipe_radeonsi.c
@@ -3,10 +3,3 @@
 #include "target-helpers/inline_debug_helper.h"
 #include "radeonsi/si_public.h"
 #include "util/driconf.h"
-
-static const char *driconf_xml =
-   #include "radeonsi/si_driinfo.h"
-   ;
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("radeonsi", &driconf_xml, pipe_radeonsi_create_screen)
diff --git a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c 
b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
index 91539017fea..33d08071def 100644
--- a/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
+++ b/src/gallium/targets/pipe-loader/pipe_vmwgfx.c
@@ -4,6 +4,3 @@
 #include "frontend/drm_driver.h"
 #include "svga/drm/svga_drm_public.h"
 #include "svga/svga_public.h"
-
-PUBLIC
-DRM_DRIVER_DESCRIPTOR("vmwgfx", NULL, pipe_vmwgfx_create_screen)

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to