mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 15:40:11 +01:00
rusticl/event: disable profiling for devices without timestamps
Timestamp queries are strictly required, but a bit odd to not expose CL for not supporting it... Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24938>
This commit is contained in:
parent
8e4d51aa1f
commit
667375999c
1 changed files with 17 additions and 4 deletions
|
|
@ -1,6 +1,7 @@
|
|||
use crate::api::event::create_and_queue;
|
||||
use crate::api::icd::*;
|
||||
use crate::api::util::*;
|
||||
use crate::core::device::*;
|
||||
use crate::core::event::*;
|
||||
use crate::core::queue::*;
|
||||
|
||||
|
|
@ -45,9 +46,21 @@ fn valid_command_queue_properties(properties: cl_command_queue_properties) -> bo
|
|||
properties & !valid_flags == 0
|
||||
}
|
||||
|
||||
fn supported_command_queue_properties(properties: cl_command_queue_properties) -> bool {
|
||||
let valid_flags = cl_bitfield::from(CL_QUEUE_PROFILING_ENABLE);
|
||||
properties & !valid_flags == 0
|
||||
fn supported_command_queue_properties(
|
||||
dev: &Device,
|
||||
properties: cl_command_queue_properties,
|
||||
) -> bool {
|
||||
let profiling = cl_bitfield::from(CL_QUEUE_PROFILING_ENABLE);
|
||||
let valid_flags = profiling;
|
||||
if properties & !valid_flags != 0 {
|
||||
return false;
|
||||
}
|
||||
|
||||
if properties & profiling != 0 && !dev.has_timestamp {
|
||||
return false;
|
||||
}
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
pub fn create_command_queue_impl(
|
||||
|
|
@ -70,7 +83,7 @@ pub fn create_command_queue_impl(
|
|||
}
|
||||
|
||||
// CL_INVALID_QUEUE_PROPERTIES if values specified in properties are valid but are not supported by the device.
|
||||
if !supported_command_queue_properties(properties) {
|
||||
if !supported_command_queue_properties(d, properties) {
|
||||
return Err(CL_INVALID_QUEUE_PROPERTIES);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue