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:
@@ -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',
|
||||
|
@@ -55,45 +55,48 @@ 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") {
|
||||
let mut last_driver = None;
|
||||
for driver_str in enabled_devs.split(',') {
|
||||
if driver_str.is_empty() {
|
||||
continue;
|
||||
}
|
||||
// we require the type here as this list can be empty depending on the build options
|
||||
let default_devs: &[&str] = &[];
|
||||
|
||||
// if the string parses to a number, just updated the device bitset
|
||||
if let Ok(dev_id) = driver_str.parse::<u8>() {
|
||||
if let Some(last_driver) = last_driver {
|
||||
*res.get_mut(last_driver).unwrap() |= 1 << dev_id;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
let driver_str: Vec<_> = driver_str.split(':').collect();
|
||||
let mut devices = 0;
|
||||
|
||||
if driver_str.len() == 1 {
|
||||
devices = !0;
|
||||
} else if let Ok(dev_id) = driver_str[1].parse::<u8>() {
|
||||
devices |= 1 << dev_id;
|
||||
}
|
||||
|
||||
let driver_str = match driver_str[0] {
|
||||
"llvmpipe" | "lp" => "swrast",
|
||||
"freedreno" => "msm",
|
||||
a => a,
|
||||
};
|
||||
|
||||
res.insert(driver_str.to_owned(), devices);
|
||||
last_driver = Some(driver_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() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if res.contains_key("panfrost") {
|
||||
res.insert("panthor".to_owned(), res["panfrost"]);
|
||||
// if the string parses to a number, just updated the device bitset
|
||||
if let Ok(dev_id) = driver_str.parse::<u8>() {
|
||||
if let Some(last_driver) = last_driver {
|
||||
*res.get_mut(last_driver).unwrap() |= 1 << dev_id;
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
let driver_str: Vec<_> = driver_str.split(':').collect();
|
||||
let mut devices = 0;
|
||||
|
||||
if driver_str.len() == 1 {
|
||||
devices = !0;
|
||||
} else if let Ok(dev_id) = driver_str[1].parse::<u8>() {
|
||||
devices |= 1 << dev_id;
|
||||
}
|
||||
|
||||
let driver_str = match driver_str[0] {
|
||||
"llvmpipe" | "lp" => "swrast",
|
||||
"freedreno" => "msm",
|
||||
a => a,
|
||||
};
|
||||
|
||||
res.insert(driver_str.to_owned(), devices);
|
||||
last_driver = Some(driver_str);
|
||||
}
|
||||
}
|
||||
|
||||
if res.contains_key("panfrost") {
|
||||
res.insert("panthor".to_owned(), res["panfrost"]);
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
|
@@ -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',
|
||||
|
Reference in New Issue
Block a user