summaryrefslogtreecommitdiffstats
path: root/minuitwrp
diff options
context:
space:
mode:
authorHiemanshu Sharma <hiemanshu@gmail.com>2012-11-21 18:25:22 +0100
committerHiemanshu Sharma <hiemanshu@gmail.com>2012-11-21 18:25:22 +0100
commit94f6c88dab4fe62d3953968a0b987c2813a5758a (patch)
treed641097d62bd4d3cca117bec8067c403385ab606 /minuitwrp
parentFix compiling for x86 targets (diff)
downloadandroid_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.tar
android_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.tar.gz
android_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.tar.bz2
android_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.tar.lz
android_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.tar.xz
android_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.tar.zst
android_bootable_recovery-94f6c88dab4fe62d3953968a0b987c2813a5758a.zip
Diffstat (limited to '')
-rw-r--r--minuitwrp/graphics.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/minuitwrp/graphics.c b/minuitwrp/graphics.c
index b30a92ef0..357639201 100644
--- a/minuitwrp/graphics.c
+++ b/minuitwrp/graphics.c
@@ -66,6 +66,7 @@ static GGLSurface gr_font_texture;
static GGLSurface gr_framebuffer[2];
static GGLSurface gr_mem_surface;
static unsigned gr_active_fb = 0;
+static unsigned double_buffering = 0;
static int gr_fb_fd = -1;
static int gr_vt_fd = -1;
@@ -199,6 +200,12 @@ static int get_framebuffer(GGLSurface *fb)
fb++;
+ /* check if we can use double buffering */
+ if (vi.yres * fi.line_length * 2 > fi.smem_len)
+ return fd;
+
+ double_buffering = 1;
+
fb->version = sizeof(*fb);
fb->width = vi.xres;
fb->height = vi.yres;
@@ -230,7 +237,7 @@ static void get_memory_surface(GGLSurface* ms) {
static void set_active_framebuffer(unsigned n)
{
- if (n > 1) return;
+ if (n > 1 || !double_buffering) return;
vi.yres_virtual = vi.yres * 2;
vi.yoffset = n * vi.yres;
// vi.bits_per_pixel = PIXEL_SIZE * 8;
@@ -244,7 +251,8 @@ void gr_flip(void)
GGLContext *gl = gr_context;
/* swap front and back buffers */
- gr_active_fb = (gr_active_fb + 1) & 1;
+ if (double_buffering)
+ gr_active_fb = (gr_active_fb + 1) & 1;
#ifdef BOARD_HAS_FLIPPED_SCREEN
/* flip buffer 180 degrees for devices with physicaly inverted screens */