From patchwork Sat Jun 7 21:56:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 4316141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 47EC2BEEAA for ; Sat, 7 Jun 2014 21:57:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 763B520222 for ; Sat, 7 Jun 2014 21:57:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99CDB2024C for ; Sat, 7 Jun 2014 21:57:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753362AbaFGV5a (ORCPT ); Sat, 7 Jun 2014 17:57:30 -0400 Received: from mail-pb0-f42.google.com ([209.85.160.42]:43393 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753357AbaFGV51 (ORCPT ); Sat, 7 Jun 2014 17:57:27 -0400 Received: by mail-pb0-f42.google.com with SMTP id md12so3891849pbc.15 for ; Sat, 07 Jun 2014 14:57:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=XZ9KVfIvZnn2zTU23ZEM3vKuLd9sCadsmiBaf5xUbx8=; b=xCEhGZ/anUf331wimxjmfAGZQIUORJwnU89J9fBR3D8Zv+IX0d7/FZCumg/IuajOMl CTdcK3eJroWhxstlxMAMH+HDpx2m4Nw2fgH1QmPLZPr/Gi5N8XGo2/POCRXgNTk1dHoP 3swB/V2DZ+jg5WbEkIgMWYkltVhQLtA8GEoAdpZGzCJfNQGhESpu5GvhA3hVSiFYQwAc wqCVMRZ+V+gO5SiKGZfPG0nFtszJApUJHE5pr4fWPgKGH8PohDihKFV24d8I91Rryck/ ABz31asXGOAoc6gf2BoTTOIv8X/lJw+bd+vc6VIO3vxLRm0HY/MxCQf99fSomOU1T26s bNRA== X-Received: by 10.68.196.137 with SMTP id im9mr15572609pbc.105.1402178247288; Sat, 07 Jun 2014 14:57:27 -0700 (PDT) Received: from slongerb-fremont-linux.mgc.mentorg.com (c-98-248-118-71.hsd1.ca.comcast.net. [98.248.118.71]) by mx.google.com with ESMTPSA id fx5sm52769595pbb.62.2014.06.07.14.57.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 07 Jun 2014 14:57:26 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: linux-media@vger.kernel.org Cc: Steve Longerbeam Subject: [PATCH 26/43] imx-drm: ipu-cpmem: Add second buffer support to ipu_cpmem_set_image() Date: Sat, 7 Jun 2014 14:56:28 -0700 Message-Id: <1402178205-22697-27-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1402178205-22697-1-git-send-email-steve_longerbeam@mentor.com> References: <1402178205-22697-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Add a second buffer physaddr to struct ipu_image, for double-buffering support. Signed-off-by: Steve Longerbeam --- drivers/staging/imx-drm/ipu-v3/ipu-cpmem.c | 32 ++++++++++++++-------------- include/linux/platform_data/imx-ipu-v3.h | 3 ++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-cpmem.c b/drivers/staging/imx-drm/ipu-v3/ipu-cpmem.c index bd76a38..70e90b40 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-cpmem.c +++ b/drivers/staging/imx-drm/ipu-v3/ipu-cpmem.c @@ -535,7 +535,7 @@ EXPORT_SYMBOL_GPL(ipu_cpmem_set_fmt); int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image) { struct v4l2_pix_format *pix = &image->pix; - int y_offset, u_offset, v_offset; + int offset, y_offset, u_offset, v_offset; pr_debug("%s: resolution: %dx%d stride: %d\n", __func__, pix->width, pix->height, @@ -557,30 +557,30 @@ int ipu_cpmem_set_image(struct ipuv3_channel *ch, struct ipu_image *image) ipu_cpmem_set_yuv_planar_full(ch, pix->pixelformat, pix->bytesperline, u_offset, v_offset); - ipu_cpmem_set_buffer(ch, 0, image->phys + y_offset); + ipu_cpmem_set_buffer(ch, 0, image->phys0 + y_offset); + ipu_cpmem_set_buffer(ch, 1, image->phys1 + y_offset); break; case V4L2_PIX_FMT_UYVY: case V4L2_PIX_FMT_YUYV: - ipu_cpmem_set_buffer(ch, 0, image->phys + - image->rect.left * 2 + - image->rect.top * image->pix.bytesperline); + case V4L2_PIX_FMT_RGB565: + offset = image->rect.left * 2 + + image->rect.top * pix->bytesperline; + ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset); + ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset); break; case V4L2_PIX_FMT_RGB32: case V4L2_PIX_FMT_BGR32: - ipu_cpmem_set_buffer(ch, 0, image->phys + - image->rect.left * 4 + - image->rect.top * image->pix.bytesperline); - break; - case V4L2_PIX_FMT_RGB565: - ipu_cpmem_set_buffer(ch, 0, image->phys + - image->rect.left * 2 + - image->rect.top * image->pix.bytesperline); + offset = image->rect.left * 4 + + image->rect.top * pix->bytesperline; + ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset); + ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset); break; case V4L2_PIX_FMT_RGB24: case V4L2_PIX_FMT_BGR24: - ipu_cpmem_set_buffer(ch, 0, image->phys + - image->rect.left * 3 + - image->rect.top * image->pix.bytesperline); + offset = image->rect.left * 3 + + image->rect.top * pix->bytesperline; + ipu_cpmem_set_buffer(ch, 0, image->phys0 + offset); + ipu_cpmem_set_buffer(ch, 1, image->phys1 + offset); break; default: return -EINVAL; diff --git a/include/linux/platform_data/imx-ipu-v3.h b/include/linux/platform_data/imx-ipu-v3.h index 53aab16..4575657 100644 --- a/include/linux/platform_data/imx-ipu-v3.h +++ b/include/linux/platform_data/imx-ipu-v3.h @@ -219,7 +219,8 @@ struct ipu_rgb { struct ipu_image { struct v4l2_pix_format pix; struct v4l2_rect rect; - dma_addr_t phys; + dma_addr_t phys0; + dma_addr_t phys1; }; void ipu_cpmem_zero(struct ipuv3_channel *ch);