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: 11463485 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 6E1B61667 for ; Sat, 28 Mar 2020 10:56:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C38720732 for ; Sat, 28 Mar 2020 10:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726316AbgC1K4U (ORCPT ); Sat, 28 Mar 2020 06:56:20 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42010 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726291AbgC1K4U (ORCPT ); Sat, 28 Mar 2020 06:56:20 -0400 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> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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: 11463489 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 5FA9A15AB for ; Sat, 28 Mar 2020 10:56:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3E46C20774 for ; Sat, 28 Mar 2020 10:56:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726342AbgC1K4V (ORCPT ); Sat, 28 Mar 2020 06:56:21 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42024 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726293AbgC1K4U (ORCPT ); Sat, 28 Mar 2020 06:56:20 -0400 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> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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: 11463487 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 98D021893 for ; Sat, 28 Mar 2020 10:56:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 774B220732 for ; Sat, 28 Mar 2020 10:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726325AbgC1K4U (ORCPT ); Sat, 28 Mar 2020 06:56:20 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:42038 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725973AbgC1K4U (ORCPT ); Sat, 28 Mar 2020 06:56:20 -0400 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> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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,