Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5430311img; Wed, 27 Mar 2019 08:22:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwfEsMrgnbaZodwji1/IBZXO23BV1JVtADX/Qrr92Ir9y3HihJPRJeoiDSayPO5GozjA3ei X-Received: by 2002:a17:902:15a8:: with SMTP id m37mr38775032pla.178.1553700149978; Wed, 27 Mar 2019 08:22:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553700149; cv=none; d=google.com; s=arc-20160816; b=gq4qpPr/t6thss6E6iUdl8u6lKJAF9RfCtjRtpAYX7In4Ji3Ifr05ZEIYrT7ZVIHAE gcLXiGGiRJer1yO3mdoj11CtlVRZr0eiJqiAJiaV5wu+yxH4EzffPYjaDSUSFMFU3Fpf HeY4ei8WVL1EEWyFjWct1tO/pyTvtwv5nCvODUyC/kn5CXgE5kPQn4k5v+rZfe4gVHNV ml4ay9kFuZftkhO7iw3t0SoVHJvuJDngjPN1yP3Ztnns3IGaPYMgLqiswMA1CAfmrz+M EtaIgYr126iyuZ9fvBoIGrZMuTGnYulCLcjcEF5JVVL+qBN9qNDKOfQidkDinrFzArc9 PlHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=f2C3pzfgJt1j+IMJVIp6jWrLheDPeIxAxCSF0chvm4c=; b=A95ghYsuX2v9QsScHbrVtRlv9jw5PTT1F97oGMfxB5CFHjVbYWeHS7EugzbhNR7Tdf RRfpEvj9j7Qs7sfVdMeCQfD6qEHxt8a2+VL0EEijjO4TVC1d4eLPJtmxtfhPisw1nTbF Vc+/Xi8tKCMqvdebldhtrPlVpLRf4jaOC1DtzliRBnYSyJnl32lt3iyDH/x7S/X3BeTK oK2WSlG7sfMwUtHTdB8DxHeN49HnKoAuHMmYwk7w3UD9Ch4uy+YZvV//KhC3Dv2EhKdd QUpw/JMZlDWIjrelMrcfAOPWMOsPbWDWbCkTCxENDqKWCCIaEDXVK/O5+xC8tFx5aOTH 53nA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si18130051pgp.444.2019.03.27.08.22.14; Wed, 27 Mar 2019 08:22:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731431AbfC0PTy (ORCPT + 99 others); Wed, 27 Mar 2019 11:19:54 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:48598 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731183AbfC0PTm (ORCPT ); Wed, 27 Mar 2019 11:19:42 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 4E047281FF9 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, hverkuil@xs4all.nl, helen.koike@collabora.com, lucmaga@gmail.com, linux-kernel@vger.kernel.org, kernel@collabora.com, lkcamp@lists.libreplanetbr.org Subject: [PATCH v2 14/15] media: vimc: cap: Add support for multiplanar formats Date: Wed, 27 Mar 2019 12:17:42 -0300 Message-Id: <20190327151743.18528-15-andrealmeid@collabora.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190327151743.18528-1-andrealmeid@collabora.com> References: <20190327151743.18528-1-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adapt vimc-capture to support multiplanar formats, copying each plane to the correct buffer. Signed-off-by: André Almeida --- Change in v2: none drivers/media/platform/vimc/vimc-capture.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index fae42b778711..f5bfb36a145c 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -606,6 +606,8 @@ static struct vimc_frame *vimc_cap_process_frame(struct vimc_ent_device *ved, struct vimc_cap_device *vcap = container_of(ved, struct vimc_cap_device, ved); struct vimc_cap_buffer *vimc_buf; + unsigned long plane_size; + unsigned int i; void *vbuf; spin_lock(&vcap->qlock); @@ -628,13 +630,17 @@ static struct vimc_frame *vimc_cap_process_frame(struct vimc_ent_device *ved, vimc_buf->vb2.sequence = vcap->sequence++; vimc_buf->vb2.field = vcap->format.fmt.pix.field; - vbuf = vb2_plane_vaddr(&vimc_buf->vb2.vb2_buf, 0); + /* For each plane, copy the pixels */ + for (i = 0; i < vimc_buf->vb2.vb2_buf.num_planes; i++) { + vbuf = vb2_plane_vaddr(&vimc_buf->vb2.vb2_buf, i); + plane_size = frame->sizeimage[i]; + + memcpy(vbuf, frame->plane_addr[i], plane_size); - memcpy(vbuf, frame->plane_addr[0], vcap->format.fmt.pix.sizeimage); + /* Set it as ready */ + vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, i, plane_size); + } - /* Set it as ready */ - vb2_set_plane_payload(&vimc_buf->vb2.vb2_buf, 0, - vcap->format.fmt.pix.sizeimage); vb2_buffer_done(&vimc_buf->vb2.vb2_buf, VB2_BUF_STATE_DONE); return NULL; } -- 2.21.0