From patchwork Mon Nov 30 09:08:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11939977 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.8 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 2612BC71156 for ; Mon, 30 Nov 2020 09:11:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D872F207F7 for ; Mon, 30 Nov 2020 09:11:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Jai7AcgL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727656AbgK3JKs (ORCPT ); Mon, 30 Nov 2020 04:10:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725965AbgK3JKr (ORCPT ); Mon, 30 Nov 2020 04:10:47 -0500 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DECAC0617A7 for ; Mon, 30 Nov 2020 01:09:29 -0800 (PST) Received: by mail-ej1-x643.google.com with SMTP id f9so18063186ejw.4 for ; Mon, 30 Nov 2020 01:09:29 -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=bYlnpDHyjfod0Sy7GFzmidvMbQ6rkW4h8xNRqXS+z7s=; b=Jai7AcgLvGIuOSsYBlHZWPPc8hxUOvZoHJPKEhvTAmc/3ci+m1aJEi1Ym93l0aqFWC DM+eGuk7OzgH7BJYCNBR1Ref1o8pNPQu04JfYS/v8tutJ3EZG2jwH4ZwEt80K3Xf9y+J XG1nMT3P/M4m845aPTF04SRSC9j45jPXOfW5sIfGSy2sgiC8IlboqU3phoKSjW54i1Ge 0btTVca53r/L4w8CM2I9rUmFHewc79yVwUS4q1ZA07U9ebDxHNjC1CTC9dmH/p/+7qDC w6oiQ3Dx7oErIlr/9pLH+u+K3m58EA5Ifr/RS4QDNksdLvbWaKqep69DSiY4ixDfXEcZ SVlA== 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=bYlnpDHyjfod0Sy7GFzmidvMbQ6rkW4h8xNRqXS+z7s=; b=RnVOrsVQjzeGxfJ+PESAWKaPzKJeUCJgS7SAlbijk5FoUjz3fwUK62nRjjKhCh8Ay2 Xqx2vA7PrW0pVYpqkrl2nb6+sKA9Bo0Jed9z+V1tFeB4fCeM69kaHPn3GVs4F2NJyay7 z7CCgj673LavqAFqcu0NB5gqMh56l+9glxvwZzP+KAEMLXMsbIlfvMNmPIeQBx6HSEqW 7GJKrln3uXUyGu+LuZ8CXEjdsqETIDKgY6AVqaetP2uDo8HGs7lXotxM0o9oNGnahbDT 1VisYPwI/49Y2lIUiv3LLCdCC5W1/BbKdEr1ePZsr/a/I5L/CTfXtmQgHG56whZuQN9N 6mBA== X-Gm-Message-State: AOAM533ix4n5CCPbTswjG2vYkQaT+bmwU52gkdHh/5/g+tnHqSyfpAO4 /lUH37IZPXWG3/ruRWmtM31uoJSwQTUAMMKn X-Google-Smtp-Source: ABdhPJz2+Z+Vol7rk4wNv3WI4q4xJIb8wql7mv/dFMB2zV6+V9kY0JQuhVwl5+vTlMOS33S6M9ecDw== X-Received: by 2002:a17:906:e15:: with SMTP id l21mr19709397eji.509.1606727367777; Mon, 30 Nov 2020 01:09:27 -0800 (PST) Received: from localhost.localdomain (hst-221-92.medicom.bg. [84.238.221.92]) by smtp.gmail.com with ESMTPSA id t19sm8239101eje.86.2020.11.30.01.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 01:09:27 -0800 (PST) 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 , Maheshwar Ajja , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 1/4] media: v4l2-ctrls: Add random intra-refresh control Date: Mon, 30 Nov 2020 11:08:56 +0200 Message-Id: <20201130090859.25272-2-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130090859.25272-1-stanimir.varbanov@linaro.org> References: <20201130090859.25272-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a control to configure number of macroblocks for random intra-refresh mode. Signed-off-by: Stanimir Varbanov --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 6 ++++++ drivers/media/v4l2-core/v4l2-ctrls.c | 1 + include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 8 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index ce728c757eaf..59c5d3da4d95 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1104,6 +1104,12 @@ enum v4l2_mpeg_video_h264_entropy_mode - macroblocks is refreshed until the cycle completes and starts from the top of the frame. Applicable to H264, H263 and MPEG4 encoder. +``V4L2_CID_MPEG_VIDEO_RANDOM_INTRA_REFRESH_MB (integer)`` + Random intra macroblock refresh. This is the number of random + macroblocks refreshed on every frame. Here the positions of + macroblocks to be refreshed on every frame is random. Applicable + to H264 and HEVC encoder. + ``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.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ad47d00e28d6..5354547ed777 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -869,6 +869,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_RANDOM_INTRA_REFRESH_MB: return "Number of Random IR MBs"; 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"; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 7035f4fb182c..cc7676ffff67 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -421,6 +421,7 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_MV_H_SEARCH_RANGE (V4L2_CID_MPEG_BASE+227) #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) +#define V4L2_CID_MPEG_VIDEO_RANDOM_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+230) /* CIDs for the MPEG-2 Part 2 (H.262) codec */ #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_MPEG_BASE+270) From patchwork Mon Nov 30 09:08:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11939973 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.8 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=ham 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 EBFF6C63777 for ; Mon, 30 Nov 2020 09:10:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8A7422074A for ; Mon, 30 Nov 2020 09:10:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yvPkWucn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727722AbgK3JKs (ORCPT ); Mon, 30 Nov 2020 04:10:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgK3JKs (ORCPT ); Mon, 30 Nov 2020 04:10:48 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C5EBC061A48 for ; Mon, 30 Nov 2020 01:09:31 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id jx16so19682472ejb.10 for ; Mon, 30 Nov 2020 01:09:30 -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=8QrjaTCkjPvuv3eCz5yZqJhYMQLwskQwM5C2/UPSspg=; b=yvPkWucn4mJgXMlkP1ZbweBgcSxIvQjRbegvcrUQI+tritWaokvLG9R51WM+xK1Nar ELIixBlaBoir/1LU7gYWJVaNm0H/7iEUXytw+gFaxGOqG0c2cv1IwBBZAzJiKQOmVj17 i/GmMMwRLOBq9G/OoxbaveAvm12HjC7aOMFtWTCHmoLByP+jsjyoK203Rs/FhfzhfbXO uLxT4UdtVIiaHvL1XNbyv1lst0X0fd4cN96pAZViGalGcxJYk54J/HTMlOMKTmX9P08U 9/yWcQddYTlju41dGTSco1VMf3DCyOp1ZiqQgLFrn8H2kPmqvyICXtD6A1Izyi38j/4t VzjQ== 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=8QrjaTCkjPvuv3eCz5yZqJhYMQLwskQwM5C2/UPSspg=; b=qe/cKz5TL5zKJ6NnL6ZzOsonT4eIHiFm/tE8p5r90OHpM4Iisxj4Pzy0TNDPiU/2Mq TJ9FPeioH2G/a4j/0KabkZmgu8mtmwsdn90OgWdTzUEA3q1PBBark57LOyXzntEw8Sr4 RH0dx79/s4ttEWCbsQRKaGb3A0I7LMI+M7c/rufL0D/w0BCw/w8g97hwDLX2ZpG1O6O7 9KeXW74Z0M3SWlEmE8L/r87QrCzaoBxCcFcg8wnzfRWbzhtOZmK4fuaULaTgxFdcZLAb MrcORx3fOsRIabgziGf/QTHgg4sTYZTcdpMp8chc436IkUNjxsYYCpNaOm0N2PhzDQTw SN9Q== X-Gm-Message-State: AOAM530kdUsz7QXTkjzdMWiSbHUfPaaNWblNUKTySr9ofLpZ1foKSX12 ZVa+O0sQOyaM02xkhr8yRfiGu83fgA+9sIOl X-Google-Smtp-Source: ABdhPJzyaMm6dJcz+uPv2ZqV8DI4ArTq6Et2Wrq1S18xXNLzvErEQw43wjmjMQoDVoDWyE3GKDS1EA== X-Received: by 2002:a17:906:4982:: with SMTP id p2mr19980724eju.416.1606727369480; Mon, 30 Nov 2020 01:09:29 -0800 (PST) Received: from localhost.localdomain (hst-221-92.medicom.bg. [84.238.221.92]) by smtp.gmail.com with ESMTPSA id t19sm8239101eje.86.2020.11.30.01.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 01:09:28 -0800 (PST) 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 , Maheshwar Ajja , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 2/4] venus: venc: Add support for intra-refresh modes Date: Mon, 30 Nov 2020 11:08:57 +0200 Message-Id: <20201130090859.25272-3-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130090859.25272-1-stanimir.varbanov@linaro.org> References: <20201130090859.25272-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add support for random intra-refresh mode and number of macroblocks. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 2 ++ drivers/media/platform/qcom/venus/venc.c | 12 ++++++++++++ drivers/media/platform/qcom/venus/venc_ctrls.c | 10 +++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 3bc129a4f817..52df8b3ea438 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -242,6 +242,8 @@ struct venc_controls { u32 multi_slice_max_mb; u32 header_mode; + u32 intra_refresh_mode; + u32 intra_refresh_mbs; u32 profile; u32 level; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 0bf92cc21f3a..71b525099e45 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -536,6 +536,7 @@ static int venc_set_properties(struct venus_inst *inst) struct hfi_idr_period idrp; struct hfi_quantization quant; struct hfi_quantization_range quant_range; + struct hfi_intra_refresh intra_refresh = {}; u32 ptype, rate_control, bitrate; int ret; @@ -684,6 +685,17 @@ static int venc_set_properties(struct venus_inst *inst) if (ret) return ret; + if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 || + inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) { + ptype = HFI_PROPERTY_PARAM_VENC_INTRA_REFRESH; + intra_refresh.mode = ctr->intra_refresh_mode; + intra_refresh.cir_mbs = ctr->intra_refresh_mbs; + + ret = hfi_session_set_property(inst, ptype, &intra_refresh); + if (ret) + return ret; + } + ret = venus_helper_set_profile_level(inst, ctr->profile, ctr->level); 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 0708b3b89d0c..74b4269e2e9c 100644 --- a/drivers/media/platform/qcom/venus/venc_ctrls.c +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c @@ -198,6 +198,10 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) case V4L2_CID_MPEG_VIDEO_FRAME_SKIP_MODE: ctr->frame_skip_mode = ctrl->val; break; + case V4L2_CID_MPEG_VIDEO_RANDOM_INTRA_REFRESH_MB: + ctr->intra_refresh_mbs = ctrl->val; + ctr->intra_refresh_mode = HFI_INTRA_REFRESH_RANDOM; + break; default: return -EINVAL; } @@ -213,7 +217,7 @@ int venc_ctrl_init(struct venus_inst *inst) { int ret; - ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 33); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 34); if (ret) return ret; @@ -364,6 +368,10 @@ int venc_ctrl_init(struct venus_inst *inst) (1 << V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT)), V4L2_MPEG_VIDEO_FRAME_SKIP_MODE_DISABLED); + v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_RANDOM_INTRA_REFRESH_MB, 0, + ((7680 * 4320) >> 8), 1, 0); + ret = inst->ctrl_handler.error; if (ret) goto err; From patchwork Mon Nov 30 09:08:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11939975 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.8 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 7F257C71155 for ; Mon, 30 Nov 2020 09:11:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2463C20809 for ; Mon, 30 Nov 2020 09:11:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QBgV4trj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727873AbgK3JKx (ORCPT ); Mon, 30 Nov 2020 04:10:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgK3JKx (ORCPT ); Mon, 30 Nov 2020 04:10:53 -0500 Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0BC9C061A4B for ; Mon, 30 Nov 2020 01:09:32 -0800 (PST) Received: by mail-ej1-x642.google.com with SMTP id lt17so20301844ejb.3 for ; Mon, 30 Nov 2020 01:09: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:in-reply-to:references; bh=9wOXMKATuHa9G+HaHhh8X09v/rbcq2HvMS+ihJfuLug=; b=QBgV4trjaAlL95oXB+TOb+G0HeF+xJY1TRbm4zPKApeO1Pu+GN64ccut7SQbm2nHNp l+XYTRtP9omMey2/SROVyoSNRx0GcMch+M7AlHA0dcjb0MuoR8QhwS2u5psw/QJZOCd/ amBDgbPAJkvPjCUeK8e6aheKtUckKk0LLXxGf0Phb/d3zvgz3+72Ub5ua9ZIHbX2LXfc 70hx1y0OiLpx9JjFnecWaZn5JBuItvTuwxQkDSDhflNE7MXsHv/FSx6KW+CXeINupdIM Ue+1BFRw2QrPWd5vEVdqImaMIUYWdozPIYILiWG9qI/xj75EKaVB5YYAK7qPsbCyZTpI Yi0g== 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=9wOXMKATuHa9G+HaHhh8X09v/rbcq2HvMS+ihJfuLug=; b=uCRB6Z6bHM8ymcJtCRlTl7BQrSmPCDS/Vhb3BNWW3dhO5CfeKAGYChSrUMsSK2xgpR r52UwzWhlp4hguMcQHNJ2UHo1EjjYKrS697RwRcef441rsakvF+RlCiOaxx+/duao6Uw hia1fwCNWUi1psawqm8P4DrGXPQXoaAZUVdkmQqJ8/C2IcKdpNKzyzebl9HJLXpTN/Wd CbsX+y2PYGFPt71hFdLRGNidrAJsjjANhoZIb3fCNFJZYN37sppm3HMGTXdDR5NODqRc FCQ5EkfGyqYKF4EbbP1rV4WyQvEJjHn88/jFVhgis/Tc1SBLf3+y9FIpmVK+zuuoeRst lG6w== X-Gm-Message-State: AOAM530mUB2ex1XYJsVlJlj04M5Mj1PDK+3cjz9qvONu/r2/lhWkMlDg 5BLoQZPawAyoVm5OckuD9yA32uPVWjQcq87E X-Google-Smtp-Source: ABdhPJxPHEghkA644AajakkGv7Keq6RpocvqbnqA4ImdwIXt8IG8ViO/ggApeOHvO1GKcGb19a5lPg== X-Received: by 2002:a17:906:6c2:: with SMTP id v2mr19966240ejb.387.1606727371122; Mon, 30 Nov 2020 01:09:31 -0800 (PST) Received: from localhost.localdomain (hst-221-92.medicom.bg. [84.238.221.92]) by smtp.gmail.com with ESMTPSA id t19sm8239101eje.86.2020.11.30.01.09.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 01:09:30 -0800 (PST) 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 , Maheshwar Ajja , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 3/4] media: v4l2-ctrls: Add control for AUD generation Date: Mon, 30 Nov 2020 11:08:58 +0200 Message-Id: <20201130090859.25272-4-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130090859.25272-1-stanimir.varbanov@linaro.org> References: <20201130090859.25272-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add a control to enable inserting of AUD NALU into encoded bitstream. Signed-off-by: Stanimir Varbanov --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 5 +++++ drivers/media/v4l2-core/v4l2-ctrls.c | 2 ++ include/uapi/linux/v4l2-controls.h | 1 + 3 files changed, 8 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 59c5d3da4d95..d0a161add543 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -679,6 +679,11 @@ enum v4l2_mpeg_video_frame_skip_mode - otherwise the decoder expects a single frame in per buffer. Applicable to the decoder, all codecs. +``V4L2_CID_MPEG_VIDEO_AU_DELIMITER (boolean)`` + If enabled, AUD (Access Unit Delimiter) NALU will be generated. That + could be useful to find the start of a frame without having to fully + parse each NALU. Applicable to the H264 and HEVC encoders. + ``V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (boolean)`` Enable writing sample aspect ratio in the Video Usability Information. Applicable to the H264 encoder. diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 5354547ed777..887fb13974de 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -875,6 +875,7 @@ const char *v4l2_ctrl_get_name(u32 id) 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_AU_DELIMITER: return "Acess Unit Delimiter"; 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"; @@ -1228,6 +1229,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE: case V4L2_CID_MPEG_VIDEO_MPEG4_QPEL: case V4L2_CID_MPEG_VIDEO_REPEAT_SEQ_HEADER: + case V4L2_CID_MPEG_VIDEO_AU_DELIMITER: case V4L2_CID_WIDE_DYNAMIC_RANGE: case V4L2_CID_IMAGE_STABILIZATION: case V4L2_CID_RDS_RECEPTION: diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index cc7676ffff67..18c4f46423bc 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -422,6 +422,7 @@ enum v4l2_mpeg_video_multi_slice_mode { #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) #define V4L2_CID_MPEG_VIDEO_RANDOM_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+230) +#define V4L2_CID_MPEG_VIDEO_AU_DELIMITER (V4L2_CID_MPEG_BASE+231) /* CIDs for the MPEG-2 Part 2 (H.262) codec */ #define V4L2_CID_MPEG_VIDEO_MPEG2_LEVEL (V4L2_CID_MPEG_BASE+270) From patchwork Mon Nov 30 09:08:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 11939979 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.8 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 7FDD3C83013 for ; Mon, 30 Nov 2020 09:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2561B20809 for ; Mon, 30 Nov 2020 09:11:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MDQnnQJ9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727890AbgK3JLB (ORCPT ); Mon, 30 Nov 2020 04:11:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726498AbgK3JLB (ORCPT ); Mon, 30 Nov 2020 04:11:01 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 622D3C061A51 for ; Mon, 30 Nov 2020 01:09:34 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id 7so20312723ejm.0 for ; Mon, 30 Nov 2020 01:09:34 -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=qDd5wvZU+POagS4ld3kHCXja5LSpbyG9oiFPo6cziGI=; b=MDQnnQJ9FCLHBxDYaYAnDa4Zaj+foOO+J5Mnj4m1j+fw4k8LbhNYojvRuL1aW5xQt8 W/b850fl+W7uHugrqN7HkG/6jTalwFk8Ktg+VTKq7Ay7b310s5KySsYm9gqgcmO+qIFR xdSk2dBWfQrvQg3m424HH2K2knLTT+GHiorOwMhDacrKI+wPc8WF7wyJkaXvLMx4Sfso xn6lgfe1vWtQsfUeiKMnBZpDOgaCbIagyKaQ1qB/JvYy3qCYOTKLaFP+sXYT+q24X4vX qgbuumMUbReclRcD5Sh0v54yl5TcxEE5lZqhGXfyLyDH+I4lapH7JbR7h6fDAUmk7Z2L SU6Q== 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=qDd5wvZU+POagS4ld3kHCXja5LSpbyG9oiFPo6cziGI=; b=NTrt+sokmiYIe2rFqSt2SzN4HpUIH5m6cVZpLyZyPDId9B1H1J19oiamsqdFbOFkd8 R3mzRlkeSGdSR6UY6PPfsalndRJLbdGwSPrPSW1lcqAMYbjAvtkU2mfRnIP0Vlz+VW2B wmG6UVPWLufXJh+JtYNWqU4+hinSE5i+gLi4CtUwpRX8w3L6WfmiPpX9A+eRq5RGA8zQ B254KXqq5ZwR9zwX8711kcJvMS/KA9lfXWH2WB+XxqtV18/UqILT7WyqOrsrimqWbTjW T/d99oOeU1Eu9EM2+jDXYSweNUD8p0v6a0wlcfr9Y3t36o81i9vmU6c4bWgdHZD4H+Hx SMuQ== X-Gm-Message-State: AOAM5315+E2vQhg5PIvqBS3rJKur1DEyiULcQ3jtscchNsNbTnfmNEYe cZOry24nGNZEFhwDlFpw7385fx84wuvyzDrw X-Google-Smtp-Source: ABdhPJy5vWEz9mQQidABL4fgPNSFp9kET9MWz4/NTY5Ii06XzG/1wa+2jr04gv+8d6je2TpN8fXAbQ== X-Received: by 2002:a17:906:1294:: with SMTP id k20mr14656263ejb.404.1606727372858; Mon, 30 Nov 2020 01:09:32 -0800 (PST) Received: from localhost.localdomain (hst-221-92.medicom.bg. [84.238.221.92]) by smtp.gmail.com with ESMTPSA id t19sm8239101eje.86.2020.11.30.01.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 01:09:32 -0800 (PST) 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 , Maheshwar Ajja , Hans Verkuil , Stanimir Varbanov Subject: [PATCH 4/4] venus: venc: Add support for AUD NALU control Date: Mon, 30 Nov 2020 11:08:59 +0200 Message-Id: <20201130090859.25272-5-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201130090859.25272-1-stanimir.varbanov@linaro.org> References: <20201130090859.25272-1-stanimir.varbanov@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add support for Access Unit Delimiter control into encoder. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/core.h | 1 + drivers/media/platform/qcom/venus/venc.c | 14 ++++++++++++++ drivers/media/platform/qcom/venus/venc_ctrls.c | 8 +++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 52df8b3ea438..041d33ad7688 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -244,6 +244,7 @@ struct venc_controls { u32 header_mode; u32 intra_refresh_mode; u32 intra_refresh_mbs; + bool aud_enable; u32 profile; u32 level; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 71b525099e45..986d33b633db 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -696,6 +696,20 @@ static int venc_set_properties(struct venus_inst *inst) return ret; } + if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_H264 || + inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) { + struct hfi_enable en = {}; + + ptype = HFI_PROPERTY_PARAM_VENC_H264_GENERATE_AUDNAL; + + if (ctr->aud_enable) + en.enable = 1; + + ret = hfi_session_set_property(inst, ptype, &en); + if (ret) + return ret; + } + ret = venus_helper_set_profile_level(inst, ctr->profile, ctr->level); 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 74b4269e2e9c..8d34a5396306 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) ctr->intra_refresh_mbs = ctrl->val; ctr->intra_refresh_mode = HFI_INTRA_REFRESH_RANDOM; break; + case V4L2_CID_MPEG_VIDEO_AU_DELIMITER: + ctr->aud_enable = 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, 34); + ret = v4l2_ctrl_handler_init(&inst->ctrl_handler, 35); if (ret) return ret; @@ -372,6 +375,9 @@ int venc_ctrl_init(struct venus_inst *inst) V4L2_CID_MPEG_VIDEO_RANDOM_INTRA_REFRESH_MB, 0, ((7680 * 4320) >> 8), 1, 0); + v4l2_ctrl_new_std(&inst->ctrl_handler, &venc_ctrl_ops, + V4L2_CID_MPEG_VIDEO_AU_DELIMITER, 0, 1, 1, 0); + ret = inst->ctrl_handler.error; if (ret) goto err;