All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Pitoiset <samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH RFC 13/20] pm: allow to query the number of sources for a signal
Date: Sun,  7 Jun 2015 22:40:23 +0200	[thread overview]
Message-ID: <1433709630-3293-14-git-send-email-samuel.pitoiset@gmail.com> (raw)
In-Reply-To: <1433709630-3293-1-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
---
 drm/nouveau/include/nvif/class.h  |  3 ++-
 drm/nouveau/nvkm/engine/pm/base.c | 22 +++++++++++++++++++---
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/drm/nouveau/include/nvif/class.h b/drm/nouveau/include/nvif/class.h
index 9e4db3a..caae193 100644
--- a/drm/nouveau/include/nvif/class.h
+++ b/drm/nouveau/include/nvif/class.h
@@ -268,7 +268,8 @@ struct nvif_perfmon_query_signal_v0 {
 	__u8  domain;
 	__u16 iter;
 	__u8  signal;
-	__u8  pad04[3];
+	__u8  source_nr;
+	__u8  pad05[2];
 	char  name[64];
 };
 
diff --git a/drm/nouveau/nvkm/engine/pm/base.c b/drm/nouveau/nvkm/engine/pm/base.c
index dfafefd..a9c57a2 100644
--- a/drm/nouveau/nvkm/engine/pm/base.c
+++ b/drm/nouveau/nvkm/engine/pm/base.c
@@ -91,6 +91,18 @@ nvkm_perfsig_find(struct nvkm_pm *ppm, uint8_t di, uint8_t si,
 	return &dom->signal[si];
 }
 
+static u8
+nvkm_perfsig_count_perfsrc(struct nvkm_perfsig *sig)
+{
+	u8 source_nr = 0, i;
+
+	for (i = 0; i < ARRAY_SIZE(sig->source); i++) {
+		if (sig->source[i])
+			source_nr++;
+	}
+	return source_nr;
+}
+
 /*******************************************************************************
  * Perfmon object classes
  ******************************************************************************/
@@ -148,9 +160,9 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size)
 	struct nvkm_device *device = nv_device(object);
 	struct nvkm_pm *ppm = (void *)object->engine;
 	struct nvkm_perfdom *dom;
+	struct nvkm_perfsig *sig;
 	const bool all = nvkm_boolopt(device->cfgopt, "NvPmShowAll", false);
 	const bool raw = nvkm_boolopt(device->cfgopt, "NvPmUnnamed", all);
-	const char *name;
 	int ret, si;
 
 	nv_ioctl(object, "perfmon query signal size %d\n", size);
@@ -167,13 +179,17 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size)
 		return -EINVAL;
 
 	if (si >= 0) {
-		if (raw || !(name = dom->signal[si].name)) {
+		sig = &dom->signal[si];
+		if (raw || !sig->name) {
 			snprintf(args->v0.name, sizeof(args->v0.name),
 				 "/%s/%02x", dom->name, si);
 		} else {
-			strncpy(args->v0.name, name, sizeof(args->v0.name));
+			strncpy(args->v0.name, sig->name,
+				sizeof(args->v0.name));
 		}
+
 		args->v0.signal = si;
+		args->v0.source_nr = nvkm_perfsig_count_perfsrc(sig);
 	}
 
 	while (++si < dom->signal_nr) {
-- 
2.4.2

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/nouveau

  parent reply	other threads:[~2015-06-07 20:40 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-07 20:40 [PATCH RFC 00/20] expose global performance counters Samuel Pitoiset
     [not found] ` <1433709630-3293-1-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-07 20:40   ` [PATCH RFC 01/20] pm: prevent freeing the wrong engine context Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 02/20] pm: fix a potential race condition when creating an " Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 03/20] pm: remove pmu signals Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 04/20] pm: remove unused nvkm_perfsig_wrap() function Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 05/20] pm: reorganize the nvif interface Samuel Pitoiset
     [not found]     ` <1433709630-3293-6-git-send-email-samuel.pitoiset-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-08 22:02       ` Ben Skeggs
     [not found]         ` <CACAvsv4x2vcWND6bE1tGSDQMy_doysboV7O8551CfGKz4MwcMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-09 21:53           ` Samuel Pitoiset
     [not found]             ` <55776056.9010302-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-06-14  2:32               ` Ben Skeggs
     [not found]                 ` <CACAvsv6+xYKtqFQ5HW3vp7yJ1D+puJS7k8TgfxhLO9aY0tzHtA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-14 11:54                   ` Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 06/20] pm: prevent creating a perfctr object when signals are not found Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 07/20] pm: implement NVIF_PERFMON_V0_QUERY_DOMAIN method Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 08/20] pm: allow to query signals by domain Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 09/20] pm: change signal iter to u16 Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 10/20] pm: use hardware signals indexes instead of user-readable names Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 11/20] pm: allow to monitor hardware signal index 0x00 Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 12/20] pm: add concept of sources Samuel Pitoiset
2015-06-07 20:40   ` Samuel Pitoiset [this message]
2015-06-07 20:40   ` [PATCH RFC 14/20] pm: implement NVIF_PERFMON_V0_QUERY_SOURCE method Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 15/20] pm: allow the userspace to schedule hardware counters Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 16/20] pm: allow to configure domains instead of simple counters Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 17/20] pm: allow the userspace to configure sources Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 18/20] pm/nv50: add compute and graphics signals/sources Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 19/20] sw/nv50: add some private functions to factorize code Samuel Pitoiset
2015-06-07 20:40   ` [PATCH RFC 20/20] sw/nv50: add and interface for controlling performance counters Samuel Pitoiset

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433709630-3293-14-git-send-email-samuel.pitoiset@gmail.com \
    --to=samuel.pitoiset-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.