Imported enum for use with bufferProducerQuery(). Changed gfxGetDisplayResolution to static with adjusted name and removed it from the .h. Disabled _gfxGetDisplayResolution. Added disabled get-{resolution/width/height} code. Check fence->is_valid when calling nvgfxEventWait(), with the commented out line.

This commit is contained in:
yellows8 2017-12-07 11:37:40 -05:00
parent 4c1c1ee14b
commit 2db9a5fdb9
4 changed files with 24 additions and 7 deletions

View File

@ -25,6 +25,17 @@ typedef struct {
u32 numPendingBuffers;
} PACKED bufferProducerQueueBufferOutput;
//From Android window.h.
/* attributes queriable with query() */
enum {
NATIVE_WINDOW_WIDTH = 0,
NATIVE_WINDOW_HEIGHT = 1,
NATIVE_WINDOW_FORMAT = 2,
//...
// NATIVE_WINDOW_DEFAULT_WIDTH = 6, //These two return invalid data.
// NATIVE_WINDOW_DEFAULT_HEIGHT = 7,
};
Result bufferProducerInitialize(binderSession *session);
void bufferProducerExit();

View File

@ -10,9 +10,6 @@ u8* gfxGetFramebuffer(u32* width, u32* height);
void gfxSetDoubleBuffering(bool doubleBuffering);
void gfxFlushBuffers(void);
//Do not use this for getting the framebuffer width/height, use gfxGetFramebuffer for getting that.
Result gfxGetDisplayResolution(u64 *width, u64 *height);
/// Use this to get the pixel-offset in the framebuffer. Returned value is in pixels, not bytes.
/// This implements tegra blocklinear, with hard-coded constants etc.
static inline u32 gfxGetFramebufferDisplayOffset(u32 x, u32 y) {

View File

@ -15,6 +15,8 @@ static bool g_gfx_ProducerConnected = 0;
static bool g_gfx_ProducerSlotsRequested[2] = {0, 0};
static u8 *g_gfxFramebuf;
static size_t g_gfxFramebufSize;
/*static u64 g_gfx_DisplayResolution_width, g_gfx_DisplayResolution_height;
static s32 g_gfx_Query_width, g_gfx_Query_height;*/
static bufferProducerFence g_gfx_DequeueBuffer_fence;
static bufferProducerQueueBufferOutput g_gfx_Connect_QueueBufferOutput;
static bufferProducerQueueBufferOutput g_gfx_QueueBuffer_QueueBufferOutput;
@ -26,6 +28,8 @@ extern u32 __nx_applet_type;
extern u32 g_nvgfx_totalframebufs;
extern size_t g_nvgfx_singleframebuf_size;
//static Result _gfxGetDisplayResolution(u64 *width, u64 *height);
//TODO: Let the user configure some of this?
static bufferProducerQueueBufferInput g_gfxQueueBufferData = {
.timestamp = 0x0,
@ -72,7 +76,7 @@ static Result _gfxDequeueBuffer(bufferProducerFence *fence) {
rc = bufferProducerDequeueBuffer(/*1*/0, 1280, 720, 0, 0x300, &g_gfxCurrentProducerBuffer, fence);
//if (R_SUCCEEDED(rc) && fence) rc = nvgfxEventWait(fence->nv_fences[0].id, fence->nv_fences[0].value);
//if (R_SUCCEEDED(rc) && fence && fence->is_valid) rc = nvgfxEventWait(fence->nv_fences[0].id, fence->nv_fences[0].value);
if (R_SUCCEEDED(rc)) g_gfxCurrentBuffer = (g_gfxCurrentBuffer + 1) & (g_nvgfx_totalframebufs-1);
@ -169,6 +173,11 @@ static Result _gfxInit(viServiceType servicetype, const char *DisplayName, u32 L
if (R_SUCCEEDED(rc)) rc = _gfxDequeueBuffer(&g_gfx_DequeueBuffer_fence);
/*if (R_SUCCEEDED(rc)) rc = _gfxGetDisplayResolution(&g_gfx_DisplayResolution_width, &g_gfx_DisplayResolution_height);
if (R_SUCCEEDED(rc)) rc = bufferProducerQuery(NATIVE_WINDOW_WIDTH, &g_gfx_Query_width);
if (R_SUCCEEDED(rc)) rc = bufferProducerQuery(NATIVE_WINDOW_HEIGHT, &g_gfx_Query_height);*/
/*if (R_SUCCEEDED(rc)) { //Workaround a gfx display issue.
for(i=0; i<2; i++)gfxWaitForVsync();
}*/
@ -317,7 +326,7 @@ void gfxFlushBuffers(void) {
armDCacheFlush(&g_gfxFramebuf[g_gfxCurrentBuffer*g_nvgfx_singleframebuf_size], g_nvgfx_singleframebuf_size);
}
Result gfxGetDisplayResolution(u64 *width, u64 *height) {
/*static Result _gfxGetDisplayResolution(u64 *width, u64 *height) {
return viGetDisplayResolution(&g_gfxDisplay, width, height);
}
}*/

View File

@ -286,7 +286,7 @@ Result nvgfxInitialize(void) {
if (R_FAILED(rc)) break;
if(pos==1) {
rc = bufferProducerQuery(2, &tmp);//"NATIVE_WINDOW_FORMAT"
rc = bufferProducerQuery(NATIVE_WINDOW_FORMAT, &tmp);
if (R_FAILED(rc)) break;
for(i=0; i<2; i++) {