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>
main
Rob Clark 2015-08-17 10:33:59 -04:00
parent 4413f191a0
commit 15ba8768f7
7 changed files with 20 additions and 9 deletions

View 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, int fd_pipe_get_param(struct fd_pipe *pipe, enum fd_param_id param,
uint64_t *value); uint64_t *value);
int fd_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp); 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: /* buffer-object functions:

View 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) 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);
} }

View File

@ -100,7 +100,7 @@ drm_private void fd_device_del_locked(struct fd_device *dev);
struct fd_pipe_funcs { struct fd_pipe_funcs {
struct fd_ringbuffer * (*ringbuffer_new)(struct fd_pipe *pipe, uint32_t size); 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 (*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); void (*destroy)(struct fd_pipe *pipe);
}; };

View 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_pipe *kgsl_pipe = to_kgsl_pipe(pipe);
struct kgsl_device_waittimestamp req = { struct kgsl_device_waittimestamp req = {

View File

@ -75,7 +75,7 @@ static int msm_bo_cpu_prep(struct fd_bo *bo, struct fd_pipe *pipe, uint32_t op)
.op = 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)); return drmCommandWrite(bo->dev->fd, DRM_MSM_GEM_CPU_PREP, &req, sizeof(req));
} }

View 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 fd_device *dev = pipe->dev;
struct drm_msm_wait_fence req = { struct drm_msm_wait_fence req = {
@ -62,7 +63,7 @@ static int msm_pipe_wait(struct fd_pipe *pipe, uint32_t timestamp)
}; };
int ret; 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)); ret = drmCommandWrite(dev->fd, DRM_MSM_WAIT_FENCE, &req, sizeof(req));
if (ret) { if (ret) {

View 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, drm_private struct fd_bo * msm_bo_from_handle(struct fd_device *dev,
uint32_t size, uint32_t handle); 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; struct timespec t;
uint32_t s = ms / 1000; uint32_t s = ns / 1000000000;
clock_gettime(CLOCK_MONOTONIC, &t); clock_gettime(CLOCK_MONOTONIC, &t);
tv->tv_sec = t.tv_sec + s; 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_ */ #endif /* MSM_PRIV_H_ */