[igt-dev] [PATCH i-g-t v2 6/7] lib/gpgpu_fill: libdrm-free gpgpu pipeline creation for gen7

Zbigniew Kempczyński zbigniew.kempczynski at intel.com
Fri May 15 06:44:34 UTC 2020


Provide pipeline for gpgpu fill for gen7.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
Cc: Chris Wilson <chris at chris-wilson.co.uk>
---
 lib/gpgpu_fill.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
 lib/gpgpu_fill.h |  8 ++++++++
 2 files changed, 57 insertions(+)

diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c
index 5660d4c0..cc38ccae 100644
--- a/lib/gpgpu_fill.c
+++ b/lib/gpgpu_fill.c
@@ -120,6 +120,7 @@ static const uint32_t gen12_gpgpu_kernel[][4] = {
  *
  */
 
+#define PAGE_SIZE 4096
 #define BATCH_STATE_SPLIT 2048
 /* VFE STATE params */
 #define THREADS 1
@@ -178,6 +179,54 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 	intel_batchbuffer_reset(batch);
 }
 
+void
+gen7_gpgpu_fillfunc_v2(int i915,
+		       struct intel_buf *buf,
+		       unsigned x, unsigned y,
+		       unsigned width, unsigned height,
+		       uint8_t color)
+{
+	struct intel_bb *ibb;
+	uint32_t curbe_buffer, interface_descriptor;
+
+	ibb = intel_bb_create(i915, PAGE_SIZE);
+	intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+	/* Fill curbe buffer data */
+	curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+
+	/*
+	 * 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.
+	 */
+	interface_descriptor =
+			gen7_fill_interface_descriptor_v2(ibb, buf,
+							  gen7_gpgpu_kernel,
+							  sizeof(gen7_gpgpu_kernel));
+
+	intel_bb_ptr_set(ibb, 0);
+
+	/* GPGPU pipeline */
+	intel_bb_out(ibb, GEN7_PIPELINE_SELECT | PIPELINE_SELECT_GPGPU);
+
+	gen7_emit_state_base_address_v2(ibb);
+	gen7_emit_vfe_state_v2(ibb, THREADS, GEN7_GPGPU_URB_ENTRIES,
+			       GPGPU_URB_SIZE, GPGPU_CURBE_SIZE,
+			       GEN7_VFE_STATE_GPGPU_MODE);
+	gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+	gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+	gen7_emit_gpgpu_walk_v2(ibb, x, y, width, height);
+
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 32);
+
+	intel_bb_exec(ibb, intel_bb_offset(ibb),
+		      I915_EXEC_DEFAULT | I915_EXEC_NO_RELOC, true);
+
+	intel_bb_destroy(ibb);
+}
+
 void
 gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    const struct igt_buf *dst,
diff --git a/lib/gpgpu_fill.h b/lib/gpgpu_fill.h
index da7d646f..0ba3d033 100644
--- a/lib/gpgpu_fill.h
+++ b/lib/gpgpu_fill.h
@@ -28,6 +28,7 @@
 #define GPGPU_FILL_H
 
 #include "intel_batchbuffer.h"
+#include "intel_bufops.h"
 
 void
 gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
@@ -36,6 +37,13 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    unsigned int width, unsigned int height,
 		    uint8_t color);
 
+void
+gen7_gpgpu_fillfunc_v2(int i915,
+		       struct intel_buf *buf,
+		       unsigned x, unsigned y,
+		       unsigned width, unsigned height,
+		       uint8_t color);
+
 void
 gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
 		    const struct igt_buf *dst,
-- 
2.26.0



More information about the igt-dev mailing list