aboutsummaryrefslogtreecommitdiff
path: root/fb.c
diff options
context:
space:
mode:
authorrodri <rgl@antares-labs.eu>2024-04-15 04:53:51 +0000
committerrodri <rgl@antares-labs.eu>2024-04-15 04:53:51 +0000
commit4d88a3779d1f5e15ea7ea3bca5330b9c8d1ef2fd (patch)
tree6385ecdd66209b32e4d48ac34cf7c6916f93237b /fb.c
parent2c286986893435895528d59c7db624261ac5571b (diff)
downloadlibgraphics-4d88a3779d1f5e15ea7ea3bca5330b9c8d1ef2fd.tar.gz
libgraphics-4d88a3779d1f5e15ea7ea3bca5330b9c8d1ef2fd.tar.bz2
libgraphics-4d88a3779d1f5e15ea7ea3bca5330b9c8d1ef2fd.zip
implement a fully concurrent pipeline based on tiles.
- got rid of the z-buffer lock to avoid contention. - little improvements to fb.c
Diffstat (limited to 'fb.c')
-rw-r--r--fb.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fb.c b/fb.c
index 02c984d..b630094 100644
--- a/fb.c
+++ b/fb.c
@@ -13,26 +13,29 @@ framebufctl_draw(Framebufctl *ctl, Image *dst)
{
Framebuf *fb;
- fb = ctl->fb[ctl->idx];
- lock(&ctl->swplk);
+ lock(ctl);
+ fb = ctl->getfb(ctl);
loadimage(dst, rectaddpt(fb->r, dst->r.min), byteaddr(fb->cb, fb->r.min), bytesperline(fb->r, fb->cb->depth)*Dy(fb->r));
- unlock(&ctl->swplk);
+ unlock(ctl);
}
static void
framebufctl_memdraw(Framebufctl *ctl, Memimage *dst)
{
- lock(&ctl->swplk);
- memimagedraw(dst, dst->r, ctl->fb[ctl->idx]->cb, ZP, nil, ZP, SoverD);
- unlock(&ctl->swplk);
+ Framebuf *fb;
+
+ lock(ctl);
+ fb = ctl->getfb(ctl);
+ memimagedraw(dst, dst->r, fb->cb, ZP, nil, ZP, SoverD);
+ unlock(ctl);
}
static void
framebufctl_swap(Framebufctl *ctl)
{
- lock(&ctl->swplk);
+ lock(ctl);
ctl->idx ^= 1;
- unlock(&ctl->swplk);
+ unlock(ctl);
}
static void
@@ -41,7 +44,7 @@ framebufctl_reset(Framebufctl *ctl)
Framebuf *fb;
/* address the back buffer—resetting the front buffer is VERBOTEN */
- fb = ctl->fb[ctl->idx^1];
+ fb = ctl->getbb(ctl);
memsetd(fb->zbuf, Inf(-1), Dx(fb->r)*Dy(fb->r));
memfillcolor(fb->cb, DTransparent);
}