mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 20:42:44 +02:00
Parse bufferProducerConnect() parcel reply properly. Store the output QueueBufferOutput from bufferProducerConnect/bufferProducerQueueBuffer in gfx.c.
This commit is contained in:
parent
63016db072
commit
4c1c1ee14b
@ -33,6 +33,6 @@ Result bufferProducerDequeueBuffer(bool async, u32 width, u32 height, s32 format
|
|||||||
Result bufferProducerDetachBuffer(s32 slot);
|
Result bufferProducerDetachBuffer(s32 slot);
|
||||||
Result bufferProducerQueueBuffer(s32 buf, bufferProducerQueueBufferInput *input, bufferProducerQueueBufferOutput *output);
|
Result bufferProducerQueueBuffer(s32 buf, bufferProducerQueueBufferInput *input, bufferProducerQueueBufferOutput *output);
|
||||||
Result bufferProducerQuery(s32 what, s32* value);
|
Result bufferProducerQuery(s32 what, s32* value);
|
||||||
Result bufferProducerConnect(s32 api, bool producerControlledByApp);
|
Result bufferProducerConnect(s32 api, bool producerControlledByApp, bufferProducerQueueBufferOutput *output);
|
||||||
Result bufferProducerDisconnect(s32 api);
|
Result bufferProducerDisconnect(s32 api);
|
||||||
Result bufferProducerTegraBufferInit(s32 buf, u8 input[0x178]);
|
Result bufferProducerTegraBufferInit(s32 buf, u8 input[0x178]);
|
||||||
|
@ -193,7 +193,7 @@ Result bufferProducerQuery(s32 what, s32* value)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result bufferProducerConnect(s32 api, bool producerControlledByApp)
|
Result bufferProducerConnect(s32 api, bool producerControlledByApp, bufferProducerQueueBufferOutput *output)
|
||||||
{
|
{
|
||||||
Result rc;
|
Result rc;
|
||||||
Parcel parcel, parcel_reply;
|
Parcel parcel, parcel_reply;
|
||||||
@ -214,7 +214,11 @@ Result bufferProducerConnect(s32 api, bool producerControlledByApp)
|
|||||||
rc = parcelTransact(g_bufferProducerBinderSession, CONNECT, &parcel, &parcel_reply);
|
rc = parcelTransact(g_bufferProducerBinderSession, CONNECT, &parcel, &parcel_reply);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) {
|
if (R_SUCCEEDED(rc)) {
|
||||||
//TODO: parse reply (contains 32bit width and height)
|
if (parcelReadData(&parcel_reply, output, sizeof(bufferProducerQueueBufferOutput))==NULL) return MAKERESULT(MODULE_LIBNX, LIBNX_BADINPUT);
|
||||||
|
|
||||||
|
int result = parcelReadInt32(&parcel_reply);
|
||||||
|
if (result != 0)
|
||||||
|
rc = MAKERESULT(MODULE_LIBNX, LIBNX_BUFFERPRODUCER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -16,6 +16,8 @@ static bool g_gfx_ProducerSlotsRequested[2] = {0, 0};
|
|||||||
static u8 *g_gfxFramebuf;
|
static u8 *g_gfxFramebuf;
|
||||||
static size_t g_gfxFramebufSize;
|
static size_t g_gfxFramebufSize;
|
||||||
static bufferProducerFence g_gfx_DequeueBuffer_fence;
|
static bufferProducerFence g_gfx_DequeueBuffer_fence;
|
||||||
|
static bufferProducerQueueBufferOutput g_gfx_Connect_QueueBufferOutput;
|
||||||
|
static bufferProducerQueueBufferOutput g_gfx_QueueBuffer_QueueBufferOutput;
|
||||||
|
|
||||||
static bool g_gfxDoubleBuf = 1;
|
static bool g_gfxDoubleBuf = 1;
|
||||||
|
|
||||||
@ -84,7 +86,7 @@ static Result _gfxQueueBuffer(s32 buf) {
|
|||||||
|
|
||||||
g_gfxQueueBufferData.timestamp = svcGetSystemTick();//This is probably not the proper value for the timestamp, but shouldn't(?) matter.
|
g_gfxQueueBufferData.timestamp = svcGetSystemTick();//This is probably not the proper value for the timestamp, but shouldn't(?) matter.
|
||||||
|
|
||||||
rc = bufferProducerQueueBuffer(buf, &g_gfxQueueBufferData, NULL);
|
rc = bufferProducerQueueBuffer(buf, &g_gfxQueueBufferData, &g_gfx_QueueBuffer_QueueBufferOutput);
|
||||||
if (R_FAILED(rc)) return rc;
|
if (R_FAILED(rc)) return rc;
|
||||||
|
|
||||||
/*if(buf==0) {//
|
/*if(buf==0) {//
|
||||||
@ -135,7 +137,7 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L
|
|||||||
|
|
||||||
if (R_SUCCEEDED(rc)) rc = bufferProducerInitialize(&g_gfxBinderSession);
|
if (R_SUCCEEDED(rc)) rc = bufferProducerInitialize(&g_gfxBinderSession);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) rc = bufferProducerConnect(2, 0);
|
if (R_SUCCEEDED(rc)) rc = bufferProducerConnect(2, 0, &g_gfx_Connect_QueueBufferOutput);
|
||||||
|
|
||||||
if (R_SUCCEEDED(rc)) g_gfx_ProducerConnected = 1;
|
if (R_SUCCEEDED(rc)) g_gfx_ProducerConnected = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user