display: Enable vsync
* Use the vsync uevents from the kernel to start
surfaceflinger composition.
* This patch also does some code cleanup
- Move copybit specific functions to copybit files.
- Cleanup verbose logging.
Change-Id: I36936e4b0a082cfb0347d8ee7d2bc936e01808e6
diff --git a/libhwcomposer/hwc_copybit.cpp b/libhwcomposer/hwc_copybit.cpp
index adcd4dc..7892632 100644
--- a/libhwcomposer/hwc_copybit.cpp
+++ b/libhwcomposer/hwc_copybit.cpp
@@ -18,8 +18,9 @@
* limitations under the License.
*/
+#include <copybit.h>
+#include <genlock.h>
#include "hwc_copybit.h"
-#include "hwc_copybitEngine.h"
namespace qhwc {
@@ -71,6 +72,23 @@
bool CopyBit::sIsLayerSkip = false;
void* CopyBit::egl_lib = NULL;
+void CopyBit::openEglLibAndGethandle()
+{
+ egl_lib = ::dlopen("libEGL_adreno200.so", RTLD_GLOBAL | RTLD_LAZY);
+ if (!egl_lib) {
+ return;
+ }
+ updateEglHandles(egl_lib);
+}
+void CopyBit::closeEglLib()
+{
+ if(egl_lib)
+ ::dlclose(egl_lib);
+
+ egl_lib = NULL;
+ updateEglHandles(NULL);
+}
+
void CopyBit::updateEglHandles(void* egl_lib)
{
if(egl_lib != NULL) {
@@ -365,7 +383,7 @@
if(ctx->hasOverlay)
return false;
- framebuffer_device_t* fbDev = ctx->mFbDevice->getFb();
+ framebuffer_device_t* fbDev = ctx->mFbDev;
if(!fbDev) {
ALOGE("ERROR: canUseCopybit : fb device is invalid");
return false;
@@ -402,27 +420,11 @@
return (renderArea <= (2 * fb_w * fb_h));
}
-void CopyBit::openEglLibAndGethandle()
-{
- egl_lib = ::dlopen("libEGL_adreno200.so", RTLD_GLOBAL | RTLD_LAZY);
- if (!egl_lib) {
- return;
- }
- updateEglHandles(egl_lib);
-}
-void CopyBit::closeEglLib()
-{
- if(egl_lib)
- ::dlclose(egl_lib);
-
- egl_lib = NULL;
- updateEglHandles(NULL);
-}
//CopybitEngine Class functions
-CopybitEngine* CopybitEngine::sInstance = 0;;
+CopybitEngine* CopybitEngine::sInstance = 0;
struct copybit_device_t* CopybitEngine::getEngine() {
return sEngine;
@@ -440,9 +442,11 @@
} else {
ALOGE("FATAL ERROR: copybit open failed.");
}
+ CopyBit::openEglLibAndGethandle();
}
CopybitEngine::~CopybitEngine()
{
+ CopyBit::closeEglLib();
if(sEngine)
{
copybit_close(sEngine);