etna_pipe_wait_ns(..)
v4 cover etna_pipe_wait_ns(..)
Add an API to pass the timeout value (ns) from pipe->fence_finish(..) to the kernel. The current API accepts ms and special handling is needed for PIPE_TIMEOUT_INFINITE.
The idea is not to break old mesa (out-of-tree) + new libdrm.
Changes from v2 to v3:
- Builds at each step
- Keep the _ns postfix of get_abs_timeout_ns(..)
Changes from v3 to v4:
- Rework the patches based on Emil's suggestion.
Christian Gmeiner (2):
etnaviv: change get_abs_timeout(..) to use ns.
etnaviv: add etna_pipe_wait_ns(..)
etnaviv/etnaviv-symbol-check | 1 + etnaviv/etnaviv_bo.c | 2 +- etnaviv/etnaviv_drmif.h | 1 + etnaviv/etnaviv_pipe.c | 9 +++++++-- etnaviv/etnaviv_priv.h | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 1/2 etnaviv: change get_abs_timeout(..) to use ns.
Also update all callers.
--- etnaviv/etnaviv_bo.c | 2 +- etnaviv/etnaviv_pipe.c | 2 +- etnaviv/etnaviv_priv.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-)
etnaviv/etnaviv_bo.c +1 -1
@@ -330,7 +330,7 @@ int etna_bo_cpu_prep(struct etna_bo *bo, uint32_t op) .op = op, }; -get_abs_timeout (&req.timeout,5000 ); +get_abs_timeout (&req.timeout,5000000000 );return drmCommandWrite (bo->dev->fd,DRM_ETNAVIV_GEM_CPU_PREP , &req,sizeof (req));
etnaviv/etnaviv_pipe.c +1 -1
@@ -43,7 +43,7 @@ int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)if (ms ==0 ) req.flags |=ETNA_WAIT_NONBLOCK ; -get_abs_timeout (&req.timeout, ms); +get_abs_timeout (&req.timeout, ms *1000000 ); ret =drmCommandWrite (dev->fd,DRM_ETNAVIV_WAIT_FENCE , &req,sizeof (req));if (ret) {
etnaviv/etnaviv_priv.h +3 -3
@@ -189,13 +189,13 @@ struct etna_cmd_stream_priv {#define VOID2U64 (x) ((uint64_t)(unsigned long)(x)) -static inline void get_abs_timeout (struct drm_etnaviv_timespec *tv,uint32_t ms) +static inline void get_abs_timeout (struct drm_etnaviv_timespec *tv,uint64_t ns) {struct timespec t; -uint32_t s = ms /1000 ; +uint32_t s = ns /1000000000 ;clock_gettime (CLOCK_MONOTONIC , &t); tv->tv_sec = t.tv_sec + s; - tv->tv_nsec = t.tv_nsec + ((ms - (s *1000 )) *1000000 ); + tv->tv_nsec = t.tv_nsec + ns - (s *1000000000 ); }#endif /* ETNAVIV_PRIV_H_ */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 2/2 etnaviv: add etna_pipe_wait_ns(..)
In reply to Christian GmeinerWe need to pass through a timeout parameter to implement pipe->fence_finish() properly. The new fxn accepts a timeout in nanoseconds. Simplify etna_pipe_wait(..) by using etna_pipe_wait_ns(..).
--- etnaviv/etnaviv-symbol-check | 1 + etnaviv/etnaviv_drmif.h | 1 + etnaviv/etnaviv_pipe.c | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-)
etnaviv/etnaviv-symbol-check +1 -0
@@ -21,6 +21,7 @@ etna_gpu_get_param etna_pipe_new etna_pipe_del etna_pipe_wait +etna_pipe_wait_ns etna_bo_new etna_bo_from_handle etna_bo_from_name
etnaviv/etnaviv_drmif.h +1 -0
@@ -104,6 +104,7 @@ int etna_gpu_get_param(struct etna_gpu *gpu, enum etna_param_id param,struct etna_pipe *etna_pipe_new (struct etna_gpu *gpu,enum etna_pipe_id id);void etna_pipe_del (struct etna_pipe *pipe);int etna_pipe_wait (struct etna_pipe *pipe,uint32_t timestamp,uint32_t ms); +int etna_pipe_wait_ns (struct etna_pipe *pipe,uint32_t timestamp,uint64_t ns);/* buffer-object functions:
etnaviv/etnaviv_pipe.c +7 -2
@@ -32,6 +32,11 @@int etna_pipe_wait (struct etna_pipe *pipe,uint32_t timestamp,uint32_t ms) { +return etna_pipe_wait_ns (pipe, timestamp, ms *1000000 ); +} + +int etna_pipe_wait_ns (struct etna_pipe *pipe,uint32_t timestamp,uint64_t ns) +{struct etna_device *dev = pipe->gpu->dev;int ret;
@@ -40,10 +45,10 @@ int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms) .fence = timestamp, }; -if (ms ==0 ) +if (ns ==0 ) req.flags |=ETNA_WAIT_NONBLOCK ; -get_abs_timeout (&req.timeout, ms *1000000 ); +get_abs_timeout (&req.timeout, ns); ret =drmCommandWrite (dev->fd,DRM_ETNAVIV_WAIT_FENCE , &req,sizeof (req));if (ret) {
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Christian Gmeiner
Add an API to pass the timeout value (ns) from
pipe->fence_finish(..)to the kernel. The current API accepts ms and special handling is needed forPIPE_TIMEOUT_INFINITE.
Quoted 9 lines
The idea is not to break old mesa (out-of-tree) + new libdrm.
Changes from v2 to v3:
- Builds at each step
- Keep the_nspostfix ofget_abs_timeout_ns(..)Changes from v3 to v4:
- Rework the patches based on Emil's suggestion.
Fwiw v4 is
Thanks
Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel