diff options
author | Rob Clark <robclark@freedesktop.org> | 2015-08-17 10:33:59 -0400 |
---|---|---|
committer | Rob Clark <robclark@freedesktop.org> | 2015-08-17 14:23:03 -0400 |
commit | 15ba8768f7002d220002d424790ff2e89310c07f (patch) | |
tree | caf70a9e95d69fef514213fafb84ce02c10ee732 | |
parent | 4413f191a051847c53a6150df199d35a106b6cf4 (diff) | |
download | libdrm-15ba8768f7002d220002d424790ff2e89310c07f.tar.gz libdrm-15ba8768f7002d220002d424790ff2e89310c07f.tar.bz2 libdrm-15ba8768f7002d220002d424790ff2e89310c07f.zip |
freedreno: add fd_pipe_wait_timeout()
We need to pass through a timeout parameter to implement
pipe->fence_finish() properly.
Signed-off-by: Rob Clark <robclark@freedesktop.org>
-rw-r--r-- | freedreno/freedreno_drmif.h | 3 | ||||
-rw-r--r-- | freedreno/freedreno_pipe.c | 8 | ||||
-rw-r--r-- | freedreno/freedreno_priv.h | 2 | ||||
-rw-r--r-- | freedreno/kgsl/kgsl_pipe.c | 3 | ||||
-rw-r--r-- | freedreno/msm/msm_bo.c | 2 | ||||
-rw-r--r-- | freedreno/msm/msm_pipe.c | 5 | ||||
-rw-r--r-- | freedreno/msm/msm_priv.h | 6 |
7 files changed, 20 insertions, 9 deletions
diff --git a/freedreno/freedreno_drmif.h b/freedreno/freedreno_drmif.h index 88fc03de..81a14b43 100644 --- a/freedreno/freedreno_drmif.h +++ b/freedreno/freedreno_drmif.h @@ -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: diff --git a/freedreno/freedreno_pipe.c b/freedreno/freedreno_pipe.c index b6fed0a4..4a756d70 100644 --- a/freedreno/freedreno_pipe.c +++ b/freedreno/freedreno_pipe.c @@ -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); } diff --git a/freedreno/freedreno_priv.h b/freedreno/freedreno_priv.h index cb24780d..1dddcc39 100644 --- a/freedreno/freedreno_priv.h +++ b/freedreno/freedreno_priv.h @@ -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); }; diff --git a/freedreno/kgsl/kgsl_pipe.c b/freedreno/kgsl/kgsl_pipe.c index 08c87a62..e2fd65c0 100644 --- a/freedreno/kgsl/kgsl_pipe.c +++ b/freedreno/kgsl/kgsl_pipe.c @@ -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 = { diff --git a/freedreno/msm/msm_bo.c b/freedreno/msm/msm_bo.c index 6dc3776b..fd944131 100644 --- a/freedreno/msm/msm_bo.c +++ b/freedreno/msm/msm_bo.c @@ -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)); } diff --git a/freedreno/msm/msm_pipe.c b/freedreno/msm/msm_pipe.c index ddc975ed..e1edffea 100644 --- a/freedreno/msm/msm_pipe.c +++ b/freedreno/msm/msm_pipe.c @@ -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) { diff --git a/freedreno/msm/msm_priv.h b/freedreno/msm/msm_priv.h index 637cb521..e499b3b8 100644 --- a/freedreno/msm/msm_priv.h +++ b/freedreno/msm/msm_priv.h @@ -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_ */ |