Skip to content

Commit 9f46331

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 30062f0 commit 9f46331

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
@@ -85,6 +85,8 @@ impl super::QueueInner::ver {
8585
return Err(EINVAL);
8686
}
8787

88+
let mut user_timestamps: fw::job::UserTimestamps = Default::default();
89+
8890
// This sequence number increases per new client/VM? assigned to some slot,
8991
// but it's unclear *which* slot...
9092
let slot_client_seq: u8 = (self.id & 0xff) as u8;
@@ -263,6 +265,7 @@ impl super::QueueInner::ver {
263265
notifier,
264266
vm_bind,
265267
timestamps,
268+
user_timestamps,
266269
})
267270
},
268271
|inner, _ptr| {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ impl super::QueueInner::ver {
271271
return Err(EINVAL);
272272
}
273273

274+
let mut vtx_user_timestamps: fw::job::UserTimestamps = Default::default();
275+
let mut frg_user_timestamps: fw::job::UserTimestamps = Default::default();
276+
274277
if cmdbuf.fb_width == 0
275278
|| cmdbuf.fb_height == 0
276279
|| cmdbuf.fb_width > 16384
@@ -772,6 +775,7 @@ impl super::QueueInner::ver {
772775
vm_bind,
773776
aux_fb: self.ualloc.lock().array_empty_tagged(0x8000, b"AXFB")?,
774777
timestamps,
778+
user_timestamps: frg_user_timestamps,
775779
})
776780
},
777781
|inner, _ptr| {
@@ -1295,6 +1299,7 @@ impl super::QueueInner::ver {
12951299
scene,
12961300
vm_bind,
12971301
timestamps,
1302+
user_timestamps: vtx_user_timestamps,
12981303
})
12991304
},
13001305
|inner, _ptr| {

0 commit comments

Comments
 (0)