Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp870863pxu; Wed, 2 Dec 2020 05:41:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6lNrlxUVUEvRS3y/rShXleckOU/+WRDFJY3S/uvt1ET7/C3j6Ji4f65UtJRgxW2G4J0XH X-Received: by 2002:a17:907:2718:: with SMTP id w24mr2229291ejk.525.1606916502391; Wed, 02 Dec 2020 05:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606916502; cv=none; d=google.com; s=arc-20160816; b=R3RCOVv8BHRb9Gfer3xGwsJyLUU3hUEdhVb/xlOfsalZjt39LVsnuBTJ+O1csCI3tZ OUIz6V2Yrn0Q46AGGb6uGgrzboyIDDjX3NcfLi0DHXFDnG/dUtGa8OYt2p6EN6A3AlUJ NLS3AKMsJcsgDgIWJEKqtLT56tyOK3KXXgkdAgeKU1sZNzw0ffzPOonF0mxA+bXgH3mh MOCzIUo7BSDLSsGUDCVsHtfedie38s/yyXKf+HjQOjA/kBYbF6OkPnJk+R92Kv4UW8z4 eFFg8cLF7wPbyhky6vvXpGpbd1YqeKkQxiQbGh8uzbEaNShw0RKfsjGXH5qDrYEKDtmJ eG/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=0p93BDswAy4jNORVIR/sbAsAJ8XI35uwObYCucjeNFU=; b=MPAjgRKtKUL2V5SNerAguldl6ZhM8X17k2uH7j07jTGT7lRC8rBNqkL3oa4/15YDv1 POUir1d6Tr2gfT0kpIoyod/haEeJlY4pXJHBGnCyO6/paMextlX2YOVn3hnamkuKMP7D M+4ZvdZgdFq/jQ2BVk1gzDOzg9vaYHRbSQNKwYTKoqvl/ex6iMhLttF8bS0a1hw0wIiD FBwKzeTSqZOZLX0Aie2Mc3iSY19AAC7A2tgNlYQgiiWd10K7B1e3x3UrS1oH0DfvNhRp WUOiekLEIYSR5Kbsw5TvdCdB2kdbITrhE3CtK/SQYWQa7qLvlZCB/LZ0HeYTGrcyYAMx N0WQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xs4all.nl header.s=s2 header.b=OA4EMhrI; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si827075ejm.641.2020.12.02.05.41.18; Wed, 02 Dec 2020 05:41:42 -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=@xs4all.nl header.s=s2 header.b=OA4EMhrI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727533AbgLBNhi (ORCPT + 99 others); Wed, 2 Dec 2020 08:37:38 -0500 Received: from lb2-smtp-cloud7.xs4all.net ([194.109.24.28]:38709 "EHLO lb2-smtp-cloud7.xs4all.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726063AbgLBNhh (ORCPT ); Wed, 2 Dec 2020 08:37:37 -0500 Received: from cust-b5b5937f ([IPv6:fc0c:c16d:66b8:757f:c639:739b:9d66:799d]) by smtp-cloud7.xs4all.net with ESMTPA id kSJOkELI0N7XgkSJSktGTp; Wed, 02 Dec 2020 14:36:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s2; t=1606916214; bh=0p93BDswAy4jNORVIR/sbAsAJ8XI35uwObYCucjeNFU=; h=Subject:To:From:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=OA4EMhrIWm5j/M8DVVuSRWPsUcifXI8imAbRTYoOBqgSH968xkZ8Z/itEHOKsiTm3 4VUMtsqY1CSlzsVruJ0HogYmaLGysIyw86hn/289BRohUAcn5EXGkfcwu1OgO3zOWb 49DPOK+6BqQuIHDoVcqOj9exrGMnm6gF/8JU9PYVWLJPhtMRBnEE5QswuXY6vkGSdE 181v6NHStKYTpXF0h5KY/SplTp1klfICJN1Q4paGIbliF/XNckgo64t65PNN+ArqtC SIEc0TOuHqWrHC19/n/2HS/+g75VGfdfeAPHxBPyOhXwB0PJhgmIKwOSn2oZ0TU4DK bvCG/X4g5Dtqw== Subject: Re: [PATCH v3 3/3] venus: venc: Add support for frame-specific min/max qp controls To: Dikshita Agarwal , linux-media@vger.kernel.org, nicolas@ndufresne.ca, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org References: <1605682497-29273-1-git-send-email-dikshita@codeaurora.org> <1605682497-29273-4-git-send-email-dikshita@codeaurora.org> From: Hans Verkuil Message-ID: Date: Wed, 2 Dec 2020 14:36:50 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1605682497-29273-4-git-send-email-dikshita@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfJCyZqR7dyovBx+dTvzQQXmQvFZKmbkyGAhGrBWWLn40ycWdbDIGr539lSV9UScf4eSh7ov4OqV1WhJoMmUIpFN6qgezYv6BoAYCdHkfM9gnBcR4AoID MnHng437DzuLyFMKjT16M3I768eimb2lN1qAlqvuEaEEls2ZDSDvnrLx1j8/Q/BljSsw5+kZxc4RItAk2GVU5RSezNzN9oi3yLQ+8O4vAuMAvPp4HbXNiFb/ VCyzzDu9JUOuCrKuMz4DYoGEawuv5XyiOVf3Enmddg/iTrS+7+0ZRPmsCt01r1vkwPOrKLUln1lxg1GkXdLXxIJQB5DRKaxBP3r4/7mr0J0eB1rNdEY/MZoI ygaQstbq2KhiWK7SfZTnikPuCouzzkGulPlwKTXR1vcvlJRSRj4nNzW3JljY3JikYc1JeVRGWlW3vi7i2NNH5szVMVzO4w== Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/11/2020 07:54, Dikshita Agarwal wrote: > Add support for frame type specific min and max qp controls > for encoder. > > Signed-off-by: Dikshita Agarwal > --- > drivers/media/platform/qcom/venus/core.h | 18 +++++++++ > drivers/media/platform/qcom/venus/venc.c | 21 ++++++++--- > drivers/media/platform/qcom/venus/venc_ctrls.c | 51 ++++++++++++++++++++++++++ > 3 files changed, 85 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h > index 3bc129a..6a764c9 100644 > --- a/drivers/media/platform/qcom/venus/core.h > +++ b/drivers/media/platform/qcom/venus/core.h > @@ -230,10 +230,28 @@ struct venc_controls { > u32 h264_b_qp; > u32 h264_min_qp; > u32 h264_max_qp; > + u32 h264_i_min_qp; > + u32 h264_i_max_qp; > + u32 h264_p_min_qp; > + u32 h264_p_max_qp; > + u32 h264_b_min_qp; > + u32 h264_b_max_qp; > u32 h264_loop_filter_mode; > s32 h264_loop_filter_alpha; > s32 h264_loop_filter_beta; > > + u32 hevc_i_qp; > + u32 hevc_p_qp; > + u32 hevc_b_qp; > + u32 hevc_min_qp; > + u32 hevc_max_qp; > + u32 hevc_i_min_qp; > + u32 hevc_i_max_qp; > + u32 hevc_p_min_qp; > + u32 hevc_p_max_qp; > + u32 hevc_b_min_qp; > + u32 hevc_b_max_qp; > + > u32 vp8_min_qp; > u32 vp8_max_qp; > > diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c > index 0bf92cc..f2f5a85 100644 > --- a/drivers/media/platform/qcom/venus/venc.c > +++ b/drivers/media/platform/qcom/venus/venc.c > @@ -668,17 +668,28 @@ static int venc_set_properties(struct venus_inst *inst) > return ret; > > ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP; > - quant.qp_i = ctr->h264_i_qp; > - quant.qp_p = ctr->h264_p_qp; > - quant.qp_b = ctr->h264_b_qp; > + if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) { > + quant.qp_i = ctr->hevc_i_qp; > + quant.qp_p = ctr->hevc_p_qp; > + quant.qp_b = ctr->hevc_b_qp; > + } else { > + quant.qp_i = ctr->h264_i_qp; > + quant.qp_p = ctr->h264_p_qp; > + quant.qp_b = ctr->h264_b_qp; > + } > quant.layer_id = 0; > ret = hfi_session_set_property(inst, ptype, &quant); > if (ret) > return ret; > > ptype = HFI_PROPERTY_PARAM_VENC_SESSION_QP_RANGE; > - quant_range.min_qp = ctr->h264_min_qp; > - quant_range.max_qp = ctr->h264_max_qp; > + if (inst->fmt_cap->pixfmt == V4L2_PIX_FMT_HEVC) { > + quant_range.min_qp = ctr->hevc_min_qp; > + quant_range.max_qp = ctr->hevc_max_qp; > + } else { > + quant_range.min_qp = ctr->h264_min_qp; > + quant_range.max_qp = ctr->h264_max_qp; > + } > quant_range.layer_id = 0; > ret = hfi_session_set_property(inst, ptype, &quant_range); > if (ret) > diff --git a/drivers/media/platform/qcom/venus/venc_ctrls.c b/drivers/media/platform/qcom/venus/venc_ctrls.c > index 0708b3b..cd131e3 100644 > --- a/drivers/media/platform/qcom/venus/venc_ctrls.c > +++ b/drivers/media/platform/qcom/venus/venc_ctrls.c > @@ -125,9 +125,60 @@ static int venc_op_s_ctrl(struct v4l2_ctrl *ctrl) > case V4L2_CID_MPEG_VIDEO_H264_MIN_QP: > ctr->h264_min_qp = ctrl->val; > break; > + case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MIN_QP: > + ctr->h264_i_min_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MIN_QP: > + ctr->h264_p_min_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MIN_QP: > + ctr->h264_b_min_qp = ctrl->val; > + break; > case V4L2_CID_MPEG_VIDEO_H264_MAX_QP: > ctr->h264_max_qp = ctrl->val; > break; > + case V4L2_CID_MPEG_VIDEO_H264_I_FRAME_MAX_QP: > + ctr->h264_i_max_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_H264_P_FRAME_MAX_QP: > + ctr->h264_p_max_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_H264_B_FRAME_MAX_QP: > + ctr->h264_b_max_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP: > + ctr->hevc_i_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_QP: > + ctr->hevc_p_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_QP: > + ctr->hevc_b_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_MIN_QP: > + ctr->hevc_min_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MIN_QP: > + ctr->hevc_i_min_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MIN_QP: > + ctr->hevc_p_min_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MIN_QP: > + ctr->hevc_b_min_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_MAX_QP: > + ctr->hevc_max_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_MAX_QP: > + ctr->hevc_i_max_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_P_FRAME_MAX_QP: > + ctr->hevc_p_max_qp = ctrl->val; > + break; > + case V4L2_CID_MPEG_VIDEO_HEVC_B_FRAME_MAX_QP: > + ctr->hevc_b_max_qp = ctrl->val; > + break; > case V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE: > ctr->multi_slice_mode = ctrl->val; > break; > This looks incomplete: the new controls aren't actually added to the driver with v4l2_ctrl_new_std(). Did you test this? Regards, Hans