]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm/nouveau/pm: reorganize the nvif interface
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Sun, 7 Jun 2015 20:40:15 +0000 (22:40 +0200)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:39:57 +0000 (12:39 +1000)
This commit introduces the NVIF_IOCTL_NEW_V0_PERFMON class which will be
used in order to query domains, signals and sources. This separates the
querying and the counting interface.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/class.h
drivers/gpu/drm/nouveau/include/nvif/ioctl.h
drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c

index 64f8b2f687d29bb206ae1fe461706fbf1be3fe12..11935a048744ca9eaeb41fe0a707f38638f6fe84 100644 (file)
@@ -251,6 +251,20 @@ struct gf110_dma_v0 {
  * perfmon
  ******************************************************************************/
 
+#define NVIF_PERFMON_V0_QUERY_SIGNAL                                       0x00
+
+struct nvif_perfmon_query_signal_v0 {
+       __u8  version;
+       __u8  pad01[3];
+       __u32 iter;
+       char  name[64];
+};
+
+
+/*******************************************************************************
+ * perfctr
+ ******************************************************************************/
+
 struct nvif_perfctr_v0 {
        __u8  version;
        __u8  pad01[1];
@@ -259,16 +273,8 @@ struct nvif_perfctr_v0 {
        char  name[4][64];
 };
 
-#define NVIF_PERFCTR_V0_QUERY                                              0x00
-#define NVIF_PERFCTR_V0_SAMPLE                                             0x01
-#define NVIF_PERFCTR_V0_READ                                               0x02
-
-struct nvif_perfctr_query_v0 {
-       __u8  version;
-       __u8  pad01[3];
-       __u32 iter;
-       char  name[64];
-};
+#define NVIF_PERFCTR_V0_SAMPLE                                             0x00
+#define NVIF_PERFCTR_V0_READ                                               0x01
 
 struct nvif_perfctr_sample {
 };
index 4cd8e323b23d7868d5fda2952ecc8207b9e151ad..517cd27cdc377e52c8c202879b0dd417e1b94c1d 100644 (file)
@@ -49,8 +49,9 @@ struct nvif_ioctl_new_v0 {
        __u64 token;
        __u32 handle;
 /* these class numbers are made up by us, and not nvidia-assigned */
-#define NVIF_IOCTL_NEW_V0_PERFCTR                                    0x0000ffff
-#define NVIF_IOCTL_NEW_V0_CONTROL                                    0x0000fffe
+#define NVIF_IOCTL_NEW_V0_PERFMON                                    0x0000ffff
+#define NVIF_IOCTL_NEW_V0_PERFCTR                                    0x0000fffe
+#define NVIF_IOCTL_NEW_V0_CONTROL                                    0x0000fffd
        __u32 oclass;
        __u8  data[];           /* class data (class.h) */
 };
index 7b07e8b04052b96f4a8e06de4f135095fda4623e..cb88170610bbb4c70f48373efb5a16176a627d8f 100644 (file)
@@ -83,10 +83,10 @@ nvkm_perfsig_find(struct nvkm_pm *ppm, const char *name, u32 size,
  * Perfmon object classes
  ******************************************************************************/
 static int
-nvkm_perfctr_query(struct nvkm_object *object, void *data, u32 size)
+nvkm_perfmon_mthd_query_signal(struct nvkm_object *object, void *data, u32 size)
 {
        union {
-               struct nvif_perfctr_query_v0 v0;
+               struct nvif_perfmon_query_signal_v0 v0;
        } *args = data;
        struct nvkm_device *device = nv_device(object);
        struct nvkm_pm *ppm = (void *)object->engine;
@@ -97,9 +97,9 @@ nvkm_perfctr_query(struct nvkm_object *object, void *data, u32 size)
        int tmp = 0, di, si;
        int ret;
 
-       nv_ioctl(object, "perfctr query size %d\n", size);
+       nv_ioctl(object, "perfmon query signal size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
-               nv_ioctl(object, "perfctr query vers %d iter %08x\n",
+               nv_ioctl(object, "perfmon query signal vers %d iter %08x\n",
                         args->v0.version, args->v0.iter);
                di = (args->v0.iter & 0xff000000) >> 24;
                si = (args->v0.iter & 0x00ffffff) - 1;
@@ -141,6 +141,30 @@ nvkm_perfctr_query(struct nvkm_object *object, void *data, u32 size)
        return 0;
 }
 
+static int
+nvkm_perfmon_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
+{
+       switch (mthd) {
+       case NVIF_PERFMON_V0_QUERY_SIGNAL:
+               return nvkm_perfmon_mthd_query_signal(object, data, size);
+       default:
+               break;
+       }
+       return -EINVAL;
+}
+
+static struct nvkm_ofuncs
+nvkm_perfmon_ofuncs = {
+       .ctor = _nvkm_object_ctor,
+       .dtor = nvkm_object_destroy,
+       .init = nvkm_object_init,
+       .fini = nvkm_object_fini,
+       .mthd = nvkm_perfmon_mthd,
+};
+
+/*******************************************************************************
+ * Perfctr object classes
+ ******************************************************************************/
 static int
 nvkm_perfctr_sample(struct nvkm_object *object, void *data, u32 size)
 {
@@ -221,8 +245,6 @@ static int
 nvkm_perfctr_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
 {
        switch (mthd) {
-       case NVIF_PERFCTR_V0_QUERY:
-               return nvkm_perfctr_query(object, data, size);
        case NVIF_PERFCTR_V0_SAMPLE:
                return nvkm_perfctr_sample(object, data, size);
        case NVIF_PERFCTR_V0_READ:
@@ -299,6 +321,10 @@ nvkm_perfctr_ofuncs = {
 
 struct nvkm_oclass
 nvkm_pm_sclass[] = {
+       {
+         .handle = NVIF_IOCTL_NEW_V0_PERFMON,
+         .ofuncs = &nvkm_perfmon_ofuncs,
+       },
        { .handle = NVIF_IOCTL_NEW_V0_PERFCTR,
          .ofuncs = &nvkm_perfctr_ofuncs,
        },