From patchwork Fri Mar 18 21:59:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Vanderlip X-Patchwork-Id: 645431 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2IM0IMx031453 for ; Fri, 18 Mar 2011 22:00:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932830Ab1CRWAH (ORCPT ); Fri, 18 Mar 2011 18:00:07 -0400 Received: from wolverine01.qualcomm.com ([199.106.114.254]:28903 "EHLO wolverine01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932889Ab1CRWAC (ORCPT ); Fri, 18 Mar 2011 18:00:02 -0400 X-IronPort-AV: E=McAfee;i="5400,1158,6289"; a="80850625" Received: from ironmsg04-r.qualcomm.com ([172.30.46.18]) by wolverine01.qualcomm.com with ESMTP; 18 Mar 2011 15:00:01 -0700 X-IronPort-AV: E=Sophos;i="4.63,205,1299484800"; d="scan'208";a="37045096" Received: from carlv-linux.qualcomm.com ([10.52.52.151]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 18 Mar 2011 15:00:01 -0700 Received: from carlv-linux.qualcomm.com (localhost [127.0.0.1]) by carlv-linux.qualcomm.com (8.14.2/8.14.2/1.0) with ESMTP id p2IM01A6027774; Fri, 18 Mar 2011 15:00:01 -0700 Received: (from carlv@localhost) by carlv-linux.qualcomm.com (8.14.2/8.12.1/Submit) id p2IM01fL027772; Fri, 18 Mar 2011 15:00:01 -0700 From: Carl Vanderlip To: David Brown , Daniel Walker , Bryan Huntsman Cc: Brian Swetland , Dima Zavin , Rebecca Schultz Zavin , Colin Cross , linux-fbdev@vger.kernel.org, Carl Vanderlip , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 19/20] video: msm: Separate calculation of base and offset Date: Fri, 18 Mar 2011 14:59:59 -0700 Message-Id: <1300485599-27680-1-git-send-email-carlv@codeaurora.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1300484846-26393-1-git-send-email-carlv@codeaurora.org> References: <1300484846-26393-1-git-send-email-carlv@codeaurora.org> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Fri, 18 Mar 2011 22:00:29 +0000 (UTC) diff --git a/drivers/video/msm/mdp_ppp.c b/drivers/video/msm/mdp_ppp.c index 290c29a..6d14c4f 100644 --- a/drivers/video/msm/mdp_ppp.c +++ b/drivers/video/msm/mdp_ppp.c @@ -100,6 +100,17 @@ static void rotate_dst_addr_y(struct mdp_blit_req *req, regs->dst_ystride; } +static uint32_t get_luma_offset(struct mdp_img *img, + struct mdp_rect *rect, uint32_t bpp) +{ + return 0; +} + +static uint32_t get_chroma_offset(struct mdp_img *img, + struct mdp_rect *rect, uint32_t bpp) +{ + return 0; +} static void blit_rotate(struct mdp_blit_req *req, struct ppp_regs *regs) { @@ -311,24 +322,14 @@ static void flush_imgs(struct mdp_blit_req *req, struct ppp_regs *regs, { } -static void get_chroma_addr(struct mdp_img *img, struct mdp_rect *rect, - uint32_t base, uint32_t bpp, uint32_t cfg, - uint32_t *addr, uint32_t *ystride) +static uint32_t get_chroma_base(struct mdp_img *img, uint32_t base, + uint32_t bpp) { - uint32_t compress_v = Y_TO_CRCB_RATIO(img->format); - uint32_t compress_h = 2; - uint32_t offset; - - if (IS_PSEUDOPLNR(img->format)) { - offset = (rect->x / compress_h) * compress_h; - offset += rect->y == 0 ? 0 : - ((rect->y + 1) / compress_v) * img->width; - *addr = base + (img->width * img->height * bpp); - *addr += offset * bpp; - *ystride |= *ystride << 16; - } else { - *addr = 0; - } + uint32_t addr = 0; + + if (IS_PSEUDOPLNR(img->format)) + addr = base + (img->width * img->height * bpp); + return addr; } #define mdp_writel_dbg(mdp, val, reg) mdp_writel((mdp), (val), (reg)) @@ -381,6 +382,7 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, struct file *dst_file, unsigned long dst_start, unsigned long dst_len) { struct ppp_regs regs = {0}; + uint32_t luma_base; if (unlikely(req->src.format >= MDP_IMGTYPE_LIMIT || req->dst.format >= MDP_IMGTYPE_LIMIT)) { @@ -416,23 +418,23 @@ int mdp_ppp_blit(const struct mdp_info *mdp, struct mdp_blit_req *req, /* set src, bpp, start pixel and ystride */ regs.src_bpp = bytes_per_pixel[req->src.format]; - regs.src0 = src_start + req->src.offset; + luma_base = src_start + req->src.offset; + regs.src0 = luma_base + + get_luma_offset(&req->src, &req->src_rect, regs.src_bpp); + regs.src1 = get_chroma_base(&req->src, luma_base, regs.src_bpp); + regs.src1 += get_chroma_offset(&req->src, &req->src_rect, regs.src_bpp); regs.src_ystride = req->src.width * regs.src_bpp; set_src_region(&req->src, &req->src_rect, ®s); - get_chroma_addr(&req->src, &req->src_rect, regs.src0, regs.src_bpp, - regs.src_cfg, ®s.src1, ®s.src_ystride); - regs.src0 += (req->src_rect.x + (req->src_rect.y * req->src.width)) * - regs.src_bpp; /* set dst, bpp, start pixel and ystride */ regs.dst_bpp = bytes_per_pixel[req->dst.format]; - regs.dst0 = dst_start + req->dst.offset; + luma_base = dst_start + req->dst.offset; + regs.dst0 = luma_base + + get_luma_offset(&req->dst, &req->dst_rect, regs.dst_bpp); + regs.dst1 = get_chroma_base(&req->dst, luma_base, regs.dst_bpp); + regs.dst1 += get_chroma_offset(&req->dst, &req->dst_rect, regs.dst_bpp); regs.dst_ystride = req->dst.width * regs.dst_bpp; set_dst_region(&req->dst_rect, ®s); - get_chroma_addr(&req->dst, &req->dst_rect, regs.dst0, regs.dst_bpp, - regs.dst_cfg, ®s.dst1, ®s.dst_ystride); - regs.dst0 += (req->dst_rect.x + (req->dst_rect.y * req->dst.width)) * - regs.dst_bpp; if (!valid_src_dst(src_start, src_len, dst_start, dst_len, req, ®s)) {