From 2bcdc4939c283003e8a7f638229604973aa5327a Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Fri, 15 Dec 2023 12:35:48 +0100 Subject: [PATCH] panfrost: add driconf infrastructure This is the boiler-plate code needed to support driver-specific driconf variables in Panfrost. Acked-by: Boris Brezillon Part-of: --- src/gallium/auxiliary/target-helpers/drm_helper.h | 13 ++++++++++--- src/gallium/drivers/panfrost/driinfo_panfrost.h | 1 + src/gallium/drivers/panfrost/meson.build | 1 + src/gallium/drivers/panfrost/pan_screen.c | 4 ++++ .../winsys/panfrost/drm/panfrost_drm_public.h | 4 +++- .../winsys/panfrost/drm/panfrost_drm_winsys.c | 4 ++-- 6 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 src/gallium/drivers/panfrost/driinfo_panfrost.h diff --git a/src/gallium/auxiliary/target-helpers/drm_helper.h b/src/gallium/auxiliary/target-helpers/drm_helper.h index 8a06b775cdd..23f2215a1e6 100644 --- a/src/gallium/auxiliary/target-helpers/drm_helper.h +++ b/src/gallium/auxiliary/target-helpers/drm_helper.h @@ -331,11 +331,15 @@ pipe_panfrost_create_screen(int fd, const struct pipe_screen_config *config) { struct pipe_screen *screen; - screen = panfrost_drm_screen_create(fd); + screen = panfrost_drm_screen_create(fd, config); return screen ? debug_screen_wrap(screen) : NULL; } -DRM_DRIVER_DESCRIPTOR(panfrost, NULL, 0) -DRM_DRIVER_DESCRIPTOR_ALIAS(panfrost, panthor, NULL, 0) + +const driOptionDescription pan_driconf[] = { + #include "panfrost/driinfo_panfrost.h" +}; +DRM_DRIVER_DESCRIPTOR(panfrost, pan_driconf, ARRAY_SIZE(pan_driconf)) +DRM_DRIVER_DESCRIPTOR_ALIAS(panfrost, panthor, pan_driconf, ARRAY_SIZE(pan_driconf)) #else DRM_DRIVER_DESCRIPTOR_STUB(panfrost) @@ -456,6 +460,9 @@ const driOptionDescription kmsro_driconf[] = { #ifdef GALLIUM_FREEDRENO #include "freedreno/driinfo_freedreno.h" #endif +#ifdef GALLIUM_PANFROST + #include "panfrost/driinfo_panfrost.h" +#endif }; DRM_DRIVER_DESCRIPTOR(kmsro, kmsro_driconf, ARRAY_SIZE(kmsro_driconf)) diff --git a/src/gallium/drivers/panfrost/driinfo_panfrost.h b/src/gallium/drivers/panfrost/driinfo_panfrost.h new file mode 100644 index 00000000000..031726ba6b1 --- /dev/null +++ b/src/gallium/drivers/panfrost/driinfo_panfrost.h @@ -0,0 +1 @@ +/* panfrost specific driconf options */ diff --git a/src/gallium/drivers/panfrost/meson.build b/src/gallium/drivers/panfrost/meson.build index a8e903f6ba3..84f71915675 100644 --- a/src/gallium/drivers/panfrost/meson.build +++ b/src/gallium/drivers/panfrost/meson.build @@ -20,6 +20,7 @@ # SOFTWARE. files_panfrost = files( + 'driinfo_panfrost.h', 'pan_afbc_cso.c', 'pan_bo.c', 'pan_device.c', diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index b71809156d0..c8894dbd8f1 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -37,6 +37,7 @@ #include "util/u_process.h" #include "util/u_screen.h" #include "util/u_video.h" +#include "util/xmlconfig.h" #include @@ -834,6 +835,9 @@ panfrost_create_screen(int fd, const struct pipe_screen_config *config, struct panfrost_device *dev = pan_device(&screen->base); + driParseConfigFiles(config->options, config->options_info, 0, + "panfrost", NULL, NULL, NULL, 0, NULL, 0); + /* Debug must be set first for pandecode to work correctly */ dev->debug = debug_get_flags_option("PAN_MESA_DEBUG", panfrost_debug_options, 0); diff --git a/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h b/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h index 5a000cfa1eb..dd440c1d0c6 100644 --- a/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h +++ b/src/gallium/winsys/panfrost/drm/panfrost_drm_public.h @@ -34,7 +34,9 @@ struct renderonly; struct renderonly_scanout; struct winsys_handle; -struct pipe_screen *panfrost_drm_screen_create(int drmFD); +struct pipe_screen * +panfrost_drm_screen_create(int drmFD, + const struct pipe_screen_config *config); struct pipe_screen * panfrost_drm_screen_create_renderonly(int fd, struct renderonly *ro, const struct pipe_screen_config *config); diff --git a/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c b/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c index 6123e32dcbd..de80759d94c 100644 --- a/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c +++ b/src/gallium/winsys/panfrost/drm/panfrost_drm_winsys.c @@ -119,9 +119,9 @@ free_dumb: } struct pipe_screen * -panfrost_drm_screen_create(int fd) +panfrost_drm_screen_create(int fd, const struct pipe_screen_config *config) { - return u_pipe_screen_lookup_or_create(os_dupfd_cloexec(fd), NULL, NULL, + return u_pipe_screen_lookup_or_create(os_dupfd_cloexec(fd), config, NULL, panfrost_create_screen); }