Created
          July 28, 2012 18:03 
        
      - 
      
- 
        Save nicklaslof/3194208 to your computer and use it in GitHub Desktop. 
    a bit cleaner hack to get the display to work in jellybean on Xperia HDPI devices (still not perfect but better) (+ it flickers in recovery instead)
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | diff --git a/drivers/video/msm/mdp_dma.c b/drivers/video/msm/mdp_dma.c | |
| index 9303d6e..06c212e 100644 | |
| --- a/drivers/video/msm/mdp_dma.c | |
| +++ b/drivers/video/msm/mdp_dma.c | |
| @@ -472,14 +472,15 @@ void mdp_set_dma_pan_info(struct fb_info *info, struct mdp_dirty_region *dirty, | |
| boolean sync) | |
| { | |
| struct msm_fb_data_type *mfd = (struct msm_fb_data_type *)info->par; | |
| + struct fb_info *fbi = mfd->fbi; | |
| MDPIBUF *iBuf; | |
| int bpp = info->var.bits_per_pixel / 8; | |
| down(&mfd->sem); | |
| iBuf = &mfd->ibuf; | |
| iBuf->buf = (uint8 *) info->fix.smem_start; | |
| - iBuf->buf += info->var.xoffset * bpp + | |
| - info->var.yoffset * info->fix.line_length; | |
| + | |
| + iBuf->buf += calc_fb_offset(mfd, fbi, bpp); | |
| iBuf->ibuf_width = info->var.xres_virtual; | |
| iBuf->bpp = bpp; | |
| diff --git a/drivers/video/msm/msm_fb.c b/drivers/video/msm/msm_fb.c | |
| index 7c81dc4..42a3a17 100644 | |
| --- a/drivers/video/msm/msm_fb.c | |
| +++ b/drivers/video/msm/msm_fb.c | |
| @@ -685,6 +685,31 @@ static int msm_fb_blank_sub(int blank_mode, struct fb_info *info, | |
| return ret; | |
| } | |
| +int calc_fb_offset(struct msm_fb_data_type *mfd, struct fb_info *fbi, int bpp) | |
| +{ | |
| + struct msm_panel_info *panel_info = &mfd->panel_info; | |
| + int remainder, yres, offset; | |
| + | |
| + yres = panel_info->yres; | |
| + remainder = (fbi->fix.line_length*yres) & (PAGE_SIZE - 1); | |
| + | |
| + if (!remainder) | |
| + remainder = PAGE_SIZE; | |
| + | |
| + if (fbi->var.yoffset < yres) { | |
| + offset = (fbi->var.xoffset * bpp); | |
| + /* iBuf->buf += fbi->var.xoffset * bpp + 0 * | |
| + yres * fbi->fix.line_length; */ | |
| + } else if (fbi->var.yoffset >= yres && fbi->var.yoffset < 2 * yres) { | |
| + offset = (fbi->var.xoffset * bpp + yres * | |
| + fbi->fix.line_length + PAGE_SIZE - remainder); | |
| + } else { | |
| + offset = (fbi->var.xoffset * bpp + 2 * yres * | |
| + fbi->fix.line_length + 2 * (PAGE_SIZE - remainder)); | |
| + } | |
| + return offset; | |
| +} | |
| + | |
| static void msm_fb_fillrect(struct fb_info *info, | |
| const struct fb_fillrect *rect) | |
| { | |
| diff --git a/drivers/video/msm/msm_fb.h b/drivers/video/msm/msm_fb.h | |
| index 61d1272..2a4db86 100644 | |
| --- a/drivers/video/msm/msm_fb.h | |
| +++ b/drivers/video/msm/msm_fb.h | |
| @@ -173,6 +173,8 @@ void msm_fb_add_device(struct platform_device *pdev); | |
| int msm_fb_detect_client(const char *name); | |
| +int calc_fb_offset(struct msm_fb_data_type *mfd, struct fb_info *fbi, int bpp); | |
| + | |
| #ifdef CONFIG_FB_BACKLIGHT | |
| void msm_fb_config_backlight(struct msm_fb_data_type *mfd); | |
| #endif | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment