From 7181de24ab3d4692c16fe8944f44dd112eab70cf Mon Sep 17 00:00:00 2001 From: Naomi Luis Date: Thu, 20 Sep 2012 17:35:20 -0700 Subject: [PATCH] hardware/qcom/display: Remove glfinish call There is no need to do a glFinish on every composition complete. glFinish needs to be called for composition cycles where GPU and copybit are both used for composition. This is because the GPU and copybit operate on the same framebuffer. (cherry picked from commit 7983c275ae3eb15fab931d301e6338f83ad4a75a) Change-Id: If06da4ca60ec17122c3dd698558cbf08fec73251 --- libgralloc/framebuffer.cpp | 1 - libhwcomposer/Android.mk | 2 +- libhwcomposer/hwc_copybit.cpp | 7 +++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp index c643e3b..e1735fc 100644 --- a/libgralloc/framebuffer.cpp +++ b/libgralloc/framebuffer.cpp @@ -152,7 +152,6 @@ static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) static int fb_compositionComplete(struct framebuffer_device_t* dev) { // TODO: Properly implement composition complete callback - glFinish(); return 0; } diff --git a/libhwcomposer/Android.mk b/libhwcomposer/Android.mk index 2ef979a..dbcab81 100644 --- a/libhwcomposer/Android.mk +++ b/libhwcomposer/Android.mk @@ -7,7 +7,7 @@ LOCAL_MODULE_TAGS := optional LOCAL_C_INCLUDES := $(common_includes) $(kernel_includes) LOCAL_SHARED_LIBRARIES := $(common_libs) libEGL liboverlay libgenlock \ libhwcexternal libqdutils libhardware_legacy \ - libdl libmemalloc libhwcservice + libdl libmemalloc libhwcservice libGLESv1_CM LOCAL_CFLAGS := $(common_flags) -DLOG_TAG=\"hwcomposer\" LOCAL_ADDITIONAL_DEPENDENCIES := $(common_deps) diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp index 069913f..bab7184 100644 --- a/libhwcomposer/hwc_copybit.cpp +++ b/libhwcomposer/hwc_copybit.cpp @@ -21,6 +21,7 @@ #define DEBUG_COPYBIT 0 #include #include +#include #include "hwc_copybit.h" #include "comptype.h" #include "egl_handles.h" @@ -185,6 +186,12 @@ bool CopyBit::draw(hwc_context_t *ctx, hwc_layer_list_t *list, EGLDisplay dpy, return -1; } + // Invoke a glFinish if we are rendering any layers using copybit. + // We call glFinish instead of locking the renderBuffer because the + // GPU could take longer than the genlock timeout value to complete + // rendering + glFinish(); + for (size_t i=0; inumHwLayers; i++) { if (list->hwLayers[i].compositionType == HWC_USE_COPYBIT) { retVal = drawLayerUsingCopybit(ctx, &(list->hwLayers[i]),