From patchwork Thu Aug 27 09:24:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanimir Varbanov X-Patchwork-Id: 248440 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp9183ilg; Thu, 27 Aug 2020 02:25:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxfUAKwO1lsXTSJSkc2m1/3FYLehVB4PFOM2QEWrKu3cphC/pYwm+kC7zaH3Q/kFfjJUzoq X-Received: by 2002:a17:906:1404:: with SMTP id p4mr19731893ejc.256.1598520343508; Thu, 27 Aug 2020 02:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598520343; cv=none; d=google.com; s=arc-20160816; b=O4hzK7d2WK/inWaitooM5oFWa1IwZK0DbLYoIZCDdi6i+WE8CJhit2jUu4lp9zZ1Eb +W5XalMkOAkqeQSWCOBW0Mo2sbb/JeYlGuIdFlidEsUKOPKNfthIlhhhZ6DomNiDwo+z OnRzQr1keDJsVD1WffP1yMFqYw/uRdBA2xWofDyuPUxExpg+eMW3IgYNBiUcTQyzTMwX ZezMbw4+iSUmYKyY13dunYhNAHPyioosRtr1Tdz5XYz5upE8uTzEgJOZpXKSMCqN8jts vxV69/mYcy4eHPIRVVQt64boyoKcNfmdz1M/W+jTcMPIcWGjdauhC9SODgQN8cD0CRo7 3yug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=IFNMyaH4C8tyb/mJTWrzTTwDqXVQt+oIKxEwk0xfFcs=; b=IyLLb4CoCBYx8kF58bD2WxG5dnVIFQ705c4HEChptJ+aTVeM+cwuzoqG18jyMbido6 8KPZmegXYSOEBplOrOUV34ZNarU4I17eaHCYIrrRup6pZea3JBwqG8LJHfe5qexOCIG9 yoRL5p++MZSdm5vjoFDtuZBkjKwKS74i3wa61t4QjA32QHcaFaS3zXeR7nfaKU/43XyB 84kROMbZuM4TFkPuYPDdWVW5MnZB2GC1xdNCMW8VRh93ZpjaxWFLv2iXQIFmizM6JVdX q5IctaRDZ7/osAXdeY8oeVXjaYXwZUIk54mkXiVu0r2GEOpl4nEgzvnzjT3jNfYR/LcR HfSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dolX/Oj/"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 a2si1175359eda.380.2020.08.27.02.25.43; Thu, 27 Aug 2020 02:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-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="dolX/Oj/"; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-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 S1728590AbgH0JZd (ORCPT + 15 others); Thu, 27 Aug 2020 05:25:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728622AbgH0JZY (ORCPT ); Thu, 27 Aug 2020 05:25:24 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15B8CC06123A for ; Thu, 27 Aug 2020 02:25:24 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id h15so4639702wrt.12 for ; Thu, 27 Aug 2020 02:25:24 -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=IFNMyaH4C8tyb/mJTWrzTTwDqXVQt+oIKxEwk0xfFcs=; b=dolX/Oj/ruvZXAdY9Awn2EFLCyhybVa7noGABscD4AETJE40yPNweFzjsbch+7oNWD E9nAAOpcJUgp9Zeqgha+dssMpvo6RwBkMdKQr1/shKrQb0Y4cHWz0ezv+I0u83obAvvs bxIIDWcO3SxyVq+9yL4RT0eclQmQCeE61H2Le1JzT6LZEjHn8FIOK2vXK5RGTu9VzPcR WlhWpzHcuySlhhcZMMW1BJw56yMBEgmOpH8MrD85+vdLpTWukcT7HwdGUEZDK9qEuGzE EEvUN3FdcV2SjAR3UvcnQyjrQkSL1X9pwPfyfVrHiU1yoYtiTJg8HyGXsdwT/G9xnbHr KRwA== 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=IFNMyaH4C8tyb/mJTWrzTTwDqXVQt+oIKxEwk0xfFcs=; b=S1Dsz67g+rhwJ5PJQEjHBVLwdmW90C5LRURItKQYXIgKW8s44ReDJmw9gDP8feoweo J5Tim23b+NBM2J4qUFr7Eog60jBv604d14a3GNNN3JRgXRixQR5m0tJF6PBWgoMLP0lQ gTnYO9cWmiQvP+mTg4/UHslurzhBAUWBFsvMCd90B521gI8iPazCcbIrn5fdzEcPHDu2 N2MXamtMIcWiSF/J1kj4ze5IQ6zl2RyJ7RFbIttTPcHmL2Ra76PkSNkUm6zkg0RZiKFK el3YBzgkhiLvbouw6mys6IZ91aWsy0Kc8BlnIasXbFPeVOjMTuUv48Xa/xcIrD98fbs+ +vNg== X-Gm-Message-State: AOAM533fTQxM9r75Xi+tkItvhm0mwkf+bKi/vsVusCRdG1TxZtKWwJ8S EpoxMgS/iLm0ucUxCRZholSREQ== X-Received: by 2002:a5d:6505:: with SMTP id x5mr18875316wru.336.1598520322734; Thu, 27 Aug 2020 02:25:22 -0700 (PDT) Received: from localhost.localdomain ([195.24.90.54]) by smtp.gmail.com with ESMTPSA id z203sm4357330wmc.31.2020.08.27.02.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 02:25:22 -0700 (PDT) From: Stanimir Varbanov To: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org Cc: Dikshita Agarwal , Vikash Garodia , Stanimir Varbanov Subject: [PATCH 13/13] venus: helpers: Wire up hfi platform buffer requirements Date: Thu, 27 Aug 2020 12:24:17 +0300 Message-Id: <20200827092417.16040-14-stanimir.varbanov@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200827092417.16040-1-stanimir.varbanov@linaro.org> References: <20200827092417.16040-1-stanimir.varbanov@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now when everything is in place wire up buffer requirements from hfi platform buffers to the buffer requirements helper. Signed-off-by: Stanimir Varbanov --- drivers/media/platform/qcom/venus/helpers.c | 50 +++++++++++++++++++ .../media/platform/qcom/venus/hfi_parser.h | 5 ++ 2 files changed, 55 insertions(+) -- 2.17.1 diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index cd06a6998f52..a3e59b3791eb 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -15,6 +15,7 @@ #include "hfi_helper.h" #include "pm_helpers.h" #include "hfi_platform.h" +#include "hfi_parser.h" struct intbuf { struct list_head list; @@ -552,6 +553,51 @@ static u32 to_hfi_raw_fmt(u32 v4l2_fmt) return 0; } +static int platform_get_bufreq(struct venus_inst *inst, u32 buftype, + struct hfi_buffer_requirements *req) +{ + enum hfi_version version = inst->core->res->hfi_version; + const struct hfi_platform *hfi_plat; + struct hfi_plat_buffers_params params; + bool is_dec = inst->session_type == VIDC_SESSION_TYPE_DEC; + struct venc_controls *enc_ctr = &inst->controls.enc; + + hfi_plat = hfi_platform_get(version); + + if (!hfi_plat || !hfi_plat->bufreq) + return -EINVAL; + + params.version = version; + params.num_vpp_pipes = hfi_platform_num_vpp_pipes(version); + + if (is_dec) { + params.width = inst->width; + params.height = inst->height; + params.codec = inst->fmt_out->pixfmt; + params.hfi_color_fmt = to_hfi_raw_fmt(inst->fmt_cap->pixfmt); + params.dec.max_mbs_per_frame = mbs_per_frame_max(inst); + params.dec.buffer_size_limit = 0; + params.dec.is_secondary_output = + inst->opb_buftype == HFI_BUFFER_OUTPUT2; + params.dec.is_interlaced = + inst->pic_struct != HFI_INTERLACE_FRAME_PROGRESSIVE ? + true : false; + } else { + params.width = inst->out_width; + params.height = inst->out_height; + params.codec = inst->fmt_cap->pixfmt; + params.hfi_color_fmt = to_hfi_raw_fmt(inst->fmt_out->pixfmt); + params.enc.work_mode = VIDC_WORK_MODE_2; + params.enc.rc_type = HFI_RATE_CONTROL_OFF; + if (enc_ctr->bitrate_mode == V4L2_MPEG_VIDEO_BITRATE_MODE_CQ) + params.enc.rc_type = HFI_RATE_CONTROL_CQ; + params.enc.num_b_frames = enc_ctr->num_b_frames; + params.enc.is_tenbit = inst->bit_depth == VIDC_BITDEPTH_10; + } + + return hfi_plat->bufreq(¶ms, inst->session_type, buftype, req); +} + int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, struct hfi_buffer_requirements *req) { @@ -563,6 +609,10 @@ int venus_helper_get_bufreq(struct venus_inst *inst, u32 type, if (req) memset(req, 0, sizeof(*req)); + ret = platform_get_bufreq(inst, type, req); + if (!ret) + return 0; + ret = hfi_session_get_property(inst, ptype, &hprop); if (ret) return ret; diff --git a/drivers/media/platform/qcom/venus/hfi_parser.h b/drivers/media/platform/qcom/venus/hfi_parser.h index 7f59d82110f9..5751d0140700 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.h +++ b/drivers/media/platform/qcom/venus/hfi_parser.h @@ -112,4 +112,9 @@ static inline u32 core_num_max(struct venus_inst *inst) return cap_max(inst, HFI_CAPABILITY_MAX_VIDEOCORES); } +static inline u32 mbs_per_frame_max(struct venus_inst *inst) +{ + return cap_max(inst, HFI_CAPABILITY_MBS_PER_FRAME); +} + #endif