Parse bufferProducerConnect() parcel reply properly. Store the output QueueBufferOutput from bufferProducerConnect/bufferProducerQueueBuffer in gfx.c.

This commit is contained in:
yellows8 2017-12-04 13:31:29 -05:00
parent 63016db072
commit 4c1c1ee14b
3 changed files with 11 additions and 5 deletions

View File

@ -33,6 +33,6 @@ Result bufferProducerDequeueBuffer(bool async, u32 width, u32 height, s32 format
Result bufferProducerDetachBuffer(s32 slot);
Result bufferProducerQueueBuffer(s32 buf, bufferProducerQueueBufferInput *input, bufferProducerQueueBufferOutput *output);
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 bufferProducerTegraBufferInit(s32 buf, u8 input[0x178]);

View File

@ -193,7 +193,7 @@ Result bufferProducerQuery(s32 what, s32* value)
return rc;
}
Result bufferProducerConnect(s32 api, bool producerControlledByApp)
Result bufferProducerConnect(s32 api, bool producerControlledByApp, bufferProducerQueueBufferOutput *output)
{
Result rc;
Parcel parcel, parcel_reply;
@ -214,7 +214,11 @@ Result bufferProducerConnect(s32 api, bool producerControlledByApp)
rc = parcelTransact(g_bufferProducerBinderSession, CONNECT, &parcel, &parcel_reply);
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;

View File

@ -16,6 +16,8 @@ static bool g_gfx_ProducerSlotsRequested[2] = {0, 0};
static u8 *g_gfxFramebuf;
static size_t g_gfxFramebufSize;
static bufferProducerFence g_gfx_DequeueBuffer_fence;
static bufferProducerQueueBufferOutput g_gfx_Connect_QueueBufferOutput;
static bufferProducerQueueBufferOutput g_gfx_QueueBuffer_QueueBufferOutput;
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.
rc = bufferProducerQueueBuffer(buf, &g_gfxQueueBufferData, NULL);
rc = bufferProducerQueueBuffer(buf, &g_gfxQueueBufferData, &g_gfx_QueueBuffer_QueueBufferOutput);
if (R_FAILED(rc)) return rc;
/*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 = bufferProducerConnect(2, 0);
if (R_SUCCEEDED(rc)) rc = bufferProducerConnect(2, 0, &g_gfx_Connect_QueueBufferOutput);
if (R_SUCCEEDED(rc)) g_gfx_ProducerConnected = 1;