summaryrefslogtreecommitdiffstats
path: root/libhwcomposer
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-11-15 22:52:25 -0800
committerMathias Agopian <mathias@google.com>2011-11-16 16:13:03 -0800
commit85a2e2f0284ce5b5cc79b2db775d32cf03078029 (patch)
tree27545eefaa0b1984bbb9ff6407be5149bc9d339b /libhwcomposer
parent7adf0e24868b88a1541bb88444a58d276d394e68 (diff)
downloaddevice_samsung_crespo-85a2e2f0284ce5b5cc79b2db775d32cf03078029.zip
device_samsung_crespo-85a2e2f0284ce5b5cc79b2db775d32cf03078029.tar.gz
device_samsung_crespo-85a2e2f0284ce5b5cc79b2db775d32cf03078029.tar.bz2
don't call eglSwapBufferss() when its not needed.
eglSwapBuffers() copies the previous backbuffer, which consumes power and bandwidth. If there are no framebuffer layers there is no reason to do this. this should save power with full-screen videos. Change-Id: I7feb5a3f2d7d426dd93d2203849a6d591ce377db
Diffstat (limited to 'libhwcomposer')
-rw-r--r--libhwcomposer/SecHWC.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/libhwcomposer/SecHWC.cpp b/libhwcomposer/SecHWC.cpp
index 6fe39a0..0f81277 100644
--- a/libhwcomposer/SecHWC.cpp
+++ b/libhwcomposer/SecHWC.cpp
@@ -293,6 +293,8 @@ static int hwc_set(hwc_composer_device_t *dev,
struct sec_rect dst_rect;
+ bool need_swap_buffers = ctx->num_of_fb_layer > 0;
+
/*
* H/W composer documentation states:
* There is an implicit layer containing opaque black
@@ -312,13 +314,16 @@ static int hwc_set(hwc_composer_device_t *dev,
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
+ need_swap_buffers = true;
}
ctx->num_of_fb_layer_prev = ctx->num_of_fb_layer;
- EGLBoolean sucess = eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur);
- if (!sucess) {
- return HWC_EGL_ERROR;
+ if (need_swap_buffers || !list) {
+ EGLBoolean sucess = eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur);
+ if (!sucess) {
+ return HWC_EGL_ERROR;
+ }
}
if (!list) {