Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4024722ybi; Mon, 10 Jun 2019 23:08:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEQ7+F9xqu7+WxyWgwRGO38qufkUMsGbW9+x7Cqx1MOqNMPBQ8NYX+GVejzcwNM6KA26Q/ X-Received: by 2002:a17:902:8490:: with SMTP id c16mr76245599plo.259.1560233322444; Mon, 10 Jun 2019 23:08:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560233322; cv=none; d=google.com; s=arc-20160816; b=wPXZHXxpD6yM1pHaHGK3+a2WVZ4E1FvdwxnvhZbcGvSiLlpif96bang0ec8c6L/D+J YKFkF0jIviwXzAH6VK8AFpGCMl217jIlwPT/w39beFRiNa58txOU6ZHRXJAd7umq5JwF Jxh7jXx+GHAFU4Fyb8YyyLE/mLdZU1u26HqKfz8AM6MrOjUF+qv1BgdNpUiR9CgcXbRw CITQNtOrz9DBcusb07qzBsc1cdFlt8EUw4Es1mzmXzV9SIss+pTeVYk99iEoh5wJIYwW JVIExlcUM+/rGDzcvdgQcdBebpeb12sQrpoxJ/I+eDdqKnP5jNnmnPI+U132A40ORAaW 413Q== 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=hF4bxEU5U36rvaOK8YCjqRpKY7LPNKReuT7UyWbbjLo=; b=nVCX89WIxICM3P2iKE28u3pbCDS6sxC+4LBxtHSJ/72ERQzZHinmaJUfgnbpqzrAGY GNCIVOZ+PzKXz9TfHsW+4tMkLlklEqY9hrrXnz+23lDOO5HKdY6LD6qRnoelEGqiJI8F buoz024izh2rfmViV9V904Vh8juzvxyvJMZZHMKvsJSj3NKm/Hs3bGWYCZn+e+Kmu22n 0+PsgTQAH+HVS78acCX8HqZ9TfW6vNuQ4M6km1lWIephPy3wC0pWQEGhD8kLFvb9x/Kl 94Psfl81U92VgDpOaFVqzo5Vl0vK0VWrW0D/uOe7abDSQJqp5IczsonXQ9KhWsdoRLf+ 8Dbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=U8o3UIoF; dkim=pass header.i=@codeaurora.org header.s=default header.b=U8o3UIoF; 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 j14si12021049pfe.183.2019.06.10.23.08.26; Mon, 10 Jun 2019 23:08:42 -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=U8o3UIoF; dkim=pass header.i=@codeaurora.org header.s=default header.b=U8o3UIoF; 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 S2391304AbfFKGGR (ORCPT + 99 others); Tue, 11 Jun 2019 02:06:17 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45758 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391051AbfFKGGQ (ORCPT ); Tue, 11 Jun 2019 02:06:16 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D153A60DAA; Tue, 11 Jun 2019 06:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560233174; bh=p/e3pSzcL3SLRuMjZnkU5Uaw9Miiat6SAo2qj6EhyeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8o3UIoFscMK41ckBUcAG6jU0MZoOMn8E+Z5BB8dSUYzHbIl7hMArOVisDH3GMLkj BHbIH1ebY1qcYrChWTyvkT0si+GAeOf/ARM+2bcaIH65zKbhGkFqYBF0uDwtPqgx7K GLXrdxK7eOdpzNRELxyWMRI41xzbQtVlzdtSRwfo= 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 3BA7E60C72; Tue, 11 Jun 2019 06:06:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1560233174; bh=p/e3pSzcL3SLRuMjZnkU5Uaw9Miiat6SAo2qj6EhyeE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8o3UIoFscMK41ckBUcAG6jU0MZoOMn8E+Z5BB8dSUYzHbIl7hMArOVisDH3GMLkj BHbIH1ebY1qcYrChWTyvkT0si+GAeOf/ARM+2bcaIH65zKbhGkFqYBF0uDwtPqgx7K GLXrdxK7eOdpzNRELxyWMRI41xzbQtVlzdtSRwfo= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3BA7E60C72 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 4/5] media: venus: Add interface for load per core Date: Tue, 11 Jun 2019 11:35:29 +0530 Message-Id: <1560233130-27264-5-git-send-email-amasule@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1560233130-27264-1-git-send-email-amasule@codeaurora.org> References: <1560233130-27264-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 | 18 ++++++++++++++++++ drivers/media/platform/qcom/venus/hfi_helper.h | 1 + drivers/media/platform/qcom/venus/hfi_parser.h | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 7bcc1e6..edb653e 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -331,6 +331,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_data->vpp_cycles; + } + 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..3677e2e 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