diff options
author | rodri <rgl@antares-labs.eu> | 2024-09-19 21:33:17 +0000 |
---|---|---|
committer | rodri <rgl@antares-labs.eu> | 2024-09-19 21:33:17 +0000 |
commit | 2fd16cbf190d5c37fc627f79bf586f66129fea46 (patch) | |
tree | bc7ec8c30e79c722c3a4216fd430152b5265f68a | |
parent | 9f4d2e578fa2b874d65fd85d28f9b9f31e88dd0f (diff) | |
download | libgraphics-2fd16cbf190d5c37fc627f79bf586f66129fea46.tar.gz libgraphics-2fd16cbf190d5c37fc627f79bf586f66129fea46.tar.bz2 libgraphics-2fd16cbf190d5c37fc627f79bf586f66129fea46.zip |
get rid of the turbopool (the experiment was futile.)
-rw-r--r-- | fb.c | 67 | ||||
-rw-r--r-- | internal.h | 22 | ||||
-rw-r--r-- | mkfile | 1 | ||||
-rw-r--r-- | render.c | 3 | ||||
-rw-r--r-- | turbopool.c | 60 |
5 files changed, 0 insertions, 153 deletions
@@ -205,25 +205,6 @@ upscaledraw(Raster *fb, Image *dst, Point off, Point scale, uint filter) free(blk); } -//typedef struct Ldimgtask Ldimgtask; -//struct Ldimgtask -//{ -// Image *dst; -// Rectangle dr; -// uchar *src; -// ulong len; -// Channel *done; /* task completion signal */ -//}; -//static void -//ldimgtask(void *arg) -//{ -// Ldimgtask *t; -// -// t = arg; -// loadimage(t->dst, t->dr, t->src, t->len); -// nbsend(t->done, nil); -//} - static void framebufctl_draw(Framebufctl *ctl, Image *dst, char *name, Point off, Point scale) { @@ -266,54 +247,6 @@ framebufctl_draw(Framebufctl *ctl, Image *dst, char *name, Point off, Point scal sr = rectaddpt(fb->r, off); dr = rectsubpt(dst->r, dst->r.min); if(rectinrect(sr, dr)){ -// Ldimgtask *tasks; -// Rectangle blkr; -// ulong len, stride; -// int Δy, i; -// static Display **disps; -// static Image **imgs; -// static int loaded; -// -// assert(turbodrawingpool != nil); -// -// if(!loaded){ -// disps = emalloc(turbodrawingpool->nprocs * sizeof(*disps)); -// imgs = emalloc(turbodrawingpool->nprocs * sizeof(*imgs)); -// for(i = 0; i < turbodrawingpool->nprocs; i++){ -// disps[i] = initdisplay(nil, nil, nil); -// if(disps[i] == nil) -// sysfatal("initdisplay: %r"); -// imgs[i] = namedimage(disps[i], "screenb"); -// if(imgs[i] == nil) -// sysfatal("namedimage: %r"); -////fprint(2, "d %#p i %#p → %#p\n", disps[i], imgs[i], imgs[i]->display); -// } -// loaded++; -// } -// -// len = Dx(r->r)*Dy(r->r)*4; -// Δy = Dy(sr)/turbodrawingpool->nprocs; -// dr = rectaddpt(sr, dst->r.min); -// blkr = dr; -// blkr.max.y = blkr.min.y + Δy; -// stride = Dx(blkr)*Dy(blkr)*4; -// tasks = emalloc(turbodrawingpool->nprocs * sizeof(*tasks)); -// -// for(i = 0; i < turbodrawingpool->nprocs; i++){ -// tasks[i].dst = imgs[i]; -// tasks[i].dr = rectaddpt(blkr, Pt(0, i*Δy)); -// tasks[i].src = (uchar*)r->data + i*stride; -// tasks[i].len = stride; -// if(i == turbodrawingpool->nprocs-1){ -// tasks[i].dr.max.y = dr.max.y; -// tasks[i].len = len - i*stride; -// } -// turbopoolexec(turbodrawingpool, ldimgtask, &tasks[i]); -// } -// for(i = 0; i < turbodrawingpool->nprocs; i++) -// recvp(tasks[i].done); -// free(tasks); - tmp = allocimage(display, sr, RGBA32, 0, DNofill); if(tmp == nil) sysfatal("allocimage: %r"); @@ -39,23 +39,6 @@ struct Rastertask Primitive p; }; -typedef struct Turbotask Turbotask; -typedef struct Turbopool Turbopool; - -struct Turbotask -{ - void (*fn)(void*); - void *arg; -}; - -struct Turbopool -{ - ulong nprocs; - Channel *subq; /* task submission queue */ -}; - -extern Turbopool *turbopool; - /* alloc */ void *emalloc(ulong); void *erealloc(void*, ulong); @@ -96,11 +79,6 @@ void memsetl(void*, ulong, usize); /* nanosec */ uvlong nanosec(void); -/* turbopool */ -Turbopool *mkturbopool(ulong); -void turbopoolexec(Turbopool*, void(*)(void*), void*); -void rmturbopool(Turbopool*); - #define getpixel(fb, p) rastergetcolor(fb, p) #define putpixel(fb, p, c) rasterputcolor(fb, p, c) #define getdepth(fb, p) rastergetfloat(fb, p) @@ -17,7 +17,6 @@ OFILES=\ color.$O\ util.$O\ nanosec.$O\ - turbopool.$O\ HFILES=\ graphics.h\ @@ -9,7 +9,6 @@ #include "internal.h" Rectangle UR = {0,0,1,1}; -//Turbopool *turbopool; static Vertexattr * sparams_getuniform(Shaderparams *sp, char *id) @@ -732,8 +731,6 @@ initgraphics(void) nproc = 1; free(nprocs); -// turbopool = mkturbopool(nproc); - r = emalloc(sizeof *r); memset(r, 0, sizeof *r); r->jobq = chancreate(sizeof(Renderjob*), 8); diff --git a/turbopool.c b/turbopool.c deleted file mode 100644 index 8011c18..0000000 --- a/turbopool.c +++ /dev/null @@ -1,60 +0,0 @@ -#include <u.h> -#include <libc.h> -#include <thread.h> -#include <draw.h> -#include <memdraw.h> -#include <geometry.h> -#include "libobj/obj.h" -#include "graphics.h" -#include "internal.h" - -static void -_turboproc(void *arg) -{ - Turbopool *p; - Turbotask *t; - - threadsetname("turboproc"); - - p = arg; - - while((t = recvp(p->subq)) != nil){ - t->fn(t->arg); - free(t); - } -} - -Turbopool * -mkturbopool(ulong nprocs) -{ - Turbopool *p; - - p = emalloc(sizeof *p); - memset(p, 0, sizeof *p); - p->nprocs = nprocs; - p->subq = chancreate(sizeof(void*), nprocs); - while(nprocs--) - proccreate(_turboproc, p, mainstacksize); - return p; -} - -void -turbopoolexec(Turbopool *p, void (*fn)(void*), void *arg) -{ - Turbotask *t; - - t = emalloc(sizeof *t); - t->fn = fn; - t->arg = arg; - - sendp(p->subq, t); -} - -void -rmturbopool(Turbopool *p) -{ - while(p->nprocs--) - sendp(p->subq, nil); - chanfree(p->subq); - free(p); -} |