asahi: Add scaffolding for supporting driconf options

It's time to start using some of these, so add the required scaffolding
to be able to have driver-specific driconf handling for us.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25052>
This commit is contained in:
Asahi Lina 2023-08-30 15:40:27 +09:00 committed by Marge Bot
parent c83672a0b3
commit 45be01374f
7 changed files with 29 additions and 8 deletions

View file

@ -348,10 +348,14 @@ pipe_asahi_create_screen(int fd, const struct pipe_screen_config *config)
{
struct pipe_screen *screen;
screen = asahi_drm_screen_create(fd);
screen = asahi_drm_screen_create(fd, config);
return screen ? debug_screen_wrap(screen) : NULL;
}
DRM_DRIVER_DESCRIPTOR(asahi, NULL, 0)
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)
@ -444,6 +448,9 @@ const driOptionDescription kmsro_driconf[] = {
#if defined(GALLIUM_VC4) || defined(GALLIUM_V3D)
#include "v3d/driinfo_v3d.h"
#endif
#ifdef GALLIUM_ASAHI
#include "asahi/driinfo_asahi.h"
#endif
#ifdef GALLIUM_FREEDRENO
#include "freedreno/driinfo_freedreno.h"
#endif

View file

@ -33,6 +33,7 @@
#include "util/u_memory.h"
#include "util/u_screen.h"
#include "util/u_upload_mgr.h"
#include "util/xmlconfig.h"
#include "agx_device.h"
#include "agx_disk_cache.h"
#include "agx_fence.h"
@ -2129,7 +2130,8 @@ agx_screen_get_fd(struct pipe_screen *pscreen)
}
struct pipe_screen *
agx_screen_create(int fd, struct renderonly *ro)
agx_screen_create(int fd, struct renderonly *ro,
const struct pipe_screen_config *config)
{
struct agx_screen *agx_screen;
struct pipe_screen *screen;
@ -2144,6 +2146,10 @@ agx_screen_create(int fd, struct renderonly *ro)
agx_screen->dev.debug =
debug_get_flags_option("ASAHI_MESA_DEBUG", agx_debug_options, 0);
/* parse driconf configuration now for device specific overrides */
driParseConfigFiles(config->options, config->options_info, 0, "asahi", NULL,
NULL, NULL, 0, NULL, 0);
agx_screen->dev.fd = fd;
agx_screen->dev.ro = ro;

View file

@ -12,7 +12,8 @@ extern "C" {
struct pipe_screen;
struct renderonly;
struct pipe_screen *agx_screen_create(int fd, struct renderonly *ro);
struct pipe_screen *agx_screen_create(int fd, struct renderonly *ro,
const struct pipe_screen_config *config);
#ifdef __cplusplus
}

View file

@ -0,0 +1,5 @@
/* asahi specific driconf options */
/* clang-format off */
DRI_CONF_SECTION_MISCELLANEOUS
DRI_CONF_SECTION_END

View file

@ -2,6 +2,7 @@
# SPDX-License-Identifier: MIT
files_asahi = files(
'driinfo_asahi.h',
'agx_batch.c',
'agx_blit.c',
'agx_disk_cache.c',

View file

@ -13,7 +13,8 @@ struct pipe_screen;
struct pipe_screen_config;
struct renderonly;
struct pipe_screen *asahi_drm_screen_create(int drmFD);
struct pipe_screen *
asahi_drm_screen_create(int drmFD, const struct pipe_screen_config *config);
struct pipe_screen *
asahi_drm_screen_create_renderonly(int fd, struct renderonly *ro,
const struct pipe_screen_config *config);

View file

@ -23,13 +23,13 @@ static struct pipe_screen *
asahi_screen_create(int fd, const struct pipe_screen_config *config,
struct renderonly *ro)
{
return agx_screen_create(fd, ro);
return agx_screen_create(fd, ro, config);
}
struct pipe_screen *
asahi_drm_screen_create(int fd)
asahi_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,
asahi_screen_create);
}