Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

video: mmp: add pitch info in mmp_win structure

Add pitch length info of graphics/video layer, pitch is used
to represent line length in byte, the usage depends on pix_fmt.
If the fmt is YUV, the pitch[0] will be Y length,pitch[1]
will be U length, pitch[2] will be V lenth.
If the fmt is RGB, the picth[0] will be line lenth, and
pitch[1]/pitch[2] will be 0 and not be used.

Signed-off-by: Jing Xiang <jxiang@marvell.com>
Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Signed-off-by: Zhou Zhu <zzhu3@marvell.com>
Reviewed-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

authored by

Jing Xiang and committed by
Tomi Valkeinen
24586d83 cc50bc5b

+34 -7
+6
drivers/video/mmp/fb/mmpfb.c
··· 395 395 static void mmpfb_set_win(struct fb_info *info) 396 396 { 397 397 struct mmpfb_info *fbi = info->par; 398 + struct fb_var_screeninfo *var = &info->var; 398 399 struct mmp_win win; 400 + u32 stride; 399 401 400 402 memset(&win, 0, sizeof(win)); 401 403 win.xsrc = win.xdst = fbi->mode.xres; 402 404 win.ysrc = win.ydst = fbi->mode.yres; 403 405 win.pix_fmt = fbi->pix_fmt; 406 + stride = pixfmt_to_stride(win.pix_fmt); 407 + win.pitch[0] = var->xres_virtual * stride; 408 + win.pitch[1] = win.pitch[2] = 409 + (stride == 1) ? (var->xres_virtual >> 1) : 0; 404 410 mmp_overlay_set_win(fbi->overlay, &win); 405 411 } 406 412
+23 -7
drivers/video/mmp/hw/mmp_ctrl.c
··· 142 142 static void overlay_set_win(struct mmp_overlay *overlay, struct mmp_win *win) 143 143 { 144 144 struct lcd_regs *regs = path_regs(overlay->path); 145 - u32 pitch; 146 145 147 146 /* assert win supported */ 148 147 memcpy(&overlay->win, win, sizeof(struct mmp_win)); 149 148 150 149 mutex_lock(&overlay->access_ok); 151 - pitch = win->xsrc * pixfmt_to_stride(win->pix_fmt); 152 - writel_relaxed(pitch, &regs->g_pitch); 153 - writel_relaxed((win->ysrc << 16) | win->xsrc, &regs->g_size); 154 - writel_relaxed((win->ydst << 16) | win->xdst, &regs->g_size_z); 155 - writel_relaxed(0, &regs->g_start); 150 + 151 + if (overlay_is_vid(overlay)) { 152 + writel_relaxed(win->pitch[0], &regs->v_pitch_yc); 153 + writel_relaxed(win->pitch[2] << 16 | 154 + win->pitch[1], &regs->v_pitch_uv); 155 + 156 + writel_relaxed((win->ysrc << 16) | win->xsrc, &regs->v_size); 157 + writel_relaxed((win->ydst << 16) | win->xdst, &regs->v_size_z); 158 + writel_relaxed(win->ypos << 16 | win->xpos, &regs->v_start); 159 + } else { 160 + writel_relaxed(win->pitch[0], &regs->g_pitch); 161 + 162 + writel_relaxed((win->ysrc << 16) | win->xsrc, &regs->g_size); 163 + writel_relaxed((win->ydst << 16) | win->xdst, &regs->g_size_z); 164 + writel_relaxed(win->ypos << 16 | win->xpos, &regs->g_start); 165 + } 156 166 157 167 dmafetch_set_fmt(overlay); 158 168 mutex_unlock(&overlay->access_ok); ··· 244 234 245 235 /* FIXME: assert addr supported */ 246 236 memcpy(&overlay->addr, addr, sizeof(struct mmp_addr)); 247 - writel(addr->phys[0], &regs->g_0); 237 + 238 + if (overlay_is_vid(overlay)) { 239 + writel_relaxed(addr->phys[0], &regs->v_y0); 240 + writel_relaxed(addr->phys[1], &regs->v_u0); 241 + writel_relaxed(addr->phys[2], &regs->v_v0); 242 + } else 243 + writel_relaxed(addr->phys[0], &regs->g_0); 248 244 249 245 return overlay->addr.phys[0]; 250 246 }
+5
include/video/mmp_disp.h
··· 91 91 u16 up_crop; 92 92 u16 bottom_crop; 93 93 int pix_fmt; 94 + /* 95 + * pitch[0]: graphics/video layer line length or y pitch 96 + * pitch[1]/pitch[2]: video u/v pitch if non-zero 97 + */ 98 + u32 pitch[3]; 94 99 }; 95 100 96 101 struct mmp_addr {