We can make use of etna_pipe_wait_ns(..).

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 etnaviv/etnaviv_pipe.c | 21 +--------------------
 etnaviv/etnaviv_priv.h |  9 ---------
 2 files changed, 1 insertion(+), 29 deletions(-)

diff --git a/etnaviv/etnaviv_pipe.c b/etnaviv/etnaviv_pipe.c
index f2e417f..6951362 100644
--- a/etnaviv/etnaviv_pipe.c
+++ b/etnaviv/etnaviv_pipe.c
@@ -32,26 +32,7 @@

 int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
 {
-       struct etna_device *dev = pipe->gpu->dev;
-       int ret;
-
-       struct drm_etnaviv_wait_fence req = {
-               .pipe = pipe->gpu->core,
-               .fence = timestamp,
-       };
-
-       if (ms == 0)
-               req.flags |= ETNA_WAIT_NONBLOCK;
-
-       get_abs_timeout(&req.timeout, ms);
-
-       ret = drmCommandWrite(dev->fd, DRM_ETNAVIV_WAIT_FENCE, &req, 
sizeof(req));
-       if (ret) {
-               ERROR_MSG("wait-fence failed! %d (%s)", ret, strerror(errno));
-               return ret;
-       }
-
-       return 0;
+       return etna_pipe_wait_ns(pipe, timestamp, ms * 1000000);
 }

 int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns)
diff --git a/etnaviv/etnaviv_priv.h b/etnaviv/etnaviv_priv.h
index 30cc1bd..667bf23 100644
--- a/etnaviv/etnaviv_priv.h
+++ b/etnaviv/etnaviv_priv.h
@@ -189,15 +189,6 @@ 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)
-{
-       struct timespec t;
-       uint32_t s = ms / 1000;
-       clock_gettime(CLOCK_MONOTONIC, &t);
-       tv->tv_sec = t.tv_sec + s;
-       tv->tv_nsec = t.tv_nsec + ((ms - (s * 1000)) * 1000000);
-}
-
 static inline void get_abs_timeout_ns(struct drm_etnaviv_timespec *tv, 
uint64_t ns)
 {
        struct timespec t;
-- 
2.7.4

Reply via email to