From patchwork Fri Sep 13 06:59:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Zhu X-Patchwork-Id: 2881871 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7FC349F1C0 for ; Fri, 13 Sep 2013 07:08:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EBBDD20411 for ; Fri, 13 Sep 2013 07:08:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DCB5B2039A for ; Fri, 13 Sep 2013 07:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754232Ab3IMHIa (ORCPT ); Fri, 13 Sep 2013 03:08:30 -0400 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174]:28064 "EHLO mx0a-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157Ab3IMHI3 (ORCPT ); Fri, 13 Sep 2013 03:08:29 -0400 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.14.5/8.14.5) with SMTP id r8D70eXo007474; Fri, 13 Sep 2013 00:00:40 -0700 Received: from sc-owa02.marvell.com ([199.233.58.137]) by mx0a-0016f401.pphosted.com with ESMTP id 1eu92xwb0r-6 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Fri, 13 Sep 2013 00:00:40 -0700 Received: from maili.marvell.com (10.93.76.43) by sc-owa02.marvell.com (10.93.76.22) with Microsoft SMTP Server id 8.3.213.0; Fri, 13 Sep 2013 00:00:40 -0700 Received: from localhost (unknown [10.38.36.226]) by maili.marvell.com (Postfix) with ESMTP id 7FF891CCDAE; Fri, 13 Sep 2013 00:00:39 -0700 (PDT) From: Zhou Zhu To: , Tomi Valkeinen , Jean-Christophe Plagniol-Villard , Haojian Zhuang CC: Jing Xiang , Guoqing Li , Zhou Zhu , "Jett.Zhou" , Zhou Zhu Subject: [PATCH V5 5/5] video: mmp: add pitch info in mmp_win structure Date: Fri, 13 Sep 2013 14:59:49 +0800 Message-ID: <1379055589-26132-6-git-send-email-zzhu3@marvell.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379055589-26132-1-git-send-email-zzhu3@marvell.com> References: <1379055589-26132-1-git-send-email-zzhu3@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.431, 0.0.0000 definitions=2013-09-13_03:2013-09-13, 2013-09-13, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1309120225 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jing Xiang 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 Signed-off-by: Jett.Zhou Signed-off-by: Zhou Zhu Reviewed-by: Daniel Drake --- drivers/video/mmp/fb/mmpfb.c | 6 ++++++ drivers/video/mmp/hw/mmp_ctrl.c | 30 +++++++++++++++++++++++------- include/video/mmp_disp.h | 5 +++++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/video/mmp/fb/mmpfb.c b/drivers/video/mmp/fb/mmpfb.c index 19fd913..7ab31eb 100644 --- a/drivers/video/mmp/fb/mmpfb.c +++ b/drivers/video/mmp/fb/mmpfb.c @@ -395,12 +395,18 @@ static int var_update(struct fb_info *info) static void mmpfb_set_win(struct fb_info *info) { struct mmpfb_info *fbi = info->par; + struct fb_var_screeninfo *var = &info->var; struct mmp_win win; + u32 stride; memset(&win, 0, sizeof(win)); win.xsrc = win.xdst = fbi->mode.xres; win.ysrc = win.ydst = fbi->mode.yres; win.pix_fmt = fbi->pix_fmt; + stride = pixfmt_to_stride(win.pix_fmt); + win.pitch[0] = var->xres_virtual * stride; + win.pitch[1] = win.pitch[2] = + (stride == 1) ? (var->xres_virtual >> 1) : 0; mmp_overlay_set_win(fbi->overlay, &win); } diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c index c0eb8bc..ae724aa 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.c +++ b/drivers/video/mmp/hw/mmp_ctrl.c @@ -142,17 +142,27 @@ static void dmafetch_set_fmt(struct mmp_overlay *overlay) static void overlay_set_win(struct mmp_overlay *overlay, struct mmp_win *win) { struct lcd_regs *regs = path_regs(overlay->path); - u32 pitch; /* assert win supported */ memcpy(&overlay->win, win, sizeof(struct mmp_win)); mutex_lock(&overlay->access_ok); - pitch = win->xsrc * pixfmt_to_stride(win->pix_fmt); - writel_relaxed(pitch, ®s->g_pitch); - writel_relaxed((win->ysrc << 16) | win->xsrc, ®s->g_size); - writel_relaxed((win->ydst << 16) | win->xdst, ®s->g_size_z); - writel_relaxed(0, ®s->g_start); + + if (overlay_is_vid(overlay)) { + writel_relaxed(win->pitch[0], ®s->v_pitch_yc); + writel_relaxed(win->pitch[2] << 16 | + win->pitch[1], ®s->v_pitch_uv); + + writel_relaxed((win->ysrc << 16) | win->xsrc, ®s->v_size); + writel_relaxed((win->ydst << 16) | win->xdst, ®s->v_size_z); + writel_relaxed(win->ypos << 16 | win->xpos, ®s->v_start); + } else { + writel_relaxed(win->pitch[0], ®s->g_pitch); + + writel_relaxed((win->ysrc << 16) | win->xsrc, ®s->g_size); + writel_relaxed((win->ydst << 16) | win->xdst, ®s->g_size_z); + writel_relaxed(win->ypos << 16 | win->xpos, ®s->g_start); + } dmafetch_set_fmt(overlay); mutex_unlock(&overlay->access_ok); @@ -234,7 +244,13 @@ static int overlay_set_addr(struct mmp_overlay *overlay, struct mmp_addr *addr) /* FIXME: assert addr supported */ memcpy(&overlay->addr, addr, sizeof(struct mmp_addr)); - writel(addr->phys[0], ®s->g_0); + + if (overlay_is_vid(overlay)) { + writel_relaxed(addr->phys[0], ®s->v_y0); + writel_relaxed(addr->phys[1], ®s->v_u0); + writel_relaxed(addr->phys[2], ®s->v_v0); + } else + writel_relaxed(addr->phys[0], ®s->g_0); return overlay->addr.phys[0]; } diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h index 32094c0..9fd9398 100644 --- a/include/video/mmp_disp.h +++ b/include/video/mmp_disp.h @@ -91,6 +91,11 @@ struct mmp_win { u16 up_crop; u16 bottom_crop; int pix_fmt; + /* + * pitch[0]: graphics/video layer line length or y pitch + * pitch[1]/pitch[2]: video u/v pitch if non-zero + */ + u32 pitch[3]; }; struct mmp_addr {