summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornorablackcat <blackcatgames@protonmail.com>2023-05-15 05:20:16 -0600
committerMarge Bot <emma+marge@anholt.net>2023-05-15 18:34:41 +0000
commit1404c180e93c4b5ce717d8df3bc598b1f21ba816 (patch)
treec72af9381b0f9d238ff1618aa2f1c84f7ccc661e
parentb031b28063caaf5fb7986f3fd5b1f6f0a2f25d47 (diff)
downloadmesa-1404c180e93c4b5ce717d8df3bc598b1f21ba816.tar.gz
rusticl: implement cl_khr_pci_bus_info
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23022>
-rw-r--r--src/gallium/frontends/rusticl/api/device.rs3
-rw-r--r--src/gallium/frontends/rusticl/api/util.rs1
-rw-r--r--src/gallium/frontends/rusticl/core/device.rs22
3 files changed, 26 insertions, 0 deletions
diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs
index 2428d997af6..be548f8dd17 100644
--- a/src/gallium/frontends/rusticl/api/device.rs
+++ b/src/gallium/frontends/rusticl/api/device.rs
@@ -146,6 +146,9 @@ impl CLInfo<cl_device_info> for cl_device_id {
CL_DEVICE_PARTITION_MAX_SUB_DEVICES => cl_prop::<cl_uint>(0),
CL_DEVICE_PARTITION_PROPERTIES => cl_prop::<Vec<cl_device_partition_property>>(vec![0]),
CL_DEVICE_PARTITION_TYPE => cl_prop::<Vec<cl_device_partition_property>>(Vec::new()),
+ CL_DEVICE_PCI_BUS_INFO_KHR => {
+ cl_prop::<cl_device_pci_bus_info_khr>(dev.pci_info().ok_or(CL_INVALID_VALUE)?)
+ }
CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS => cl_prop::<cl_uint>(0),
CL_DEVICE_PIPE_MAX_PACKET_SIZE => cl_prop::<cl_uint>(0),
CL_DEVICE_PIPE_SUPPORT => cl_prop::<bool>(false),
diff --git a/src/gallium/frontends/rusticl/api/util.rs b/src/gallium/frontends/rusticl/api/util.rs
index 9a5b21e8f2c..80da7de90a6 100644
--- a/src/gallium/frontends/rusticl/api/util.rs
+++ b/src/gallium/frontends/rusticl/api/util.rs
@@ -124,6 +124,7 @@ cl_prop_for_type!(cl_ulong);
cl_prop_for_type!(isize);
cl_prop_for_type!(usize);
+cl_prop_for_struct!(cl_device_pci_bus_info_khr);
cl_prop_for_struct!(cl_image_format);
cl_prop_for_struct!(cl_name_version);
diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs
index bd2d0da0e3f..b8653986945 100644
--- a/src/gallium/frontends/rusticl/core/device.rs
+++ b/src/gallium/frontends/rusticl/core/device.rs
@@ -525,6 +525,10 @@ impl Device {
}
}
+ if self.pci_info().is_some() {
+ add_ext(1, 0, 0, "cl_khr_pci_bus_info", "");
+ }
+
if self.svm_supported() {
add_ext(1, 0, 0, "cl_arm_shared_virtual_memory", "");
}
@@ -745,6 +749,24 @@ impl Device {
1024 * 1024
}
+ pub fn pci_info(&self) -> Option<cl_device_pci_bus_info_khr> {
+ if self.screen.device_type() != pipe_loader_device_type::PIPE_LOADER_DEVICE_PCI {
+ return None;
+ }
+
+ let pci_domain = self.screen.param(pipe_cap::PIPE_CAP_PCI_GROUP) as cl_uint;
+ let pci_bus = self.screen.param(pipe_cap::PIPE_CAP_PCI_BUS) as cl_uint;
+ let pci_device = self.screen.param(pipe_cap::PIPE_CAP_PCI_DEVICE) as cl_uint;
+ let pci_function = self.screen.param(pipe_cap::PIPE_CAP_PCI_FUNCTION) as cl_uint;
+
+ Some(cl_device_pci_bus_info_khr {
+ pci_domain,
+ pci_bus,
+ pci_device,
+ pci_function,
+ })
+ }
+
pub fn screen(&self) -> &Arc<PipeScreen> {
&self.screen
}