From d46e0e1b44c4c4d1ad76ad37407ab723fd0da904 Mon Sep 17 00:00:00 2001 From: "Arun Kumar K.R" Date: Thu, 31 Mar 2011 20:27:26 -0700 Subject: [PATCH] liboverlay: Always use rotator for UI mirroring on HDMI - Use rotator buffer for UI mirroring on HDMI - Avoid ioctl calls on getPosition CRs-fixed: 278858 Change-Id: Id390e2b85fe939d8388ed17f5f9c7fcd30499755 --- framebuffer.cpp | 15 ++++++++++----- gralloc_priv.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/framebuffer.cpp b/framebuffer.cpp index 4d1ab7e..64798aa 100644 --- a/framebuffer.cpp +++ b/framebuffer.cpp @@ -163,6 +163,7 @@ static void *disp_loop(void *ptr) pthread_mutex_lock(&m->overlayLock); m->orientation = neworientation; m->currentOffset = offset; + m->hdmiStateChanged = true; pthread_cond_signal(&(m->overlayPost)); pthread_mutex_unlock(&m->overlayLock); #endif @@ -210,7 +211,9 @@ static void *hdmi_ui_loop(void *ptr) ptr); while (1) { pthread_mutex_lock(&m->overlayLock); - pthread_cond_wait(&(m->overlayPost), &(m->overlayLock)); + while(!(m->hdmiStateChanged)) + pthread_cond_wait(&(m->overlayPost), &(m->overlayLock)); + m->hdmiStateChanged = false; if (m->exitHDMIUILoop) { pthread_mutex_unlock(&m->overlayLock); return NULL; @@ -226,7 +229,7 @@ static void *hdmi_ui_loop(void *ptr) if (!pTemp->isChannelUP()) { int alignedW = ALIGN(m->info.xres, 32); if (pTemp->startChannel(alignedW, m->info.yres, - m->fbFormat, 1, false, true)) { + m->fbFormat, 1, false, true, 0, VG0_PIPE, true)) { pTemp->setFd(m->framebuffer->fd); pTemp->setCrop(0, 0, m->info.xres, m->info.yres); } else @@ -312,11 +315,10 @@ static void *hdmi_ui_loop(void *ptr) break; } } - int currentOrientation = 0; - pTemp->getOrientation(currentOrientation); - if(rot != currentOrientation) { + if(rot != m->currentOrientation) { pTemp->setParameter(OVERLAY_TRANSFORM, rot); + m->currentOrientation = rot; } EVEN_OUT(asX); EVEN_OUT(asY); @@ -348,6 +350,7 @@ static int fb_videoOverlayStarted(struct framebuffer_device_t* dev, int started) pthread_mutex_lock(&m->overlayLock); Overlay* pTemp = m->pobjOverlay; if(started != m->videoOverlay) { + m->hdmiStateChanged = true; if (started && pTemp) { pTemp->closeChannel(); m->videoOverlay = true; @@ -371,6 +374,7 @@ static int fb_enableHDMIOutput(struct framebuffer_device_t* dev, int enable) if (!enable && pTemp) pTemp->closeChannel(); m->enableHDMIOutput = enable; + m->hdmiStateChanged = true; pthread_cond_signal(&(m->overlayPost)); pthread_mutex_unlock(&m->overlayLock); return 0; @@ -809,6 +813,7 @@ int mapFrameBufferLocked(struct private_module_t* module) module->pobjOverlay = new Overlay(); module->currentOffset = 0; module->exitHDMIUILoop = false; + module->hdmiStateChanged = false; pthread_t hdmiUIThread; pthread_create(&hdmiUIThread, NULL, &hdmi_ui_loop, (void *) module); #endif diff --git a/gralloc_priv.h b/gralloc_priv.h index 417acce..8e779d9 100644 --- a/gralloc_priv.h +++ b/gralloc_priv.h @@ -227,6 +227,8 @@ struct private_module_t { bool exitHDMIUILoop; float actionsafeWidthRatio; float actionsafeHeightRatio; + int currentOrientation; + bool hdmiStateChanged; pthread_mutex_t overlayLock; pthread_cond_t overlayPost; #endif