mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-29 00:02:39 +02:00
Potentially fix race condition nvGpfifoCreate by waiting on the fence returned by nvioctlChannel_AllocGpfifoEx2
This commit is contained in:
parent
d718a8dd28
commit
7f4001bec2
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
NvChannel* parent;
|
NvChannel* parent;
|
||||||
nvioctl_fence fifo_fence;
|
|
||||||
} NvGpfifo;
|
} NvGpfifo;
|
||||||
|
|
||||||
Result nvGpfifoCreate(NvGpfifo* f, NvChannel* parent);
|
Result nvGpfifoCreate(NvGpfifo* f, NvChannel* parent);
|
||||||
|
@ -24,8 +24,11 @@ Result nvGpfifoCreate(NvGpfifo* f, NvChannel* parent)
|
|||||||
{
|
{
|
||||||
f->parent = parent;
|
f->parent = parent;
|
||||||
|
|
||||||
return nvioctlChannel_AllocGpfifoEx2(
|
NvFence fence;
|
||||||
parent->fd, DEFAULT_FIFO_ENTRIES, 1, 0, 0, 0, 0, &f->fifo_fence);
|
Result res = nvioctlChannel_AllocGpfifoEx2(parent->fd, DEFAULT_FIFO_ENTRIES, 1, 0, 0, 0, 0, &fence);
|
||||||
|
if (R_SUCCEEDED(res) && (s32)fence.id >= 0)
|
||||||
|
nvFenceWait(&fence, -1);
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nvGpfifoClose(NvGpfifo* f) {
|
void nvGpfifoClose(NvGpfifo* f) {
|
||||||
|
Loading…
Reference in New Issue
Block a user