freedreno: add fd_pipe_wait_timeout()
authorRob Clark <robclark@freedesktop.org>
Mon, 17 Aug 2015 14:33:59 +0000 (10:33 -0400)
committerRob Clark <robclark@freedesktop.org>
Mon, 17 Aug 2015 18:23:03 +0000 (14:23 -0400)
We need to pass through a timeout parameter to implement
pipe->fence_finish() properly.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
freedreno/freedreno_drmif.h
freedreno/freedreno_pipe.c
freedreno/freedreno_priv.h
freedreno/kgsl/kgsl_pipe.c
freedreno/msm/msm_bo.c
freedreno/msm/msm_pipe.c
freedreno/msm/msm_priv.h

index 88fc03d..81a14b4 100644 (file)
@@ -86,6 +86,9 @@ void fd_pipe_del(struct fd_pipe *pipe);
 int fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param,
                uint64_t *value);
 int fd_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp);
+/* timeout in nanosec */
+int fd_pipe_wait_timeout(struct fd_pipe *pipe, uint32_t timestamp,
+               uint64_t timeout);
 
 
 /* buffer-object functions:
index b6fed0a..4a756d7 100644 (file)
@@ -72,5 +72,11 @@ int fd_pipe_get_param(struct fd_pipe *pipe,
 
 int fd_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
 {
-       return pipe->funcs->wait(pipe, timestamp);
+       return fd_pipe_wait_timeout(pipe, timestamp, ~0);
+}
+
+int fd_pipe_wait_timeout(struct fd_pipe *pipe, uint32_t timestamp,
+               uint64_t timeout)
+{
+       return pipe->funcs->wait(pipe, timestamp, timeout);
 }
index cb24780..1dddcc3 100644 (file)
@@ -100,7 +100,7 @@ drm_private void fd_device_del_locked(struct fd_device *dev);
 struct fd_pipe_funcs {
        struct fd_ringbuffer * (*ringbuffer_new)(struct fd_pipe *pipe, uint32_t size);
        int (*get_param)(struct fd_pipe *pipe, enum fd_param_id param, uint64_t *value);
-       int (*wait)(struct fd_pipe *pipe, uint32_t timestamp);
+       int (*wait)(struct fd_pipe *pipe, uint32_t timestamp, uint64_t timeout);
        void (*destroy)(struct fd_pipe *pipe);
 };
 
index 08c87a6..e2fd65c 100644 (file)
@@ -56,7 +56,8 @@ static int kgsl_pipe_get_param(struct fd_pipe *pipe,
        }
 }
 
-static int kgsl_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
+static int kgsl_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp,
+               uint64_t timeout)
 {
        struct kgsl_pipe *kgsl_pipe = to_kgsl_pipe(pipe);
        struct kgsl_device_waittimestamp req = {
index 6dc3776..fd94413 100644 (file)
@@ -75,7 +75,7 @@ static int msm_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op)
                        .op = op,
        };
 
-       get_abs_timeout(&req.timeout, 5000);
+       get_abs_timeout(&req.timeout, 5000000000);
 
        return drmCommandWrite(bo->dev->fd, DRM_MSM_GEM_CPU_PREP, &req, sizeof(req));
 }
index ddc975e..e1edffe 100644 (file)
@@ -54,7 +54,8 @@ static int msm_pipe_get_param(struct fd_pipe *pipe,
        }
 }
 
-static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
+static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp,
+               uint64_t timeout)
 {
        struct fd_device *dev = pipe->dev;
        struct drm_msm_wait_fence req = {
@@ -62,7 +63,7 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
        };
        int ret;
 
-       get_abs_timeout(&req.timeout, 5000);
+       get_abs_timeout(&req.timeout, timeout);
 
        ret = drmCommandWrite(dev->fd, DRM_MSM_WAIT_FENCE, &req, sizeof(req));
        if (ret) {
index 637cb52..e499b3b 100644 (file)
@@ -96,13 +96,13 @@ drm_private int msm_bo_new_handle(struct fd_device *dev,
 drm_private struct fd_bo * msm_bo_from_handle(struct fd_device *dev,
                uint32_t size, uint32_t handle);
 
-static inline void get_abs_timeout(struct drm_msm_timespec *tv, uint32_t ms)
+static inline void get_abs_timeout(struct drm_msm_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 /* MSM_PRIV_H_ */