Commit 41a490ec authored by Liu Ying's avatar Liu Ying Committed by Florian Tobias Schandinat

mx3fb: avoid screen flash when panning with fb_set_var

Users may call FBIOPUT_VSCREENINFO ioctrl to do pan display.
This ioctrl relies on fb_set_var() to do the job. fb_set_var()
calls custom fb_set_par() method and then calls custom
fb_pan_display() method. The current implementation of mx3fb
reinitializes IPU display controller every time the custom
fb_set_par() method is called, which makes the screen flash
if fb_set_var() is called to do panning frequently. This patch
compares the new var info with the cached old one to decide
whether we really need to reinitialize IPU display controller.
We ignore xoffset and yoffset update because it doesn't require
to reinitialize the controller. Users may specify activate field
of var info with FB_ACTIVATE_NOW and FB_ACTIVATE_FORCE to
reinialize the controller by force.
Signed-off-by: default avatarLiu Ying <Ying.Liu@freescale.com>
Signed-off-by: default avatarFlorian Tobias Schandinat <FlorianSchandinat@gmx.de>
parent 6cd77e00
...@@ -698,6 +698,26 @@ static void mx3fb_dma_done(void *arg) ...@@ -698,6 +698,26 @@ static void mx3fb_dma_done(void *arg)
complete(&mx3_fbi->flip_cmpl); complete(&mx3_fbi->flip_cmpl);
} }
static bool mx3fb_must_set_par(struct fb_info *fbi)
{
struct mx3fb_info *mx3_fbi = fbi->par;
struct fb_var_screeninfo old_var = mx3_fbi->cur_var;
struct fb_var_screeninfo new_var = fbi->var;
if ((fbi->var.activate & FB_ACTIVATE_FORCE) &&
(fbi->var.activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW)
return true;
/*
* Ignore xoffset and yoffset update,
* because pan display handles this case.
*/
old_var.xoffset = new_var.xoffset;
old_var.yoffset = new_var.yoffset;
return !!memcmp(&old_var, &new_var, sizeof(struct fb_var_screeninfo));
}
static int __set_par(struct fb_info *fbi, bool lock) static int __set_par(struct fb_info *fbi, bool lock)
{ {
u32 mem_len, cur_xoffset, cur_yoffset; u32 mem_len, cur_xoffset, cur_yoffset;
...@@ -819,7 +839,7 @@ static int mx3fb_set_par(struct fb_info *fbi) ...@@ -819,7 +839,7 @@ static int mx3fb_set_par(struct fb_info *fbi)
mutex_lock(&mx3_fbi->mutex); mutex_lock(&mx3_fbi->mutex);
ret = __set_par(fbi, true); ret = mx3fb_must_set_par(fbi) ? __set_par(fbi, true) : 0;
mutex_unlock(&mx3_fbi->mutex); mutex_unlock(&mx3_fbi->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment