rusticl: allow devices to be enabled by default

Reviewed-by: David Heidelberg <david@ixit.cz>
Acked-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31202>
This commit is contained in:
Karol Herbst
2024-09-16 13:29:29 +02:00
committed by Marge Bot
parent 911606081f
commit 1301d61de4
3 changed files with 51 additions and 33 deletions

View File

@@ -160,6 +160,14 @@ option(
description : 'build gallium "rusticl" OpenCL frontend.',
)
option(
'gallium-rusticl-enable-drivers',
type : 'array',
value : ['auto'],
description : 'List of gallium drivers for which rusticl will be enabled ' +
'by default',
)
option(
'gallium-wgl-dll-name',
type : 'string',

View File

@@ -55,7 +55,11 @@ fn load_devs() -> impl Iterator<Item = PipeLoaderDevice> {
fn get_enabled_devs() -> HashMap<String, u32> {
let mut res = HashMap::new();
if let Ok(enabled_devs) = env::var("RUSTICL_ENABLE") {
// we require the type here as this list can be empty depending on the build options
let default_devs: &[&str] = &[];
// I wished we could use different iterators, but that's not really working out.
let enabled_devs = env::var("RUSTICL_ENABLE").unwrap_or(default_devs.join(","));
let mut last_driver = None;
for driver_str in enabled_devs.split(',') {
if driver_str.is_empty() {
@@ -92,7 +96,6 @@ fn get_enabled_devs() -> HashMap<String, u32> {
if res.contains_key("panfrost") {
res.insert("panthor".to_owned(), res["panfrost"]);
}
}
res
}

View File

@@ -75,6 +75,13 @@ rusticl_args = [
'-Aclippy::type_complexity',
]
rusticl_drivers_enable = get_option('gallium-rusticl-enable-drivers')
foreach driver : rusticl_drivers_enable
rusticl_args += [
'--cfg', 'rusticl_enable_' + driver,
]
endforeach
if with_platform_x11
rusticl_args += [
'--cfg', 'glx',