[igt-dev] [PATCH i-g-t v2 1/5] lib/gpu_cmds: Add media pipeline functions based on intel_bb

Zbigniew Kempczyński
2020-05-21T08:39:29Z

Add "_v2" versions of media pipeline creation functions.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
lib/gpu_cmds.c | 43 +++++++++++++++++++++++++++++++++++++++++++
lib/gpu_cmds.h | 11 +++++++++++
2 files changed, 54 insertions(+)

diff --git a/lib/gpu_cmds.c b/lib/gpu_cmds.c
index 788f2eb6..2eb09cd4 100644
--- a/lib/gpu_cmds.c
+++ b/lib/gpu_cmds.c
@@ -1331,3 +1331,46 @@ gen8_emit_gpgpu_walk_v2(struct intel_bb *ibb,
/* bottom mask, height 1, always 0xffffffff */
intel_bb_out(ibb, 0xffffffff);
}
+
+void
+gen8_emit_media_state_flush_v2(struct intel_bb *ibb)
+{
+ intel_bb_out(ibb, GEN8_MEDIA_STATE_FLUSH | (2 - 2));
+ intel_bb_out(ibb, 0);
+}
+
+void
+gen_emit_media_object_v2(struct intel_bb *ibb,
+ unsigned int xoffset, unsigned int yoffset)
+{
+ intel_bb_out(ibb, GEN7_MEDIA_OBJECT | (8 - 2));
+
+ /* interface descriptor offset */
+ intel_bb_out(ibb, 0);
+
+ /* without indirect data */
+ intel_bb_out(ibb, 0);
+ intel_bb_out(ibb, 0);
+
+ /* scoreboard */
+ intel_bb_out(ibb, 0);
+ intel_bb_out(ibb, 0);
+
+ /* inline data (xoffset, yoffset) */
+ intel_bb_out(ibb, xoffset);
+ intel_bb_out(ibb, yoffset);
+ if (AT_LEAST_GEN(ibb->devid, 8) && !IS_CHERRYVIEW(ibb->devid))
+ gen8_emit_media_state_flush_v2(ibb);
+}
+
+void
+gen7_emit_media_objects_v2(struct intel_bb *ibb,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height)
+{
+ int i, j;
+
+ for (i = 0; i < width / 16; i++)
+ for (j = 0; j < height / 16; j++)
+ gen_emit_media_object_v2(ibb, x + i * 16, y + j * 16);
+}
diff --git a/lib/gpu_cmds.h b/lib/gpu_cmds.h
index 61aff153..ab5fe74b 100644
--- a/lib/gpu_cmds.h
+++ b/lib/gpu_cmds.h
@@ -202,4 +202,15 @@ gen8_emit_gpgpu_walk_v2(struct intel_bb *ibb,
unsigned int x, unsigned int y,
unsigned int width, unsigned int height);

+void
+gen8_emit_media_state_flush_v2(struct intel_bb *ibb);
+
+void
+gen_emit_media_object_v2(struct intel_bb *ibb,
+ unsigned int xoffset, unsigned int yoffset);
+
+void
+gen7_emit_media_objects_v2(struct intel_bb *ibb,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height);
#endif /* GPU_CMDS_H */