From patchwork Fri Mar 18 21:55:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Carl Vanderlip X-Patchwork-Id: 645161 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 p2ILtCWY028460 for ; Fri, 18 Mar 2011 21:55:12 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932773Ab1CRVzG (ORCPT ); Fri, 18 Mar 2011 17:55:06 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:46829 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932755Ab1CRVzE (ORCPT ); Fri, 18 Mar 2011 17:55:04 -0400 X-IronPort-AV: E=McAfee;i="5400,1158,6289"; a="80647442" Received: from ironmsg04-r.qualcomm.com ([172.30.46.18]) by wolverine02.qualcomm.com with ESMTP; 18 Mar 2011 14:55:04 -0700 X-IronPort-AV: E=Sophos;i="4.63,205,1299484800"; d="scan'208";a="37044761" 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 14:55:04 -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 p2ILt4A4027159; Fri, 18 Mar 2011 14:55:04 -0700 Received: (from carlv@localhost) by carlv-linux.qualcomm.com (8.14.2/8.12.1/Submit) id p2ILt4un027158; Fri, 18 Mar 2011 14:55:04 -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 06/20] video: msm: Simplify mdp_blit function Date: Fri, 18 Mar 2011 14:55:02 -0700 Message-Id: <1300485302-27123-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 21:55:12 +0000 (UTC) diff --git a/drivers/video/msm/mdp.c b/drivers/video/msm/mdp.c index c046982..765df06 100644 --- a/drivers/video/msm/mdp.c +++ b/drivers/video/msm/mdp.c @@ -308,6 +308,29 @@ void put_img(struct file *src_file, struct file *dst_file) { } +int mdp_blit_and_wait(struct mdp_info *mdp, struct mdp_blit_req *req, + struct file *src_file, unsigned long src_start, + unsigned long src_len, struct file *dst_file, + unsigned long dst_start, unsigned long dst_len) +{ + int ret; + enable_mdp_irq(mdp, DL0_ROI_DONE); + ret = mdp_ppp_blit(mdp, req, + src_file, src_start, src_len, + dst_file, dst_start, dst_len); + if (unlikely(ret)) { + disable_mdp_irq(mdp, DL0_ROI_DONE); + return ret; + } + ret = mdp_ppp_wait(mdp); + if (unlikely(ret)) { + printk(KERN_ERR "%s: failed!\n", __func__); + BUG(); + return ret; + } + return 0; +} + int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, struct mdp_blit_req *req) { @@ -354,15 +377,11 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, req->src_rect.w = 16*req->src_rect.w / req->dst_rect.h; req->dst_rect.h = 16; for (i = 0; i < tiles; i++) { - enable_mdp_irq(mdp, DL0_ROI_DONE); - ret = mdp_ppp_blit(mdp, req, src_file, src_start, - src_len, dst_file, dst_start, - dst_len); - if (ret) - goto err_bad_blit; - ret = mdp_ppp_wait(mdp); + ret = mdp_blit_and_wait(mdp, req, + src_file, src_start, src_len, + dst_file, dst_start, dst_len); if (ret) - goto err_wait_failed; + goto end; req->dst_rect.y += 16; req->src_rect.x += req->src_rect.w; } @@ -371,24 +390,12 @@ int mdp_blit(struct mdp_device *mdp_dev, struct fb_info *fb, req->src_rect.w = remainder*req->src_rect.w / req->dst_rect.h; req->dst_rect.h = remainder; } - enable_mdp_irq(mdp, DL0_ROI_DONE); - ret = mdp_ppp_blit(mdp, req, src_file, src_start, src_len, dst_file, - dst_start, - dst_len); - if (ret) - goto err_bad_blit; - ret = mdp_ppp_wait(mdp); - if (ret) - goto err_wait_failed; + ret = mdp_blit_and_wait(mdp, req, + src_file, src_start, src_len, + dst_file, dst_start, dst_len); end: put_img(src_file, dst_file); mutex_unlock(&mdp_mutex); - return 0; -err_bad_blit: - disable_mdp_irq(mdp, DL0_ROI_DONE); -err_wait_failed: - put_img(src_file, dst_file); - mutex_unlock(&mdp_mutex); return ret; }