feat(oakrender): render-process isolation S2 - process backend by default, zero-copy onscreen
- WorkerPool thread pool deleted; RenderManager defaults to the Processes backend (oak-worker children), Threads kept as a test-only inline dispatcher; audio tickets stay in-process until S3. - Onscreen path reads worker shm slots directly: BGRA8 slot format, RenderedFrame::Shm wrapped into the display buffer (single disclosed GPU-staging memcpy), scopes analyze BGRA8; the long-lived full-res / thumbnail paths take the counted slot_to_vec copy and release. - Playback pre-render window: forward 120 frames (configurable) fed to the PreviewScheduler at Playback priority, interleaved across workers, cached in shm slots until the playhead consumes them; generation-based invalidation cancels and releases on edits. - oaktask export and oak-cli run on private ProcessDispatchers (fixed a pump-while-locked self-deadlock in the export loop); facade get_frame handles ShmFrame payloads. - Acceptance: preview path main_heap_frame_copies == 0 with spawned workers, CLI transcode/render verified end to end.
This commit is contained in:
@@ -47,6 +47,7 @@ use oaktimeline::undogeneral::TimelineAddTrackCommand;
|
||||
use oaktimeline::undopointer::TrackPlaceBlockCommand;
|
||||
use oaktimeline::util::NodeRef;
|
||||
use oakrender::manager::RenderManager;
|
||||
use oakrender::procpool::bgra8_to_rgba8;
|
||||
use oakrender::ticket::{
|
||||
AudioTicketParams, MontageClip, TicketPayload, VideoTicketParams,
|
||||
};
|
||||
@@ -628,7 +629,9 @@ pub struct RenderedFrame {
|
||||
}
|
||||
|
||||
/// Render one frame of the sequence's montage at `time` (seconds
|
||||
/// rational) into a `(width, height)` F32 frame.
|
||||
/// rational) into a `(width, height)` F32 frame. M15 S2: the process
|
||||
/// backend renders a BGRA8 shm slot; the frame is copied out once as
|
||||
/// RGBA8 u8 (the PPM writer's format 0) and the slot released.
|
||||
pub fn render_frame(
|
||||
seq_id: NodeId,
|
||||
time: Rational,
|
||||
@@ -663,11 +666,35 @@ pub fn render_frame(
|
||||
data: frame.data.clone(),
|
||||
})
|
||||
}
|
||||
Ok(TicketPayload::ShmFrame(frame)) => {
|
||||
let out = shm_to_rendered_frame(frame);
|
||||
m.release_frame(frame);
|
||||
Ok(out)
|
||||
}
|
||||
Ok(TicketPayload::Video(_)) => Err("render produced a non-CPU frame".to_string()),
|
||||
_ => Err("render produced no video frame".to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy a process-backend shm frame (BGRA8 slot) out into the CLI's
|
||||
/// RGBA8 u8 frame layout (format 0, 4 channels — the PPM writer's RGB
|
||||
/// order). Necessary copy: the CLI owns the pixels it writes to disk.
|
||||
fn shm_to_rendered_frame(frame: &oakrender::procpool::ShmFrameRef) -> RenderedFrame {
|
||||
let meta = &frame.meta;
|
||||
let pixels = frame
|
||||
.shm
|
||||
.slot_bytes(frame.slot)
|
||||
.get(..meta.data_size.max(0) as usize)
|
||||
.unwrap_or_default();
|
||||
RenderedFrame {
|
||||
width: meta.width,
|
||||
height: meta.height,
|
||||
format: 0,
|
||||
linesize: meta.width.max(0) * 4,
|
||||
data: bgra8_to_rgba8(pixels),
|
||||
}
|
||||
}
|
||||
|
||||
/// Rendered interleaved f32 audio (the module audio ticket payload).
|
||||
pub struct RenderedAudio {
|
||||
/// Interleaved samples (`frame_count * channel_count` values).
|
||||
|
||||
Reference in New Issue
Block a user