From patchwork Wed Mar 7 22:05:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 10265435 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E60BF60247 for ; Wed, 7 Mar 2018 22:05:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF28C29445 for ; Wed, 7 Mar 2018 22:05:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3F35294B0; Wed, 7 Mar 2018 22:05:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CB9A29445 for ; Wed, 7 Mar 2018 22:05:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934255AbeCGWF4 (ORCPT ); Wed, 7 Mar 2018 17:05:56 -0500 Received: from bin-mail-out-05.binero.net ([195.74.38.228]:32123 "EHLO bin-vsp-out-02.atm.binero.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934221AbeCGWFz (ORCPT ); Wed, 7 Mar 2018 17:05:55 -0500 X-Halon-ID: ac3a6379-2253-11e8-9bc5-005056917f90 Authorized-sender: niklas@soderlund.pp.se Received: from bismarck.berto.se (unknown [89.233.230.99]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id ac3a6379-2253-11e8-9bc5-005056917f90; Wed, 07 Mar 2018 23:05:40 +0100 (CET) From: =?UTF-8?q?Niklas=20S=C3=B6derlund?= To: Laurent Pinchart , Hans Verkuil , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, tomoharu.fukawa.eb@renesas.com, Kieran Bingham , =?UTF-8?q?Niklas=20S=C3=B6derlund?= Subject: [PATCH v12 23/33] rcar-vin: force default colorspace for media centric mode Date: Wed, 7 Mar 2018 23:05:01 +0100 Message-Id: <20180307220511.9826-24-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307220511.9826-1-niklas.soderlund+renesas@ragnatech.se> References: <20180307220511.9826-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The V4L2 specification clearly documents the colorspace fields as being set by drivers for capture devices. Using the values supplied by userspace thus wouldn't comply with the API. Until the API is updated to allow for userspace to set these Hans wants the fields to be set by the driver to fixed values. Signed-off-by: Niklas Söderlund Reviewed-by: Hans Verkuil --- drivers/media/platform/rcar-vin/rcar-v4l2.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 2280535ca981993f..ea0759a645e49490 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -664,12 +664,29 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = { * V4L2 Media Controller */ +static int rvin_mc_try_format(struct rvin_dev *vin, struct v4l2_pix_format *pix) +{ + /* + * The V4L2 specification clearly documents the colorspace fields + * as being set by drivers for capture devices. Using the values + * supplied by userspace thus wouldn't comply with the API. Until + * the API is updated force fixed vaules. + */ + pix->colorspace = RVIN_DEFAULT_COLORSPACE; + pix->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(pix->colorspace); + pix->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(pix->colorspace); + pix->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true, pix->colorspace, + pix->ycbcr_enc); + + return rvin_format_align(vin, pix); +} + static int rvin_mc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct rvin_dev *vin = video_drvdata(file); - return rvin_format_align(vin, &f->fmt.pix); + return rvin_mc_try_format(vin, &f->fmt.pix); } static int rvin_mc_s_fmt_vid_cap(struct file *file, void *priv, @@ -681,7 +698,7 @@ static int rvin_mc_s_fmt_vid_cap(struct file *file, void *priv, if (vb2_is_busy(&vin->queue)) return -EBUSY; - ret = rvin_format_align(vin, &f->fmt.pix); + ret = rvin_mc_try_format(vin, &f->fmt.pix); if (ret) return ret;