MCPcopy Create free account
hub / github.com/devkitPro/libctru / gspEventThreadMain

Function gspEventThreadMain

libctru/source/services/gspgpu.c:364–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

362}
363
364void gspEventThreadMain(void *arg)
365{
366 while (gspRunEvents)
367 {
368 svcWaitSynchronization(gspEvent, U64_MAX);
369 svcClearEvent(gspEvent);
370
371 if (!gspRunEvents)
372 break;
373
374 while (true)
375 {
376 int curEvt = popInterrupt();
377
378 if (curEvt == -1)
379 break;
380
381 if (curEvt < GSPGPU_EVENT_MAX)
382 {
383 gxCmdQueueInterrupt((GSPGPU_Event)curEvt);
384 if (gspEventCb[curEvt])
385 {
386 ThreadFunc func = gspEventCb[curEvt];
387 if (gspEventCbOneShot[curEvt])
388 gspEventCb[curEvt] = NULL;
389 func(gspEventCbData[curEvt]);
390 }
391 LightEvent_Signal(&gspEvents[curEvt]);
392 do
393 __ldrex(&gspLastEvent);
394 while (__strex(&gspLastEvent, curEvt));
395 syncArbitrateAddress(&gspLastEvent, ARBITRATION_SIGNAL, 1);
396 }
397 }
398 }
399}
400
401//essentially : get commandIndex and totalCommands, calculate offset of new command, copy command and update totalCommands
402//use LDREX/STREX because this data may also be accessed by the GSP module and we don't want to break stuff

Callers

nothing calls this directly

Calls 6

popInterruptFunction · 0.85
LightEvent_SignalFunction · 0.85
__ldrexFunction · 0.85
__strexFunction · 0.85
syncArbitrateAddressFunction · 0.85
gxCmdQueueInterruptFunction · 0.70

Tested by

no test coverage detected