drm/nouveau/pm: allow to query the number of sources for a signal
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
e82661e23c
commit
50d138d752
|
@ -268,7 +268,8 @@ struct nvif_perfmon_query_signal_v0 {
|
||||||
__u8 domain;
|
__u8 domain;
|
||||||
__u16 iter;
|
__u16 iter;
|
||||||
__u8 signal;
|
__u8 signal;
|
||||||
__u8 pad04[3];
|
__u8 source_nr;
|
||||||
|
__u8 pad05[2];
|
||||||
char name[64];
|
char name[64];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,18 @@ nvkm_perfsig_find(struct nvkm_pm *ppm, uint8_t di, uint8_t si,
|
||||||
return &dom->signal[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
|
* 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_device *device = nv_device(object);
|
||||||
struct nvkm_pm *ppm = (void *)object->engine;
|
struct nvkm_pm *ppm = (void *)object->engine;
|
||||||
struct nvkm_perfdom *dom;
|
struct nvkm_perfdom *dom;
|
||||||
|
struct nvkm_perfsig *sig;
|
||||||
const bool all = nvkm_boolopt(device->cfgopt, "NvPmShowAll", false);
|
const bool all = nvkm_boolopt(device->cfgopt, "NvPmShowAll", false);
|
||||||
const bool raw = nvkm_boolopt(device->cfgopt, "NvPmUnnamed", all);
|
const bool raw = nvkm_boolopt(device->cfgopt, "NvPmUnnamed", all);
|
||||||
const char *name;
|
|
||||||
int ret, si;
|
int ret, si;
|
||||||
|
|
||||||
nv_ioctl(object, "perfmon query signal size %d\n", size);
|
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;
|
return -EINVAL;
|
||||||
|
|
||||||
if (si >= 0) {
|
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),
|
snprintf(args->v0.name, sizeof(args->v0.name),
|
||||||
"/%s/%02x", dom->name, si);
|
"/%s/%02x", dom->name, si);
|
||||||
} else {
|
} 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.signal = si;
|
||||||
|
args->v0.source_nr = nvkm_perfsig_count_perfsrc(sig);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (++si < dom->signal_nr) {
|
while (++si < dom->signal_nr) {
|
||||||
|
|
Loading…
Reference in New Issue