Skip to content

Commit

Permalink
drm/asahi: Identify more Render fields & update to UAPI 10007
Browse files Browse the repository at this point in the history
Also set the large_tib flag properly (implied from tib size for now, not
sure if this should be a separate flag?)

Signed-off-by: Asahi Lina <[email protected]>
  • Loading branch information
asahilina committed Apr 7, 2023
1 parent 745b345 commit ec153d7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 22 deletions.
8 changes: 4 additions & 4 deletions drivers/gpu/drm/asahi/fw/fragment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub(crate) mod raw {
pub(crate) utiles_per_mtile_x: u16,
pub(crate) unk_24: u32,
pub(crate) tile_counts: u32,
pub(crate) iogpu_unk_212: u32,
pub(crate) tib_blocks: u32,
pub(crate) isp_bgobjdepth: u32,
pub(crate) isp_bgobjvals: u32,
pub(crate) unk_38: u32,
Expand Down Expand Up @@ -171,15 +171,15 @@ pub(crate) mod raw {
pub(crate) stencil_buffer_ptr3: U64,
pub(crate) stencil_meta_buffer_ptr3: U64,
pub(crate) unk_2f8: Array<2, U64>,
pub(crate) iogpu_unk_212: u32,
pub(crate) tib_blocks: u32,
pub(crate) unk_30c: u32,
pub(crate) aux_fb_info: AuxFBInfo::ver,
pub(crate) unk_320_padding: Array<0x10, u8>,
pub(crate) unk_partial_store_pipeline: StorePipelineBinding,
pub(crate) partial_store_pipeline: StorePipelineBinding,
pub(crate) isp_bgobjdepth: u32,
pub(crate) isp_bgobjvals: u32,
pub(crate) iogpu_unk_49: u32,
pub(crate) sample_size: u32,
pub(crate) unk_37c: u32,
pub(crate) unk_380: U64,
pub(crate) unk_388: U64,
Expand Down Expand Up @@ -230,7 +230,7 @@ pub(crate) mod raw {
pub(crate) encoder_params: job::raw::EncoderParams<'a>,
pub(crate) process_empty_tiles: u32,
pub(crate) no_clear_pipeline_textures: u32,
pub(crate) unk_param: u32,
pub(crate) msaa_zs: u32,
pub(crate) unk_pointee: u32,
pub(crate) meta: job::raw::JobMeta,
pub(crate) unk_after_meta: u32,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/fw/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub(crate) mod raw {
#[repr(C)]
pub(crate) struct EncoderParams<'a> {
pub(crate) unk_8: u32,
pub(crate) unk_c: u32,
pub(crate) large_tib: u32,
pub(crate) unk_10: u32,
pub(crate) encoder_id: u32,
pub(crate) unk_18: u32,
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/asahi/fw/microseq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pub(crate) struct StartFragment<'a> {
pub(crate) unk_50: u32,
pub(crate) event_generation: u32,
pub(crate) buffer_slot: u32,
pub(crate) unk_5c: u32,
pub(crate) large_tib: u32,
pub(crate) event_seq: U64,
pub(crate) unk_68: u32,
pub(crate) unk_758_flag: GpuWeakPointer<u32>,
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/asahi/queue/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ impl super::Queue::ver {
unk_5c: 0,
},
encoder_params: fw::job::raw::EncoderParams {
unk_8: 0x0, // fixed
unk_c: 0x0, // fixed
unk_10: 0x0, // fixed
unk_8: 0x0, // fixed
large_tib: 0x0, // check!
unk_10: 0x0, // fixed
encoder_id: cmdbuf.encoder_id,
unk_18: 0x0, // fixed
iogpu_compute_unk44: cmdbuf.iogpu_unk_44,
Expand Down
29 changes: 16 additions & 13 deletions drivers/gpu/drm/asahi/queue/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,9 @@ impl super::Queue::ver {
| uapi::ASAHI_RENDER_SET_WHEN_RELOADING_Z_OR_S
| uapi::ASAHI_RENDER_MEMORYLESS_RTS_USED
| uapi::ASAHI_RENDER_PROCESS_EMPTY_TILES
| uapi::ASAHI_RENDER_NO_VERTEX_CLUSTERING) as u64
| uapi::ASAHI_RENDER_NO_VERTEX_CLUSTERING
| uapi::ASAHI_RENDER_MSAA_ZS
| uapi::ASAHI_RENDER_UNK_FLAG1) as u64
!= 0
{
return Err(EINVAL);
Expand Down Expand Up @@ -395,8 +397,7 @@ impl super::Queue::ver {

let timestamps = Arc::try_new(kalloc.shared.new_default::<fw::job::RenderTimestamps>()?)?;

let unk1 = debug_enabled(debug::DebugFlags::Debug1);
let unk2 = debug_enabled(debug::DebugFlags::Debug2);
let unk1 = cmdbuf.flags & uapi::ASAHI_RENDER_UNK_FLAG1 as u64 != 0;

let mut tile_config: u64 = 0;
if !unk1 {
Expand Down Expand Up @@ -449,6 +450,8 @@ impl super::Queue::ver {
#[ver(V >= V13_0B4)]
let count_vtx = count_frag + 1;

let large_tib = cmdbuf.tib_blocks > 8;

mod_dev_dbg!(self.dev, "[Submission {}] Create Frag\n", id);
let frag = GpuObject::new_prealloc(
kalloc.private.alloc_object()?,
Expand All @@ -475,7 +478,7 @@ impl super::Queue::ver {
unk_50: 0x1, // fixed
event_generation: self.id as u32,
buffer_slot: scene.slot(),
unk_5c: 0,
large_tib: large_tib as u32,
event_seq: U64(ev_frag.event_seq),
unk_68: 0,
unk_758_flag: inner_weak_ptr!(ptr, unk_758_flag),
Expand Down Expand Up @@ -671,7 +674,7 @@ impl super::Queue::ver {
utiles_per_mtile_x: tile_info.utiles_per_mtile_x as u16,
unk_24: 0x0,
tile_counts: ((tile_info.tiles_y - 1) << 12) | (tile_info.tiles_x - 1),
iogpu_unk_212: cmdbuf.iogpu_unk_212,
tib_blocks: cmdbuf.tib_blocks,
isp_bgobjdepth: cmdbuf.isp_bgobjdepth,
// TODO: does this flag need to be exposed to userspace?
isp_bgobjvals: cmdbuf.isp_bgobjvals | 0x400,
Expand Down Expand Up @@ -719,7 +722,7 @@ impl super::Queue::ver {
stencil_buffer_ptr3: U64(cmdbuf.stencil_buffer_3),
stencil_meta_buffer_ptr3: U64(cmdbuf.stencil_meta_buffer_3),
unk_2f8: Default::default(),
iogpu_unk_212: cmdbuf.iogpu_unk_212,
tib_blocks: cmdbuf.tib_blocks,
unk_30c: 0x0,
aux_fb_info: aux_fb_info,
unk_320_padding: Default::default(),
Expand All @@ -734,7 +737,7 @@ impl super::Queue::ver {
),
isp_bgobjdepth: cmdbuf.isp_bgobjdepth,
isp_bgobjvals: cmdbuf.isp_bgobjvals,
iogpu_unk_49: cmdbuf.iogpu_unk_49,
sample_size: cmdbuf.sample_size,
unk_37c: 0x0,
unk_380: U64(0x0),
unk_388: U64(0x0),
Expand All @@ -752,8 +755,8 @@ impl super::Queue::ver {
unk_8: (cmdbuf.flags
& uapi::ASAHI_RENDER_SET_WHEN_RELOADING_Z_OR_S as u64
!= 0) as u32,
unk_c: 0x0, // fixed
unk_10: 0x0, // fixed
large_tib: large_tib as u32, // fixed
unk_10: 0x0, // fixed
encoder_id: cmdbuf.encoder_id,
unk_18: 0x0, // fixed
iogpu_compute_unk44: 0xffffffff,
Expand All @@ -766,7 +769,7 @@ impl super::Queue::ver {
no_clear_pipeline_textures: (cmdbuf.flags
& uapi::ASAHI_RENDER_NO_CLEAR_PIPELINE_TEXTURES as u64
!= 0) as u32,
unk_param: unk2.into(), // 1 for boot stuff?
msaa_zs: (cmdbuf.flags & uapi::ASAHI_RENDER_MSAA_ZS as u64 != 0) as u32,
unk_pointee: 0,
meta: fw::job::raw::JobMeta {
unk_0: 0,
Expand Down Expand Up @@ -1077,9 +1080,9 @@ impl super::Queue::ver {
unk_520: U64(0x0), // fixed
},
encoder_params: fw::job::raw::EncoderParams {
unk_8: 0x0, // fixed
unk_c: 0x0, // fixed
unk_10: 0x0, // fixed
unk_8: 0x0, // fixed
large_tib: 0x0, // fixed
unk_10: 0x0, // fixed
encoder_id: cmdbuf.encoder_id,
unk_18: 0x0, // fixed
iogpu_compute_unk44: 0xffffffff,
Expand Down

0 comments on commit ec153d7

Please sign in to comment.