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: 334688 Delivered-To: patch@linaro.org Received: by 2002:a92:5e16:0:0:0:0:0 with SMTP id s22csp4466545ilb; Mon, 30 Nov 2020 01:11:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiqCA5F7K9s7fztnOmU1vsY3WyS0Jv/TzB94WhOeRmYY0jjymbIirpBn7kw9Q8n81TiU0m X-Received: by 2002:a17:906:33d4:: with SMTP id w20mr8561812eja.396.1606727499334; Mon, 30 Nov 2020 01:11:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606727499; cv=none; d=google.com; s=arc-20160816; b=IZt8mE3uJ2yVisi9N/4NgtiVMd6Hi8xlPCTwqF5NU1FyBbK3rkAlgICPKxItTG+JpN zFprRZaDLmHFTUPBp1OkKyHuvhvZ9gJRlqNGuX42Gh+25oa+SvPiuB+TcGeBRB4oQsBP gP7FELJ1Llsq6SRRe74KAadkrfW1Bh8M3Kz/giveX2llmpYtbnhIDR5UsQ9Rk5VmgpAr N/fmASr0cBi5s5NoIqk4VJms2r3k60hH6E4h00K+OUUOLeMVq2PMULyeqQUaV3Ch0bTj xZMEQw1/8UqA2J3iqBH0QubjivnMMBZvCwEKU3CckncCgP/NBhhecF8zE4A2vRntiQMm LFJw== 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=8QrjaTCkjPvuv3eCz5yZqJhYMQLwskQwM5C2/UPSspg=; b=d0zcxBSJjgzGFyu6XKPkSVs/uTdPqBc76IIxt632npLL/gQSxzSqQ0nwGS4FyB3LOJ 2Kr5ClBDRkva8yd0TpthzQjq7zBvKYvNwZF2IyNytsGEe/MhGTzCM9b1xuImD3vzhpEF zK1rHvQgmu6w0saHANekKmQmUF7DTd6JVTgbPaP73Iw3GpBJ/a16drm++TEDoAn4YJ9N fG6eyWBdxZ7QpafE4umwHup3APw/GscfFg0NTeSvCOweSYquphF/2sarhEq4WJ85w4YK w/61DOSJAMGWmCl6vyoC7TBU2aqYG2fsH/Zhl1QQDYIhwBICWE+hslZxD5soKkzpHG5V wGqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yvPkWucn; 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 du15si11159467ejc.471.2020.11.30.01.11.39; Mon, 30 Nov 2020 01:11:39 -0800 (PST) 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=yvPkWucn; 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 S1727722AbgK3JKs (ORCPT + 4 others); 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-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(-) -- 2.17.1 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;