Skip to content

Commit 92c5257

Browse files
hoshinolinajannau
authored andcommitted
fixup! drm/asahi: Implement ASAHI_GET_TIME
1 parent 3e61c1f commit 92c5257

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

drivers/gpu/drm/asahi/file.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl File {
235235
unstable_uabi_version: uapi::DRM_ASAHI_UNSTABLE_UABI_VERSION,
236236
pad0: 0,
237237

238-
feat_compat: gpu.get_cfg().gpu_feat_compat,
238+
feat_compat: gpu.get_cfg().gpu_feat_compat | hw::feat::compat::GETTIME,
239239
feat_incompat: gpu.get_cfg().gpu_feat_incompat,
240240

241241
gpu_generation: gpu.get_dyncfg().id.gpu_gen as u32,
@@ -937,23 +937,17 @@ impl File {
937937
return Err(EINVAL);
938938
}
939939

940-
let mut tp: kernel::bindings::timespec64 = Default::default();
941940
let mut gputime: u64 = 0;
942941

943-
// TODO: bindings
944-
// SAFETY: These functions are safe to call as long as the argument pointer is valid
942+
// SAFETY: Assembly only loads the timer
945943
unsafe {
946944
core::arch::asm!(
947945
"mrs {x}, CNTPCT_EL0",
948946
x = out(reg) gputime
949947
);
950-
kernel::bindings::ktime_get_raw_ts64(&mut tp);
951-
kernel::bindings::timens_add_monotonic(&mut tp);
952948
}
953949

954950
data.gpu_timestamp = gputime;
955-
data.tv_sec = tp.tv_sec;
956-
data.tv_nsec = tp.tv_nsec;
957951

958952
Ok(0)
959953
}

drivers/gpu/drm/asahi/hw/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ pub(crate) mod feat {
9494
/// Soft MMU faults enabled.
9595
pub(crate) const SOFT_FAULTS: u64 =
9696
uapi::drm_asahi_feat_compat_DRM_ASAHI_FEAT_SOFT_FAULTS as u64;
97+
/// GETTIME API supported
98+
pub(crate) const GETTIME: u64 = uapi::drm_asahi_feat_compat_DRM_ASAHI_FEAT_GETTIME as u64;
9799
}
98100

99101
/// Backwards-incompatible features.

0 commit comments

Comments
 (0)