From 1dbfb9a468859fb0e0ce228740731e0876bcdcf6 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 25 Oct 2026 10:15:44 -0300 Subject: pdfrender 1: PDF pages render off the loop: MuPDF's base context gets locks (fz_locks_context, pthread mutexes), a render lane is a cloned context with its own document opened from the base's shared fz_buffer (no fz_context or fz_document is ever touched by two threads); jobs on io.concurrent, a generation per slot (a stale raster never lands), fz_cookie aborts a job nobody waits for; a page not landed shows its paper, the page past the strip is rendered ahead, the second lane starts once the first is warm; pages kept past their pane for a second open or a Restore (64 MiB, oldest out first); a PDF's watch armed over the bytes it read no longer reopens it (every open parsed the document twice); a far jump's first frame no longer falls back to the page's text --- src/tty/tty.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/tty') diff --git a/src/tty/tty.zig b/src/tty/tty.zig index c97ba4bf..5ad02c28 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -1298,9 +1298,12 @@ fn localSession( pardes.image.start(io, allocs.image); if (comptime pardes.pdf_enabled) pardes.pdf.start(allocs.pdf); + // Pages render on lanes off the loop (pdf_view.workers). + if (comptime pardes.pdf_enabled) pardes.panes.Pdf.workers = io; pardes.syntax.start(allocs.tree_sitter); defer { pardes.image.stop(); + if (comptime pardes.pdf_enabled) pardes.panes.Pdf.dropKept(); if (comptime pardes.pdf_enabled) pardes.pdf.stop(); pardes.syntax.stop(); } -- cgit v1.3