File 0008-pipe-loader-plumb-a-flag-for-implicit-driver-load-th.patch of Package Mesa
From 4df36439ecff5a2b65e93ab36d1ebea780269b63 Mon Sep 17 00:00:00 2001
From: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Date: Tue, 12 Mar 2024 10:13:40 -0400
Subject: [PATCH 8/9] pipe-loader: plumb a flag for implicit driver load
through screen creation
---
src/gallium/auxiliary/pipe-loader/pipe_loader.c | 7 ++++---
src/gallium/auxiliary/pipe-loader/pipe_loader.h | 6 ++++--
src/gallium/auxiliary/vl/vl_winsys_dri.c | 2 +-
src/gallium/auxiliary/vl/vl_winsys_dri3.c | 2 +-
src/gallium/auxiliary/vl/vl_winsys_drm.c | 2 +-
src/gallium/frontends/clover/core/device.cpp | 2 +-
src/gallium/frontends/dri/dri2.c | 4 ++--
src/gallium/frontends/dri/drisw.c | 2 +-
src/gallium/frontends/dri/kopper.c | 2 +-
src/gallium/frontends/lavapipe/lvp_device.c | 2 +-
src/gallium/frontends/rusticl/mesa/pipe/device.rs | 2 +-
src/gallium/frontends/teflon/tfl_device.c | 2 +-
src/gallium/frontends/xa/xa_tracker.c | 2 +-
src/gallium/include/pipe/p_screen.h | 1 +
src/gallium/targets/d3dadapter9/drm.c | 4 ++--
src/gallium/tests/trivial/quad-tex.c | 2 +-
src/gallium/tests/trivial/tri.c | 2 +-
17 files changed, 25 insertions(+), 21 deletions(-)
Index: mesa-24.0.3/src/gallium/auxiliary/pipe-loader/pipe_loader.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/auxiliary/pipe-loader/pipe_loader.c
+++ mesa-24.0.3/src/gallium/auxiliary/pipe-loader/pipe_loader.c
@@ -169,11 +169,12 @@ pipe_loader_get_driinfo_xml(const char *
}
struct pipe_screen *
-pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk)
+pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk, bool implicit)
{
struct pipe_screen_config config;
pipe_loader_load_options(dev);
+ config.implicit_driver_load = implicit;
config.options_info = &dev->option_info;
config.options = &dev->option_cache;
@@ -181,9 +182,9 @@ pipe_loader_create_screen_vk(struct pipe
}
struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev)
+pipe_loader_create_screen(struct pipe_loader_device *dev, bool implicit)
{
- return pipe_loader_create_screen_vk(dev, false);
+ return pipe_loader_create_screen_vk(dev, false, implicit);
}
struct util_dl_library *
Index: mesa-24.0.3/src/gallium/auxiliary/pipe-loader/pipe_loader.h
===================================================================
--- mesa-24.0.3.orig/src/gallium/auxiliary/pipe-loader/pipe_loader.h
+++ mesa-24.0.3/src/gallium/auxiliary/pipe-loader/pipe_loader.h
@@ -88,17 +88,19 @@ pipe_loader_probe(struct pipe_loader_dev
*
* \param dev Device the screen will be created for.
* \param sw_vk Device is for software vulkan
+ * \param implicit Whether the driver is being loaded implicitly.
*/
struct pipe_screen *
-pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk);
+pipe_loader_create_screen_vk(struct pipe_loader_device *dev, bool sw_vk, bool implicit);
/**
* Create a pipe_screen for the specified device.
*
* \param dev Device the screen will be created for.
+ * \param implicit Whether the driver is being loaded implicitly.
*/
struct pipe_screen *
-pipe_loader_create_screen(struct pipe_loader_device *dev);
+pipe_loader_create_screen(struct pipe_loader_device *dev, bool implicit);
/**
* Ensures that the driconf option cache has been parsed for the driver.
Index: mesa-24.0.3/src/gallium/auxiliary/vl/vl_winsys_dri.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/auxiliary/vl/vl_winsys_dri.c
+++ mesa-24.0.3/src/gallium/auxiliary/vl/vl_winsys_dri.c
@@ -459,7 +459,7 @@ vl_dri2_screen_create(Display *display,
goto free_authenticate;
if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd, false))
- scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
+ scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, false);
if (!scrn->base.pscreen)
goto release_pipe;
Index: mesa-24.0.3/src/gallium/auxiliary/vl/vl_winsys_dri3.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/auxiliary/vl/vl_winsys_dri3.c
+++ mesa-24.0.3/src/gallium/auxiliary/vl/vl_winsys_dri3.c
@@ -843,7 +843,7 @@ vl_dri3_screen_create(Display *display,
free(geom_reply);
if (pipe_loader_drm_probe_fd(&scrn->base.dev, fd, false))
- scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev);
+ scrn->base.pscreen = pipe_loader_create_screen(scrn->base.dev, false);
if (!scrn->base.pscreen)
goto release_pipe;
Index: mesa-24.0.3/src/gallium/auxiliary/vl/vl_winsys_drm.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/auxiliary/vl/vl_winsys_drm.c
+++ mesa-24.0.3/src/gallium/auxiliary/vl/vl_winsys_drm.c
@@ -47,7 +47,7 @@ vl_drm_screen_create(int fd)
return NULL;
if (pipe_loader_drm_probe_fd(&vscreen->dev, fd, false))
- vscreen->pscreen = pipe_loader_create_screen(vscreen->dev);
+ vscreen->pscreen = pipe_loader_create_screen(vscreen->dev, false);
if (!vscreen->pscreen)
goto release_pipe;
Index: mesa-24.0.3/src/gallium/frontends/clover/core/device.cpp
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/clover/core/device.cpp
+++ mesa-24.0.3/src/gallium/frontends/clover/core/device.cpp
@@ -163,7 +163,7 @@ namespace {
device::device(clover::platform &platform, pipe_loader_device *ldev) :
platform(platform), clc_cache(NULL), ldev(ldev) {
- pipe = pipe_loader_create_screen(ldev);
+ pipe = pipe_loader_create_screen(ldev, false);
if (pipe && pipe->get_param(pipe, PIPE_CAP_COMPUTE)) {
const bool has_supported_ir = supports_ir(PIPE_SHADER_IR_NATIVE) ||
supports_ir(PIPE_SHADER_IR_NIR_SERIALIZED);
Index: mesa-24.0.3/src/gallium/frontends/dri/dri2.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/dri/dri2.c
+++ mesa-24.0.3/src/gallium/frontends/dri/dri2.c
@@ -2382,7 +2382,7 @@ dri2_init_screen(struct dri_screen *scre
(void) mtx_init(&screen->opencl_func_mutex, mtx_plain);
if (pipe_loader_drm_probe_fd(&screen->dev, screen->fd, false))
- pscreen = pipe_loader_create_screen(screen->dev);
+ pscreen = pipe_loader_create_screen(screen->dev, implicit);
if (!pscreen)
goto fail;
@@ -2438,7 +2438,7 @@ dri_swrast_kms_init_screen(struct dri_sc
#ifdef HAVE_DRISW_KMS
if (pipe_loader_sw_probe_kms(&screen->dev, screen->fd))
- pscreen = pipe_loader_create_screen(screen->dev);
+ pscreen = pipe_loader_create_screen(screen->dev, implicit);
#endif
if (!pscreen)
Index: mesa-24.0.3/src/gallium/frontends/dri/drisw.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/dri/drisw.c
+++ mesa-24.0.3/src/gallium/frontends/dri/drisw.c
@@ -562,7 +562,7 @@ drisw_init_screen(struct dri_screen *scr
success = pipe_loader_sw_probe_dri(&screen->dev, lf);
if (success)
- pscreen = pipe_loader_create_screen(screen->dev);
+ pscreen = pipe_loader_create_screen(screen->dev, implicit);
if (!pscreen)
goto fail;
Index: mesa-24.0.3/src/gallium/frontends/dri/kopper.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/dri/kopper.c
+++ mesa-24.0.3/src/gallium/frontends/dri/kopper.c
@@ -131,7 +131,7 @@ kopper_init_screen(struct dri_screen *sc
success = pipe_loader_vk_probe_dri(&screen->dev);
if (success)
- pscreen = pipe_loader_create_screen(screen->dev);
+ pscreen = pipe_loader_create_screen(screen->dev, implicit);
if (!pscreen)
goto fail;
Index: mesa-24.0.3/src/gallium/frontends/lavapipe/lvp_device.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/lavapipe/lvp_device.c
+++ mesa-24.0.3/src/gallium/frontends/lavapipe/lvp_device.c
@@ -1101,7 +1101,7 @@ lvp_physical_device_init(struct lvp_phys
}
device->pld = pld;
- device->pscreen = pipe_loader_create_screen_vk(device->pld, true);
+ device->pscreen = pipe_loader_create_screen_vk(device->pld, true, false);
if (!device->pscreen)
return vk_error(instance, VK_ERROR_OUT_OF_HOST_MEMORY);
for (unsigned i = 0; i < ARRAY_SIZE(device->drv_options); i++)
Index: mesa-24.0.3/src/gallium/frontends/xa/xa_tracker.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/xa/xa_tracker.c
+++ mesa-24.0.3/src/gallium/frontends/xa/xa_tracker.c
@@ -172,7 +172,7 @@ xa_tracker_create(int drm_fd)
return NULL;
if (pipe_loader_drm_probe_fd(&xa->dev, drm_fd, false))
- xa->screen = pipe_loader_create_screen(xa->dev);
+ xa->screen = pipe_loader_create_screen(xa->dev, false);
if (!xa->screen)
goto out_no_screen;
Index: mesa-24.0.3/src/gallium/include/pipe/p_screen.h
===================================================================
--- mesa-24.0.3.orig/src/gallium/include/pipe/p_screen.h
+++ mesa-24.0.3/src/gallium/include/pipe/p_screen.h
@@ -806,6 +806,7 @@ struct pipe_screen {
* Global configuration options for screen creation.
*/
struct pipe_screen_config {
+ bool implicit_driver_load;
struct driOptionCache *options;
const struct driOptionCache *options_info;
};
Index: mesa-24.0.3/src/gallium/targets/d3dadapter9/drm.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/targets/d3dadapter9/drm.c
+++ mesa-24.0.3/src/gallium/targets/d3dadapter9/drm.c
@@ -242,7 +242,7 @@ drm_create_adapter( int fd,
return D3DERR_DRIVERINTERNALERROR;
}
- ctx->base.hal = pipe_loader_create_screen(ctx->dev);
+ ctx->base.hal = pipe_loader_create_screen(ctx->dev, false);
if (!ctx->base.hal) {
ERR("Unable to load requested driver.\n");
drm_destroy(&ctx->base);
@@ -302,7 +302,7 @@ drm_create_adapter( int fd,
sw_rendering |= debug_get_bool_option("D3D_ALWAYS_SOFTWARE", false);
/* wrap it to create a software screen that can share resources */
if (sw_rendering && pipe_loader_sw_probe_wrapped(&ctx->swdev, ctx->base.hal))
- ctx->base.ref = pipe_loader_create_screen(ctx->swdev);
+ ctx->base.ref = pipe_loader_create_screen(ctx->swdev, false);
else {
/* Use the hardware for sw rendering */
ctx->swdev = ctx->dev;
Index: mesa-24.0.3/src/gallium/tests/trivial/quad-tex.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/tests/trivial/quad-tex.c
+++ mesa-24.0.3/src/gallium/tests/trivial/quad-tex.c
@@ -97,7 +97,7 @@ static void init_prog(struct program *p)
assert(ret);
/* init a pipe screen */
- p->screen = pipe_loader_create_screen(p->dev);
+ p->screen = pipe_loader_create_screen(p->dev, false);
assert(p->screen);
/* create the pipe driver context and cso context */
Index: mesa-24.0.3/src/gallium/tests/trivial/tri.c
===================================================================
--- mesa-24.0.3.orig/src/gallium/tests/trivial/tri.c
+++ mesa-24.0.3/src/gallium/tests/trivial/tri.c
@@ -91,7 +91,7 @@ static void init_prog(struct program *p)
assert(ret);
/* init a pipe screen */
- p->screen = pipe_loader_create_screen(p->dev);
+ p->screen = pipe_loader_create_screen(p->dev, false);
assert(p->screen);
/* create the pipe driver context and cso context */
Index: mesa-24.0.3/src/gallium/frontends/rusticl/mesa/pipe/device.rs
===================================================================
--- mesa-24.0.3.orig/src/gallium/frontends/rusticl/mesa/pipe/device.rs
+++ mesa-24.0.3/src/gallium/frontends/rusticl/mesa/pipe/device.rs
@@ -20,7 +20,7 @@ impl PipeLoaderDevice {
}
fn load_screen(self) -> Option<PipeScreen> {
- let s = unsafe { pipe_loader_create_screen(self.ldev) };
+ let s = unsafe { pipe_loader_create_screen(self.ldev, false) };
PipeScreen::new(self, s)
}