Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1132988ybl; Fri, 6 Dec 2019 11:49:08 -0800 (PST) X-Google-Smtp-Source: APXvYqyaRXTWCzLYcpP1dGKq7ltdrA4JlrvTIgujNT/NfOaAcOb9xhhUJZuVxp4aJSiSloKFi6tK X-Received: by 2002:aca:75d7:: with SMTP id q206mr8424069oic.9.1575661748354; Fri, 06 Dec 2019 11:49:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575661748; cv=none; d=google.com; s=arc-20160816; b=LDzK4AV3N4YR3/IFNRdoGfzqMEOCa69nHAowCm4gL2stEwk1fkW+RiC8OjRXk6GFn1 5JjktNvn16brO8AF0+w2xVGNgDF5kq0MN+7oO4LzV/8lWaA5G4tlx4qAWa36WF9GlY2h 1YbPtUSNgSr7UWkzDSm1oGHz86hfyH/kK65EbsUJJ0JEUzQvSsmoVbXrxhqUrQKW7qHR UEwQ0noBQUlqA9TC9hgmDMF89I3gYxopphPNPyrj5sspZgcWQ5O5XhmJMS1Otn4S+Dtv VC9kEJJc/ftpAcUGFYOrm9hLKf+F5+LovBgLo1DEAO7umDe3vXcOY9AVfRKdUIxg1N7J D9nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=1LvDPvxelfaYR9ZfukstyYBPhz1WxGviRUoVT3QbgCk=; b=ZKPWa4iHopfU1ofR7C73gUtQeZDPobxolVFbsOBirizSq/PfxScvjEjfabKQgYD+qE nsF5of3nRqO5o3kLRl4IQPl64zp3LXgV+FP0oBRvU5ipeaXstgPerLqRd3NeKEM1z96Q uKD2eC9axj4ImRyeZ4p5eNoaDrtk45awZSHZDRwk+pFRQBgrvNSF3QuLkZ8LOz93+P7/ A4+q/ur36MIt5STCL2S0pN27VvPk3Jh83aot5U9OT7wa90UiAOSJ9ZnFDSdXC6SznlzW ReKUM11EzBER8D36GMvDLpDcPttbT343zxOgk37fYtNOYSGFbVNOC3lPKC1WIwMLUQ2l 9ifQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zRfUEREd; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t134si6385808oie.148.2019.12.06.11.48.55; Fri, 06 Dec 2019 11:49:08 -0800 (PST) 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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=zRfUEREd; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726425AbfLFTsP (ORCPT + 99 others); Fri, 6 Dec 2019 14:48:15 -0500 Received: from fllv0015.ext.ti.com ([198.47.19.141]:36424 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726328AbfLFTsP (ORCPT ); Fri, 6 Dec 2019 14:48:15 -0500 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id xB6JmETd124305; Fri, 6 Dec 2019 13:48:14 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1575661694; bh=1LvDPvxelfaYR9ZfukstyYBPhz1WxGviRUoVT3QbgCk=; h=From:To:CC:Subject:Date; b=zRfUEREd7mDzvO1zZNCOhyTH5Z28n3bc++1GzoV0JelWEg+uZ9pCjza9JDnjrw0U3 +FOtAVxdHJv04rWJNe9pa4kg8jctAdjBWapyySx+pW73bkNZy4Fc13QOcYqH5uIhdx HCFaijAAPrFAsXn/bjWuTGW16jQgBYKMOcyESSNc= Received: from DFLE115.ent.ti.com (dfle115.ent.ti.com [10.64.6.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id xB6JmETO048020 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 6 Dec 2019 13:48:14 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE115.ent.ti.com (10.64.6.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Fri, 6 Dec 2019 13:48:12 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Fri, 6 Dec 2019 13:48:12 -0600 Received: from uda0869644b.dal.design.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id xB6JmCKs008244; Fri, 6 Dec 2019 13:48:12 -0600 From: Benoit Parrot To: Hans Verkuil CC: , , Benoit Parrot Subject: [Patch] media: ti-vpe: csc: fix single vs multiplanar format handling Date: Fri, 6 Dec 2019 13:51:32 -0600 Message-ID: <20191206195132.21482-1-bparrot@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In csc_set_coeff() we were previously checking if the format type was V4L2_BUF_TYPE_VIDEO_OUTPUT or V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE as a mean to figure out if the format was multiplanar or not. This was not entirely accurate as the format type could also be a CAPTURE type instead. Fix this by removing the 'switch' construct and replacing them with "if (V4L2_TYPE_IS_MULTIPLANAR(type))" instead. Signed-off-by: Benoit Parrot --- drivers/media/platform/ti-vpe/csc.c | 32 +++++++++++------------------ 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/media/platform/ti-vpe/csc.c b/drivers/media/platform/ti-vpe/csc.c index 834114a4eebe..f4e0cf72d1cf 100644 --- a/drivers/media/platform/ti-vpe/csc.c +++ b/drivers/media/platform/ti-vpe/csc.c @@ -149,36 +149,28 @@ void csc_set_coeff(struct csc_data *csc, u32 *csc_reg0, enum v4l2_quantization src_quantization, dst_quantization; u32 src_pixelformat, dst_pixelformat; - switch (src_fmt->type) { - case V4L2_BUF_TYPE_VIDEO_OUTPUT: - pix = &src_fmt->fmt.pix; - src_pixelformat = pix->pixelformat; - src_ycbcr_enc = pix->ycbcr_enc; - src_quantization = pix->quantization; - break; - case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - default: + if (V4L2_TYPE_IS_MULTIPLANAR(src_fmt->type)) { mp = &src_fmt->fmt.pix_mp; src_pixelformat = mp->pixelformat; src_ycbcr_enc = mp->ycbcr_enc; src_quantization = mp->quantization; - break; + } else { + pix = &src_fmt->fmt.pix; + src_pixelformat = pix->pixelformat; + src_ycbcr_enc = pix->ycbcr_enc; + src_quantization = pix->quantization; } - switch (dst_fmt->type) { - case V4L2_BUF_TYPE_VIDEO_OUTPUT: - pix = &dst_fmt->fmt.pix; - dst_pixelformat = pix->pixelformat; - dst_ycbcr_enc = pix->ycbcr_enc; - dst_quantization = pix->quantization; - break; - case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - default: + if (V4L2_TYPE_IS_MULTIPLANAR(dst_fmt->type)) { mp = &dst_fmt->fmt.pix_mp; dst_pixelformat = mp->pixelformat; dst_ycbcr_enc = mp->ycbcr_enc; dst_quantization = mp->quantization; - break; + } else { + pix = &dst_fmt->fmt.pix; + dst_pixelformat = pix->pixelformat; + dst_ycbcr_enc = pix->ycbcr_enc; + dst_quantization = pix->quantization; } src_finfo = v4l2_format_info(src_pixelformat); -- 2.17.1