[PATCH RFC 026/111] staging: etnaviv: track the last known GPU position

Lucas Stach l.stach at pengutronix.de
Thu Apr 2 08:29:28 PDT 2015


From: Russell King <rmk+kernel at arm.linux.org.uk>

Signed-off-by: Russell King <rmk+kernel at arm.linux.org.uk>
---
 drivers/staging/etnaviv/etnaviv_buffer.c | 4 ++++
 drivers/staging/etnaviv/etnaviv_gpu.c    | 3 +--
 drivers/staging/etnaviv/etnaviv_gpu.h    | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/etnaviv/etnaviv_buffer.c b/drivers/staging/etnaviv/etnaviv_buffer.c
index be2b02ce9a46..a93d5091828e 100644
--- a/drivers/staging/etnaviv/etnaviv_buffer.c
+++ b/drivers/staging/etnaviv/etnaviv_buffer.c
@@ -159,6 +159,10 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, unsigned int event, struct et
 	link_target = buffer->paddr + buffer->offset * 4;
 	link_size = 6;
 
+	/* Save the event and buffer position of the new event trigger */
+	gpu->event[event].fence = submit->fence;
+	gpu->event[event].ring_pos = buffer->offset;
+
 	/* trigger event */
 	CMD_LOAD_STATE(buffer, VIVS_GL_EVENT, VIVS_GL_EVENT_EVENT_ID(event) | VIVS_GL_EVENT_FROM_PE);
 
diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c
index 55a58cb27a3d..8c88940a2bc6 100644
--- a/drivers/staging/etnaviv/etnaviv_gpu.c
+++ b/drivers/staging/etnaviv/etnaviv_gpu.c
@@ -781,8 +781,6 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu, struct etnaviv_gem_submit *submi
 		goto fail;
 	}
 
-	gpu->event[event].fence = submit->fence;
-
 	etnaviv_buffer_queue(gpu, event, submit);
 
 	priv->lastctx = ctx;
@@ -834,6 +832,7 @@ static irqreturn_t irq_handler(int irq, void *data)
 			uint8_t event = __fls(intr);
 			dev_dbg(gpu->dev->dev, "event %u\n", event);
 			gpu->retired_fence = gpu->event[event].fence;
+			gpu->last_ring_pos = gpu->event[event].ring_pos;
 			event_free(gpu, event);
 			etnaviv_gpu_retire(gpu);
 		}
diff --git a/drivers/staging/etnaviv/etnaviv_gpu.h b/drivers/staging/etnaviv/etnaviv_gpu.h
index 519b9344ed0c..52db3dc54079 100644
--- a/drivers/staging/etnaviv/etnaviv_gpu.h
+++ b/drivers/staging/etnaviv/etnaviv_gpu.h
@@ -81,6 +81,7 @@ struct etnaviv_chip_identity {
 struct etnaviv_event {
 	bool used;
 	uint32_t fence;
+	uint32_t ring_pos;
 };
 
 struct etnaviv_gpu {
@@ -102,6 +103,7 @@ struct etnaviv_gpu {
 
 	uint32_t submitted_fence;
 	uint32_t retired_fence;
+	uint32_t last_ring_pos;
 
 	/* worker for handling active-list retiring: */
 	struct work_struct retire_work;
-- 
2.1.4



More information about the dri-devel mailing list