From a1462c8b0b7111692ba42780d6bb6da734e1d0a0 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sat, 17 Feb 2018 19:35:04 -0500 Subject: [PATCH] Fixed size of bufferProducerGraphicBuffer and removed the union for it. Removed an invalid comment from gfx.c, since bufferProducerRequestBuffer() is used after bufferProducerGraphicBufferInit(). --- nx/include/switch/gfx/buffer_producer.h | 68 ++++++++++++------------- nx/source/gfx/gfx.c | 1 - 2 files changed, 32 insertions(+), 37 deletions(-) diff --git a/nx/include/switch/gfx/buffer_producer.h b/nx/include/switch/gfx/buffer_producer.h index 1d6e30bb..e6a8a750 100644 --- a/nx/include/switch/gfx/buffer_producer.h +++ b/nx/include/switch/gfx/buffer_producer.h @@ -45,42 +45,38 @@ typedef struct { u32 numFds; u32 numInts; - union { - u32 rawdata[0x144>>2];//Actual size is numFds*4 + numInts*4. - - struct { - u32 unk_x0; - u32 nvmap_handle0; - u32 unk_x8; - u32 unk_xc; - u32 unk_x10; - u32 unk_x14; - u32 unk_x18; - u32 unk_x1c; - u32 unk_x20; - u32 width_unk0; - u32 buffer_size0; - u32 unk_x2c; - u32 unk_x30; - u32 width_unk1; - u32 height_unk; - u32 flags; - u32 unk_x40; - u32 unk_x44; - u32 byte_stride; - u32 nvmap_handle1; - u32 buffer_offset; - u32 unk_x54; - u32 unk_x58; - u32 unk_x5c; - u32 unk_x60; - u32 unk_x64; - u32 unk_x68; - u32 buffer_size1; - u32 unk_x70[0x33];//Normally all-zero. - u64 timestamp;//Unknown, some timestamp perhaps? - } data; - }; + struct {//Actual size is numFds*4 + numInts*4. + u32 unk_x0; + u32 nvmap_handle0; + u32 unk_x8; + u32 unk_xc; + u32 unk_x10; + u32 unk_x14; + u32 unk_x18; + u32 unk_x1c; + u32 unk_x20; + u32 width_unk0; + u32 buffer_size0; + u32 unk_x2c; + u32 unk_x30; + u32 width_unk1; + u32 height_unk; + u32 flags; + u32 unk_x40; + u32 unk_x44; + u32 byte_stride; + u32 nvmap_handle1; + u32 buffer_offset; + u32 unk_x54; + u32 unk_x58; + u32 unk_x5c; + u32 unk_x60; + u32 unk_x64; + u32 unk_x68; + u32 buffer_size1; + u32 unk_x70[0x33];//Normally all-zero. + u64 timestamp; + } PACKED data; } PACKED bufferProducerGraphicBuffer; //From Android window.h. diff --git a/nx/source/gfx/gfx.c b/nx/source/gfx/gfx.c index 23aeda92..a70ae5fe 100644 --- a/nx/source/gfx/gfx.c +++ b/nx/source/gfx/gfx.c @@ -78,7 +78,6 @@ static bufferProducerQueueBufferInput g_gfxQueueBufferData = { }; //Some of this struct is based on tegra_dc_ext_flip_windowattr. -//TODO: How much of this struct do official apps really set? Most of it seems to be used as-is from the bufferProducerRequestBuffer() output. static bufferProducerGraphicBuffer g_gfx_BufferInitData = { .magic = 0x47424652,//"RFBG"/'GBFR' .format = 0x1,