Perf adjustments for gfxGetFramebufferDisplayOffset().

This commit is contained in:
yellows8 2017-12-29 22:04:15 -05:00
parent 28e2759412
commit 4e77c36c30
2 changed files with 10 additions and 7 deletions

View File

@ -53,13 +53,16 @@ void gfxFlushBuffers(void);
/// 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) {
u32 width=0, height=0;
u32 width, height;
u32 tilepos, tmp_pos;
gfxGetFramebufferResolution(&width, NULL);
gfxGetFramebuffer(NULL, &height);
extern size_t g_gfx_framebuf_width;
extern size_t g_gfx_framebuf_display_height;
if (x >= width || y >= height) return (gfxGetFramebufferSize()-4)/4;//Return the last pixel-offset in the buffer, the data located here is not displayed due to alignment.
width = g_gfx_framebuf_width;
height = g_gfx_framebuf_display_height;
//if (x >= width || y >= height) return (gfxGetFramebufferSize()-4)/4;//Return the last pixel-offset in the buffer, the data located here is not displayed due to alignment. (Disabled for perf)
y = height-1-y;

View File

@ -21,9 +21,9 @@ static bufferProducerQueueBufferOutput g_gfx_QueueBuffer_QueueBufferOutput;
static bool g_gfxDoubleBuf = 1;
static size_t g_gfx_framebuf_width=0, g_gfx_framebuf_aligned_width=0;
static size_t g_gfx_framebuf_height=0, g_gfx_framebuf_aligned_height=0;
static size_t g_gfx_framebuf_display_width=0, g_gfx_framebuf_display_height=0;
size_t g_gfx_framebuf_width=0, g_gfx_framebuf_aligned_width=0;
size_t g_gfx_framebuf_height=0, g_gfx_framebuf_aligned_height=0;
size_t g_gfx_framebuf_display_width=0, g_gfx_framebuf_display_height=0;
size_t g_gfx_singleframebuf_size=0;
static appletHookCookie g_gfx_autoresolution_applethookcookie;