[igt-dev] [PATCH i-g-t v15 2/3] igt/lib: Use proper functions to gen11+ gpgpu_fill

Stanislav Lisovskiy stanislav.lisovskiy at intel.com
Thu Dec 12 09:46:00 UTC 2019


From: "Lisovskiy, Stanislav" <stanislav.lisovskiy at intel.com>

gen11_fill_curbe_buffer_data and gen11_fill_interface_descriptor
are there but for some reason gen12_gpgpu_fill still uses
those from gen8, which seems to cause ocassional input/output error
in gen7_render_flush.

Change-Id: I99e6f65230d242235cf037a40e7def471eb097ac
Signed-off-by: Stanislav Lisovskiy <stanislav.lisovskiy at intel.com>
---
 lib/gpgpu_fill.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 52 insertions(+), 2 deletions(-)

diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c
index ec7204b8..15931782 100644
--- a/lib/gpgpu_fill.c
+++ b/lib/gpgpu_fill.c
@@ -276,6 +276,56 @@ __gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 	intel_batchbuffer_reset(batch);
 }
 
+static void
+__gen11_gpgpu_fillfunc(struct intel_batchbuffer *batch,
+		      const struct igt_buf *dst,
+		      unsigned int x, unsigned int y,
+		      unsigned int width, unsigned int height,
+		      uint8_t color, const uint32_t kernel[][4],
+		      size_t kernel_size)
+{
+	uint32_t curbe_buffer, interface_descriptor;
+	uint32_t batch_end;
+
+	intel_batchbuffer_flush(batch);
+
+	/* setup states */
+	batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
+
+	/*
+	 * const buffer needs to fill for every thread, but as we have just 1
+	 * thread per every group, so need only one curbe data.
+	 * For each thread, just use thread group ID for buffer offset.
+	 */
+	curbe_buffer = gen11_fill_curbe_buffer_data(batch);
+
+	interface_descriptor = gen11_fill_interface_descriptor(batch, dst, dst,
+				kernel, kernel_size);
+
+	igt_assert(batch->ptr < &batch->buffer[4095]);
+
+	batch->ptr = batch->buffer;
+
+	/* GPGPU pipeline */
+	OUT_BATCH(GEN7_PIPELINE_SELECT | GEN9_PIPELINE_SELECTION_MASK |
+		  PIPELINE_SELECT_GPGPU);
+
+	gen9_emit_state_base_address(batch);
+	gen8_emit_vfe_state(batch, THREADS, GEN8_GPGPU_URB_ENTRIES,
+			    GPGPU_URB_SIZE, GPGPU_CURBE_SIZE);
+	gen7_emit_curbe_load(batch, curbe_buffer);
+	gen7_emit_interface_descriptor_load(batch, interface_descriptor);
+	gen8_emit_gpgpu_walk(batch, x, y, width, height);
+
+	OUT_BATCH(MI_BATCH_BUFFER_END);
+
+	batch_end = intel_batchbuffer_align(batch, 8);
+	igt_assert(batch_end < BATCH_STATE_SPLIT);
+
+	gen7_render_flush(batch, batch_end);
+	intel_batchbuffer_reset(batch);
+}
+
 void gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			 const struct igt_buf *dst,
 			 unsigned int x, unsigned int y,
@@ -292,7 +342,7 @@ void gen11_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			  unsigned int width, unsigned int height,
 			  uint8_t color)
 {
-	__gen9_gpgpu_fillfunc(batch, dst, x, y, width, height, color,
+	__gen11_gpgpu_fillfunc(batch, dst, x, y, width, height, color,
 			      gen11_gpgpu_kernel, sizeof(gen11_gpgpu_kernel));
 }
 void gen12p1_gpgpu_fillfunc(struct intel_batchbuffer *batch,
@@ -301,6 +351,6 @@ void gen12p1_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 			  unsigned int width, unsigned int height,
 			  uint8_t color)
 {
-	__gen9_gpgpu_fillfunc(batch, dst, x, y, width, height, color,
+	__gen11_gpgpu_fillfunc(batch, dst, x, y, width, height, color,
 			      gen12p1_gpgpu_kernel, sizeof(gen12p1_gpgpu_kernel));
 }
-- 
2.17.1



More information about the igt-dev mailing list