From 2a41b1869f142d871a1e60e3171aa5f19106b422 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Sat, 24 Jun 2023 22:03:02 +0100 Subject: [PATCH] rusticl/device: Stash timestamp availability Check if the device claims to have timestamps and a valid resolution and stash it in the device. Signed-off-by: Dr. David Alan Gilbert Part-of: --- src/gallium/frontends/rusticl/core/device.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gallium/frontends/rusticl/core/device.rs b/src/gallium/frontends/rusticl/core/device.rs index 83b121f3cb0..af9680d8620 100644 --- a/src/gallium/frontends/rusticl/core/device.rs +++ b/src/gallium/frontends/rusticl/core/device.rs @@ -37,6 +37,7 @@ pub struct Device { pub clc_versions: Vec, pub custom: bool, pub embedded: bool, + pub has_timestamp: bool, // Cached to keep API fast pub extension_string: String, pub extensions: Vec, pub spirv_extensions: Vec, @@ -198,6 +199,7 @@ impl Device { clc_versions: Vec::new(), custom: false, embedded: false, + has_timestamp: false, extension_string: String::from(""), extensions: Vec::new(), spirv_extensions: Vec::new(), @@ -214,6 +216,10 @@ impl Device { // check if we have to report it as a custom device d.custom = d.check_custom(); + let cap_timestamp = d.screen.param(pipe_cap::PIPE_CAP_QUERY_TIMESTAMP); + let cap_timestamp_res = d.timer_resolution(); + d.has_timestamp = cap_timestamp != 0 && cap_timestamp_res > 0; + // query supported extensions d.fill_extensions(); @@ -850,6 +856,10 @@ impl Device { self.screen.param(pipe_cap::PIPE_CAP_SYSTEM_SVM) == 1 } + pub fn timer_resolution(&self) -> usize { + self.screen.param(pipe_cap::PIPE_CAP_TIMER_RESOLUTION) as usize + } + pub fn unified_memory(&self) -> bool { self.screen.param(pipe_cap::PIPE_CAP_UMA) == 1 }