From patchwork Sun Jul 5 12:11:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11644361 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 960AA618 for ; Sun, 5 Jul 2020 12:13:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F45F20724 for ; Sun, 5 Jul 2020 12:13:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="K+EAXCSi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vbZMpbtL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F45F20724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aGXBcUR1hOgDKwoVOt3DbEGYKjxpnSMtl6LXv4OMs8w=; b=K+EAXCSiLMzpTfHNXNbRm+A/df e3oCy89GXjTFPZ7IAeeqXUka/iHoWeMk/qyc8hvyfcKMgNXi6VAnFW/K0FshRDGuNw3TrorFM9XXF U/PR6gDURetrnLOL22f8BdpBDL3PgwiZixMpvdJS1qYSVeg6HBR8vusaHmqlzrcZ789iJAhP3aVxN C//RbsPvTmZfKUZUMaxQJY6W7E5ci9k8jDjxHL77PTz/F+kq4hSiF80Zy+Wvhm26TSAWWoNzR/cRN VgU5GBU9mL1cEFnvACvrZxJQh0oQI6xCNYzqMHwTmGcaYGv6uI8bPiEaAxTKc85VFN9LmrMI1CKdc txX2s5oA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1js3V8-0006kI-Ka; Sun, 05 Jul 2020 12:12:06 +0000 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1js3V5-0006jS-2U for linux-arm-kernel@lists.infradead.org; Sun, 05 Jul 2020 12:12:03 +0000 Received: by mail-ej1-x642.google.com with SMTP id dr13so39552051ejc.3 for ; Sun, 05 Jul 2020 05:12:03 -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=c3pGEpF7DAEXcC0pN3mSKCevTRzMwQB5I1tTMzDxF0M=; b=vbZMpbtLs7CMVmEYX3n7vzrtz2n0vXIVLeeIYUduO9/JCmDVzmpE694X79b/QX8vbk g79hDHalKGmtcUL12AUmRKvMKm1EBXLb1nyJH7sS/R7R/YunYkUlpLDWakrxNIHfvO6m EKYd5Rghwsgo34jU1V8Kk0yV/7jBrcc2tPGQupqn0K7yl83ucAPK/zzudLC2BH4e65tx X6O3YYZ4f1tloPGYPuULuSiNoZMYUuIBy6Osww1D0Bmx0lXeoKn9uByUILggLchm9IKF grffUmDqIbnH+zRGIG70MjEr5QUfwh2NgcV/iWw1zagwRdSt8ZqA9jRqThntJprFW5Ar nqwg== 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=c3pGEpF7DAEXcC0pN3mSKCevTRzMwQB5I1tTMzDxF0M=; b=MNvHq5OdBdzzQcvR0aybJ9wb1g/cqU0gIkO3Qu5j5h4tWFywZ3aD/9Vb3g1UlYnDX0 2imLWYT4bRkoti3RiQiEAn0J+rOAudZL6CzZqNWCyVqK+64umoIYav1GBP25C4AsA6pm X/Lik1ItYW6CiNvtoXVUR9wcLYkyrnyN+lowylsGJWBBH1CfeOpCZPCap9GzpWeqJJvv TFY7uEoXsltyDnN/EzhUjVozCxIlrmhBnwyOA4iN8xFQWpVMJ0hNfx4uAj7quN9Ze+Vt ZoQBCSuxyT6aiwRyRhWSoBZGouNiIsoSXOU+ymxNBbUzU6SWT5dcFr/hONZO1XGQHYgI apcw== X-Gm-Message-State: AOAM531i+oYo5DbR+1wVUpX1j2zmvPeqvYbf2fjaaoZkUb8EgroFlGGO jBH++OYpSJz+VVaC16LOVjY0fw== X-Google-Smtp-Source: ABdhPJwegaq+qx2Qs3TctwwlzOm8u+gVW6hpz/YzvS9BnNgGVly0C6L2+37x3HsFr6j0j1L5FmD2LA== X-Received: by 2002:a17:906:8316:: with SMTP id j22mr38504760ejx.97.1593951122243; Sun, 05 Jul 2020 05:12:02 -0700 (PDT) Received: from localhost.localdomain (212-5-158-133.ip.btc-net.bg. [212.5.158.133]) by smtp.gmail.com with ESMTPSA id j64sm1517458edd.61.2020.07.05.05.12.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 05:12:01 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/4] media: v4l2-ctrl: Add frame-skip std encoder control Date: Sun, 5 Jul 2020 15:11:25 +0300 Message-Id: <20200705121128.5250-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200705121128.5250-1-stanimir.varbanov@linaro.org> References: <20200705121128.5250-1-stanimir.varbanov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200705_081203_158367_24AFF815 X-CRM114-Status: GOOD ( 13.76 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:642 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maheshwar Ajja , Andrzej Hajda , Kamil Debski , Stanimir Varbanov , Jeongtae Park , Kyungmin Park , Hans Verkuil MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Adds encoders standard v4l2 control for frame-skip. The control is a copy of a custom encoder control so that other v4l2 encoder drivers can use it. Signed-off-by: Stanimir Varbanov Reviewed-by: Hans Verkuil --- .../media/v4l/ext-ctrls-codec.rst | 32 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 10 ++++++ include/uapi/linux/v4l2-controls.h | 6 ++++ 3 files changed, 48 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index d0d506a444b1..a8b4c0b40747 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -592,6 +592,38 @@ enum v4l2_mpeg_video_bitrate_mode - the average video bitrate. It is ignored if the video bitrate mode is set to constant bitrate. +``V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE (enum)`` + +enum v4l2_mpeg_video_frame_skip_mode - + Indicates in what conditions the encoder should skip frames. If + encoding a frame would cause the encoded stream to be larger then a + chosen data limit then the frame will be skipped. Possible values + are: + + +.. tabularcolumns:: |p{9.2cm}|p{8.3cm}| + +.. raw:: latex + + \small + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + + * - ``V4L2_MPEG_FRAME_SKIP_MODE_DISABLED`` + - Frame skip mode is disabled. + * - ``V4L2_MPEG_FRAME_SKIP_MODE_LEVEL_LIMIT`` + - Frame skip mode enabled and buffer limit is set by the chosen + level and is defined by the standard. + * - ``V4L2_MPEG_FRAME_SKIP_MODE_BUF_LIMIT`` + - Frame skip mode enabled and buffer limit is set by the VBV + (MPEG1/2/4) or CPB (H264) buffer size control. + +.. raw:: latex + + \normalsize + ``V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (integer)`` For every captured frame, skip this many subsequent frames (default 0). diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 3f3fbcd60cc6..d088acfa6dd8 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -590,6 +590,12 @@ const char * const *v4l2_ctrl_get_menu(u32 id) "External", NULL, }; + static const char * const mpeg_video_frame_skip[] = { + "Disabled", + "Level Limit", + "VBV/CPB Limit", + NULL, + }; switch (id) { case V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ: @@ -651,6 +657,8 @@ const char * const *v4l2_ctrl_get_menu(u32 id) return flash_strobe_source; case V4L2_CID_MPEG_VIDEO_HEADER_MODE: return header_mode; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: + return mpeg_video_frame_skip; case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: return multi_slice; case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: @@ -844,6 +852,7 @@ const char *v4l2_ctrl_get_name(u32 id) 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"; case V4L2_CID_MPEG_VIDEO_MAX_REF_PIC: return "Max Number of Reference Pics"; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: return "Frame Skip Mode"; case V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP: return "H263 I-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP: return "H263 P-Frame QP Value"; case V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP: return "H263 B-Frame QP Value"; @@ -1265,6 +1274,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_FLASH_LED_MODE: case V4L2_CID_FLASH_STROBE_SOURCE: case V4L2_CID_MPEG_VIDEO_HEADER_MODE: + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: case V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE: case V4L2_CID_MPEG_VIDEO_H264_LEVEL: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 62271418c1be..4e1526175a4c 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -742,6 +742,12 @@ enum v4l2_cid_mpeg_video_hevc_size_of_length_field { #define V4L2_CID_MPEG_VIDEO_HEVC_HIER_CODING_L6_BR (V4L2_CID_MPEG_BASE + 642) #define V4L2_CID_MPEG_VIDEO_REF_NUMBER_FOR_PFRAMES (V4L2_CID_MPEG_BASE + 643) #define V4L2_CID_MPEG_VIDEO_PREPEND_SPSPPS_TO_IDR (V4L2_CID_MPEG_BASE + 644) +#define V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_BASE + 645) +enum v4l2_mpeg_video_frame_skip_mode { + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED = 0, + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1, + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2, +}; /* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ #define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) From patchwork Sun Jul 5 12:11:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11644357 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DB7F460D for ; Sun, 5 Jul 2020 12:13:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B504920724 for ; Sun, 5 Jul 2020 12:13:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="wmyEjFaV"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HdJZqMAC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B504920724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zETLUj1uHARwOeUjXviKv5eVphZVEZsvAMBNz1LVmIk=; b=wmyEjFaVkSeKX/SFhR4fsDbssQ /asQ0j2TxUM/xU73U0V7XxUnC+9HYMkUIkWyAxAaczEwJpcJNM9KrtSffgmYKBxnR8MfwQUBhDw0t OLBkxHZeIxKAELN1ZF6UZUBBMwnV62X+rtyu7KIfXKyfW+EPzKJDpJis4FXD+F5arhQrfRsmTBVoQ ux9EHCB55gE/2o9A9g/2uPMJcr9CBxucH19qNWxqGvEg4u3Gms87jFfd7GcO0YgDoM01KF1S4sZ2l 4koTTPYgRwJtpbP0HDZ+Fsoh9R4bvUi2VfoXr1bmdaOYhCOZoU9TqF6akEOvE4gwqutp7iMAKYcn/ FS8lbHrw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1js3VB-0006lU-U9; Sun, 05 Jul 2020 12:12:10 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1js3V8-0006kE-9a for linux-arm-kernel@lists.infradead.org; Sun, 05 Jul 2020 12:12:07 +0000 Received: by mail-ej1-x641.google.com with SMTP id a1so39528394ejg.12 for ; Sun, 05 Jul 2020 05:12:05 -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=PVmLU+hVnh8Nuu06hzfy+sP04k3OApAgFHgahioSu+I=; b=HdJZqMAC9vwDwq/2+iB7h9yJXCGAIGf8xNMQ9liFjhLi/fvb1XZzTeWNBYjSiMHKOa 98mdSBS50YvGC0BDVIhjIAFTKcDlIyz92ScwSNbaxLdwW6nf7N6Cj/zKQIe4jq7t2GvX wi+NVJRogKGWybka9wuVMlNXfLtjuhLHL0rZlVSNg//AcGoqJU1V43CPFBxjCSoK6zrB 71KTZXPIyrDe+8RGyBhMaNUxMYCKdwbTc1Ghw6QNClu8AH4nbo72658WQJefPVrbG/51 wDZsc7GMLht95gL3fkIsHaXRHdSFYj3mdO7pfHCvFX2yjFo0NPMC+JiMfVWs7wEH1dte i9+Q== 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=PVmLU+hVnh8Nuu06hzfy+sP04k3OApAgFHgahioSu+I=; b=d4WG3vKtB9Rzpg7HBWBwj+37hx02VeUirzrfqXe/UtPLSxRHgtPhfnNWIzO8/RwVV/ pThARDu5S9z3yp9Yo5IEquNUxR49SWJdo3h8GhzyOXunnwFaNY/z4StG7LJPvzejG9t9 E7v681xI4nDEEib+zYE1S0m6OobVabb8YFn/dU/TDVehiked/VBtJpE5l2EmFgY06JCs dHUq0aNbQ2he2YEqaeghPi/npis1WOCHj/iKOX+q1rRBjyRePO/2mESU2ckjZxs7/0lZ 4c46s6V02HiWeQPwXXUtGzq7Gyhbx4Jh6WfTZpPH+aHOLC4TkGjzWCJzKSPhdg6n7Gq5 3BpA== X-Gm-Message-State: AOAM533Y7u+2tydgslYisUU58xwu7h7husNOHGLkStw9xrFLEZRj1Bu6 p4zKQ74oFPPu3FKBAuI4ZDbmQg== X-Google-Smtp-Source: ABdhPJy4XaYVS+16tekoMGYfBYwnsNfJBNfDgfK15oRSsNfDpEBBKvFHSmrSAPvlhLCTRmzxo2y36w== X-Received: by 2002:a17:906:1a59:: with SMTP id j25mr37496895ejf.398.1593951125047; Sun, 05 Jul 2020 05:12:05 -0700 (PDT) Received: from localhost.localdomain (212-5-158-133.ip.btc-net.bg. [212.5.158.133]) by smtp.gmail.com with ESMTPSA id j64sm1517458edd.61.2020.07.05.05.12.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 05:12:04 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/4] venus: venc: Add support for frame-skip mode v4l2 control Date: Sun, 5 Jul 2020 15:11:26 +0300 Message-Id: <20200705121128.5250-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200705121128.5250-1-stanimir.varbanov@linaro.org> References: <20200705121128.5250-1-stanimir.varbanov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200705_081206_407689_C3805F31 X-CRM114-Status: GOOD ( 13.43 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:641 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maheshwar Ajja , Andrzej Hajda , Kamil Debski , Stanimir Varbanov , Jeongtae Park , Kyungmin Park , Hans Verkuil MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This adds support for frame-skip-mode standard v4l2 control in encoder driver. The control is implemented based on the combination of client selected bitrate-mode and frame-skip-mode. Once The client selected bitrate-mode (constant or variable) and the frame-skip-mode is not disabled we set variable framerate for rate controller. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/venc.c | 6 ++++-- drivers/media/platform/qcom/venus/venc_ctrls.c | 12 +++++++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 7118612673c9..5e74d0441592 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -201,6 +201,7 @@ struct venc_controls { u32 bitrate; u32 bitrate_peak; u32 rc_enable; + u32 frame_skip_mode; u32 h264_i_period; u32 h264_entropy_mode; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 513bbc07f7bc..2279596d4d60 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -739,9 +739,11 @@ static int venc_set_properties(struct venus_inst *inst) if (!ctr->rc_enable) rate_control = HFI_RATE_CONTROL_OFF; else if (ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) - rate_control = HFI_RATE_CONTROL_VBR_CFR; + rate_control = ctr->frame_skip_mode ? HFI_RATE_CONTROL_VBR_VFR : + HFI_RATE_CONTROL_VBR_CFR; else - rate_control = HFI_RATE_CONTROL_CBR_CFR; + rate_control = ctr->frame_skip_mode ? HFI_RATE_CONTROL_CBR_VFR : + HFI_RATE_CONTROL_CBR_CFR; ptype = HFI_PROPERTY_PARAM_VENC_RATE_CONTROL; ret = hfi_session_set_property(inst, ptype, &rate_control); diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c index 8362dde7949e..a418d7d6db0c 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -202,6 +202,9 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE: ctr->rc_enable = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: + ctr->frame_skip_mode = ctrl->val; + break; default: return -EINVAL; } @@ -217,7 +220,7 @@ int venc_ctrl_init(struct venus_inst *inst) { int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 31); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 32); if (ret) return ret; @@ -357,6 +360,13 @@ int venc_ctrl_init(struct venus_inst *inst) v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE, 0, 1, 1, 1); + v4l2_ctrl_new_std_menu(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE, + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT, + ~((1 << V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED) | + (1 << V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT)), + V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED); + ret = inst->ctrl_handler.error; if (ret) goto err; From patchwork Sun Jul 5 12:11:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11644359 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EA9F160D for ; Sun, 5 Jul 2020 12:13:51 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C418720724 for ; Sun, 5 Jul 2020 12:13:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="O1tTo5og"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FynBPSjD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C418720724 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=AHHot9OOO4GLoToqPKSlndlCDHKaoo5h32OacBX1PBA=; b=O1tTo5ogtl2ydOvx+f6a5ra+Q3 c0hOujpjw8CRg9X7jJoaebHngpo+nAbeeWBg85wJSR1YMeFOQc4LDE65Se1AGLl1f7WddTmEm0bx+ VTGg4p+wiKGskq06Jz8sKKv6L+eYzgaSOOKrU6my7CSksBDTsvMyNyC0CuDD2+LRP3kKPpAPd0ZgG haIP00m/v1JrQpY6vTrWCs+0LDpsLnBBse7hfF+ItCa8qKxH3lwLJwjjdXzwC0E0mUD0YglMsV61D pEQUYARkCaGkcY8vIHZYYCw7MOMyEDsmGrPPSA/qwLLJnDqwh4bmHas1R7CRvVG76vbx+FS/+mPCG EdjgTrrw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1js3VG-0006mx-VH; Sun, 05 Jul 2020 12:12:15 +0000 Received: from mail-ej1-x641.google.com ([2a00:1450:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1js3VC-0006lh-Eb for linux-arm-kernel@lists.infradead.org; Sun, 05 Jul 2020 12:12:11 +0000 Received: by mail-ej1-x641.google.com with SMTP id n26so25598921ejx.0 for ; Sun, 05 Jul 2020 05:12:10 -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=7mX8hu/WWjnwnEyPTlU3MGnHpJuzqdu2Apw48vMC6z4=; b=FynBPSjDhveS96iN5Y0RalC1idg3UpwKXyEYfOeZzLo2ogVhqEy87dxLuAgtsox3SM 0whLGGo62pu83HJdLhY3CrWldzxYFN460mOqGomto6LXz36fymnmJfA5Mufh+qQx9M/W ao69skQFA9ywZgRdnrpEF6yM9wnsf97mBvIohYf4H8h/2UmxfVy6d2dv+9Zl4T/ysM8E S4LCilQdYEyxH4J8KMn/ILcOUrCmy9HSb+B6nLw+zXb8sywWxFkWREcJul+F5CNwIMmW B7xIeo2WhAv5C0/kge5WGslynFQ1q32Ve9xBUaGvTvhJTtG61gKKXs1wvOeX+de/Shzy w+pA== 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=7mX8hu/WWjnwnEyPTlU3MGnHpJuzqdu2Apw48vMC6z4=; b=GX1dYeF+b2vUh5CICOSFqR/s4CkW7xE92SFel8xJT0Pg/UsDeoHpCKCfJQp2QmE8Us B8rXTDSSQa76hv/5mV8dlhNRg3ZcjzswBUOMlbXtZmh75YEYt7gkGcAHBx3McvjiFK60 MZSloYZ8XO8yIlfmNXC7/W9RTs+7GekAMgx3PWvjkADgMp7AhKRh0v1EzDZMYkdAj4CI S/Hg26l8OJ+oSSFwyprpjdc41rUC0SKkUZFLWC9BmGCFOqLkJN3M+baszFsccQJF2HFe exFOQiLkHAq5Js5JA577JYL1rLWJaBaYpSBDqMCKL/JpFKZLcQF+fNR1u0694waa6Kie xxtg== X-Gm-Message-State: AOAM530Jdl8iraWm5yw1aBhn8J+MXfr3BrspqJVeyDdzQrW6sHGWMrRL j2iFXEnEQ9kbJB7iNBoPa1QvZw== X-Google-Smtp-Source: ABdhPJxbbizoo6eyMSZAaCuAXhtp8LdMYWIATAGhR85b9Jl9t3L4F4IQXUwdy/72ySrxdyoGZO3coQ== X-Received: by 2002:a17:906:5006:: with SMTP id s6mr38495933ejj.294.1593951129593; Sun, 05 Jul 2020 05:12:09 -0700 (PDT) Received: from localhost.localdomain (212-5-158-133.ip.btc-net.bg. [212.5.158.133]) by smtp.gmail.com with ESMTPSA id j64sm1517458edd.61.2020.07.05.05.12.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jul 2020 05:12:09 -0700 (PDT) From: Stanimir Varbanov To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/4] media: docs: Depricate mfc frame skip control Date: Sun, 5 Jul 2020 15:11:28 +0300 Message-Id: <20200705121128.5250-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200705121128.5250-1-stanimir.varbanov@linaro.org> References: <20200705121128.5250-1-stanimir.varbanov@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200705_081210_550566_44A271CE X-CRM114-Status: GOOD ( 10.75 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:641 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Maheshwar Ajja , Andrzej Hajda , Kamil Debski , Stanimir Varbanov , Jeongtae Park , Kyungmin Park , Hans Verkuil MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Depricate mfc private frame skip mode control for new clients and use the standard one instead. Signed-off-by: Stanimir Varbanov --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index a8b4c0b40747..c0760bfc54d4 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -2805,6 +2805,11 @@ MFC 5.1 Control IDs ``V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE`` (enum) + .. note:: + + This control is depricated. Use the standard one + ``V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE`` instead. + enum v4l2_mpeg_mfc51_video_frame_skip_mode - Indicates in what conditions the encoder should skip frames. If encoding a frame would cause the encoded stream to be larger then a