diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-18 07:22:41 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-18 09:44:10 -0300 |
| commit | b2f709d7130571658220636f33b5f89414a5101a (patch) | |
| tree | d90c39668caec2fb08bc4bfc9e0ef8c18c9cbe02 /src | |
| parent | f0e6eb0de0b5ac9f81ba2c728f3040c4a51ab284 (diff) | |
| download | pardes-b2f709d7130571658220636f33b5f89414a5101a.tar.gz pardes-b2f709d7130571658220636f33b5f89414a5101a.zip | |
pdf: the PDF kind runs where its pane is shown (PA_PLAIN): its state is one plain block of 840 bytes with no padding (the place, each view's layout, fit, tint, the state jobs out, the search, the selection made, the press, the pointer's word, the glide and the fling, the count), changed only by its calls from the block and taped values; the document, the pages' sizes, what the state jobs answered, the strips and the pictures are each process's own, found by the block's address and made again where a client joined late lacks them; its pages are draws asked as each view is painted, never jobs on the tape; its keys, mouse and ticks read no picture (a pan, a click and a revealed hit take MuPDF's measure of the raster); the glide and the fling run on the ticks' clock, never on frames painted (.scratch/sketch/reorg/pardes-addons-3/design-glide.md); with no workers a draw done at once is painted the same frame; a client's joined pane keeps the session's place; a window client wheeling the PDF to page 2 reads 80.4 MB -> 0.18 MB and waits a round trip on 0 of 36 inputs (34 before), its join reads 7.4 -> 26.8 MB (it now maps pdf.so); tui core-test 820/959 (139 skipped), shell-test 994/997, behaviour-test 274/274 and --replay 0 failures, pane-test 180/181 (the PDF Shadow test is now the line's), addon-test 1/1 (pdf.out unchanged), replicas pass, process-test 2 of 144 failed (lspcomplete, lspcompletemoved: the base's), image-harness passes, test/daemon.py plain, --far, --games, --window-clients pass; gui unit-test 1588/1592 (its perf check's BaselineBuildMismatch, known); the frame corpus 74/77 Debug and ReleaseFast: frames 58-60 differ, InactiveDim's announcement now replaced by WindowOpacity's instead of stacked, because a PDF render's answer is no longer a core event between the two 9P writes (the PDF's own frames are identical); corpus2x -0.247%; pdf-scroll-bench 18,394M -> 19,214M instructions (its clock never advances, so its slow scroll counts as a fling)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'src')
| -rw-r--r-- | src/Kind.zig | 12 | ||||
| -rw-r--r-- | src/dump.zig | 5 |
2 files changed, 14 insertions, 3 deletions
diff --git a/src/Kind.zig b/src/Kind.zig index a3d20f30..233365c7 100644 --- a/src/Kind.zig +++ b/src/Kind.zig @@ -400,6 +400,7 @@ pub fn close(p: *Pardes, pane: *Pane) void { while (i < ready.items.len) if (ready.items[i].draw == p and ready.items[i].serial == pane.serial) ready.orderedRemove(i).drop() else { i += 1; }; + if (ready.items.len == 0) ready.clearAndFree(heap); } if (s.ops) |ops| if (ops.close) |f| if (!kept) { var cl: Call = .{ .p = null, .id = 0, .slot = s, .quiet = true }; @@ -438,9 +439,15 @@ pub fn draw(p: *Pardes, s: *surface.Surface, arena: std.mem.Allocator, pane: *Pa const text = if (p.kinds.byName(slot.nameOf()) != null) why else std.fmt.bufPrint(&line, "addon {s} {d} is not loaded: {s}", .{ slot.nameOf(), slot.version, why }) catch &line; _ = s.print(x, y, cols, text, .{ .fg = fg, .bg = bg }); return; - } else { + } else for (0..8) |_| { if (ready.items.len > 0) deliver(p, slot, pane, id); frame.cells = (paint(p, slot, id, arena, cols, rows, &frame) orelse return); + // No workers here (a test's, a bench's core): a draw that paint + // asked was done at once, and is this frame's, painted again. + if (drawer != null) break; + for (ready.items) |j| { + if (j.draw == p and j.pane == id) break; + } else break; } if (frame.gpu.len != 0) s.gpu_frames[id] = .{ .bytes = frame.gpu, .serial = pane.serial, .dst = .{ .x = x, .y = y, .w = cols, .h = rows } }; for (0..@min(rows, frame.rows)) |r| for (0..@min(cols, frame.cols)) |col| { @@ -1216,7 +1223,10 @@ pub const api: c.pa_api = .{ j.* = .{ .gpa = heap, .pane = @intCast(cl.id), .serial = pane.serial, .token = token, .gen = cl.slot.gen, .ops = ops, .in = copy, .arena = .init(heap), .draw = p }; Addon.holdJob(ops, true); if (drawer) |d| if (d.go(d.ctx, j)) return token; + // Here, as a worker would run it: its time is not the call's. + const t0 = if (checked) @import("FrameStats.zig").nowNs(); j.run(); + if (checked) cl.began += @import("FrameStats.zig").nowNs() -| t0; ready.append(heap, j) catch j.drop(); return token; } diff --git a/src/dump.zig b/src/dump.zig index 742a9574..102b10d0 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -901,7 +901,8 @@ pub fn plainHere(p: *Pardes, id: usize, old: *Kind.Slot, ops: *const Kind.Ops) ! } s.path = try p.gpa.dupe(u8, old.path); s.selection = try p.gpa.dupe(u8, old.selection); - const kept = .{ old.next_tick, old.views, old.focused, old.state }; + // (and its place: the open's own `where` is of a block not yet the session's) + const kept = .{ old.next_tick, old.views, old.focused, old.state, old.where_text }; if (!Kind.reopen(p, id, s, old.file)) return error.KindRefused; // Its block the session's, byte for byte (its record), never through // the kind's load, which may tidy it. @@ -909,7 +910,7 @@ pub fn plainHere(p: *Pardes, id: usize, old: *Kind.Slot, ops: *const Kind.Ops) ! const record = old.record orelse return error.KindRefused; if (block.len != record.len) return error.KindRefused; @memcpy(block, record); - s.next_tick, s.views, s.focused, s.state = kept; + s.next_tick, s.views, s.focused, s.state, s.where_text = kept; const gpa = old.gpa; old.free(); gpa.destroy(old); |
