From patchwork Wed Nov 25 12:37:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 332373 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp399779ilb; Wed, 25 Nov 2020 04:37:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzp+SZ52bY8I6WmlaqI9rf26yoV1JqVpr53oh1BuNMmkK2vojkPysQcmFYqgj7CyCk/eg49 X-Received: by 2002:a17:906:7f95:: with SMTP id f21mr3038783ejr.340.1606307854387; Wed, 25 Nov 2020 04:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606307854; cv=none; d=google.com; s=arc-20160816; b=Mq5lkp2Ez0TBTPjiwnYE9OHNRDxpdRLOVB80R0Ic1GpCVjeyMdy7P/9rEbGP6ZiBDR v4h8COt89nWukCwGk+IYWYhsyu/kMDqhRXfmJHVeMAhlWF3dlhdl7uuGmUClT5ervv9U Nra0trS6bZqzWtgkIcqLQOxm9H6Fjz+Jc67xpMMX94Yd56Hc/g6SU4DqD6rSMGUdPykF ll+LXRAy/iem7ZccXeOam1nVD8aXZze2Bua2qDzZpApt7mx2Lk9ONX9MzDb7pN7wH4oR REBTu33zODXZJDRHD7ceagRlhPMf7MU/XBK5uRRUbvA127WdJrnvH9qKdk3/vung+zzt O0eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=/POD83bhfrWc7gHRAcRmWc2hVCnC37bpTrkRReqOp8k=; b=t0N+iDIm9NMPESNdsySNx4fzEQZN1wQD5uw+siF+uPdOlelteuiIlmlnFDow0x4TpA bC+ahmsSsOJzGuRYWnN4sHQ0ui3OUdMiJrd6ZAgADQkg3NcQLtqd5Sraz/eUjniFDd+5 MXX8c1dJl2+qgDpvN3zPfRH63+gkngtFmyFc0EOQHQFqPZJtFtv6IpVXaMLEeMYS839o stusBVa+Ocqo8w5CLAntfWybRs3DkyBJSL0JKesEluR1tVl1SisSwL2vBro/b1bCk8yz 0KwD46LDBNdUY6Pt2kSMjxloSmn+mMJDyIY9fzkIgLFX1s71CHTKH3p67eFsuKDYYP/d +cew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sUqYtGT0; 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 j18si1194899ejs.70.2020.11.25.04.37.33; Wed, 25 Nov 2020 04:37:34 -0800 (PST) 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=sUqYtGT0; 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 S1729327AbgKYMhd (ORCPT + 15 others); Wed, 25 Nov 2020 07:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726903AbgKYMhc (ORCPT ); Wed, 25 Nov 2020 07:37:32 -0500 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83654C0613D6 for ; Wed, 25 Nov 2020 04:37:32 -0800 (PST) Received: by mail-lj1-x242.google.com with SMTP id z1so2120735ljn.4 for ; Wed, 25 Nov 2020 04:37:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/POD83bhfrWc7gHRAcRmWc2hVCnC37bpTrkRReqOp8k=; b=sUqYtGT0hEGE8tEi1032R/GaoUGFH+DufaXLFL7rJuMJ6DKOI0iFV00yHWhyOiGNym ht2T35QVus9fTyHFgZdbvUtltl6DwyiZmNfpO3z/SX5fmifAhb8+o/VPwB5nzhBY7Ezi 4JH5qBpEp2CAha1L+VQwCIempbeqaSbsJNQjMt94zmEW7Or/aQtFAW3hfVvm6+BWOg0u D2ZU0vwJyqrqEnZZUHejcHi3MgI9ZJ9WZL8siuzL5vOFmKk4Vd8BB6KeN3QSK6VOqM57 nQru+/Ws2ug+rwksv0W/RC82M3G27EFFIGgk0iiuf+ZKshSRrD870Ot9rqyM3tymcs9x FI6w== 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; bh=/POD83bhfrWc7gHRAcRmWc2hVCnC37bpTrkRReqOp8k=; b=BYgeao7x+LQ6oRg1iPoS4djCwPL+4iWWYAyyyqjTuXla+yGG6KVC3VM7g62gTjWSMs /7ZORk9GlgfBoLHQ3N8lecLSWCognfV+iS7ZC9fIPjvmoISW3axojHOf2q0u9YLTf4p8 dWoAp80fxaahJysekuWnN7MMTao+WlLhjW6SkmVF5QL3MUC7Tyx8EvZWi7lgumB8Bs3o gMt69gm4UySDSTBw9PHLeTtXtX37D/0bDrNeTHXQmhUz8HetfvsZpjehBiS/A64fxvrd WivUBLcus8lMLihC4zLLdXFTk+r2mylwQUvGiZ/YZ9EeaVvk4nMnp0EbQT/4Hwt8IFUm 1UUw== X-Gm-Message-State: AOAM533aJXMc9l8QHwtvlJp1Chf5+dgKlxT0c41oJNq7jkQELggW2tiZ ZwTWpP2LBhnq35+TPFZ/xhgiaQ== X-Received: by 2002:a2e:9b83:: with SMTP id z3mr1279273lji.145.1606307850974; Wed, 25 Nov 2020 04:37:30 -0800 (PST) Received: from localhost.localdomain ([85.249.45.205]) by smtp.googlemail.com with ESMTPSA id z8sm230261ljh.74.2020.11.25.04.37.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 04:37:29 -0800 (PST) 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/2] Revert "media: camss: Make use of V4L2_CAP_IO_MC" Date: Wed, 25 Nov 2020 15:37:09 +0300 Message-Id: <20201125123710.28491-1-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This reverts commit c90f1178dcac30dee5ddd29ec0513e7589aa866e. The assumption of "Each entry in formats[] table has unique mbus_code" is valid for the RDI entities, but not for the PIX ones. Reverting this patch and creating a new one which handles the PIX entities correctly results in smaller and more straitforward patch than doing the changes on top of the current version. Signed-off-by: Andrey Konovalov --- .../media/platform/qcom/camss/camss-video.c | 67 ++++--------------- 1 file changed, 13 insertions(+), 54 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 114c3ae4a4ab..20673de9020e 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -535,16 +535,17 @@ static int video_querycap(struct file *file, void *fh, return 0; } -/* - * 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) +static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) { + 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++) { @@ -557,53 +558,11 @@ static int video_get_unique_pixelformat_by_index(struct camss_video *video, if (j == i) k++; - 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) + break; } - if (i < 0) + if (k < f->index) return -EINVAL; f->pixelformat = video->formats[i].pixelformat; @@ -989,8 +948,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 | V4L2_CAP_IO_MC; + vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_STREAMING | + V4L2_CAP_READWRITE; vdev->ioctl_ops = &msm_vid_ioctl_ops; vdev->release = msm_video_release; vdev->v4l2_dev = v4l2_dev; From patchwork Wed Nov 25 12:37:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 332374 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp400827ilb; Wed, 25 Nov 2020 04:39:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJxR0u2mc5TX74XkuLEio6hOZ4IQ/V37HaPNX9fJgTPjwrQwGA2JfA7c9ne0R7bbU1svqUdF X-Received: by 2002:a17:906:d96e:: with SMTP id rp14mr2972457ejb.214.1606307955750; Wed, 25 Nov 2020 04:39:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606307955; cv=none; d=google.com; s=arc-20160816; b=D4cRl6HE6fpjcrY3xez7cBelPAFqpjqPFHaO6LgaTYDbr2nmJJiz0DJ/wK5lI3/oLN sOYDuO462E6+4FrWvsmxVQW0JYncRgWs1wuqf0X+qkFjIxAUgSVw4a8XjGcOtSw1yVJt wLEouO9J22mqfhOE5P21EKjPWSHQHagJYOnYrfOeB+gJ3FjR3LyGMKC/zR32BvrQTRaz L8+DSwWymN5pEQ36mZvGpcTp5wkGZqRAcUCvBstkD72/dilsvOi9gJmioTtTKCROYfVX vxIOQ6cwqtXPxxRT68lFze0orlKJGwWsL/xY8sTUc3IKGI58JHMoyMlukqdTG7O2k8Ji 1Waw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=52E/kGckX47/YFVLHUCD+7iLeZo5CiFQYz7tFvrv0pM=; b=kcLwVQSxSQ4/ZVf0chnqCXRDbPfNPqlX2XSnDHRgDvIZ4+ElpilMivXW0Iz2HMBqh1 NLlOj5pMDvoubAi5RSIMgOxMZdGy2Fny8CTxJY8xGNDm29jCbHjE9B7EZOtf3OTwNGS2 IXm27dPzVDUPhTJ3wuE2odlo4a8M/7Mo96/5vHbZj1SICcbK/YEu0yuCOcYCdVxYVRrx 3yhKya+NiNc0EiN42XFP4xP1PBLyMR9ZlqeniNc7mmWkmpRhqY0ypHP2nUsGeWRwGOas ZWXsyWgX0NxRGt9TRMMFA9GYmMVMbiSafaI5vi50Di5CUx647imiCdiJU+X7TSYW+8Eh ESeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZZIbH44H; 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 j3si1145235eje.93.2020.11.25.04.39.15; Wed, 25 Nov 2020 04:39:15 -0800 (PST) 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=ZZIbH44H; 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 S1729237AbgKYMhn (ORCPT + 15 others); Wed, 25 Nov 2020 07:37:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728558AbgKYMhm (ORCPT ); Wed, 25 Nov 2020 07:37:42 -0500 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0E86C0613D6 for ; Wed, 25 Nov 2020 04:37:40 -0800 (PST) Received: by mail-lj1-x241.google.com with SMTP id o24so2108940ljj.6 for ; Wed, 25 Nov 2020 04:37:40 -0800 (PST) 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=52E/kGckX47/YFVLHUCD+7iLeZo5CiFQYz7tFvrv0pM=; b=ZZIbH44H1Bk5JfpCWGFPENkd779/Q0CUuAmhZGycRsJVw0N+Kk6HOsq3EnffMgwBJk 9WBvN0E8LMcpSxfmzJHURfuGjK9nsF2iZ2IsiTCNEWc9X/cIw6Tzbsl0Pnqj6tcp+MAA MShDBOPG7gjdIpvBD0NkcazqCSsIsgNaKIUUBUajLohuIYcJCy/3leIJjGa+wEeX4ZyE vwjs+NTxG7KQjZSmE4t1LicMVfbQq7xgJ4IvW0c8ZU7gBboHg9Ng8/iCiDsBH3VrlTXH 2NB4+7vc9xa8sKZT8szL/Z4EMKGVjPNsdjx2UFSQmKu8mlUJYvdk7TqIkI8U0yao1hAp J34Q== 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=52E/kGckX47/YFVLHUCD+7iLeZo5CiFQYz7tFvrv0pM=; b=SH9Dx1mCsdRQLlWFNKj2YmnXYhnxviAJ4mdzBlHeVBVI52/BXH7O6L3vd7c8ySRI2W ye/Jm7SRsQPPMSZaSsium+q93O7AzhRQGNaTBfANsM92cjzZpKsJBp+OOp2E/13vbwPO eo9C6x9pSnAlTmj2q6/laGa/hTFHGKOEgpIZ0m2p3d2QROhpUWICk7wp//bCqv9PZVoF 1bHj+zEyOFZ6PORDDWd70XxF9sy7yoWKnfqbmhMlDjf0cmTdluqPAd9WbDvR/cQymFsf ztk5q3RY3zov6IFuBSOBWNvKzlRrsFtSKou4Zz/VuKGXxJmEB6azIJ/ftkmJ0h8avPuq qtUA== X-Gm-Message-State: AOAM530lNDc7E8SVig9bUmoobXkOvcNLhTjhjpgkzPV4dzzgO3zgLQrE byOMtIhte9ltiBhIa4FBGCt5Lg== X-Received: by 2002:a2e:9550:: with SMTP id t16mr1224617ljh.117.1606307859184; Wed, 25 Nov 2020 04:37:39 -0800 (PST) Received: from localhost.localdomain ([85.249.45.205]) by smtp.googlemail.com with ESMTPSA id z8sm230261ljh.74.2020.11.25.04.37.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Nov 2020 04:37:38 -0800 (PST) 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/2] media: camss: Make use of V4L2_CAP_IO_MC Date: Wed, 25 Nov 2020 15:37:10 +0300 Message-Id: <20201125123710.28491-2-andrey.konovalov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201125123710.28491-1-andrey.konovalov@linaro.org> References: <20201125123710.28491-1-andrey.konovalov@linaro.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" This is the second version of this change which handles the case of several pixel formats corresponding to one media bus format correctly. Signed-off-by: Andrey Konovalov --- drivers/media/platform/qcom/camss/camss-video.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 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 20673de9020e..60737b771d52 100644 --- a/drivers/media/platform/qcom/camss/camss-video.c +++ b/drivers/media/platform/qcom/camss/camss-video.c @@ -539,6 +539,7 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) { struct camss_video *video = video_drvdata(file); int i, j, k; + u32 mcode = f->mbus_code; if (f->type != video->type) return -EINVAL; @@ -549,7 +550,12 @@ static int video_enum_fmt(struct file *file, void *fh, struct v4l2_fmtdesc *f) /* find index "i" of "k"th unique pixelformat in formats array */ k = -1; for (i = 0; i < video->nformats; i++) { + if (mcode != 0 && video->formats[i].code != mcode) + continue; + for (j = 0; j < i; j++) { + if (mcode != 0 && video->formats[j].code != mcode) + continue; if (video->formats[i].pixelformat == video->formats[j].pixelformat) break; @@ -948,8 +954,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;