Changed g_nvgfx_totalframebufs to 2. Removed the gfxFlushBuffers() call in _gfxInit() and added a dcache-flush in nvmapobjInitialize(). Moved the nvgfxGetFramebuffer() call. Added a delay in _gfxInit(). Changed the initial g_gfxCurrentBuffer value, which is then updated by _gfxDequeueBuffer() later. Adjusted the code for updating g_gfxCurrentBuffer. For the gfxproducerDequeueBuffer() call, changed the value for the async param from 1 to 0.

This commit is contained in:
yellows8 2017-11-19 20:47:03 -05:00
parent 34e22c82df
commit 7c826e57e8
2 changed files with 11 additions and 7 deletions

View File

@ -48,9 +48,9 @@ static Result _gfxGetNativeWindowID(u8 *buf, u64 size, s32 *out_ID) {
static Result _gfxDequeueBuffer() {
Result rc=0;
rc = gfxproducerDequeueBuffer(1, 1280, 720, 0, 0x300, &g_gfxCurrentProducerBuffer);
rc = gfxproducerDequeueBuffer(/*1*/0, 1280, 720, 0, 0x300, &g_gfxCurrentProducerBuffer);
if (R_SUCCEEDED(rc)) g_gfxCurrentBuffer = (g_gfxCurrentBuffer+1) & (g_nvgfx_totalframebufs-1);
if (R_SUCCEEDED(rc)) g_gfxCurrentBuffer = /*(g_gfxCurrentBuffer+1)*/(g_gfxCurrentProducerBuffer) & (g_nvgfx_totalframebufs-1);
return rc;
}
@ -80,7 +80,7 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L
g_gfxNativeWindow_ID = 0;
g_gfxDisplayVsyncEvent = INVALID_HANDLE;
g_gfxCurrentBuffer = 0;
g_gfxCurrentBuffer = -1;
g_gfxCurrentProducerBuffer = 0;
g_gfxFramebuf = NULL;
g_gfxFramebufSize = 0;
@ -111,6 +111,8 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L
if (R_SUCCEEDED(rc)) rc = nvgfxInitialize();
if (R_SUCCEEDED(rc)) rc = nvgfxGetFramebuffer(&g_gfxFramebuf, &g_gfxFramebufSize);
if (R_SUCCEEDED(rc)) {
for(i=0; i<2; i++) {
rc = _gfxDequeueBuffer();
@ -130,9 +132,9 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L
if (R_SUCCEEDED(rc)) rc = _gfxDequeueBuffer();
if (R_SUCCEEDED(rc)) rc = nvgfxGetFramebuffer(&g_gfxFramebuf, &g_gfxFramebufSize);
if (R_SUCCEEDED(rc)) gfxFlushBuffers();
if (R_SUCCEEDED(rc)) { //Workaround a gfx display issue.
for(i=0; i<2; i++)gfxWaitForVsync();
}
if (R_FAILED(rc)) {
nvgfxExit();

View File

@ -87,6 +87,8 @@ Result nvmapobjInitialize(nvmapobj *obj, size_t size) {
if (obj->mem==NULL) rc = MAKERESULT(MODULE_LIBNX, LIBNX_OUTOFMEM);
if (R_SUCCEEDED(rc)) memset(obj->mem, 0, size);
if (R_SUCCEEDED(rc)) armDCacheFlush(obj->mem, size);
if (R_SUCCEEDED(rc)) obj->initialized = 1;
return rc;
@ -139,7 +141,7 @@ Result nvgfxInitialize(void) {
g_nvgfx_nvhostctrl_eventhandle = INVALID_HANDLE;
g_nvgfx_totalframebufs = 4;
g_nvgfx_totalframebufs = 2;//4;
memset(nvmap_objs, 0, sizeof(nvmap_objs));