Skip to content

Commit 3bd20b3

Browse files
committed
drm/asahi: fw,queue: Implement helper programs
Also expose no preemption flag (?) separately. Signed-off-by: Asahi Lina <[email protected]>
1 parent deda1b8 commit 3bd20b3

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
@@ -806,8 +806,9 @@ impl super::Queue::ver {
806806
unk_108: Default::default(),
807807
pipeline_base: U64(0x11_00000000),
808808
unk_140: U64(unks.frg_unk_140),
809-
unk_148: U64(0x0),
810-
unk_150: U64(0x0),
809+
helper_program: cmdbuf.fragment_helper_program,
810+
unk_14c: 0,
811+
helper_arg: U64(cmdbuf.fragment_helper_arg),
811812
unk_158: U64(unks.frg_unk_158),
812813
unk_160: U64(0),
813814
__pad: Default::default(),
@@ -904,8 +905,8 @@ impl super::Queue::ver {
904905
r.add(0x16431, (4 * tile_info.params.rgn_size as u64) << 24); // ISP_RGN?
905906
r.add(0x10039, tile_config); // tile_config ISP_CTL?
906907
r.add(0x16451, 0x0); // ISP_RENDER_ORIGIN
907-
r.add(0x11821, 0x0); // some shader?
908-
r.add(0x11829, 0);
908+
r.add(0x11821, cmdbuf.fragment_helper_program.into());
909+
r.add(0x11829, cmdbuf.fragment_helper_arg);
909910
r.add(0x11f79, 0);
910911
r.add(0x15359, 0);
911912
r.add(0x10069, 0x11_00000000); // USC_EXEC_BASE_ISP
@@ -1019,7 +1020,9 @@ impl super::Queue::ver {
10191020
meta <- try_init!(fw::job::raw::JobMeta {
10201021
unk_0: 0,
10211022
unk_2: 0,
1022-
no_preemption: 0,
1023+
no_preemption: (cmdbuf.flags
1024+
& uapi::ASAHI_RENDER_NO_PREEMPTION as u64
1025+
!= 0) as u8,
10231026
stamp: ev_frag.stamp_pointer,
10241027
fw_stamp: ev_frag.fw_stamp_pointer,
10251028
stamp_value: ev_frag.value.next(),
@@ -1313,7 +1316,10 @@ impl super::Queue::ver {
13131316
#[ver(G < G14)]
13141317
unk_f0: U64(unks.vtx_unk_f0),
13151318
unk_f8: U64(unks.vtx_unk_f8), // fixed
1316-
unk_100: Default::default(), // fixed
1319+
helper_program: cmdbuf.vertex_helper_program,
1320+
unk_104: 0,
1321+
helper_arg: U64(cmdbuf.vertex_helper_arg),
1322+
unk_110: Default::default(), // fixed
13171323
unk_118: unks.vtx_unk_118 as u32, // fixed
13181324
__pad: Default::default(),
13191325
}),
@@ -1392,8 +1398,8 @@ impl super::Queue::ver {
13921398
r.add(0x1c1b1, 0);
13931399
r.add(0x1c1b9, 0);
13941400
r.add(0x10061, 0x11_00000000); // USC_EXEC_BASE_TA
1395-
r.add(0x11801, 0); // some shader?
1396-
r.add(0x11809, 0); // maybe arg?
1401+
r.add(0x11801, cmdbuf.vertex_helper_program.into());
1402+
r.add(0x11809, cmdbuf.vertex_helper_arg);
13971403
r.add(0x11f71, 0);
13981404
r.add(0x1c0b1, tile_info.params.rgn_size.into()); // TE_PSG
13991405
r.add(0x1c850, tile_info.params.rgn_size.into());
@@ -1469,7 +1475,9 @@ impl super::Queue::ver {
14691475
meta <- try_init!(fw::job::raw::JobMeta {
14701476
unk_0: 0,
14711477
unk_2: 0,
1472-
no_preemption: 0,
1478+
no_preemption: (cmdbuf.flags
1479+
& uapi::ASAHI_RENDER_NO_PREEMPTION as u64
1480+
!= 0) as u8,
14731481
stamp: ev_vtx.stamp_pointer,
14741482
fw_stamp: ev_vtx.fw_stamp_pointer,
14751483
stamp_value: ev_vtx.value.next(),

0 commit comments

Comments
 (0)