summaryrefslogtreecommitdiffstats
path: root/minui
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2012-07-21 00:04:08 +0200
committerandroid code review <noreply-gerritcodereview@google.com>2012-07-21 00:04:08 +0200
commitdd6cd4fcc1b22df7f55e1ab3e54589939dc54179 (patch)
treeed2c393623cb309133bc76a7d96e00375a1fd494 /minui
parentMerge "Link against libsparse" (diff)
parentgraphics: add support for "single buffering" (diff)
downloadandroid_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.tar
android_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.tar.gz
android_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.tar.bz2
android_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.tar.lz
android_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.tar.xz
android_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.tar.zst
android_bootable_recovery-dd6cd4fcc1b22df7f55e1ab3e54589939dc54179.zip
Diffstat (limited to 'minui')
-rw-r--r--minui/graphics.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/minui/graphics.c b/minui/graphics.c
index de1cfdf3b..296e2e078 100644
--- a/minui/graphics.c
+++ b/minui/graphics.c
@@ -57,6 +57,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;
@@ -139,6 +140,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;
@@ -161,7 +168,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 * PIXEL_SIZE;
vi.yoffset = n * vi.yres;
vi.bits_per_pixel = PIXEL_SIZE * 8;
@@ -175,7 +182,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;
/* copy data from the in-memory surface to the buffer we're about
* to make active. */