[PATCH 07/10] drm/etnaviv: process readbacks in interrupt handler

Christian Gmeiner christian.gmeiner at gmail.com
Fri Dec 9 11:21:28 UTC 2016


We can not defere the readback of the registers as the values likely
getting changed by an other command buffer.

Signed-off-by: Christian Gmeiner <christian.gmeiner at gmail.com>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 1fb5e37..2aa1a26 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1369,6 +1369,20 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
 	return ret;
 }
 
+static void etnaviv_process_readbacks(struct etnaviv_gpu *gpu,
+		struct etnaviv_event *event)
+{
+	unsigned i;
+
+	for (i = 0; i < event->nr_readbacks; i++) {
+		const struct etnaviv_readback *readback = event->readbacks + i;
+		const u32 val = gpu_read(gpu, readback->reg);
+		u32 *bo = readback->bo_vma;
+
+		*(bo + readback->offset) = val;
+	}
+}
+
 /*
  * Init/Cleanup:
  */
@@ -1415,6 +1429,9 @@ static irqreturn_t irq_handler(int irq, void *data)
 
 			dev_dbg(gpu->dev, "event %u\n", event);
 
+			if (gpu->event[event].nr_readbacks)
+				etnaviv_process_readbacks(gpu, &gpu->event[event]);
+
 			fence = gpu->event[event].fence;
 			gpu->event[event].fence = NULL;
 			fence_signal(fence);
-- 
2.9.3



More information about the dri-devel mailing list