Skip to content

Commit

Permalink
(shmif) finish factoring out sem_t from _cont
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 88108356d41b6c35cc44fc9d526dc5fe7cc0a385ac4635c64fbabe023ce553c3
  • Loading branch information
void committed Feb 3, 2025
1 parent 7496673 commit 4d1ba3e
Show file tree
Hide file tree
Showing 8 changed files with 357 additions and 309 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
## Net
* Several fixes to binary in/out transfers

## Shmif
* Migrating more OS specific work to platform
* Add timeout+liveness check for recvmsg for edge condition shutdown
* Allow enqueueing TARGET\_COMMAND\_EXIT to terminate one segment from another thread
* Factored sem handle use out of cont

## 0.7.0
## Core
* Wired in rendertarget vobj export for hwenc, opt-in via target\_flags on rectgt
Expand Down
32 changes: 29 additions & 3 deletions src/platform/posix/frameserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,33 @@ static size_t shmpage_size(size_t w, size_t h,
#endif
}

static void fsrv_setevqs(
struct arcan_shmif_page* dst, sem_handle esem,
arcan_evctx* inq, arcan_evctx* outq)
{
arcan_evctx* tmp = inq;
inq = outq;
outq = tmp;

outq->synch.handle = esem;
inq->synch.handle = esem;

inq->synch.killswitch = NULL;
outq->synch.killswitch = NULL;

inq->local = false;
inq->eventbuf = dst->childevq.evqueue;
inq->front = &dst->childevq.front;
inq->back = &dst->childevq.back;
inq->eventbuf_sz = PP_QUEUE_SZ;

outq->local = false;
outq->eventbuf = dst->parentevq.evqueue;
outq->front = &dst->parentevq.front;
outq->back = &dst->parentevq.back;
outq->eventbuf_sz = PP_QUEUE_SZ;
}

struct arcan_frameserver* platform_fsrv_wrapcl(struct arcan_shmif_cont* in)
{
/* alloc - set the wrapped bitflag, set MONITOR FFUNC, map in eventqueues */
Expand Down Expand Up @@ -954,8 +981,7 @@ static bool prepare_segment(struct arcan_frameserver* ctx,
ctx->abuf_cnt = abufc;
ctx->abuf_sz = abufsz;
ctx->tag = tag;
arcan_shmif_setevqs(ctx->shm.ptr, ctx->esync,
&(ctx->inqueue), &(ctx->outqueue), true);
fsrv_setevqs(ctx->shm.ptr, ctx->esync, &(ctx->inqueue), &(ctx->outqueue));
ctx->inqueue.synch.killswitch = (void*) ctx;
ctx->outqueue.synch.killswitch = (void*) ctx;

Expand Down Expand Up @@ -1449,7 +1475,7 @@ int platform_fsrv_resynch(struct arcan_frameserver* s)
shmpage->segment_size = arcan_shmif_mapav(shmpage,
s->vbufs, s->vbuf_cnt, vbufsz, s->abufs, s->abuf_cnt, abufsz);
s->abuf_sz = abufsz;
arcan_shmif_setevqs(shmpage, s->esync, &(s->inqueue), &(s->outqueue), 1);
fsrv_setevqs(shmpage, s->esync, &(s->inqueue), &(s->outqueue));

/* commit to shared page */
shmpage->resized = 0;
Expand Down
1 change: 1 addition & 0 deletions src/shmif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ set (SHMIF_SOURCES
${ASD}/engine/arcan_trace.c
${ASD}/shmif/platform/exec.c
${ASD}/shmif/platform/fdpassing.c
${ASD}/shmif/platform/eventqueue.c
)

if (LWA_PLATFORM_STR AND IS_DIRECTORY "${ASD}/shmif/${LWA_PLATFORM_STR}" AND
Expand Down
Loading

0 comments on commit 4d1ba3e

Please sign in to comment.