Skip to content

Commit 46f4cf4

Browse files
hoshinolinajannau
authored andcommitted
drm/asahi: fw, queue: Add UserTimestamp object to job structs
Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent b8bca76 commit 46f4cf4

6 files changed

Lines changed: 25 additions & 1 deletion

File tree

drivers/gpu/drm/asahi/fw/compute.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ pub(crate) struct RunCompute {
101101
pub(crate) micro_seq: microseq::MicroSequence,
102102
pub(crate) vm_bind: mmu::VmBind,
103103
pub(crate) timestamps: Arc<GpuObject<job::JobTimestamps>>,
104+
pub(crate) user_timestamps: job::UserTimestamps,
104105
}
105106

106107
#[versions(AGX)]

drivers/gpu/drm/asahi/fw/fragment.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ pub(crate) struct RunFragment {
275275
pub(crate) vm_bind: mmu::VmBind,
276276
pub(crate) aux_fb: GpuArray<u8>,
277277
pub(crate) timestamps: Arc<GpuObject<job::RenderTimestamps>>,
278+
pub(crate) user_timestamps: job::UserTimestamps,
278279
}
279280

280281
#[versions(AGX)]

drivers/gpu/drm/asahi/fw/job.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
//! Common GPU job firmware structures
44
55
use super::types::*;
6-
use crate::{default_zeroed, trivial_gpustruct};
6+
use crate::{default_zeroed, mmu, trivial_gpustruct};
7+
use kernel::sync::Arc;
78

89
pub(crate) mod raw {
910
use super::*;
@@ -119,3 +120,15 @@ pub(crate) mod raw {
119120

120121
trivial_gpustruct!(JobTimestamps);
121122
trivial_gpustruct!(RenderTimestamps);
123+
124+
#[derive(Debug)]
125+
pub(crate) struct UserTimestamp {
126+
pub(crate) mapping: Arc<mmu::KernelMapping>,
127+
pub(crate) offset: usize,
128+
}
129+
130+
#[derive(Debug, Default)]
131+
pub(crate) struct UserTimestamps {
132+
pub(crate) start: Option<UserTimestamp>,
133+
pub(crate) end: Option<UserTimestamp>,
134+
}

drivers/gpu/drm/asahi/fw/vertex.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ pub(crate) struct RunVertex {
172172
pub(crate) micro_seq: microseq::MicroSequence,
173173
pub(crate) vm_bind: mmu::VmBind,
174174
pub(crate) timestamps: Arc<GpuObject<job::RenderTimestamps>>,
175+
pub(crate) user_timestamps: job::UserTimestamps,
175176
}
176177

177178
#[versions(AGX)]

drivers/gpu/drm/asahi/queue/compute.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ impl super::QueueInner::ver {
7676
return Err(EINVAL);
7777
}
7878

79+
let mut user_timestamps: fw::job::UserTimestamps = Default::default();
80+
7981
// This sequence number increases per new client/VM? assigned to some slot,
8082
// but it's unclear *which* slot...
8183
let slot_client_seq: u8 = (self.id & 0xff) as u8;
@@ -254,6 +256,7 @@ impl super::QueueInner::ver {
254256
notifier,
255257
vm_bind,
256258
timestamps,
259+
user_timestamps,
257260
})
258261
},
259262
|inner, _ptr| {

drivers/gpu/drm/asahi/queue/render.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,9 @@ impl super::QueueInner::ver {
258258
return Err(EINVAL);
259259
}
260260

261+
let mut vtx_user_timestamps: fw::job::UserTimestamps = Default::default();
262+
let mut frg_user_timestamps: fw::job::UserTimestamps = Default::default();
263+
261264
if cmdbuf.fb_width == 0
262265
|| cmdbuf.fb_height == 0
263266
|| cmdbuf.fb_width > 16384
@@ -760,6 +763,7 @@ impl super::QueueInner::ver {
760763
vm_bind,
761764
aux_fb: self.ualloc.lock().array_empty_tagged(0x8000, b"AXFB")?,
762765
timestamps,
766+
user_timestamps: frg_user_timestamps,
763767
})
764768
},
765769
|inner, _ptr| {
@@ -1283,6 +1287,7 @@ impl super::QueueInner::ver {
12831287
scene,
12841288
vm_bind,
12851289
timestamps,
1290+
user_timestamps: vtx_user_timestamps,
12861291
})
12871292
},
12881293
|inner, _ptr| {

0 commit comments

Comments
 (0)