From patchwork Sat Mar 28 10:56:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11463491 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A14C015AB for ; Sat, 28 Mar 2020 10:56:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7F8ED206CC for ; Sat, 28 Mar 2020 10:56:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="plX7FZOq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F8ED206CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=khrdf/+ZtbC2vB8APSTWkp8+k5HsZsjfT1shEVnZqSY=; b=plX7FZOqp98kaW H8at4OSyIGnqH8nihVARWnsumpEXcZlLgW+uCVBzD9W4ZNXIb0FJC+iL3TF9nMiRE78y0VkK7qjT/ 6ooUMKRhjcfSXDV6z5U+tEg8qo9IwbA98/miQdl2/6Tuf0wYhDXf0Ye7KRbzdM0x42nOUtJuXVh0D iApl1GXpM7RvO0cL23kPvbVCea2mcpjRy1MhwLpBNBkECsvwpIjyCMYL03N2G6ugrnIRVLaIQBqvx X297a3Kub38805gspoKeeFzNStWMNNcVk2vWm6NyHe1yCVyF3QwTsng4mGUoo6wLN/kTNNKvPUWdI 0IahXI5Ai272JUMrgp2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jI98b-0002q6-5M; Sat, 28 Mar 2020 10:56:25 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jI98X-0002nu-G2 for linux-rockchip@lists.infradead.org; Sat, 28 Mar 2020 10:56:23 +0000 Received: from localhost.localdomain (unknown [IPv6:2a02:810a:1140:6758:90b5:2774:1094:333f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 7044329458D; Sat, 28 Mar 2020 10:56:18 +0000 (GMT) From: Dafna Hirschfeld To: linux-media@vger.kernel.org, dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH 1/3] media: staging: rkisp1: rsz: get the capture format info from the capture struct Date: Sat, 28 Mar 2020 11:56:04 +0100 Message-Id: <20200328105606.13660-2-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200328105606.13660-1-dafna.hirschfeld@collabora.com> References: <20200328105606.13660-1-dafna.hirschfeld@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200328_035621_669406_43EC53FE X-CRM114-Status: GOOD ( 10.97 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org Currently the format info of the capture is retrieved by calling the function v4l2_format_info. This is not needed since it is already save in the capture object. Signed-off-by: Dafna Hirschfeld Acked-by: Helen Koike Reviewed-by: Laurent Pinchart --- drivers/staging/media/rkisp1/rkisp1-resizer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c index 87799fbf0363..8704267a066f 100644 --- a/drivers/staging/media/rkisp1/rkisp1-resizer.c +++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c @@ -387,8 +387,7 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz, if (rsz->fmt_type == RKISP1_FMT_YUV) { struct rkisp1_capture *cap = &rsz->rkisp1->capture_devs[rsz->id]; - const struct v4l2_format_info *pixfmt_info = - v4l2_format_info(cap->pix.fmt.pixelformat); + const struct v4l2_format_info *pixfmt_info = cap->pix.info; hdiv = pixfmt_info->hdiv; vdiv = pixfmt_info->vdiv; From patchwork Sat Mar 28 10:56:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11463497 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4D2291667 for ; Sat, 28 Mar 2020 10:56:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2C070206CC for ; Sat, 28 Mar 2020 10:56:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="bKGaZ8lI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C070206CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XBUAbiAvEGAlXXvXvfTZe3HnZgiGoAiIZ75E7X04k+E=; b=bKGaZ8lIWU6FDw 6vOaUo3bQK2Dxh9DoS91c6tDjyOur3ijGKvz1aln76nUtdrTT9elbp6J/aEO5qX8XmHPW9UvcAWMQ hYdTiup+jJ689XmhM3RMYUY+8R63G2S3rhtAEn9FsWwkJEQYbrLI1BpdeduoGM+1v7d6LYkwtZrDY Bt2v2mQtnLj1SOTqL2jmNs39bePSWS4tWXQz4C+MJp5Zjc38xgm4NA9eCgGqM90G51Y7WiSXCOq2Y xzhZXu5rydL5PBXSelPSr9cAGQ9UnV3W8nCJWCMQdv6LUoCV29THOuKKH9jhFm2un/5LCt2enVjZr PtNtlaMiAheobFIgUZgg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jI98e-0002su-Ji; Sat, 28 Mar 2020 10:56:28 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jI98X-0002nw-G4 for linux-rockchip@lists.infradead.org; Sat, 28 Mar 2020 10:56:24 +0000 Received: from localhost.localdomain (unknown [IPv6:2a02:810a:1140:6758:90b5:2774:1094:333f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id E6B852972A2; Sat, 28 Mar 2020 10:56:18 +0000 (GMT) From: Dafna Hirschfeld To: linux-media@vger.kernel.org, dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH 2/3] media: staging: rkisp1: rsz: change (hv)div only if capture format is YUV Date: Sat, 28 Mar 2020 11:56:05 +0100 Message-Id: <20200328105606.13660-3-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200328105606.13660-1-dafna.hirschfeld@collabora.com> References: <20200328105606.13660-1-dafna.hirschfeld@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200328_035621_679955_6EE3F658 X-CRM114-Status: GOOD ( 12.30 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org RGB formats in selfpath should receive input format as YUV422. The resizer input format is always YUV422 and therefore if the capture format is RGB, the resizer should not change the YUV rations. Signed-off-by: Dafna Hirschfeld --- drivers/staging/media/rkisp1/rkisp1-resizer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c index 8704267a066f..5721eee29ecb 100644 --- a/drivers/staging/media/rkisp1/rkisp1-resizer.c +++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c @@ -389,8 +389,18 @@ static void rkisp1_rsz_config(struct rkisp1_resizer *rsz, &rsz->rkisp1->capture_devs[rsz->id]; const struct v4l2_format_info *pixfmt_info = cap->pix.info; - hdiv = pixfmt_info->hdiv; - vdiv = pixfmt_info->vdiv; + /* + * The resizer always get the input as YUV422 + * If the capture encoding is also YUV, then the resizer should + * change the 4:2:2 sampling to the sampling of the capture + * format (4:2:2 -> 4:2:0 for example). + * If the capture format is RGB then the memory input should + * be YUV422 so we don't change the default hdiv, vdiv + */ + if (v4l2_is_format_yuv(pixfmt_info)) { + hdiv = pixfmt_info->hdiv; + vdiv = pixfmt_info->vdiv; + } } src_c.width = src_y.width / hdiv; src_c.height = src_y.height / vdiv; From patchwork Sat Mar 28 10:56:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11463495 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E802915AB for ; Sat, 28 Mar 2020 10:56:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6D56206CC for ; Sat, 28 Mar 2020 10:56:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XETnQNUk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6D56206CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ElcHbnIID9u+Ai2q+cXue+ieK4JDSliGi75i8aSRoS0=; b=XETnQNUkyPqxX7 iEJbUHiKychzl8t18ddUr40oi0sJLMGPKKdQmcJALul9E0LXJlpOolEAx7dOs3faRTbrA3wycs4rB 9JuGssgRd/gCHkkFXrYXIWEBPz/aigxX4S2Mv+B+0zzEZikS1qttYOjEPOCwtiMz9QYrExciSrW3u pc+IyW+3YA41FlPDCAxdvUj0e0Gn8mDWhy/xWTU/vYiGg2qkrsGuHCnhPANxHDjdyjS+2Plju+N2u epgZE4EVLJH2vEAKkLdYbXrottu3yC94NbnTUwfWOn5ny39lqyWNtRJpGqoa6cevpzQggA3OzlDqR J2LL20FPgqn8NEX2wUeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jI98d-0002re-BZ; Sat, 28 Mar 2020 10:56:27 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jI98X-0002ny-G5 for linux-rockchip@lists.infradead.org; Sat, 28 Mar 2020 10:56:24 +0000 Received: from localhost.localdomain (unknown [IPv6:2a02:810a:1140:6758:90b5:2774:1094:333f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 6DAC129724B; Sat, 28 Mar 2020 10:56:19 +0000 (GMT) From: Dafna Hirschfeld To: linux-media@vger.kernel.org, dafna.hirschfeld@collabora.com, helen.koike@collabora.com, ezequiel@collabora.com, hverkuil@xs4all.nl, kernel@collabora.com, dafna3@gmail.com, sakari.ailus@linux.intel.com, linux-rockchip@lists.infradead.org, mchehab@kernel.org, laurent.pinchart@ideasonboard.com Subject: [PATCH 3/3] media: staging: rkisp1: cap: enable RGB capture format with YUV media bus Date: Sat, 28 Mar 2020 11:56:06 +0100 Message-Id: <20200328105606.13660-4-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200328105606.13660-1-dafna.hirschfeld@collabora.com> References: <20200328105606.13660-1-dafna.hirschfeld@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200328_035621_675542_D229029B X-CRM114-Status: GOOD ( 10.28 ) X-Spam-Score: -0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org In selfpath, RGB capture formats are received in the sink pad as YUV and are converted to RGB only when writing to memory. So the validation function should accept YUV bus formats with RGB capture encoding. Signed-off-by: Dafna Hirschfeld --- drivers/staging/media/rkisp1/rkisp1-capture.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-capture.c b/drivers/staging/media/rkisp1/rkisp1-capture.c index b7681b806b4c..3abf38362f5a 100644 --- a/drivers/staging/media/rkisp1/rkisp1-capture.c +++ b/drivers/staging/media/rkisp1/rkisp1-capture.c @@ -1227,6 +1227,9 @@ static int rkisp1_capture_link_validate(struct media_link *link) media_entity_to_v4l2_subdev(link->source->entity); struct rkisp1_capture *cap = video_get_drvdata(vdev); struct rkisp1_isp *isp = &cap->rkisp1->isp; + enum rkisp1_fmt_pix_type cap_fmt = + rkisp1_pixel_enc_to_fmt_pix(cap->pix.info); + enum rkisp1_fmt_pix_type isp_fmt = isp->src_fmt->fmt_type; struct v4l2_subdev_format sd_fmt; int ret; @@ -1237,8 +1240,8 @@ static int rkisp1_capture_link_validate(struct media_link *link) return -EPIPE; } - if (rkisp1_pixel_enc_to_fmt_pix(cap->pix.info) != - isp->src_fmt->fmt_type) { + if ((cap_fmt == RKISP1_FMT_BAYER && isp_fmt == RKISP1_FMT_YUV) || + (cap_fmt != RKISP1_FMT_BAYER && isp_fmt == RKISP1_FMT_BAYER)) { dev_err(cap->rkisp1->dev, "format type mismatch in link '%s:%d->%s:%d'\n", link->source->entity->name, link->source->index,