From bb72d78b2c673c33b09ff9473b802a48a165debd Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Sun, 23 Feb 2025 14:20:49 +0100 Subject: [PATCH] pipe-loader: Load the ethos accel driver Acked-by: Christian Gmeiner Part-of: --- src/gallium/auxiliary/pipe-loader/meson.build | 3 +++ .../auxiliary/pipe-loader/pipe_loader_drm.c | 4 ++++ .../auxiliary/target-helpers/drm_helper.h | 19 +++++++++++++++++++ .../target-helpers/drm_helper_public.h | 1 + 4 files changed, 27 insertions(+) diff --git a/src/gallium/auxiliary/pipe-loader/meson.build b/src/gallium/auxiliary/pipe-loader/meson.build index f01f594664d..2bda1d28872 100644 --- a/src/gallium/auxiliary/pipe-loader/meson.build +++ b/src/gallium/auxiliary/pipe-loader/meson.build @@ -42,6 +42,9 @@ endif if with_gallium_rocket renderonly_drivers_c_args += '-DGALLIUM_ROCKET' endif +if with_gallium_ethosu + renderonly_drivers_c_args += '-DGALLIUM_ETHOSU' +endif libpipe_loader_static = static_library( 'pipe_loader_static', diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 12e1da12b22..ee6500e9e3c 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -85,6 +85,7 @@ static const struct drm_driver_descriptor *driver_descriptors[] = { &asahi_driver_descriptor, &etnaviv_driver_descriptor, &rocket_driver_descriptor, + ðosu_driver_descriptor, &tegra_driver_descriptor, &lima_driver_descriptor, &zink_driver_descriptor, @@ -379,6 +380,9 @@ pipe_loader_get_compatible_render_capable_device_fds(int kms_only_fd, unsigned i #if defined GALLIUM_ROCKET "rocket", #endif +#if defined GALLIUM_ETHOSU + "ethosu", +#endif #if defined GALLIUM_V3D "v3d", #endif diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h index 5e30b9e3b93..236b68f8c0e 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper.h @@ -52,6 +52,7 @@ const struct drm_driver_descriptor descriptor_name = { \ #undef GALLIUM_LIMA #undef GALLIUM_ASAHI #undef GALLIUM_ROCKET +#undef GALLIUM_ETHOSU #endif #ifdef GALLIUM_I915 @@ -461,6 +462,24 @@ DRM_DRIVER_DESCRIPTOR_STUB(rknpu) DRM_DRIVER_DESCRIPTOR_STUB(rocket) #endif +#ifdef GALLIUM_ETHOSU +#include "ethosu/drm/ethosu_drm_public.h" + +static struct pipe_screen * +pipe_ethosu_create_screen(int fd, const struct pipe_screen_config *config) +{ + struct pipe_screen *screen; + + screen = ethosu_drm_screen_create(fd, config); + return screen ? debug_screen_wrap(screen) : NULL; +} + +DRM_DRIVER_DESCRIPTOR(ethosu, NULL, 0) + +#else +DRM_DRIVER_DESCRIPTOR_STUB(ethosu) +#endif + #ifdef GALLIUM_KMSRO #include "kmsro/drm/kmsro_drm_public.h" diff --git a/src/gallium/auxiliary/target-helpers/drm_helper_public.h b/src/gallium/auxiliary/target-helpers/drm_helper_public.h index 2f06df86da4..fe0e12280f6 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h @@ -23,6 +23,7 @@ extern const struct drm_driver_descriptor asahi_driver_descriptor; extern const struct drm_driver_descriptor etnaviv_driver_descriptor; extern const struct drm_driver_descriptor rknpu_driver_descriptor; extern const struct drm_driver_descriptor rocket_driver_descriptor; +extern const struct drm_driver_descriptor ethosu_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;