From 8806aad87f7be2d2e82c7db2b9f0978246e5a747 Mon Sep 17 00:00:00 2001 From: rodri Date: Tue, 10 Sep 2024 14:26:35 +0000 Subject: fix a use-after-free when profiling rasterizer times. this commit also includes the turbo drawing pool. the experiment was successful in getting reasonable drawing times to a fullhd image, but the process causes glitches when moving the objects around, which is unacceptable. it's been commented out for now. --- internal.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'internal.h') diff --git a/internal.h b/internal.h index 3173f75..e1c81ca 100644 --- a/internal.h +++ b/internal.h @@ -39,6 +39,27 @@ struct Rastertask Primitive p; }; +typedef struct Proctask Proctask; +typedef struct Procpool Procpool; + +struct Proctask +{ + void (*fn)(void*); + void *arg; +}; + +struct Procpool +{ + ulong nprocs; + Ref issued; + Ref complete; + + Channel *subq; /* task submission queue */ + Channel *done; /* task completion signal */ +}; + +extern Procpool *turbodrawingpool; + /* alloc */ void *emalloc(ulong); void *erealloc(void*, ulong); @@ -79,6 +100,12 @@ void memsetl(void*, ulong, usize); /* nanosec */ uvlong nanosec(void); +/* procpool */ +Procpool *mkprocpool(ulong); +void procpoolexec(Procpool*, void(*)(void*), void*); +void procpoolwait(Procpool*); +void rmprocpool(Procpool*); + #define getpixel(fb, p) rastergetcolor(fb, p) #define putpixel(fb, p, c) rasterputcolor(fb, p, c) #define getdepth(fb, p) rastergetfloat(fb, p) -- cgit v1.2.3