Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp4012053ybd; Tue, 25 Jun 2019 12:24:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxnTpEwlHqYF1KBR0LaqhPUGoz2cysIDl1HJiD8Q6Z62eLynDedeI+XA2lfhB7zUhuA9g+X X-Received: by 2002:a17:90a:d997:: with SMTP id d23mr500422pjv.84.1561490687381; Tue, 25 Jun 2019 12:24:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561490687; cv=none; d=google.com; s=arc-20160816; b=jOuVG1C4a74fu5YnZ8g1BSUWaVXQb9HZ0Dre/1qE31BGopajt+pwHDOYKQ1TIT0fI7 9uB0P95jA2jUTKTxW+TyxCFywG9evWFM27LP5SX13/eXdhOvM1OJURgaGs7qDziNo/KI Kv3gayOaoNqrqI0gBMtHoFFuM7aubYUuZxYNflfUzU2XbWMnOMi4WIe4DSCDX7XJE7XX v0gtWg2C35wPREw4hFaDZnpoxo3EaQWxNlURKQtw9fDutFr8/czu8/64gj5RabulpUYx u9Au4WZKvHylshSi5jcW09y48uh2fWgQT+dqHOdlU8zCJmtWulqK13bEN0s/G0BwMYcX 1Dvw== 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:dmarc-filter:dkim-signature:dkim-signature; bh=uSJf+wbq/NAoLee8MTkAcz1bojFbeLnyVplz7soHWwk=; b=A+TdykjfT3Chc8WaBcvj+gIFi6cOMkAQ/pvxN+1hdMqcNvP8u0A9eTlrYI/wasIX87 VelGukyt27WFr249mHMJ6MHEo03RPgaB6ZJ2SlVXV7r5tlXCuGID1SB2IfUHbAceYqsX spEssaTScRL04Qt4GoV0G0UQ6N4mu/0x4MiCKV+bTQZcAraxB9Txn4gf+s+sHz0xG5jx G6XTSk+HLh70rtsnh8O+BvfMmLzF+OJbwepK6pKGQ8mIjoSSL+O0y8mCWQ1gKP900dJR 96qIhu15qubhh07dznJln84qoBz95LfGuTqhDqTD/w5lodln2Q1yibw9h3/jYd9QsaSl WNKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ibbxoANa; dkim=pass header.i=@codeaurora.org header.s=default header.b=E1Npiens; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h15si7044399pgf.512.2019.06.25.12.24.31; Tue, 25 Jun 2019 12:24:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=ibbxoANa; dkim=pass header.i=@codeaurora.org header.s=default header.b=E1Npiens; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730099AbfFYQ2C (ORCPT + 99 others); Tue, 25 Jun 2019 12:28:02 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33124 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726740AbfFYQ2C (ORCPT ); Tue, 25 Jun 2019 12:28:02 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F250660A50; Tue, 25 Jun 2019 16:27:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1561480080; bh=9YJM4tU5HxDZl9fZSxJofxKk+vfCRAK8/CRj4QgCb8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ibbxoANaKtrFmaGLUaWfC/EsfPbTyKu5A1MpYnuG3DdppVI1FR6ch7MMlwIzz9M81 RkLjQK+02H0hWeZS9k64j6+FZUtoTpNOwN2ngDXwqjwhkO6ftKvQKtP+NDFCRBQ+VK UWtgmUcVPdELQ6tGNy+u0Yl2YQIo9KJNY7plUkAQ= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED,SPF_NONE autolearn=no autolearn_force=no version=3.4.0 Received: from amasule-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: amasule@codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 19F0B60ACA; Tue, 25 Jun 2019 16:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1561480077; bh=9YJM4tU5HxDZl9fZSxJofxKk+vfCRAK8/CRj4QgCb8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E1Npiens45yXJ9e7WRQ433JEcVM2EmXT39qOJUuZ0PSuo2YuAY3Ti1e8ftgit0m4z dNbzlRIP77ZXAz/s/WbH8cUSPNYGpERElQiMjER1kwWko+X6hzFiwXR88ItFAADv6U awWxCp08ZvXHibMteKh0hhsSeT5WMUMKhYhbHvzQ= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 19F0B60ACA Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=amasule@codeaurora.org From: Aniket Masule To: linux-media@vger.kernel.org, stanimir.varbanov@linaro.org Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, vgarodia@codeaurora.org, Aniket Masule Subject: [PATCH v3 3/4] media: venus: Add interface for load per core Date: Tue, 25 Jun 2019 21:57:23 +0530 Message-Id: <1561480044-11834-4-git-send-email-amasule@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1561480044-11834-1-git-send-email-amasule@codeaurora.org> References: <1561480044-11834-1-git-send-email-amasule@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add and interface to calculate load per core. Also, add an interface to get maximum cores available with video. This interface is preparation for updating core selection. Signed-off-by: Aniket Masule --- drivers/media/platform/qcom/venus/helpers.c | 19 +++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_helper.h | 1 + drivers/media/platform/qcom/venus/hfi_parser.h | 5 +++++ 3 files changed, 25 insertions(+) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index e1a0247..b79e83a 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -26,6 +26,7 @@ #include "helpers.h" #include "hfi_helper.h" #include "hfi_venus_io.h" +#include "hfi_parser.h" struct intbuf { struct list_head list; @@ -331,6 +332,24 @@ static u32 load_per_instance(struct venus_inst *inst) return mbs * inst->fps; } +static u32 load_per_core(struct venus_core *core, u32 core_id) +{ + struct venus_inst *inst = NULL; + u32 mbs_per_sec = 0, load = 0; + + mutex_lock(&core->lock); + list_for_each_entry(inst, &core->instances, list) { + if (!(inst->clk_data.core_id == core_id)) + continue; + + mbs_per_sec = load_per_instance(inst); + load = mbs_per_sec * inst->clk_data.codec_freq_data->vpp_freq; + } + mutex_unlock(&core->lock); + + return load; +} + static u32 load_per_type(struct venus_core *core, u32 session_type) { struct venus_inst *inst = NULL; diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h index 34ea503..f3d1018 100644 --- a/drivers/media/platform/qcom/venus/hfi_helper.h +++ b/drivers/media/platform/qcom/venus/hfi_helper.h @@ -559,6 +559,7 @@ struct hfi_bitrate { #define HFI_CAPABILITY_LCU_SIZE 0x14 #define HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS 0x15 #define HFI_CAPABILITY_MBS_PER_SECOND_POWERSAVE 0x16 +#define HFI_CAPABILITY_MAX_VIDEOCORES 0x2B struct hfi_capability { u32 capability_type; diff --git a/drivers/media/platform/qcom/venus/hfi_parser.h b/drivers/media/platform/qcom/venus/hfi_parser.h index 3e931c7..264e6dd 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.h +++ b/drivers/media/platform/qcom/venus/hfi_parser.h @@ -107,4 +107,9 @@ static inline u32 frate_step(struct venus_inst *inst) return cap_step(inst, HFI_CAPABILITY_FRAMERATE); } +static inline u32 core_num_max(struct venus_inst *inst) +{ + return cap_max(inst, HFI_CAPABILITY_MAX_VIDEOCORES); +} + #endif -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project