etnaviv: add etna_pipe_wait_ns(..)

We 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(..).

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
main
Christian Gmeiner 2016-11-23 22:09:11 +01:00
parent 4f750ec756
commit d15515aea3
3 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,7 @@ etna_gpu_get_param
etna_pipe_new etna_pipe_new
etna_pipe_del etna_pipe_del
etna_pipe_wait etna_pipe_wait
etna_pipe_wait_ns
etna_bo_new etna_bo_new
etna_bo_from_handle etna_bo_from_handle
etna_bo_from_name etna_bo_from_name

View File

@ -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); struct etna_pipe *etna_pipe_new(struct etna_gpu *gpu, enum etna_pipe_id id);
void etna_pipe_del(struct etna_pipe *pipe); 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(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: /* buffer-object functions:

View File

@ -31,6 +31,11 @@
#include "etnaviv_priv.h" #include "etnaviv_priv.h"
int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms) 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; struct etna_device *dev = pipe->gpu->dev;
int ret; int ret;
@ -40,10 +45,10 @@ int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
.fence = timestamp, .fence = timestamp,
}; };
if (ms == 0) if (ns == 0)
req.flags |= ETNA_WAIT_NONBLOCK; 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)); ret = drmCommandWrite(dev->fd, DRM_ETNAVIV_WAIT_FENCE, &req, sizeof(req));
if (ret) { if (ret) {