Commit 6eb01aa8 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/device: support querying available engines of a specific type

Will be used for fifo runlist selection.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent c5c9127b
......@@ -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
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment