Received: by 2002:ac0:a874:0:0:0:0:0 with SMTP id c49csp603960ima; Fri, 15 Mar 2019 09:47:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwftGzHBxTl9ddPH+NniELj58/r+yet1IZWOlnhMg3/7mhfj2ly456M0POQPgHPa118cVs/ X-Received: by 2002:a65:5c4b:: with SMTP id v11mr4243719pgr.411.1552668427638; Fri, 15 Mar 2019 09:47:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552668427; cv=none; d=google.com; s=arc-20160816; b=sier/OZVyibAhi/X3jXWMKtibbsmf/D33u0PhC1v8YF3uGC0Wx/0VBR3jgZ02qSdw9 8TUGJxTRUKeNAccLohr6PuRGudn99NQ/nlHpBb+bs0kq7+E+VWy1aZn4Z+Oyw/238VQv nP2emR+mv/nG7YSwRuTg35NkxYYXR3M8TvHIVhVOuiihELPq7Gu8otTy1zFKqUk8HTTi zjzqFI1om9AvdFcrRVvbH21mDV2C3fcM0yYeIDrcxTKgWb8BZ93uwdKrc1LWxCSO/ZXl DTBBDxXar6qcXsInLsCe7cH/8/i2X3ZdVb0/iV9lxGobROQiuxq0Y/KYJwqo0+RRRaRn 7Uig== 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=4S0CJgOMymocNK3r51W1wHJ+1WlRRPZd67NhE5497bc=; b=em+4fMOcVNAKOEM00X2NLTtJHaErEdRiv8wx3j/gNiyBbxvE0Cw/uLQB0tXkwAVevZ spCGRhHYEpe4TkB9OoJMDZi8eX9exKVCsKMVB+M1FJJRgxEFdKef3lzVKPQGgHBsmmJ5 Uh11ag3KBxolk923QdUYP6L5/n4nWx4k8VtLq+uxIl34iYSVH3ZuvkwwDuv+EMrmg11G uLg6XQnc+EagdntokyHsD93zE7x1qaiIFrDy3HV+UAbwabiE7lOVoEO4RAqlBRf5Y5so 58FtphVcFbdxFPk1EeJUfHlai3gv6uon2QVqAj9LDcydR+iNeaJutgkM5Fuhlwt2jk1c xCtQ== 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 s8si2281244pfm.41.2019.03.15.09.46.52; Fri, 15 Mar 2019 09:47:07 -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 S1729881AbfCOQpw (ORCPT + 99 others); Fri, 15 Mar 2019 12:45:52 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:49086 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729859AbfCOQpt (ORCPT ); Fri, 15 Mar 2019 12:45:49 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: tonyk) with ESMTPSA id 8820328157F 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 Subject: [PATCH 15/16] media: vimc: cap: Add support for multiplanar formats Date: Fri, 15 Mar 2019 13:43:58 -0300 Message-Id: <20190315164359.626-16-andrealmeid@collabora.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190315164359.626-1-andrealmeid@collabora.com> References: <20190315164359.626-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 --- 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 bb982761562e..50f7e71f23cd 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -577,6 +577,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); @@ -599,13 +601,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