hwc/fb/overlay: wait for fbpost and pan display

Draw sequence in hwc_set
--eglSwapBuffers
--wait for fb_post. Its ok to draw to External only at this point.
--draw to external   | Parallel with PAN
--commit to external | Parallel with PAN
--wait for pan (happening in fb_post) to finish.

Call MSMFB_OVERLAY_SET ioctl only when params change.

These thing together ensure a correct sequence and should fix tearing and
stuttering, the latter assuming there are no other display pipeline delays.

Acked-by: Arun Kumar K.R <akumarkr@codeaurora.org>

Change-Id: Ibb0ad8485fa6b30dc6ac07ae8b25a760941c08ce
This commit is contained in:
Saurabh Shah
2012-08-17 19:47:52 -07:00
committed by Iliyan Malchev
parent 94822ee87c
commit fc2acbe754
7 changed files with 66 additions and 14 deletions

View File

@@ -17,6 +17,9 @@
#include <EGL/egl.h>
#include <overlay.h>
#include <cutils/properties.h>
#include <gralloc_priv.h>
#include <fb_priv.h>
#include "hwc_utils.h"
#include "mdp_version.h"
#include "hwc_video.h"
@@ -205,4 +208,33 @@ void calculate_crop_rects(hwc_rect_t& crop, hwc_rect_t& dst,
}
}
void wait4fbPost(hwc_context_t* ctx) {
framebuffer_device_t *fbDev = ctx->mFbDev;
if(fbDev) {
private_module_t* m = reinterpret_cast<private_module_t*>(
fbDev->common.module);
//wait for the fb_post to be called
pthread_mutex_lock(&m->fbPostLock);
while(m->fbPostDone == false) {
pthread_cond_wait(&(m->fbPostCond), &(m->fbPostLock));
}
m->fbPostDone = false;
pthread_mutex_unlock(&m->fbPostLock);
}
}
void wait4Pan(hwc_context_t* ctx) {
framebuffer_device_t *fbDev = ctx->mFbDev;
if(fbDev) {
private_module_t* m = reinterpret_cast<private_module_t*>(
fbDev->common.module);
//wait for the fb_post's PAN to finish
pthread_mutex_lock(&m->fbPanLock);
while(m->fbPanDone == false) {
pthread_cond_wait(&(m->fbPanCond), &(m->fbPanLock));
}
m->fbPanDone = false;
pthread_mutex_unlock(&m->fbPanLock);
}
}
};//namespace