Skip to contentSkip to conversation

etna_pipe_wait_ns(..)

PATCH Superseded Christian Gmeiner 1 participant 4 messages Nov 22, 2016

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover etna_pipe_wait_ns(..)

Add an API to pass the timeout value (ns) from pipe->fence_finish(..) to the kernel. The current API accepts ms and special handling is needed for PIPE_TIMEOUT_INFINITE.

The idea is not to break old mesa (out-of-tree) + new libdrm. It may be possible to break etnaviv's ABI as the gallium driver is not upstream yet but I am quite unsure whats the best solution.

Christian Gmeiner (3):
etnaviv: add etna_pipe_wait_ns(..)
etnaviv: simplify etna_pipe_wait(..)
etnaviv: s/get_abs_timeout_ns/get_abs_timeout

 etnaviv/etnaviv-symbol-check | 1 +
 etnaviv/etnaviv_drmif.h      | 1 +
 etnaviv/etnaviv_pipe.c       | 9 +++++++--
 etnaviv/etnaviv_priv.h       | 6 +++---
 4 files changed, 12 insertions(+), 5 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH v2 1/3 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.

---
 etnaviv/etnaviv-symbol-check |  1 +
 etnaviv/etnaviv_drmif.h      |  1 +
 etnaviv/etnaviv_pipe.c       | 24 ++++++++++++++++++++++++
 etnaviv/etnaviv_priv.h       |  9 +++++++++
 4 files changed, 35 insertions(+)
etnaviv/etnaviv-symbol-check +1 -0
index 72f2bc5..22afd16 100755
@@ -21,6 +21,7 @@ etna_gpu_get_param
 etna_pipe_new
 etna_pipe_del
 etna_pipe_wait
+etna_pipe_wait_ns
 etna_bo_new
 etna_bo_from_handle
 etna_bo_from_name
etnaviv/etnaviv_drmif.h +1 -0
index fe9d5db..8119baa 100644
@@ -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);
 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_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns);
 
 
 /* buffer-object functions:
etnaviv/etnaviv_pipe.c +24 -0
index 402b71d..f2e417f 100644
@@ -54,6 +54,30 @@ int etna_pipe_wait(struct etna_pipe *pipe, uint32_t timestamp, uint32_t ms)
 	return 0;
 }
 
+int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns)
+{
+	struct etna_device *dev = pipe->gpu->dev;
+	int ret;
+
+	struct drm_etnaviv_wait_fence req = {
+		.pipe = pipe->gpu->core,
+		.fence = timestamp,
+	};
+
+	if (ns == 0)
+		req.flags |= ETNA_WAIT_NONBLOCK;
+
+	get_abs_timeout_ns(&req.timeout, ns);
+
+	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;
+}
+
 void etna_pipe_del(struct etna_pipe *pipe)
 {
 	free(pipe);
etnaviv/etnaviv_priv.h +9 -0
index eb62ed3..30cc1bd 100644
@@ -198,4 +198,13 @@ static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint32_t ms)
 	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;
+	uint32_t s = ns / 1000000000;
+	clock_gettime(CLOCK_MONOTONIC, &t);
+	tv->tv_sec = t.tv_sec + s;
+	tv->tv_nsec = t.tv_nsec + ns - (s * 1000000000);
+}
+
 #endif /* ETNAVIV_PRIV_H_ */
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

PATCH v2 2/3 etnaviv: simplify etna_pipe_wait(..)

In reply to Christian Gmeiner

We can make use of etna_pipe_wait_ns(..).

---
 etnaviv/etnaviv_pipe.c | 21 +--------------------
 etnaviv/etnaviv_priv.h |  9 ---------
 2 files changed, 1 insertion(+), 29 deletions(-)
etnaviv/etnaviv_pipe.c +1 -20
index f2e417f..6951362 100644
@@ -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)
etnaviv/etnaviv_priv.h +0 -9
index 30cc1bd..667bf23 100644
@@ -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;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH v2 3/3 etnaviv: s/get_abs_timeout_ns/get_abs_timeout

In reply to Christian Gmeiner
---
 etnaviv/etnaviv_pipe.c | 2 +-
 etnaviv/etnaviv_priv.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
etnaviv/etnaviv_pipe.c +1 -1
index 6951362..94c5d37 100644
@@ -48,7 +48,7 @@ int etna_pipe_wait_ns(struct etna_pipe *pipe, uint32_t timestamp, uint64_t ns)
 	if (ns == 0)
 		req.flags |= ETNA_WAIT_NONBLOCK;
 
-	get_abs_timeout_ns(&req.timeout, ns);
+	get_abs_timeout(&req.timeout, ns);
 
 	ret = drmCommandWrite(dev->fd, DRM_ETNAVIV_WAIT_FENCE, &req, sizeof(req));
 	if (ret) {
etnaviv/etnaviv_priv.h +1 -1
index 667bf23..feaa5ad 100644
@@ -189,7 +189,7 @@ struct etna_cmd_stream_priv {
 
 #define VOID2U64(x) ((uint64_t)(unsigned long)(x))
 
-static inline void get_abs_timeout_ns(struct drm_etnaviv_timespec *tv, uint64_t ns)
+static inline void get_abs_timeout(struct drm_etnaviv_timespec *tv, uint64_t ns)
 {
 	struct timespec t;
 	uint32_t s = ns / 1000000000;
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel