From 27d2bd59253cc545d460221d04293a913ee75cbb Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 7 Mar 2025 09:29:28 -0500 Subject: [PATCH] gallium: wire up asahi driver Signed-off-by: Alyssa Rosenzweig Acked-by: Eric Engestrom Part-of: --- .../auxiliary/pipe-loader/pipe_loader_drm.c | 4 ++++ .../auxiliary/target-helpers/drm_helper.h | 21 +++++++++++++++++++ .../target-helpers/drm_helper_public.h | 1 + src/gallium/targets/dril/meson.build | 1 + 4 files changed, 27 insertions(+) diff --git a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c index 8cb258e35b9..d418efb6bc8 100644 --- a/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c +++ b/src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c @@ -87,6 +87,7 @@ static const struct drm_driver_descriptor *driver_descriptors[] = { &vc4_driver_descriptor, &panfrost_driver_descriptor, &panthor_driver_descriptor, + &asahi_driver_descriptor, &etnaviv_driver_descriptor, &tegra_driver_descriptor, &lima_driver_descriptor, @@ -330,6 +331,9 @@ pipe_loader_get_compatible_render_capable_device_fds(int kms_only_fd, unsigned i bool is_platform_device; struct pipe_loader_device *dev; const char * const drivers[] = { +#if defined GALLIUM_ASAHI + "asahi", +#endif #if defined GALLIUM_ETNAVIV "etnaviv", #endif diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h index 3ddab30af49..446e0e12023 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper.h @@ -351,6 +351,27 @@ DRM_DRIVER_DESCRIPTOR_STUB(panfrost) DRM_DRIVER_DESCRIPTOR_STUB(panthor) #endif +#ifdef GALLIUM_ASAHI +#include "asahi/drm/asahi_drm_public.h" + +static struct pipe_screen * +pipe_asahi_create_screen(int fd, const struct pipe_screen_config *config) +{ + struct pipe_screen *screen; + + screen = asahi_drm_screen_create(fd, config); + return screen ? debug_screen_wrap(screen) : NULL; +} + +const driOptionDescription asahi_driconf[] = { + #include "asahi/driinfo_asahi.h" +}; +DRM_DRIVER_DESCRIPTOR(asahi, asahi_driconf, ARRAY_SIZE(asahi_driconf)) + +#else +DRM_DRIVER_DESCRIPTOR_STUB(asahi) +#endif + #ifdef GALLIUM_ETNAVIV #include "etnaviv/drm/etnaviv_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 f3889694354..e7fcd6b379f 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper_public.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper_public.h @@ -19,6 +19,7 @@ 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 panthor_driver_descriptor; +extern const struct drm_driver_descriptor asahi_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; diff --git a/src/gallium/targets/dril/meson.build b/src/gallium/targets/dril/meson.build index 22b955b9074..556047c2638 100644 --- a/src/gallium/targets/dril/meson.build +++ b/src/gallium/targets/dril/meson.build @@ -63,6 +63,7 @@ dril_dri = shared_library( ) foreach d : [[with_gallium_kmsro, [ + 'apple_dri.so', 'armada-drm_dri.so', 'exynos_dri.so', 'gm12u320_dri.so',