drm/nouveau: Add getparam for current PTIMER time.
Subsystems (3)
PATCH v2 1/1 drm/nouveau: Add getparam for current PTIMER time.
This will be useful for computing GPU-CPU latency, including GL_ARB_timer_query extension.
--- drivers/gpu/drm/nouveau/nouveau_state.c | 3 +++ include/drm/nouveau_drm.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-)
drivers/gpu/drm/nouveau/nouveau_state.c +3 -0
@@ -859,6 +859,9 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data,case NOUVEAU_GETPARAM_VM_VRAM_BASE : getparam->value = dev_priv->vm_vram_base;break ; +case NOUVEAU_GETPARAM_PTIMER_TIME : + getparam->value = dev_priv->engine.timer.read (dev); +break ;case NOUVEAU_GETPARAM_GRAPH_UNITS :/* NV40 and NV50 versions are quite different, but register * address is the same. User is supposed to know the card
include/drm/nouveau_drm.h +1 -0
@@ -79,6 +79,7 @@ struct drm_nouveau_gpuobj_free {#define NOUVEAU_GETPARAM_CHIPSET_ID 11#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12#define NOUVEAU_GETPARAM_GRAPH_UNITS 13 +#define NOUVEAU_GETPARAM_PTIMER_TIME 14struct drm_nouveau_getparam {uint64_t param;uint64_t value;
Signature · 6 lines
1.7.0.2 _______________________________________________ Nouveau mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): 1274614564-8167-1-git-send-email-koriakin-mP9o5jsk0RY@public.gmane.org
Quoted 2 lines · Marcin Kościelnicki
This will be useful for computing GPU-CPU latency, including
GL_ARB_timer_queryextension.
Looks fine, just a quick question as to whether this is necessary? I seem to recall that on nv40, the QUERY methods actually return timestamps in the "notifier" that one would assume are from PTIMER.
Is there some way to do this on G80+ also?
Ben.
Quoted 26 lines
Signed-off-by Marcin Kościelnicki <[email protected]>--- drivers/gpu/drm/nouveau/nouveau_state.c | 3 +++ include/drm/nouveau_drm.h | 1 + 2 files changed, 4 insertions(+), 0 deletions(-)drivers/gpu/drm/nouveau/nouveau_state.c +3
-0@@ -859,6 +859,9 @@ int nouveau_ioctl_getparam(struct drm_device *dev, void *data,case NOUVEAU_GETPARAM_VM_VRAM_BASE : getparam->value = dev_priv->vm_vram_base;break ; +case NOUVEAU_GETPARAM_PTIMER_TIME : + getparam->value = dev_priv->engine.timer.read (dev); +break ;case NOUVEAU_GETPARAM_GRAPH_UNITS :/* NV40 and NV50 versions are quite different, but register * address is the same. User is supposed to know the card include/drm/nouveau_drm.h +0
-0
include/drm/nouveau_drm.h struct drm_nouveau_gpuobj_free { · line 85
Quoted 7 lines
include/drm/nouveau_drm.h +1
-0@@ -79,6 +79,7 @@ struct drm_nouveau_gpuobj_free {#define NOUVEAU_GETPARAM_CHIPSET_ID 11#define NOUVEAU_GETPARAM_VM_VRAM_BASE 12#define NOUVEAU_GETPARAM_GRAPH_UNITS 13 +#define NOUVEAU_GETPARAM_PTIMER_TIME 14struct drm_nouveau_getparam {uint64_t param;uint64_t value;
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
Quoted 9 lines · Marcin Kościelnicki
Quoted 2 lines
This will be useful for computing GPU-CPU latency, including
GL_ARB_timer_queryextension.Looks fine, just a quick question as to whether this is necessary? I seem to recall that on nv40, the QUERY methods actually return timestamps in the "notifier" that one would assume are from PTIMER.
Is there some way to do this on G80+ also?
There is. Notifiers and QUERYs and PFIFO FENCEs all return PTIMER time. But that's not the point - all of these commands execute on GPU inside the GPU command stream, and we want a CPU version. See the GL_ARB_timer_query extension for details... generic idea:
1. Submit lots of commands
2. Add a GPU timestamp query at the end
3. Fire
4. Get current GPU time at the moment of firing [via the above getparam]
5. Do something else for some time, like rendering another frame
6. Substract results from 2. and 4. to measure how far ahead the CPU is at the end of a frame [CPU-GPU latency]
Using another query at the beginning of the command buffer won't do the trick, since GPU could still be busy rendering previous frame. Unless you glFinish, but this results in pipeline stalls.
Marcin Kościelnicki
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 23 lines · Marcin Kościelnicki
Quoted 9 lines · Marcin Kościelnicki
Quoted 2 lines
This will be useful for computing GPU-CPU latency, including
GL_ARB_timer_queryextension.Looks fine, just a quick question as to whether this is necessary? I seem to recall that on nv40, the QUERY methods actually return timestamps in the "notifier" that one would assume are from PTIMER.
Is there some way to do this on G80+ also?
There is. Notifiers and QUERYs and PFIFO FENCEs all return PTIMER time. But that's not the point - all of these commands execute on GPU inside the GPU command stream, and we want a CPU version. See the
GL_ARB_timer_queryextension for details... generic idea:1. Submit lots of commands
2. Add a GPU timestamp query at the end
3. Fire
4. Get current GPU time at the moment of firing [via the above getparam]
5. Do something else for some time, like rendering another frame
6. Substract results from 2. and 4. to measure how far ahead the CPU is at the end of a frame [CPU-GPU latency]
Quoted 3 lines
Using another query at the beginning of the command buffer won't do the trick, since GPU could still be busy rendering previous frame. Unless you glFinish, but this results in pipeline stalls.
Sure it will, since {EXT,ARB}_timer_query actually says that it measures the time it takes for the commands between a BeginQuery() and and EndQuery() to be processed, not the time before all commands before the BeginQuery() right up until the EndQuery() have completed.
A snippet from ARB_timer_query:
The timer is started or stopped when the effects from all previous commands on the GL client and server state and the framebuffer have been fully realized.
Which, to me, seem like using the GPU methods to write timestamps into buffers at BeginQuery() and EndQuery() time will work just fine. Or am I missing something?
Ben.
Quoted 2 lines
Marcin Kościelnicki
_______________________________________________
Nouveau mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau