Skip to content

Commit ab5b2aa

Browse files
committed
drm/asahi: fw,queue: Implement helper programs
Also expose no preemption flag (?) separately. Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 07a1cb6 commit ab5b2aa

5 files changed

Lines changed: 30 additions & 16 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub(crate) mod raw {
2424
pub(crate) helper_program: u32,
2525
pub(crate) unk_44: u32,
2626
pub(crate) helper_arg: U64,
27-
pub(crate) unk_50: u32,
27+
pub(crate) helper_unk: u32,
2828
pub(crate) unk_54: u32,
2929
pub(crate) unk_58: u32,
3030
pub(crate) unk_5c: u32,

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ pub(crate) mod raw {
105105
pub(crate) unk_108: Array<0x6, U64>,
106106
pub(crate) pipeline_base: U64,
107107
pub(crate) unk_140: U64,
108-
pub(crate) unk_148: U64,
109-
pub(crate) unk_150: U64,
108+
pub(crate) helper_program: u32,
109+
pub(crate) unk_14c: u32,
110+
pub(crate) helper_arg: U64,
110111
pub(crate) unk_158: U64,
111112
pub(crate) unk_160: U64,
112113

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,10 @@ pub(crate) mod raw {
7272
#[ver(G < G14)]
7373
pub(crate) unk_f0: U64,
7474
pub(crate) unk_f8: U64,
75-
pub(crate) unk_100: Array<3, U64>,
75+
pub(crate) helper_program: u32,
76+
pub(crate) unk_104: u32,
77+
pub(crate) helper_arg: U64,
78+
pub(crate) unk_110: U64,
7679
pub(crate) unk_118: u32,
7780
#[ver(G >= G14)]
7881
pub(crate) __pad: Pad<{ 8 * 9 + 0x268 }>,

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl super::Queue::ver {
279279
helper_program: cmdbuf.helper_program, // Internal program addr | 1
280280
unk_44: 0,
281281
helper_arg: U64(cmdbuf.helper_arg), // Only if internal program used
282-
unk_50: cmdbuf.buffer_descriptor_size, // 0x40 if internal program used
282+
helper_unk: cmdbuf.helper_unk, // 0x40 if internal program used
283283
unk_54: 0,
284284
unk_58: 1,
285285
unk_5c: 0,
@@ -300,7 +300,7 @@ impl super::Queue::ver {
300300
r.add(0x10071, 0x1100000000); // USC_EXEC_BASE_CP
301301
r.add(0x11841, cmdbuf.helper_program.into());
302302
r.add(0x11849, cmdbuf.helper_arg);
303-
r.add(0x11f81, cmdbuf.buffer_descriptor_size.into());
303+
r.add(0x11f81, cmdbuf.helper_unk.into());
304304
r.add(0x1a440, 0x24201);
305305
r.add(0x12091, cmdbuf.iogpu_unk_40.into());
306306
/*
@@ -342,7 +342,9 @@ impl super::Queue::ver {
342342
unk_0: 0,
343343
unk_2: 0,
344344
// TODO: make separate flag
345-
no_preemption: ((cmdbuf.helper_program & 1) == 0) as u8,
345+
no_preemption: (cmdbuf.flags
346+
& uapi::ASAHI_COMPUTE_NO_PREEMPTION as u64
347+
!= 0) as u8,
346348
stamp: ev_comp.stamp_pointer,
347349
fw_stamp: ev_comp.fw_stamp_pointer,
348350
stamp_value: ev_comp.value.next(),

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

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,9 @@ impl super::Queue::ver {
803803
unk_108: Default::default(),
804804
pipeline_base: U64(0x11_00000000),
805805
unk_140: U64(unks.frg_unk_140),
806-
unk_148: U64(0x0),
807-
unk_150: U64(0x0),
806+
helper_program: cmdbuf.fragment_helper_program,
807+
unk_14c: 0,
808+
helper_arg: U64(cmdbuf.fragment_helper_arg),
808809
unk_158: U64(unks.frg_unk_158),
809810
unk_160: U64(0),
810811
__pad: Default::default(),
@@ -901,8 +902,8 @@ impl super::Queue::ver {
901902
r.add(0x16431, (4 * tile_info.params.rgn_size as u64) << 24); // ISP_RGN?
902903
r.add(0x10039, tile_config); // tile_config ISP_CTL?
903904
r.add(0x16451, 0x0); // ISP_RENDER_ORIGIN
904-
r.add(0x11821, 0x0); // some shader?
905-
r.add(0x11829, 0);
905+
r.add(0x11821, cmdbuf.fragment_helper_program.into());
906+
r.add(0x11829, cmdbuf.fragment_helper_arg);
906907
r.add(0x11f79, 0);
907908
r.add(0x15359, 0);
908909
r.add(0x10069, 0x11_00000000); // USC_EXEC_BASE_ISP
@@ -1016,7 +1017,9 @@ impl super::Queue::ver {
10161017
meta <- try_init!(fw::job::raw::JobMeta {
10171018
unk_0: 0,
10181019
unk_2: 0,
1019-
no_preemption: 0,
1020+
no_preemption: (cmdbuf.flags
1021+
& uapi::ASAHI_RENDER_NO_PREEMPTION as u64
1022+
!= 0) as u8,
10201023
stamp: ev_frag.stamp_pointer,
10211024
fw_stamp: ev_frag.fw_stamp_pointer,
10221025
stamp_value: ev_frag.value.next(),
@@ -1310,7 +1313,10 @@ impl super::Queue::ver {
13101313
#[ver(G < G14)]
13111314
unk_f0: U64(unks.vtx_unk_f0),
13121315
unk_f8: U64(unks.vtx_unk_f8), // fixed
1313-
unk_100: Default::default(), // fixed
1316+
helper_program: cmdbuf.vertex_helper_program,
1317+
unk_104: 0,
1318+
helper_arg: U64(cmdbuf.vertex_helper_arg),
1319+
unk_110: Default::default(), // fixed
13141320
unk_118: unks.vtx_unk_118 as u32, // fixed
13151321
__pad: Default::default(),
13161322
}),
@@ -1389,8 +1395,8 @@ impl super::Queue::ver {
13891395
r.add(0x1c1b1, 0);
13901396
r.add(0x1c1b9, 0);
13911397
r.add(0x10061, 0x11_00000000); // USC_EXEC_BASE_TA
1392-
r.add(0x11801, 0); // some shader?
1393-
r.add(0x11809, 0); // maybe arg?
1398+
r.add(0x11801, cmdbuf.vertex_helper_program.into());
1399+
r.add(0x11809, cmdbuf.vertex_helper_arg);
13941400
r.add(0x11f71, 0);
13951401
r.add(0x1c0b1, tile_info.params.rgn_size.into()); // TE_PSG
13961402
r.add(0x1c850, tile_info.params.rgn_size.into());
@@ -1466,7 +1472,9 @@ impl super::Queue::ver {
14661472
meta <- try_init!(fw::job::raw::JobMeta {
14671473
unk_0: 0,
14681474
unk_2: 0,
1469-
no_preemption: 0,
1475+
no_preemption: (cmdbuf.flags
1476+
& uapi::ASAHI_RENDER_NO_PREEMPTION as u64
1477+
!= 0) as u8,
14701478
stamp: ev_vtx.stamp_pointer,
14711479
fw_stamp: ev_vtx.fw_stamp_pointer,
14721480
stamp_value: ev_vtx.value.next(),

0 commit comments

Comments
 (0)