Skip to content

Commit ecdc19e

Browse files
committed
drm/asahi: workqueue: Port to init!()
Signed-off-by: Asahi Lina <[email protected]>
1 parent ad86b5e commit ecdc19e

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

drivers/gpu/drm/asahi/workqueue.rs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ use crate::debug::*;
1717
use crate::fw::channels::PipeType;
1818
use crate::fw::types::*;
1919
use crate::fw::workqueue::*;
20+
use crate::no_debug;
2021
use crate::object::OpaqueGpuObject;
2122
use crate::regs::FaultReason;
22-
use crate::{box_in_place, no_debug, place};
2323
use crate::{channel, driver, event, fw, gpu, object, regs};
2424
use core::num::NonZeroU64;
2525
use core::sync::atomic::Ordering;
@@ -561,25 +561,27 @@ impl WorkQueue::ver {
561561
priority: u32,
562562
size: u32,
563563
) -> Result<Arc<WorkQueue::ver>> {
564-
let mut info = box_in_place!(QueueInfo::ver {
565-
state: alloc.shared.new_default::<RingState>()?,
566-
ring: alloc.shared.array_empty(size as usize)?,
567-
gpu_buf: alloc.private.array_empty(0x2c18)?,
568-
notifier_list: notifier_list,
569-
gpu_context: gpu_context,
570-
})?;
571-
572-
info.state.with_mut(|raw, _inner| {
573-
raw.rb_size = size;
574-
});
575-
564+
let gpu_buf = alloc.private.array_empty(0x2c18)?;
565+
let shared = &mut alloc.shared;
576566
let inner = WorkQueueInner::ver {
577567
dev: dev.clone(),
578568
event_manager,
579-
info: alloc.private.new_boxed(info, |inner, ptr| {
580-
Ok(place!(
581-
ptr,
582-
raw::QueueInfo::ver {
569+
info: alloc.private.new_init(
570+
try_init!(QueueInfo::ver {
571+
state: {
572+
let mut s = shared.new_default::<RingState>()?;
573+
s.with_mut(|raw, _inner| {
574+
raw.rb_size = size;
575+
});
576+
s
577+
},
578+
ring: shared.array_empty(size as usize)?,
579+
gpu_buf,
580+
notifier_list: notifier_list,
581+
gpu_context: gpu_context,
582+
}),
583+
|inner, _p| {
584+
try_init!(raw::QueueInfo::ver {
583585
state: inner.state.gpu_pointer(),
584586
ring: inner.ring.gpu_pointer(),
585587
notifier_list: inner.notifier_list.gpu_pointer(),
@@ -608,9 +610,9 @@ impl WorkQueue::ver {
608610
unk_a8: Default::default(),
609611
#[ver(V >= V13_2 && G < G14X)]
610612
unk_b0: 0,
611-
}
612-
))
613-
})?,
613+
})
614+
},
615+
)?,
614616
new: true,
615617
pipe_type,
616618
size,

0 commit comments

Comments
 (0)