ref: c78f84ec1698633945a6d7db3e4d76f866863728
parent: 083e03785a1d2441f84e72c3adbdee95c2230b33
author: rodri <rgl@antares-labs.eu>
date: Tue Dec 19 10:44:25 EST 2023
don't test for locking, just do it.
--- a/main.c
+++ b/main.c
@@ -76,7 +76,7 @@
uint idx;
Lock swplk;
- int (*draw)(Framebufctl*, Memimage*, int);
+ void (*draw)(Framebufctl*, Memimage*, int);
void (*swap)(Framebufctl*);
void (*reset)(Framebufctl*);
};
@@ -254,18 +254,15 @@
return i;
}
-static int
+static void
framebufctl_draw(Framebufctl *ctl, Memimage *dst, int showz)
{
- if(canlock(&ctl->swplk)){
- memimagedraw(dst, dst->r, showz? ctl->fb[ctl->idx]->zb: ctl->fb[ctl->idx]->cb, ZP, nil, ZP, SoverD);
- /* XXX DBG */
- if(shownormals)
- memimagedraw(dst, dst->r, ctl->fb[ctl->idx]->nb, ZP, nil, ZP, SoverD);
- unlock(&ctl->swplk);
- return 0;
- }
- return -1;
+ lock(&ctl->swplk);
+ memimagedraw(dst, dst->r, showz? ctl->fb[ctl->idx]->zb: ctl->fb[ctl->idx]->cb, ZP, nil, ZP, SoverD);
+ /* XXX DBG */
+ if(shownormals)
+ memimagedraw(dst, dst->r, ctl->fb[ctl->idx]->nb, ZP, nil, ZP, SoverD);
+ unlock(&ctl->swplk);
}
static void
@@ -927,8 +924,8 @@
redraw(void)
{
memfillcolor(screenfb, 0x888888FF);
- if(fbctl->draw(fbctl, screenfb, showzbuffer) < 0)
- return;
+ fbctl->draw(fbctl, screenfb, showzbuffer);
+
lockdisplay(display);
loadimage(screen, rectaddpt(screenfb->r, screen->r.min), byteaddr(screenfb, screenfb->r.min), bytesperline(screenfb->r, screenfb->depth)*Dy(screenfb->r));
drawstats();