From patchwork Fri Aug 14 20:54:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 247744 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp677882ilo; Fri, 14 Aug 2020 13:54:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2+gqjdbJ9+NjMpZ/n6+H/k+DySDGq6Dy/JoGgXw2ylq8HfzYPUuFWm1uDOoyd5B/z7ySS X-Received: by 2002:a17:906:95d4:: with SMTP id n20mr4409097ejy.485.1597438485889; Fri, 14 Aug 2020 13:54:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597438485; cv=none; d=google.com; s=arc-20160816; b=0alY+9EQwKYhLMZqft08afedSitaJJn+yF4H2tdUqyVGInLO4V18ztv+PDjIONH7VU QVycx7LYIvhJGsXtHZVCj+EcpCjrjDi7pok0eZSM/WZe5Wr7mY4gl4oZLS+azMX4fAYI tOtY2dFDgmKMpMxcLVc/OsCfJ7S1V7xGCbTcGms3F0LO89GMsHx3ZbmRpFHQ0uJ1qLdn GrF0EK/eCD/Fz/c1aSQRN4AMttb1rKQ4oxGYVbn9vOo4u46SeMAwo8ydbSkEWbZu8lRn yU29PerM45gm4fReW5MTnkNu3I/V7qhsu6+KaEK4C6EfH8J2Lr4D+mR5Ndr6GilHQ8l/ znTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=v89y35h3M88vGCG82awEg4tCgwfd/R9LYLHd6BNE3bg=; b=nxT2+cH1UANk67Ta7T8INbGSgsWUeAbG9FYUThBo6/a6CQ/uWUmX9fXpfkYkBifWXb Cwi9Bv39uOU9TowNplj+yfwtaq9xojQS8+5gEHY9zzkOb06Ue016YSGIt8VgFy/IGzH5 1+qFXVAM5MZnLDvFQoYCPM/AVu39+XXmJepTjGFPTNlc7H/5vFcA0RgYqsMsLa/gDbHC Zbo8XwUoAsiK+t12/SzVdCaPZtQAfyRFzMjNXvLrl06lxKYjPYnbmpsw23CZ5a47hIbS T43TTdPW/ef+JrihRufxQiKsUWbDjlgriz6B0cu4VlsX4oNHmAHPBNv3Yc5M0d25doyt ufOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGNVIsk2; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si6054935edv.492.2020.08.14.13.54.45; Fri, 14 Aug 2020 13:54:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zGNVIsk2; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbgHNUyp (ORCPT + 15 others); Fri, 14 Aug 2020 16:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726754AbgHNUyo (ORCPT ); Fri, 14 Aug 2020 16:54:44 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F1D7C061385 for ; Fri, 14 Aug 2020 13:54:44 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id 185so11285812ljj.7 for ; Fri, 14 Aug 2020 13:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=v89y35h3M88vGCG82awEg4tCgwfd/R9LYLHd6BNE3bg=; b=zGNVIsk2UmezNjaacj6ZypLaT5Bq7Jyj+EEMu+EN1MV38GUHIl+wGgeeuxuDawQ59s 7T1GYsqddFaBhluXp+1SA+uB+Iuv8GDHj0bfHBRLcDbq/kw4K0ejctkugyWLTTZRSG4I TTKKHDq2J2u5sRpVPbO/Nk7R79mk3mAUefX8+c/1a2oNV3f1Kx7Gdn9kUcaCkMofGxQd VIWqOcuinBP4ljiSPry2ldG5lnPIgG8ms1ekRZ3Jk23uuHq+faNndyy/nSOQGHIO12Ts fqEhKoQ8/6V3vB85lIR76zfcqprhAomvy50AsQfQ0+3f7UNlE/sgd2LAwQvaxpDDV1sM iBrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=v89y35h3M88vGCG82awEg4tCgwfd/R9LYLHd6BNE3bg=; b=Y+hSo6WMyPkJVAxvGTkguuD8PyZIBrIz4ysHmGPqUByz32nQPqlzXXgChDBn5hRL94 ekwaEcsksCmpPJUaBtoDavnbp1+85Pj8kgeli6FWtVsZng1x4VzKL09Ojs7xwzHaiFTe dcYuWQY+tzVcvsLbv0ZW8m8ICitp+OVcrjAuArxKODeDnfnYOEwrQ4EspTxRDzCOHUbk Ql7X9S0EjpjjsYqEcHEkGLADrMAIZfSIPQcy9rOpGQnnJc8DtfVcFq5qQmEYCE3W9sZx jNfDC4P2c82gRwKCgpbDKqi6HP/RV5ZXyWgpYgxCIyyPJ1kKkjOcBhAQ4PODe3SlhtRZ 3xvQ== X-Gm-Message-State: AOAM530837C2GHM8AU8QFciEwx0IFlB1s+uvgF4A6MZNKIr/UnUykeTk vK54s4JC8SzuwhoIv8Py5/aLUA== X-Received: by 2002:a2e:90e:: with SMTP id 14mr2141399ljj.293.1597438483038; Fri, 14 Aug 2020 13:54:43 -0700 (PDT) Received: from localhost.localdomain (37-144-159-139.broadband.corbina.ru. [37.144.159.139]) by smtp.googlemail.com with ESMTPSA id j26sm1963601lja.111.2020.08.14.13.54.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 13:54:42 -0700 (PDT) From: Andrey Konovalov To: mchehab@kernel.org, robert.foss@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, peter.griffin@linaro.org, Andrey Konovalov Subject: [PATCH 1/3] media: camss: Make use of V4L2_CAP_IO_MC Date: Fri, 14 Aug 2020 23:54:01 +0300 Message-Id: <20200814205403.27639-2-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200814205403.27639-1-andrey.konovalov@linaro.org> References: <20200814205403.27639-1-andrey.konovalov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Implement mbus_code filtering for format enumeration. Without this patch libcamera errors out with: "ERROR V4L2 v4l2_videodevice.cpp:982 /dev/video0[cap]: Media bus code filtering not supported by the device" Signed-off-by: Andrey Konovalov --- .../media/platform/qcom/camss/camss-video.c | 67 +++++++++++++++---- 1 file changed, 54 insertions(+), 13 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index cdbd6dba1122..90c7dd29b573 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -529,17 +529,16 @@ static int video_querycap(struct file *file, void *fh, return 0; } -static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) +/* + * Returns the index in the video->formats[] array of the element which + * has the "ndx"th unique value of pixelformat field. + * If not found (no more unique pixelformat's) returns -EINVAL. + */ +static int video_get_unique_pixelformat_by_index(struct camss_video *video, + int ndx) { - struct camss_video *video = video_drvdata(file); int i, j, k; - if (f->type != video->type) - return -EINVAL; - - if (f->index >= video->nformats) - return -EINVAL; - /* find index "i" of "k"th unique pixelformat in formats array */ k = -1; for (i = 0; i < video->nformats; i++) { @@ -552,11 +551,53 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) if (j == i) k++; - if (k == f->index) - break; + if (k == ndx) + return i; + } + + return -EINVAL; +} + +/* + * Returns the index in the video->formats[] array of the element which + * has code equal to mcode. + * If not found returns -EINVAL. + */ +static int video_get_pixelformat_by_mbus_code(struct camss_video *video, + u32 mcode) +{ + int i; + + for (i = 0; i < video->nformats; i++) { + if (video->formats[i].code == mcode) + return i; + } + + return -EINVAL; +} + +static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) +{ + struct camss_video *video = video_drvdata(file); + int i; + + if (f->type != video->type) + return -EINVAL; + + if (f->index >= video->nformats) + return -EINVAL; + + if (f->mbus_code) { + /* Each entry in formats[] table has unique mbus_code */ + if (f->index > 0) + return -EINVAL; + + i = video_get_pixelformat_by_mbus_code(video, f->mbus_code); + } else { + i = video_get_unique_pixelformat_by_index(video, f->index); } - if (k < f->index) + if (i < 0) return -EINVAL; f->pixelformat = video->formats[i].pixelformat; @@ -911,8 +952,8 @@ int msm_video_register(struct camss_video *video, struct v4l2_device *v4l2_dev, } vdev->fops = &msm_vid_fops; - vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING | - V4L2_CAP_READWRITE; + vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING + | V4L2_CAP_READWRITE | V4L2_CAP_IO_MC; vdev->ioctl_ops = &msm_vid_ioctl_ops; vdev->release = msm_video_release; vdev->v4l2_dev = v4l2_dev; From patchwork Fri Aug 14 20:54:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 250651 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFC7EC433E3 for ; Fri, 14 Aug 2020 20:54:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B4E292074D for ; Fri, 14 Aug 2020 20:54:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="LVkyRz4R" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726229AbgHNUys (ORCPT ); Fri, 14 Aug 2020 16:54:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726754AbgHNUyr (ORCPT ); Fri, 14 Aug 2020 16:54:47 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D4A2C061386 for ; Fri, 14 Aug 2020 13:54:47 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id s9so5486453lfs.4 for ; Fri, 14 Aug 2020 13:54:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gh4jDH3BMdXd5cGD6HfDwKGJPSCytu5DEXM3Fm8l8r8=; b=LVkyRz4RQCq4E0AAaFh5AMPVNjK8SXRMgREL1S+mWhLy2y0HEANpxwfGQrpXEnLeZT kgVyT1iDIEFv42yugzMO7Z5kbo360HP2Uqp/+75KQ0ykOm+v5+vtjZetsfLaOEY8OsNL tBA+IGOXYv4zUcljx9rvfDDkesLyl0V9pylEyCsslVe0kOfpsB3950McUSNCaWAjgE3Q V0Uhfv0q627W/zqGjERrt/gOtoMZ/6ILfUHN1XrdndoXf3Mf3IcwBgQQaM07y/cvn33k IVVKLhPepc0WTxBiEtSCJJjuIAoWjVTOXt5RDgLpnhlkXVJ222ij1T10l+VLAKEmeEB0 aoKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gh4jDH3BMdXd5cGD6HfDwKGJPSCytu5DEXM3Fm8l8r8=; b=o5+tNrKyMLV39GGl3OA01VUQHh1ZFSBoZA8DQx9bT9gcnlRcAV9Xt7OmLc2rvbpjzj 8NyRoCh5vbp6gqw3ooveBJ/h10CQUewLwJcmumCJz+SuJnuMQWbCuG7Q0Vtr6Nu/AzNR 3O831D1upDViHMiW3J1KtjbIw22Lf1uMwlfAmz/nwfdOunAgUGmtsmaiVbLOhwvQudDe K+r2S1eMFYIpo+712P6dagQ334AWcGJ9HLMlVZpvtZXmO+1o29G41fzYdfHRjGe6FNmK o3Nd5HCAykZTVW2BcVVUUnmMl54v0wzyK+WDxrK1KBfjc16ZS6Zsu9tVYZ1kFv6ogLuX dz1A== X-Gm-Message-State: AOAM530zSiSbT0k7l9g6pNIuVst7LXPJpPKh8E+qjZ1oyQ012TifO+dg uawHe+Wo2QrEDR8bFUlcn9fdSQ== X-Google-Smtp-Source: ABdhPJy/bsTW4rk6yhCLLdCmASmG8Ag5bgLjn2l/h51v4zcnAv5/69cvz+iuSD7jwfEMQ9fTOLdXkA== X-Received: by 2002:a05:6512:3138:: with SMTP id p24mr2061128lfd.143.1597438485456; Fri, 14 Aug 2020 13:54:45 -0700 (PDT) Received: from localhost.localdomain (37-144-159-139.broadband.corbina.ru. [37.144.159.139]) by smtp.googlemail.com with ESMTPSA id j26sm1963601lja.111.2020.08.14.13.54.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 13:54:44 -0700 (PDT) From: Andrey Konovalov To: mchehab@kernel.org, robert.foss@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, peter.griffin@linaro.org, Andrey Konovalov Subject: [PATCH 2/3] media: camss: add support for vidioc_enum_framesizes ioctl Date: Fri, 14 Aug 2020 23:54:02 +0300 Message-Id: <20200814205403.27639-3-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200814205403.27639-1-andrey.konovalov@linaro.org> References: <20200814205403.27639-1-andrey.konovalov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org VIDIOC_ENUM_FRAMESIZES support in the video capture driver is required by libcamera. Without this change libcamera errors out with: "ERROR V4L2 v4l2_videodevice.cpp:1059 /dev/video0[cap]: Unable to enumerate frame sizes: Inappropriate ioctl for device" Signed-off-by: Andrey Konovalov --- .../media/platform/qcom/camss/camss-video.c | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index 90c7dd29b573..e6255f0e6174 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -18,6 +18,12 @@ #include "camss-video.h" #include "camss.h" +#define CAMSS_FRAME_MIN_WIDTH 1 +#define CAMSS_FRAME_MAX_WIDTH 8191 +#define CAMSS_FRAME_MIN_HEIGHT 1 +#define CAMSS_FRAME_MAX_HEIGHT_RDI 8191 +#define CAMSS_FRAME_MAX_HEIGHT_PIX 4096 + struct fract { u8 numerator; u8 denominator; @@ -605,6 +611,36 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) return 0; } +static int video_enum_framesizes(struct file *file, void *fh, + struct v4l2_frmsizeenum *fsize) +{ + struct camss_video *video = video_drvdata(file); + int i; + + if (fsize->index) + return -EINVAL; + + /* Only accept pixel format present in the formats[] table */ + for (i = 0; i < video->nformats; i++) { + if (video->formats[i].pixelformat == fsize->pixel_format) + break; + } + + if (i == video->nformats) + return -EINVAL; + + fsize->type = V4L2_FRMSIZE_TYPE_CONTINUOUS; + fsize->stepwise.min_width = CAMSS_FRAME_MIN_WIDTH; + fsize->stepwise.max_width = CAMSS_FRAME_MAX_WIDTH; + fsize->stepwise.min_height = CAMSS_FRAME_MIN_HEIGHT; + fsize->stepwise.max_height = (video->line_based) ? + CAMSS_FRAME_MAX_HEIGHT_PIX : CAMSS_FRAME_MAX_HEIGHT_RDI; + fsize->stepwise.step_width = 1; + fsize->stepwise.step_height = 1; + + return 0; +} + static int video_g_fmt(struct file *file, void *fh, struct v4l2_format *f) { struct camss_video *video = video_drvdata(file); @@ -745,6 +781,7 @@ static int video_s_input(struct file *file, void *fh, unsigned int input) static const struct v4l2_ioctl_ops msm_vid_ioctl_ops = { .vidioc_querycap = video_querycap, .vidioc_enum_fmt_vid_cap = video_enum_fmt, + .vidioc_enum_framesizes = video_enum_framesizes, .vidioc_g_fmt_vid_cap_mplane = video_g_fmt, .vidioc_s_fmt_vid_cap_mplane = video_s_fmt, .vidioc_try_fmt_vid_cap_mplane = video_try_fmt, From patchwork Fri Aug 14 20:54:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 247746 Delivered-To: patch@linaro.org Received: by 2002:a92:cc90:0:0:0:0:0 with SMTP id x16csp677923ilo; Fri, 14 Aug 2020 13:54:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8NwYZDNPtbWS04WHaFbDKdncd92qQWGcgWt3Bz9Bis5uOF/UkvFHrqpvkrSFsrEFEuOlD X-Received: by 2002:a17:906:228a:: with SMTP id p10mr4136914eja.23.1597438491184; Fri, 14 Aug 2020 13:54:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597438491; cv=none; d=google.com; s=arc-20160816; b=FMQUXo7fyIXdhUOiSSpjVdJEX7MQdwMO33u0DSE66o1QsgAEYxzzAZqiOyYgUI7mKG /SyJ8fg7Qv3iuA2Snxb6+9u7szLtWHwiX+4UPZKplycr2zt9x7vfNXHRGq8pB2rf5IbS NIgK4u3RHcHgVCK3HtvHQ93AAZXOn/39xVV8CEFsSfddhYmoMLeUh+RrdM4QojzKQCau Cx3xcxQe4y4oWaI0bKJonpBXvixWgsruyqb9TsZMWuylBNWdp6LkajuWi1HnurVTJdAm LGyyvnTB1R9nzzGJshq+ZyBX0qn3Z6S+NjLDbxIZ1ORMEsIaEE4ffNzUdoXmFi8Ocf3I gXnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Vus0dqruI6TinEH786jbm9CqjsZKhoW6S8aHJE0MAZI=; b=lIEf6dX7kk56XJzD1Nx+OneDeeYvdGsQdGHcsJ6oyfYymATbKxoFT6V0vFBwjPGyA5 4azV/Y0YLX1atEbmqQ5QGwKXvsmxuDzh68bKf1XT9LGIfnp2zVVuuKv6hEn9MDUatjTx av8RbUfda1AsMFxN7kzZK8XFy3roiA5pQnU3dJMZu+zIeTd5f6sWcoeE6xu1MVsTCKMA MH39Bsz0LVBLC8j1F1zvdmzavjqR1rZmkuLA+0DtTHlG1KlNfTmNXah0CU8FLRoaQoRG CkmIirjrIcpCD3SbA5xiSZViwyX+qkLmredv4Ue78w/AmNxK61HbRGHhFrh0seOQ6SRr GMyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oSGqWf2l; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e2si6054935edv.492.2020.08.14.13.54.50; Fri, 14 Aug 2020 13:54:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oSGqWf2l; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727104AbgHNUyt (ORCPT + 15 others); Fri, 14 Aug 2020 16:54:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727093AbgHNUyt (ORCPT ); Fri, 14 Aug 2020 16:54:49 -0400 Received: from mail-lf1-x141.google.com (mail-lf1-x141.google.com [IPv6:2a00:1450:4864:20::141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CC3EC061386 for ; Fri, 14 Aug 2020 13:54:49 -0700 (PDT) Received: by mail-lf1-x141.google.com with SMTP id h8so5479553lfp.9 for ; Fri, 14 Aug 2020 13:54:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Vus0dqruI6TinEH786jbm9CqjsZKhoW6S8aHJE0MAZI=; b=oSGqWf2l5TA8ZA0SPD8bY2gh1y82+4aeVyw0p7ICfdR3GbuWbL33M9ZfRZjI3ENw29 LFDIFcZ0jV4xo+wkraBPfGcEUMj8OHXHWGZwZpKl18Vfg2Rngl4QhGE42XOwSPDUJLEE GcP/BPWO7InTFOPcXJ3zYEx7h4sUQWhFDB6SR++T45mfGqFxrMV/djpAMmytazphEboX CeTKtvCnTCrAbMmsPpbvGskv6l0lW9zkSNqe+i4omobTrySF7aYjykinPZ1kCvWSnd0+ X5J1zuFoGp8OmZf/cbINotUUvtmZrx2UB9FvkMWDkQqk6CH5xnzOD9kaiJbTXfES0zMe UaGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Vus0dqruI6TinEH786jbm9CqjsZKhoW6S8aHJE0MAZI=; b=i68MamhMed3NPn1RA4DNsqfLy7+Lb4FGLv1XqQfaX86GfitVQmrCsh4eafcAVadMNe uOKV9hPX6z2dxo3HMobPlQAavrl7aN1FomIOVjaGJ5tBGszRFLIa88nueggOxxGyhZkh S3az49gEPSfh/olsXlEC9fiD6owDsVdd9fD18DZUK8HpUWRvjEM0mhd+o7vrwcYO/HVu safgoLuYQCa6YNw7TQL0zTZ/ql89PhdVM0izs23wN3w+GO5teoE4oefIqjUBIKd/hV4B 5ijsZQjtqPYOcVK0oa9RTl186HnHbuQcg4emcr/iofFuzYM18JwVCBB/+HDLzWIjkM8G HU7Q== X-Gm-Message-State: AOAM531K74r2dXy7MbN8Ng20ArepEphaDPMoxcW4rEDOGoMzw8AmOb1L ThcNBnq6TBByaQTRoiU2OvCkCA== X-Received: by 2002:a19:8705:: with SMTP id j5mr2012582lfd.122.1597438487681; Fri, 14 Aug 2020 13:54:47 -0700 (PDT) Received: from localhost.localdomain (37-144-159-139.broadband.corbina.ru. [37.144.159.139]) by smtp.googlemail.com with ESMTPSA id j26sm1963601lja.111.2020.08.14.13.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Aug 2020 13:54:47 -0700 (PDT) From: Andrey Konovalov To: mchehab@kernel.org, robert.foss@linaro.org Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, peter.griffin@linaro.org, Andrey Konovalov Subject: [PATCH 3/3] media: camss: __video_try_fmt(): don't use hardcoded constants Date: Fri, 14 Aug 2020 23:54:03 +0300 Message-Id: <20200814205403.27639-4-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200814205403.27639-1-andrey.konovalov@linaro.org> References: <20200814205403.27639-1-andrey.konovalov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use the definitions introduced by commit "media: camss: add support for vidioc_enum_framesizes ioctl" instead of the hardcoded values. Signed-off-by: Andrey Konovalov --- drivers/media/platform/qcom/camss/camss-video.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/media/platform/qcom/camss/camss-video.c b/drivers/media/platform/qcom/camss/camss-video.c index e6255f0e6174..546393ab0a52 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -670,7 +670,7 @@ static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) 1, 65528); sizeimage[i] = clamp_t(u32, p->sizeimage, bytesperline[i], - bytesperline[i] * 4096); + bytesperline[i] * CAMSS_FRAME_MAX_HEIGHT_PIX); } for (j = 0; j < video->nformats; j++) @@ -687,8 +687,8 @@ static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) memset(pix_mp, 0, sizeof(*pix_mp)); pix_mp->pixelformat = fi->pixelformat; - pix_mp->width = clamp_t(u32, width, 1, 8191); - pix_mp->height = clamp_t(u32, height, 1, 8191); + pix_mp->width = clamp_t(u32, width, 1, CAMSS_FRAME_MAX_WIDTH); + pix_mp->height = clamp_t(u32, height, 1, CAMSS_FRAME_MAX_HEIGHT_RDI); pix_mp->num_planes = fi->planes; for (i = 0; i < pix_mp->num_planes; i++) { bpl = pix_mp->width / fi->hsub[i].numerator * @@ -714,7 +714,7 @@ static int __video_try_fmt(struct camss_video *video, struct v4l2_format *f) 1, 65528); p->sizeimage = clamp_t(u32, p->sizeimage, p->bytesperline, - p->bytesperline * 4096); + p->bytesperline * CAMSS_FRAME_MAX_HEIGHT_PIX); lines = p->sizeimage / p->bytesperline; if (p->bytesperline < bytesperline[i])