Skip to content

Commit ef96bc4

Browse files
committed
fixup! drm/asahi: Add the Asahi driver for Apple AGX GPUs
1 parent e669000 commit ef96bc4

6 files changed

Lines changed: 26 additions & 19 deletions

File tree

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,16 @@ pub(crate) enum DeviceControlMsg {
173173
Unk0a(Array<DEVICECONTROL_SZ::ver, u8>),
174174
Unk0b(Array<DEVICECONTROL_SZ::ver, u8>),
175175
Unk0c(Array<DEVICECONTROL_SZ::ver, u8>),
176+
#[ver(V >= V13_3)]
177+
Unk0d(Array<DEVICECONTROL_SZ::ver, u8>),
176178
GrowTVBAck {
177179
unk_4: u32,
178180
buffer_slot: u32,
179181
vm_slot: u32,
180182
counter: u32,
181183
subpipe: u32,
182-
__pad: Pad<{ DEVICECONTROL_SZ::ver - 0x14 }>,
184+
halt_count: U64,
185+
__pad: Pad<{ DEVICECONTROL_SZ::ver - 0x1c }>,
183186
},
184187
Unk0e(Array<DEVICECONTROL_SZ::ver, u8>),
185188
Unk0f(Array<DEVICECONTROL_SZ::ver, u8>),
@@ -190,8 +193,6 @@ pub(crate) enum DeviceControlMsg {
190193
Unk14(Array<DEVICECONTROL_SZ::ver, u8>), // Init?
191194
Unk15(Array<DEVICECONTROL_SZ::ver, u8>), // Enable something
192195
Unk16(Array<DEVICECONTROL_SZ::ver, u8>), // Disable something
193-
#[ver(V >= V13_3)]
194-
Unk17(Array<DEVICECONTROL_SZ::ver, u8>),
195196
DestroyContext {
196197
unk_4: u32,
197198
ctx_23: u8,

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ pub(crate) mod raw {
3030
#[derive(Debug, Default)]
3131
#[repr(C)]
3232
pub(crate) struct FwStatusFlags {
33-
pub(crate) halt_count: AtomicU32,
34-
__pad0: Pad<0xc>,
33+
pub(crate) halt_count: AtomicU64,
34+
__pad0: Pad<0x8>,
3535
pub(crate) halted: AtomicU32,
3636
__pad1: Pad<0xc>,
3737
pub(crate) resume: AtomicU32,
@@ -1159,9 +1159,9 @@ pub(crate) mod raw {
11591159
pub(crate) unk_10e88: Array<0x188, u8>,
11601160
pub(crate) idle_ts: U64,
11611161
pub(crate) idle_unk: U64,
1162-
pub(crate) unk_11020: u32,
1163-
pub(crate) unk_11024: u32,
1164-
pub(crate) unk_11028: u32,
1162+
pub(crate) progress_check_interval_3d: u32,
1163+
pub(crate) progress_check_interval_ta: u32,
1164+
pub(crate) progress_check_interval_cl: u32,
11651165

11661166
#[ver(V >= V13_0B4)]
11671167
pub(crate) unk_1102c_0: u32,
@@ -1202,10 +1202,10 @@ pub(crate) mod raw {
12021202
#[ver(V >= V13_3)]
12031203
pub(crate) unk_118e0_9c_x: Array<0x8, u8>,
12041204

1205-
pub(crate) unk_118e0: u32,
1205+
pub(crate) cl_context_switch_timeout_ms: u32,
12061206

12071207
#[ver(V >= V13_0B4)]
1208-
pub(crate) unk_118e4_0: u32,
1208+
pub(crate) cl_kill_timeout_ms: u32,
12091209

12101210
pub(crate) cdm_context_store_latency_threshold: u32,
12111211
pub(crate) unk_118e8: u32,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,15 +132,15 @@ pub(crate) mod raw {
132132
pub(crate) unk_58: U64,
133133
pub(crate) busy: AtomicU32,
134134
pub(crate) __pad: Pad<0x20>,
135+
#[ver(V >= V13_2 && G < G14X)]
136+
pub(crate) unk_84_0: u32,
135137
pub(crate) unk_84_state: AtomicU32,
136138
pub(crate) unk_88: u32,
137139
pub(crate) unk_8c: u32,
138140
pub(crate) unk_90: u32,
139141
pub(crate) unk_94: u32,
140142
pub(crate) pending: AtomicU32,
141143
pub(crate) unk_9c: u32,
142-
#[ver(V >= V13_2 && G < G14X)]
143-
pub(crate) unk_a0_0: u32,
144144
pub(crate) gpu_context: GpuPointer<'a, super::GpuContextData>,
145145
pub(crate) unk_a8: U64,
146146
#[ver(V >= V13_2 && G < G14X)]

drivers/gpu/drm/asahi/gpu.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,12 +1332,18 @@ impl GpuManager for GpuManager::ver {
13321332
}
13331333

13341334
fn ack_grow(&self, buffer_slot: u32, vm_slot: u32, counter: u32) {
1335+
let halt_count = self
1336+
.initdata
1337+
.fw_status
1338+
.with(|raw, _inner| raw.flags.halt_count.load(Ordering::Relaxed));
1339+
13351340
let dc = fw::channels::DeviceControlMsg::ver::GrowTVBAck {
13361341
unk_4: 1,
13371342
buffer_slot,
13381343
vm_slot,
13391344
counter,
13401345
subpipe: 0, // TODO
1346+
halt_count: U64(halt_count),
13411347
__pad: Default::default(),
13421348
};
13431349

drivers/gpu/drm/asahi/initdata.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,9 +704,9 @@ impl<'a> InitDataBuilder::ver<'a> {
704704
unk_903c: 0,
705705
fault_control: *crate::fault_control.read(),
706706
do_init: 1,
707-
unk_11020: 40,
708-
unk_11024: 10,
709-
unk_11028: 250,
707+
progress_check_interval_3d: 40,
708+
progress_check_interval_ta: 10,
709+
progress_check_interval_cl: 250,
710710
#[ver(V >= V13_0B4)]
711711
unk_1102c_0: 1,
712712
#[ver(V >= V13_0B4)]
@@ -718,9 +718,9 @@ impl<'a> InitDataBuilder::ver<'a> {
718718
idle_off_delay_ms: AtomicU32::new(pwr.idle_off_delay_ms),
719719
fender_idle_off_delay_ms: pwr.fender_idle_off_delay_ms,
720720
fw_early_wake_timeout_ms: pwr.fw_early_wake_timeout_ms,
721-
unk_118e0: 40,
721+
cl_context_switch_timeout_ms: 40,
722722
#[ver(V >= V13_0B4)]
723-
unk_118e4_0: 50,
723+
cl_kill_timeout_ms: 50,
724724
#[ver(V >= V13_0B4)]
725725
unk_11edc: 0,
726726
#[ver(V >= V13_0B4)]

drivers/gpu/drm/asahi/workqueue.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,15 +636,15 @@ impl WorkQueue::ver {
636636
unk_58: Default::default(),
637637
busy: Default::default(),
638638
__pad: Default::default(),
639+
#[ver(V >= V13_2 && G < G14X)]
640+
unk_84_0: 0,
639641
unk_84_state: Default::default(),
640642
unk_88: 0,
641643
unk_8c: 0,
642644
unk_90: 0,
643645
unk_94: 0,
644646
pending: Default::default(),
645647
unk_9c: 0,
646-
#[ver(V >= V13_2 && G < G14X)]
647-
unk_a0_0: 0,
648648
gpu_context: inner.gpu_context.gpu_pointer(),
649649
unk_a8: Default::default(),
650650
#[ver(V >= V13_2 && G < G14X)]

0 commit comments

Comments
 (0)