Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp240423pxf; Wed, 10 Mar 2021 05:26:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+1FNLDU2Xf3h+kI6EtGPZRievfgpZ/3+RxQhNI/PpHTJggLdd3FEAjzktDAfr9ReQIKPu X-Received: by 2002:a50:ee19:: with SMTP id g25mr3269249eds.351.1615382792494; Wed, 10 Mar 2021 05:26:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615382792; cv=none; d=google.com; s=arc-20160816; b=MckecyjiniSNM623I9Nj4WuMubMzKe4I2kck/VoTyKukYwbkVNxGovRiJ2szgBJkuy F3tb9dafDYEovqYuFXh/QWJdX7Fp0u7yMOxeABGx6K5rXpYvrz3lt7W7hyGgIjYtcdI1 biT7DwGt5NMuOMNrqnyEXp4MJ+R2APbBGD8a3DPt2Ro4ciagVruAAAnHa2LOeMUho3AR ielWhk/fDRPmsyPwUM83VCAcJDrAj5tv1sucOGfEpaaX27bnBwXLsLGREDuBfWyphssk wn0U9KfGCLDdNh7QK06sBPtlX52XAwZgzq+GQISRUrSL8QcB1elVz8hOFZ4Nteb02GlM TUyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sYBVpRBymqWSD8E/GWySSlqm3ALxRpHjMdrJ48XDRvg=; b=w59aSSvpWl3wg+jAoNX0Zup4r+MYl3DFjYwvRMwMczGLxsef7erYfdyUrbeYKmhSo2 Ifh87RefNhftuOa8GHyubesufT75RkWjbVxHwTsQ2ElJPzvuG7c+05NUOWwICfW3pi0t WfEWoT7ktNaCXUx/KtbbZH3zlEtQzNSX1+b8hCOuT57fcfKPR9OZta1eI/+fLTeXTY0I xF7fmdI529Z0Nh6Saj4kS7R6Sh4kB/flbK6N0X96mmJ9dEnUpSrNgpEtRuYxVzuuQgJO KIfp4YRo4AzG0viaOCQim02ygX+4C4uKjc99fFKRkqkRDePEv00Rc7tTVY5lz7/c3XPX aGuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WCkbJifA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ml22si10678747ejb.629.2021.03.10.05.26.08; Wed, 10 Mar 2021 05:26:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b=WCkbJifA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233101AbhCJNYy (ORCPT + 99 others); Wed, 10 Mar 2021 08:24:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:45464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232783AbhCJNYO (ORCPT ); Wed, 10 Mar 2021 08:24:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E6FFB64FE8; Wed, 10 Mar 2021 13:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615382654; bh=YpFHQMZyNfl+6dwoe/1qLnWAdmC1Aeyw5cp/9SSd15A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCkbJifAk+hOqW6FQTubqvcYZjUxmVYdAeT27TiQNM+9C9FLgUr8FB+myaWfsl94r gjvfqdXPhAAvGmIlmqD4NPb3B6V9SPKMdbhjrSJDoKvU8rXE835GqK0sGx7of8fcFZ h44hQjLhvq3AwSGDosDheb48I7zqj9z69/DOl+7I= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Hans Verkuil , Mauro Carvalho Chehab Subject: [PATCH 5.11 11/36] media: cedrus: Remove checking for required controls Date: Wed, 10 Mar 2021 14:23:24 +0100 Message-Id: <20210310132320.872054102@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210310132320.510840709@linuxfoundation.org> References: <20210310132320.510840709@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Jernej Skrabec commit 7072db89572135f28cad65f15877bf7e67cf2ff8 upstream. According to v4l2 request api specifications, it's allowed to skip control if its content isn't changed for performance reasons. Cedrus driver predates that, so it has implemented mechanism to check if all required controls are included in one request. Conform to specifications with removing that mechanism. Note that this mechanism with static required flag isn't very good anyway because need for control is usually signaled in other controls. Fixes: 50e761516f2b ("media: platform: Add Cedrus VPU decoder driver") Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/sunxi/cedrus/cedrus.c | 49 ---------------------------- drivers/staging/media/sunxi/cedrus/cedrus.h | 1 2 files changed, 50 deletions(-) --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -34,56 +34,48 @@ static const struct cedrus_control cedru .id = V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS, }, .codec = CEDRUS_CODEC_MPEG2, - .required = true, }, { .cfg = { .id = V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION, }, .codec = CEDRUS_CODEC_MPEG2, - .required = false, }, { .cfg = { .id = V4L2_CID_STATELESS_H264_DECODE_PARAMS, }, .codec = CEDRUS_CODEC_H264, - .required = true, }, { .cfg = { .id = V4L2_CID_STATELESS_H264_SLICE_PARAMS, }, .codec = CEDRUS_CODEC_H264, - .required = true, }, { .cfg = { .id = V4L2_CID_STATELESS_H264_SPS, }, .codec = CEDRUS_CODEC_H264, - .required = true, }, { .cfg = { .id = V4L2_CID_STATELESS_H264_PPS, }, .codec = CEDRUS_CODEC_H264, - .required = true, }, { .cfg = { .id = V4L2_CID_STATELESS_H264_SCALING_MATRIX, }, .codec = CEDRUS_CODEC_H264, - .required = false, }, { .cfg = { .id = V4L2_CID_STATELESS_H264_PRED_WEIGHTS, }, .codec = CEDRUS_CODEC_H264, - .required = false, }, { .cfg = { @@ -92,7 +84,6 @@ static const struct cedrus_control cedru .def = V4L2_STATELESS_H264_DECODE_MODE_SLICE_BASED, }, .codec = CEDRUS_CODEC_H264, - .required = false, }, { .cfg = { @@ -101,7 +92,6 @@ static const struct cedrus_control cedru .def = V4L2_STATELESS_H264_START_CODE_NONE, }, .codec = CEDRUS_CODEC_H264, - .required = false, }, /* * We only expose supported profiles information, @@ -120,28 +110,24 @@ static const struct cedrus_control cedru BIT(V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED), }, .codec = CEDRUS_CODEC_H264, - .required = false, }, { .cfg = { .id = V4L2_CID_MPEG_VIDEO_HEVC_SPS, }, .codec = CEDRUS_CODEC_H265, - .required = true, }, { .cfg = { .id = V4L2_CID_MPEG_VIDEO_HEVC_PPS, }, .codec = CEDRUS_CODEC_H265, - .required = true, }, { .cfg = { .id = V4L2_CID_MPEG_VIDEO_HEVC_SLICE_PARAMS, }, .codec = CEDRUS_CODEC_H265, - .required = true, }, { .cfg = { @@ -150,7 +136,6 @@ static const struct cedrus_control cedru .def = V4L2_MPEG_VIDEO_HEVC_DECODE_MODE_SLICE_BASED, }, .codec = CEDRUS_CODEC_H265, - .required = false, }, { .cfg = { @@ -159,14 +144,12 @@ static const struct cedrus_control cedru .def = V4L2_MPEG_VIDEO_HEVC_START_CODE_NONE, }, .codec = CEDRUS_CODEC_H265, - .required = false, }, { .cfg = { .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER, }, .codec = CEDRUS_CODEC_VP8, - .required = true, }, }; @@ -227,12 +210,8 @@ static int cedrus_init_ctrls(struct cedr static int cedrus_request_validate(struct media_request *req) { struct media_request_object *obj; - struct v4l2_ctrl_handler *parent_hdl, *hdl; struct cedrus_ctx *ctx = NULL; - struct v4l2_ctrl *ctrl_test; unsigned int count; - unsigned int i; - int ret = 0; list_for_each_entry(obj, &req->objects, list) { struct vb2_buffer *vb; @@ -259,34 +238,6 @@ static int cedrus_request_validate(struc return -EINVAL; } - parent_hdl = &ctx->hdl; - - hdl = v4l2_ctrl_request_hdl_find(req, parent_hdl); - if (!hdl) { - v4l2_info(&ctx->dev->v4l2_dev, "Missing codec control(s)\n"); - return -ENOENT; - } - - for (i = 0; i < CEDRUS_CONTROLS_COUNT; i++) { - if (cedrus_controls[i].codec != ctx->current_codec || - !cedrus_controls[i].required) - continue; - - ctrl_test = v4l2_ctrl_request_hdl_ctrl_find(hdl, - cedrus_controls[i].cfg.id); - if (!ctrl_test) { - v4l2_info(&ctx->dev->v4l2_dev, - "Missing required codec control\n"); - ret = -ENOENT; - break; - } - } - - v4l2_ctrl_request_hdl_put(hdl); - - if (ret) - return ret; - return vb2_request_validate(req); } --- a/drivers/staging/media/sunxi/cedrus/cedrus.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h @@ -56,7 +56,6 @@ enum cedrus_h264_pic_type { struct cedrus_control { struct v4l2_ctrl_config cfg; enum cedrus_codec codec; - unsigned char required:1; }; struct cedrus_h264_run {