drm/nouveau/device: support querying available engines of a specific type
authorBen Skeggs <bskeggs@redhat.com>
Tue, 8 May 2018 10:39:46 +0000 (20:39 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 18 May 2018 05:01:21 +0000 (15:01 +1000)
Will be used for fifo runlist selection.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/cl0080.h
drivers/gpu/drm/nouveau/nvkm/engine/device/user.c

index 51a4af6..6a54cda 100644 (file)
@@ -60,4 +60,23 @@ struct nv_device_time_v0 {
 
 /* This will be returned for unsupported queries. */
 #define NV_DEVICE_INFO_INVALID                                           ~0ULL
+
+/* These return a mask of available engines of particular type. */
+#define NV_DEVICE_INFO_ENGINE_SW                     NV_DEVICE_INFO(0x00000000)
+#define NV_DEVICE_INFO_ENGINE_GR                     NV_DEVICE_INFO(0x00000001)
+#define NV_DEVICE_INFO_ENGINE_MPEG                   NV_DEVICE_INFO(0x00000002)
+#define NV_DEVICE_INFO_ENGINE_ME                     NV_DEVICE_INFO(0x00000003)
+#define NV_DEVICE_INFO_ENGINE_CIPHER                 NV_DEVICE_INFO(0x00000004)
+#define NV_DEVICE_INFO_ENGINE_BSP                    NV_DEVICE_INFO(0x00000005)
+#define NV_DEVICE_INFO_ENGINE_VP                     NV_DEVICE_INFO(0x00000006)
+#define NV_DEVICE_INFO_ENGINE_CE                     NV_DEVICE_INFO(0x00000007)
+#define NV_DEVICE_INFO_ENGINE_SEC                    NV_DEVICE_INFO(0x00000008)
+#define NV_DEVICE_INFO_ENGINE_MSVLD                  NV_DEVICE_INFO(0x00000009)
+#define NV_DEVICE_INFO_ENGINE_MSPDEC                 NV_DEVICE_INFO(0x0000000a)
+#define NV_DEVICE_INFO_ENGINE_MSPPP                  NV_DEVICE_INFO(0x0000000b)
+#define NV_DEVICE_INFO_ENGINE_MSENC                  NV_DEVICE_INFO(0x0000000c)
+#define NV_DEVICE_INFO_ENGINE_VIC                    NV_DEVICE_INFO(0x0000000d)
+#define NV_DEVICE_INFO_ENGINE_SEC2                   NV_DEVICE_INFO(0x0000000e)
+#define NV_DEVICE_INFO_ENGINE_NVDEC                  NV_DEVICE_INFO(0x0000000f)
+#define NV_DEVICE_INFO_ENGINE_NVENC                  NV_DEVICE_INFO(0x00000010)
 #endif
index 3526516..42a552d 100644 (file)
@@ -67,6 +67,31 @@ nvkm_udevice_info_v1(struct nvkm_device *device,
        }
 
        switch (args->mthd) {
+#define ENGINE__(A,B,C) NV_DEVICE_INFO_ENGINE_##A: { int _i;                   \
+       for (_i = (B), args->data = 0ULL; _i <= (C); _i++) {                   \
+               if (nvkm_device_engine(device, _i))                            \
+                       args->data |= BIT_ULL(_i);                             \
+       }                                                                      \
+}
+#define ENGINE_A(A) ENGINE__(A, NVKM_ENGINE_##A   , NVKM_ENGINE_##A)
+#define ENGINE_B(A) ENGINE__(A, NVKM_ENGINE_##A##0, NVKM_ENGINE_##A##_LAST)
+       case ENGINE_A(SW    ); break;
+       case ENGINE_A(GR    ); break;
+       case ENGINE_A(MPEG  ); break;
+       case ENGINE_A(ME    ); break;
+       case ENGINE_A(CIPHER); break;
+       case ENGINE_A(BSP   ); break;
+       case ENGINE_A(VP    ); break;
+       case ENGINE_B(CE    ); break;
+       case ENGINE_A(SEC   ); break;
+       case ENGINE_A(MSVLD ); break;
+       case ENGINE_A(MSPDEC); break;
+       case ENGINE_A(MSPPP ); break;
+       case ENGINE_A(MSENC ); break;
+       case ENGINE_A(VIC   ); break;
+       case ENGINE_A(SEC2  ); break;
+       case ENGINE_A(NVDEC ); break;
+       case ENGINE_B(NVENC ); break;
        default:
                args->mthd = NV_DEVICE_INFO_INVALID;
                break;