summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kind.zig')
-rw-r--r--src/Kind.zig12
1 files changed, 11 insertions, 1 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;
}