diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 14:54:16 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-28 12:40:33 +1000 |
commit | d61f4c178cb36a7b15871fcc60814f1f94a5044d (patch) | |
tree | 469d6ef1c795c9af5df43f582c033397a651de0b /drivers/gpu/drm/nouveau/nvkm/engine | |
parent | 159045cdc460794df27e2cc624a9641be5c54b23 (diff) |
drm/nouveau/nvif: device time mthd
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/engine')
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/engine/device/user.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c index e44d60739b56..cb3f3deefb01 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/user.c @@ -26,6 +26,7 @@ #include <core/client.h> #include <subdev/fb.h> #include <subdev/instmem.h> +#include <subdev/timer.h> #include <nvif/class.h> #include <nvif/unpack.h> @@ -112,11 +113,31 @@ nvkm_udevice_info(struct nvkm_object *object, void *data, u32 size) } static int +nvkm_udevice_time(struct nvkm_object *object, void *data, u32 size) +{ + struct nvkm_udevice *udev = (void *)object; + struct nvkm_device *device = udev->device; + struct nvkm_timer *tmr = device->timer; + union { + struct nv_device_time_v0 v0; + } *args = data; + int ret; + + if (nvif_unpack(args->v0, 0, 0, false)) { + args->v0.time = tmr->read(tmr); + } + + return ret; +} + +static int nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) { switch (mthd) { case NV_DEVICE_V0_INFO: return nvkm_udevice_info(object, data, size); + case NV_DEVICE_V0_TIME: + return nvkm_udevice_time(object, data, size); default: break; } |