From patchwork Tue Jun 22 11:39:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 465161 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp559146jao; Tue, 22 Jun 2021 04:40:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKG4IXvTMWl6rJXD4U3JgPVVgasc6K/SH2ba0crXUCEhdSPo6jr8+96dDMM7XUD0qh0Thi X-Received: by 2002:a6b:ef06:: with SMTP id k6mr2559613ioh.86.1624362032921; Tue, 22 Jun 2021 04:40:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624362032; cv=none; d=google.com; s=arc-20160816; b=sV6cvkBVsSqTrPxxmcSREX5vL6zdshUvYMUkBb73/QE2hW1KlJbFumaeeNy+pMb3Tm WEy4A+hkwog9UVBF8vkD9X24AZUDZ+NlgEfS8zjJxh6hwL9LMhgtjwOTaOXCoO3AMX0W UpexLfpRG0jRDNnuGBAHY1LOc79C1oebX9vQPpvIdcq/STbKky1gRB/52iHQcfCGMXuS Kdm6zoYbdCIIumhN4ARYfDlJ5CIRgOSCrbO90E37nxECYj8NDrhfqyziwt3FtpDgSKgc 8OFXJYvt2UjPxzniZs43qIxyCiyYh3rJv5/naNHSgRNx5ino97sWkX2uOJe5cz+o+PXx 9sbQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z2HTM35L0n2QNGjiT0gcaTMB6G7YTSJkkeNRbPOxIcI=; b=abuUy2N5w+yBlQqUZnG/ak/Ot/3WNr4A7GTJ3E4qmRGU6WeiNZ5lKh0d8VmNedmvmX mwk3hzJFbqbwjTuEas4fFDtuUqgA2g8fOIrJWw9bjPKftk71PBJSv4RlQq3bm+mLlKc3 FlWds5zq4Hmg2Rq5m/K8jEkl+yGFT1vK6oOXZkuRE8SRgz4Mn01pndLoHUuKim+b18if 9pUGz4k2wZqBaeopN9f+Vr/tU1xOKXiaBxpCpe1mC6/uzi+77R377CTd4K5qsO7HP7SP 547aWKUWZBpLp3ZC8bSFM08O3F8cPb7qrwyLtBn+jRyGt/gpGOt9gUVmARZIX2wslDL0 NLJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZNtyPaTt; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 p14si24658070iov.42.2021.06.22.04.40.32; Tue, 22 Jun 2021 04:40:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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=ZNtyPaTt; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S230325AbhFVLml (ORCPT + 4 others); Tue, 22 Jun 2021 07:42:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230229AbhFVLmi (ORCPT ); Tue, 22 Jun 2021 07:42:38 -0400 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FFCBC061767 for ; Tue, 22 Jun 2021 04:40:20 -0700 (PDT) Received: by mail-wr1-x431.google.com with SMTP id i94so23245224wri.4 for ; Tue, 22 Jun 2021 04:40:20 -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 :mime-version:content-transfer-encoding; bh=z2HTM35L0n2QNGjiT0gcaTMB6G7YTSJkkeNRbPOxIcI=; b=ZNtyPaTtxaBTjXekoqNr7PIx/wIb+UYD0idlwBVEMNNx00ZmoU1rEvPcMHOmLfNTJr KzfqO5UTXQcTPpqqL9LsU1CSIwhcArMbcm7AA4dAukoBCqwjEPv6SNvo+bqTk4bExavU FRjPW+ETND3PBrvaKF/sXd108ByduGtsSxNdRziQTj1cMgFUr1PF1U4X+s3IvbmkOike dN3KK+jwqEFkL0hgDGWoHHQitLb4huxpzh0IJNd/oYGfC+/hF/79VoE4jpVtMGPP8edm 16B8E1LAYu0ACSWeXPvhCnSMRKenuOJyyvBeyhBNOum1N8169igtzeqBbYZVBK8eN8eU 4ncg== 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:mime-version:content-transfer-encoding; bh=z2HTM35L0n2QNGjiT0gcaTMB6G7YTSJkkeNRbPOxIcI=; b=ZVYdXRSmgL9scVRVSYBAUT/lWAm1NVsZXs80MH4KPfJX/brxPzwd9+Z3QdN49/AKVI Qe6tsMIAE904OyElPYAknWylFAlKcsDcVPfRlNtQygv7wUCYPrhUJCNx/KPA2WTmeJLl sZYqXLaaaviFRNcpIbgn8ipNdJHH3bZl9xGIPuyL3FwU91GVHvKba+OegMYNpgX1H3jA muDMRsuny30Lfn+fPpmuH0XfWLLZqmzzcOS/OozLXlUoe3IiO3K/jgC1UPWmZqf8acEQ 444jWIVoTg15OsBZFfClt1QhVC+VA8u0eoDJFKf8jtoNtwdIeRUapTO76vvk5rk2MtDl wXaQ== X-Gm-Message-State: AOAM531BnivRffdhUCCIng3Eoscaw+B3YmVE4xwhQclVOkL+5FhyRIu7 HVpOZrPID5khLg+nb+ioNYzVHXkRqQq6bZ3j X-Received: by 2002:adf:b64b:: with SMTP id i11mr4167388wre.393.1624362019123; Tue, 22 Jun 2021 04:40:19 -0700 (PDT) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id k2sm20690929wrw.93.2021.06.22.04.40.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 04:40:18 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Ezequiel Garcia , nicolas.dufresne@collabora.com, Hans Verkuil , Stanimir Varbanov Subject: [PATCH v5 1/3] docs: ext-ctrls-codec: Document cyclic intra-refresh zero control value Date: Tue, 22 Jun 2021 14:39:56 +0300 Message-Id: <20210622113958.809173-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622113958.809173-1-stanimir.varbanov@linaro.org> References: <20210622113958.809173-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org In all drivers _CYCLIC_INTRA_REFRESH_MB default control value is zero which means that the macroblocks will not be intra-refreshed. Document this _CYCLIC_INTRA_REFRESH_MB control behaviour in control description. Signed-off-by: Stanimir Varbanov --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- 2.25.1 Acked-by: Hans Verkuil diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 8c6e2a11ed95..addf44b99dfa 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1174,7 +1174,9 @@ enum v4l2_mpeg_video_h264_entropy_mode - Cyclic intra macroblock refresh. This is the number of continuous macroblocks refreshed every frame. Each frame a successive set of macroblocks is refreshed until the cycle completes and starts from - the top of the frame. Applicable to H264, H263 and MPEG4 encoder. + the top of the frame. Setting this control to zero means that + macroblocks will not be refreshed. + Applicable to H264, H263 and MPEG4 encoder. ``V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (boolean)`` Frame level rate control enable. If this control is disabled then From patchwork Tue Jun 22 11:39:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 465163 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp559168jao; Tue, 22 Jun 2021 04:40:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF8TCQoUrG2I0nxyH7RJDW3/XEGhOSOwLhkTBRA3NSNr+NvDWhW1qoluoTXwzxxNkRpjjU X-Received: by 2002:a02:5b45:: with SMTP id g66mr3602195jab.62.1624362034331; Tue, 22 Jun 2021 04:40:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624362034; cv=none; d=google.com; s=arc-20160816; b=cfIKowRX33OptnoZxG4wFvDBfnniNa/QknQX/8GqD5uIAByBZj/3pafTbqBFybHIOl r3p51vZRJzW+aoj5QmUOivjBe6W9CnDJvSn9lSQa96zZGY+l7YKq6vSkf9qGgpn6FE5D F+ME/KVaPgVc7on9t/hBX97ph8YCPnw2sVCJsIc5LTo/oP9gnv/jR1or+iS7CowWXhWm zcKB7XYxgizylMQW3x3eC/00K4a2XvAhox25ZJDgQTxf0fX31sOBQiwh/oaPHun/4GhH RidtWRCy0Vst4F0zq2BVxQL+T8fzxLv4NZAYtN782mZrK2JlShSNMFUScKzte7IW3DAc AMbQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=SuSvtD+Nv+CHB27crL9nwMh5wHimNIqoxaFLzzkG3PY=; b=ul8x6hRY8HkptDXluppn11SwG7z8DHS7O4p7udXO07JKDuXoJ1npXtupBRXlTXi4eX xpY1Dir8je4UuMWJS+zebsat5r7akJVk2kkiujvPlRDZEQf7AQdfdm+Id4ymtF1RtMXt MugnO9gDR4Phr9Ktrul2VxcWoLdoXGxO1dmg/3zEIibgvTWwcnPKi+ZvvCT4kL9hIP8e LW1RfQnFie/7Ypna5zPgV9dlEVbNnCwJwWW828gf1Pt30PMISaNGtra+y8xf4069OZ9n hyK4n1tO8V2w18HUK6iDypa5fgLRglwNTf0zfLwfvnCRezrame6so41ob3sSSZNg5lBr xXng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ijzVsaIB; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 p14si24658070iov.42.2021.06.22.04.40.34; Tue, 22 Jun 2021 04:40:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-media-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=ijzVsaIB; spf=pass (google.com: domain of linux-media-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-media-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 S230331AbhFVLmm (ORCPT + 4 others); Tue, 22 Jun 2021 07:42:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbhFVLmi (ORCPT ); Tue, 22 Jun 2021 07:42:38 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B394C0617A6 for ; Tue, 22 Jun 2021 04:40:21 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id i94so23245282wri.4 for ; Tue, 22 Jun 2021 04:40:21 -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 :mime-version:content-transfer-encoding; bh=SuSvtD+Nv+CHB27crL9nwMh5wHimNIqoxaFLzzkG3PY=; b=ijzVsaIB4FsCX9SbN3ecdP5Ei7CZr43XT9EKA5w58gn6k00DcpJvG9J0XT99hC87yX 3ujmqoDlzmyQFGcA9KMW/fdY7BzsO5tflw/7Lj/BD0hpZpIZ/NITB2LQbrpZRdT47evY sVstdEzVSCppVDlWQbGrCQIlKWBocXDEtD+5ILfGE1eSeVR9x/cpORMMRTxd9hf7JSor dwRYx+yMaJ5nSeCqHW8j1d53lu1Zd5UZl+zMlrOrftCeTRaPxf0YjXBaTNSi00x37DO2 k/y+L9j0xwHSP0hqhwMnSvDxMkMs+MhkR1Pc/RxBGDRy0GmKi+eQ+wtOMrs7OI3iYLs2 bWkQ== 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:mime-version:content-transfer-encoding; bh=SuSvtD+Nv+CHB27crL9nwMh5wHimNIqoxaFLzzkG3PY=; b=e5pHe/yTsd6NL1nypWyRrCJb1xFoey8GL3xmDKAnMplvr+QVTp/zXRCh7hl8G15XU4 ZOa+TR9FqRsoAo/I7WT5e3erGOxlBNKoDHgyRDtYalPSIY43DqOYQvgOhbnXxhMZpqHv 5UPr8yEXfNZsZua8+84UhOYnFxKrJNbcZImqcO6MdujC3qefHlXqWphUBvKjOC9JF07Y k9/5sFns44R7oTd+Mu9KVwL0Klk2k1+R258/Ur10A/ZGHWxBaTCu7va18W0M8ITxy4fg 9TF5CwZXo7XkhhgkeAQe8Wi3Npdqp0T3WFTh7alD/4gSvQBe7mhjVMCDxBzR6gyhfLY+ p/kg== X-Gm-Message-State: AOAM530MalsblPY+8AGVncVicz4f4DWbWfvZx1Bet6PBgB6APf8P2g3P vAWwOAOTiI+cfC9L6oM0HxGqpo+ypEUGMMPn X-Received: by 2002:a5d:6992:: with SMTP id g18mr4184521wru.73.1624362019899; Tue, 22 Jun 2021 04:40:19 -0700 (PDT) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id k2sm20690929wrw.93.2021.06.22.04.40.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 04:40:19 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Ezequiel Garcia , nicolas.dufresne@collabora.com, Hans Verkuil , Stanimir Varbanov Subject: [PATCH v5 2/3] media: v4l2-ctrls: Add intra-refresh period control Date: Tue, 22 Jun 2021 14:39:57 +0300 Message-Id: <20210622113958.809173-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622113958.809173-1-stanimir.varbanov@linaro.org> References: <20210622113958.809173-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a control to set intra-refresh period. Signed-off-by: Stanimir Varbanov --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 17 ++++++++++++++++- drivers/media/v4l2-core/v4l2-ctrls-defs.c | 2 ++ include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) -- 2.25.1 Acked-by: Hans Verkuil diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index addf44b99dfa..64c76a3a1205 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1175,9 +1175,24 @@ enum v4l2_mpeg_video_h264_entropy_mode - macroblocks refreshed every frame. Each frame a successive set of macroblocks is refreshed until the cycle completes and starts from the top of the frame. Setting this control to zero means that - macroblocks will not be refreshed. + macroblocks will not be refreshed. Note that this control will not + take effect when ``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD`` control + is set to non zero value. Applicable to H264, H263 and MPEG4 encoder. +``V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (integer)`` + Intra macroblock refresh period. This sets the period to refresh + the whole frame. In other words, this defines the number of frames + for which the whole frame will be intra-refreshed. An example: + setting period to 1 means that the whole frame will be refreshed, + setting period to 2 means that the half of macroblocks will be + intra-refreshed on frameX and the other half of macroblocks + will be refreshed in frameX + 1 and so on. Setting the period to + zero means no period is specified. + Note that if the client sets this control to non zero value the + ``V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB`` control shall be + ignored. Applicable to H264 and HEVC encoders. + ``V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (boolean)`` Frame level rate control enable. If this control is disabled then the quantization parameter for each frame type is constant and set diff --git a/drivers/media/v4l2-core/v4l2-ctrls-defs.c b/drivers/media/v4l2-core/v4l2-ctrls-defs.c index b6344bbf1e00..421300e13a41 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-defs.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-defs.c @@ -833,6 +833,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE: return "Decoder Slice Interface"; case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: return "MPEG4 Loop Filter Enable"; case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: return "Number of Intra Refresh MBs"; + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: return "Intra Refresh Period"; case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: return "Frame Level Rate Control Enable"; case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE: return "H264 MB Level Rate Control"; case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return "Sequence Header Mode"; @@ -1258,6 +1259,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE: case V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE: case V4L2_CID_MPEG_VIDEO_DEC_DISPLAY_DELAY: + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: *type = V4L2_CTRL_TYPE_INTEGER; break; case V4L2_CID_MPEG_VIDEO_LTR_COUNT: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index fdf97a6d7d18..5532b5f68493 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -435,6 +435,7 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_FRAME_LTR_INDEX (V4L2_CID_CODEC_BASE+233) #define V4L2_CID_MPEG_VIDEO_USE_LTR_FRAMES (V4L2_CID_CODEC_BASE+234) #define V4L2_CID_MPEG_VIDEO_DEC_CONCEAL_COLOR (V4L2_CID_CODEC_BASE+235) +#define V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD (V4L2_CID_CODEC_BASE+236) /* CIDs for the MPEG-2 Part 2 (H.262) codec */ #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_CODEC_BASE+270) From patchwork Tue Jun 22 11:39:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 465426 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 1AA48C49EA7 for ; Tue, 22 Jun 2021 11:40:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 005F06113E for ; Tue, 22 Jun 2021 11:40:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230363AbhFVLmo (ORCPT ); Tue, 22 Jun 2021 07:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230300AbhFVLmk (ORCPT ); Tue, 22 Jun 2021 07:42:40 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FEDDC061574 for ; Tue, 22 Jun 2021 04:40:22 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id f15so7814323wro.8 for ; Tue, 22 Jun 2021 04:40:22 -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 :mime-version:content-transfer-encoding; bh=jUBkBWWpavQfJ/XXZFQzGX0EU9d+FGRKZtwFN9vG+OA=; b=vyE3RxJoCu5DMSxbDGOfacy7HyUP9y0Txh3uYhEUKh/FBMLutl5b9mXWMKbN2AEQCg +nzElUppRSE3mIeyBJTGRW/wKN7j49HsTJSNI/p13Rhv/JgvZKHZgeMiR+nwv4SesSa7 1A4q5+EubABALDEa7qh9gBae8IuFvrirRrI8oLyXWxuWmhVw0N/auuo8BLS1tt8naljY vb9AN/Rnh2Wsog4yxaF0V2xifTZekod6/WpFcOPvIRXx1CLkLfAktCSvx5IezPA0QOMS 6xNyHoOTmjSc5HN0X614njJjD+Fsi9875FUhWQxXjTAfPHrXNctkeItokoMxGFepChmC l16Q== 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:mime-version:content-transfer-encoding; bh=jUBkBWWpavQfJ/XXZFQzGX0EU9d+FGRKZtwFN9vG+OA=; b=pnEbc7PxGNxUK0DYcTfWp3jn4eneNoCYtFKQ1vpdUkLenRoHqK7yYIvadAPY1KrCd5 rWyiFClkRbon8xyVqK6aygH9VV2tTZ+egM5vHBdG6gNaGwqJ244Mbjq/dqmDG6sIgNih RGEW3tu+tKmSwvGWobflAnGNhj1718cvVLBSbR6HjajmDinXOSNuAuRszdYjaoknbnfQ JzMwmdXQk6ErM0HvfT9ehthdjWFEMyr/vj8iEy6hQksOJNN1EIoLQg0dKipr4q6FccPk dkljgcznMk7TuJ7gxE7b0gHsrR8S9XCl3kAWHcccJRQBCKH67O1ocDlSNMjbtmNyhHc+ dzgw== X-Gm-Message-State: AOAM531U9kY5eUMgnKQg90zTk307zuE6DTqmNaCc6lBRPWmVml7jsi1M fzm5DuXZUBk+LwpYfqeKZ1lSDwm4EdGO4rr+ X-Google-Smtp-Source: ABdhPJytmq1wHQ+S/OsD4Ekc6a4R9V5gIBbT4aui9p8X/DVFcP1ylbK0V4uXpl2U3TfC0hLHi5RnDw== X-Received: by 2002:a5d:6a01:: with SMTP id m1mr4224961wru.363.1624362020790; Tue, 22 Jun 2021 04:40:20 -0700 (PDT) Received: from localhost.localdomain (hst-221-32.medicom.bg. [84.238.221.32]) by smtp.gmail.com with ESMTPSA id k2sm20690929wrw.93.2021.06.22.04.40.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 04:40:20 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Ezequiel Garcia , nicolas.dufresne@collabora.com, Hans Verkuil , Stanimir Varbanov Subject: [PATCH v5 3/3] venus: venc: Add support for intra-refresh period Date: Tue, 22 Jun 2021 14:39:58 +0300 Message-Id: <20210622113958.809173-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210622113958.809173-1-stanimir.varbanov@linaro.org> References: <20210622113958.809173-1-stanimir.varbanov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add support for intra-refresh period v4l2 control and drop cyclic intra-refresh macroblock control in the same time. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/venc.c | 26 +++++++++++++++++++ .../media/platform/qcom/venus/venc_ctrls.c | 14 +++++----- 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 8df2d497d706..df9f79f5b164 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -256,6 +256,7 @@ struct venc_controls { u32 header_mode; bool aud_enable; + u32 intra_refresh_period; struct { u32 h264; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 8dd49d4f124c..718ce3578be8 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -547,6 +547,7 @@ static int venc_set_properties(struct venus_inst *inst) struct hfi_quantization_range quant_range; struct hfi_enable en; struct hfi_ltr_mode ltr_mode; + struct hfi_intra_refresh intra_refresh = {}; u32 ptype, rate_control, bitrate; u32 profile, level; int ret; @@ -802,6 +803,31 @@ static int venc_set_properties(struct venus_inst *inst) en.enable = 1; ret = hfi_session_set_property(inst, ptype, &en); + } + + if ((inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 || + inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) && + (rate_control == HFI_RATE_CONTROL_CBR_VFR || + rate_control == HFI_RATE_CONTROL_CBR_CFR)) { + intra_refresh.mode = HFI_INTRA_REFRESH_NONE; + intra_refresh.cir_mbs = 0; + + if (ctr->intra_refresh_period) { + u32 mbs; + + mbs = ALIGN(inst->width, 16) * ALIGN(inst->height, 16); + mbs /= 16 * 16; + if (mbs % ctr->intra_refresh_period) + mbs++; + mbs /= ctr->intra_refresh_period; + + intra_refresh.mode = HFI_INTRA_REFRESH_RANDOM; + intra_refresh.cir_mbs = mbs; + } + + ptype = HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH; + + ret = hfi_session_set_property(inst, ptype, &intra_refresh); if (ret) return ret; } diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 637c92f6c5be..eb10affc6277 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -17,7 +17,6 @@ #define SLICE_BYTE_SIZE_MAX 1024 #define SLICE_BYTE_SIZE_MIN 1024 #define SLICE_MB_SIZE_MAX 300 -#define INTRA_REFRESH_MBS_MAX 300 #define AT_SLICE_BOUNDARY \ V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY #define MAX_LTR_FRAME_COUNT 4 @@ -227,8 +226,6 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) } mutex_unlock(&inst->lock); break; - case V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB: - break; case V4L2_CID_MPEG_VIDEO_GOP_SIZE: ret = venc_calc_bpframes(ctrl->val, ctr->num_b_frames, &bframes, &ctr->num_p_frames); @@ -319,6 +316,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY: ctr->mastering = *ctrl->p_new.p_hdr10_mastering; break; + case V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD: + ctr->intra_refresh_period = ctrl->val; + break; default: return -EINVAL; } @@ -502,10 +502,6 @@ int venc_ctrl_init(struct venus_inst *inst) v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA, -6, 6, 1, 0); - v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, - V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB, - 0, INTRA_REFRESH_MBS_MAX, 1, 0); - v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_GOP_SIZE, 0, (1 << 16) - 1, 1, 30); @@ -564,6 +560,10 @@ int venc_ctrl_init(struct venus_inst *inst) V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY, v4l2_ctrl_ptr_create(NULL)); + v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_INTRA_REFRESH_PERIOD, 0, + ((4096 * 2304) >> 8), 1, 0); + ret = inst->ctrl_handler.error; if (ret) goto err;