mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-21 12:32:40 +02:00
Use total-framebufs value from a global field instead of hard-coding it.
This commit is contained in:
parent
0a7de00fe0
commit
34e22c82df
@ -17,6 +17,8 @@ static size_t g_gfxFramebufSingleSize = 0x3c0000;
|
||||
|
||||
extern u32 __nx_applet_type;
|
||||
|
||||
extern u32 g_nvgfx_totalframebufs;
|
||||
|
||||
static u32 g_gfxQueueBufferData[0x5c>>2] = {
|
||||
0x54, 0x0,
|
||||
0x0, 0x0, //u64 timestamp
|
||||
@ -48,7 +50,7 @@ static Result _gfxDequeueBuffer() {
|
||||
|
||||
rc = gfxproducerDequeueBuffer(1, 1280, 720, 0, 0x300, &g_gfxCurrentProducerBuffer);
|
||||
|
||||
if (R_SUCCEEDED(rc)) g_gfxCurrentBuffer = (g_gfxCurrentBuffer+1) & 3;
|
||||
if (R_SUCCEEDED(rc)) g_gfxCurrentBuffer = (g_gfxCurrentBuffer+1) & (g_nvgfx_totalframebufs-1);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ static u8 *g_nvgfx_nvhost_userdata;
|
||||
static size_t g_nvgfx_nvhost_userdata_size;
|
||||
static u32 g_nvgfx_nvhostctrl_eventres;
|
||||
|
||||
u32 g_nvgfx_totalframebufs = 0;
|
||||
|
||||
static nvmapobj nvmap_objs[18];
|
||||
|
||||
static u64 nvmap_obj6_mapbuffer_xdb_offset;
|
||||
@ -49,7 +51,7 @@ static u32 g_gfxprod_BufferInitData[0x178>>2] = {
|
||||
0x0, 0xdaffcaff, 0x2a, 0x0,
|
||||
0xb00, 0x1, 0x1, 1280,
|
||||
0x3c0000, 0x1, 0x0, 1280,
|
||||
720, 0x532120, 0x1, 0x3, //0x52* field is flags
|
||||
720, 0x532120/* & ~0x20*/, 0x1, 0x3, //0x52* field is flags
|
||||
0x1400,
|
||||
0x0, //nvmap handle
|
||||
0x0,
|
||||
@ -137,6 +139,8 @@ Result nvgfxInitialize(void) {
|
||||
|
||||
g_nvgfx_nvhostctrl_eventhandle = INVALID_HANDLE;
|
||||
|
||||
g_nvgfx_totalframebufs = 4;
|
||||
|
||||
memset(nvmap_objs, 0, sizeof(nvmap_objs));
|
||||
|
||||
memset(&g_nvgfx_gpu_characteristics, 0, sizeof(gpu_characteristics));
|
||||
@ -158,7 +162,7 @@ Result nvgfxInitialize(void) {
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[3], 0x10000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[4], 0x59000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[5], 0x1000000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[6], 0x4000000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[6], g_nvgfx_totalframebufs*0x3c0000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[7], 0x1000000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[8], 0x800000);
|
||||
if (R_SUCCEEDED(rc)) rc = nvmapobjInitialize(&nvmap_objs[9], 0x100000);
|
||||
@ -273,7 +277,7 @@ Result nvgfxInitialize(void) {
|
||||
//Skip init for 0x10000000-byte nvmap obj done by certain official sw.
|
||||
|
||||
if (R_SUCCEEDED(rc)) {
|
||||
for(pos=0; pos<4; pos++) {
|
||||
for(pos=0; pos<g_nvgfx_totalframebufs; pos++) {
|
||||
rc = nvioctlNvhostAsGpu_MapBufferEx(g_nvgfx_fd_nvhostasgpu, 0x100, pos<3 ? 0xdb : 0x86, framebuf_nvmap_handle, 0, pos*0x3c0000, 0x3c0000, nvmap_obj6_mapbuffer_xdb_offset, NULL);
|
||||
if (R_FAILED(rc)) break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user