[Nouveau] [PATCH RFC 09/20] pm: change signal iter to u16

Samuel Pitoiset samuel.pitoiset at gmail.com
Sun Jun 7 13:40:19 PDT 2015


16 bits is large enough to store the maximum number of signals available
for one domain (i.e. 256).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 bin/nv_perfmon.c                  |  4 ++--
 drm/nouveau/include/nvif/class.h  |  7 ++++---
 drm/nouveau/nvkm/engine/pm/base.c | 10 +++++-----
 drm/nouveau/nvkm/engine/pm/priv.h |  2 +-
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/bin/nv_perfmon.c b/bin/nv_perfmon.c
index 958520e..043d864 100644
--- a/bin/nv_perfmon.c
+++ b/bin/nv_perfmon.c
@@ -289,7 +289,7 @@ ui_perfmon_query_signals(struct nvif_object *perfmon,
 
 	args.domain = dom->id;
 	do {
-		u32 prev_iter = args.iter;
+		u16 prev_iter = args.iter;
 
 		args.name[0] = '\0';
 		ret = nvif_mthd(perfmon, NVIF_PERFMON_V0_QUERY_SIGNAL,
@@ -308,7 +308,7 @@ ui_perfmon_query_signals(struct nvif_object *perfmon,
 					&args, sizeof(args));
 			assert(ret == 0);
 		}
-	} while (args.iter != 0xffffffff);
+	} while (args.iter != 0xffff);
 }
 
 static void
diff --git a/drm/nouveau/include/nvif/class.h b/drm/nouveau/include/nvif/class.h
index cf2af89..871247c 100644
--- a/drm/nouveau/include/nvif/class.h
+++ b/drm/nouveau/include/nvif/class.h
@@ -259,14 +259,15 @@ struct nvif_perfmon_query_domain_v0 {
 	__u8  id;
 	__u8  counter_nr;
 	__u8  iter;
-	__u32 signal_nr;
+	__u16 signal_nr;
+	__u8  pad05[2];
 };
 
 struct nvif_perfmon_query_signal_v0 {
 	__u8  version;
 	__u8  domain;
-	__u8  pad02[2];
-	__u32 iter;
+	__u16 iter;
+	__u8  pad03[4];
 	char  name[64];
 };
 
diff --git a/drm/nouveau/nvkm/engine/pm/base.c b/drm/nouveau/nvkm/engine/pm/base.c
index d61beff..fab0598 100644
--- a/drm/nouveau/nvkm/engine/pm/base.c
+++ b/drm/nouveau/nvkm/engine/pm/base.c
@@ -45,10 +45,10 @@ nvkm_pm_count_perfdom(struct nvkm_pm *ppm)
 	return domain_nr;
 }
 
-static u32
+static u16
 nvkm_perfdom_count_perfsig(struct nvkm_perfdom *dom)
 {
-	u32 signal_nr = 0;
+	u16 signal_nr = 0;
 	int i;
 
 	if (dom) {
@@ -183,9 +183,9 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size)
 	nv_ioctl(object, "perfmon query signal size %d\n", size);
 	if (nvif_unpack(args->v0, 0, 0, false)) {
 		nv_ioctl(object,
-			 "perfmon query signal vers %d dom %d iter %08x\n",
+			 "perfmon query signal vers %d dom %d iter %04x\n",
 			 args->v0.version, args->v0.domain, args->v0.iter);
-		si = (args->v0.iter & 0xffffffff) - 1;
+		si = (args->v0.iter & 0xffff) - 1;
 	} else
 		return ret;
 
@@ -209,7 +209,7 @@ nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size)
 		}
 	}
 
-	args->v0.iter = 0xffffffff;
+	args->v0.iter = 0xffff;
 	return 0;
 }
 
diff --git a/drm/nouveau/nvkm/engine/pm/priv.h b/drm/nouveau/nvkm/engine/pm/priv.h
index 06a6e60..71667fc 100644
--- a/drm/nouveau/nvkm/engine/pm/priv.h
+++ b/drm/nouveau/nvkm/engine/pm/priv.h
@@ -44,7 +44,7 @@ struct nvkm_perfdom {
 	char name[32];
 	u32 addr;
 	u8  quad;
-	u32 signal_nr;
+	u16 signal_nr;
 	struct nvkm_perfsig signal[];
 };
 
-- 
2.4.2



More information about the Nouveau mailing list