summaryrefslogtreecommitdiff
path: root/lib/media_fill.c
diff options
context:
space:
mode:
authorTony Ye <tony.ye@intel.com>2018-11-13 14:36:28 +0000
committerTvrtko Ursulin <tvrtko.ursulin@intel.com>2019-02-05 12:23:09 +0000
commitc4b2b2f07fe8231afb8514fab19218dec95d562d (patch)
treed3f9c878c0041baff61b2aa57506a029a4b0bfd7 /lib/media_fill.c
parent5b31f04ae8cc4b922a7a8a6f5da639865a4cacd3 (diff)
tests/gem_media_vme: Simple test to exercise the VME block
Simple test which exercises the VME fixed function block. v2: (Tvrtko Ursulin) * Small cleanups like copyright date, tabs, remove unused bits. v3: (Tony Ye) * Added curbe data entry for dst surface. * Read the dst surface after the VME kernel being executed. v4: (Tony Ye) * Added the media_vme.gxa kernel source code and compile instructions. v5: (Tvrtko Ursulin) * Added hang detector. v6: (Tvrtko Ursulin) * Replace gem_read with gem_sync. (Chris Wilson) Signed-off-by: Tony Ye <tony.ye@intel.com> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Cc: Tony Ye <tony.ye@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Diffstat (limited to 'lib/media_fill.c')
-rw-r--r--lib/media_fill.c110
1 files changed, 110 insertions, 0 deletions
diff --git a/lib/media_fill.c b/lib/media_fill.c
index 49422295..b1e84727 100644
--- a/lib/media_fill.c
+++ b/lib/media_fill.c
@@ -61,6 +61,46 @@ static const uint32_t gen8_media_kernel[][4] = {
{ 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 },
};
+static const uint32_t gen11_media_vme_kernel[][4] = {
+ { 0x00600001, 0x20302e68, 0x00000000, 0x20000000 },
+ { 0x00600001, 0x22802e68, 0x00000000, 0x00000001 },
+ { 0x00000001, 0x20284f2c, 0x00000000, 0x3818000c },
+ { 0x00600001, 0x22902e68, 0x00000000, 0x00000010 },
+ { 0x00600001, 0x22a02e68, 0x00000000, 0x00010000 },
+ { 0x00000001, 0x202c4f2c, 0x00000000, 0x22222222 },
+ { 0x00000040, 0x22000a20, 0x0e000020, 0x10782000 },
+ { 0x00600001, 0x20404f28, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x20a04f28, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x20c04f28, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x21204f28, 0x00000000, 0x00000000 },
+ { 0x00600001, 0x20601a28, 0x008d0030, 0x00000000 },
+ { 0x00600041, 0x20800a28, 0x1a000028, 0x008d0280 },
+ { 0x00600041, 0x20e01a28, 0x1e8d0290, 0x01000100 },
+ { 0x00600041, 0x21000a28, 0x1a00002c, 0x008d02a0 },
+ { 0x00000001, 0x22284f2c, 0x00000000, 0x00000000 },
+ { 0x0d80c031, 0x21404a48, 0x00000040, 0x00000200 },
+ { 0x00000001, 0x215c4708, 0x00000000, 0xbeefbeef },
+ { 0x00000040, 0x22000204, 0x06000024, 0x020a0400 },
+ { 0x00000001, 0x215e4708, 0x00000000, 0xdeaddead },
+ { 0x00000001, 0x22484f2c, 0x00000000, 0x00000008 },
+ { 0x00000001, 0x22684f2c, 0x00000000, 0x0000000c },
+ { 0x00600001, 0x2fe04b2c, 0x008d0000, 0x00000000 },
+ { 0x0a800033, 0x0000a054, 0x00002224, 0x00000000 },
+ { 0x00000040, 0x22000204, 0x06000024, 0x020a0300 },
+ { 0x0a800033, 0x0000e054, 0x00002242, 0x00000000 },
+ { 0x00000040, 0x22000204, 0x06000024, 0x020a0200 },
+ { 0x0a600033, 0x00010014, 0x00002261, 0x00000000 },
+ { 0x07600031, 0x20004a04, 0x06000fe0, 0x82000010 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+ { 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
+};
+
/*
* This sets up the media pipeline,
*
@@ -245,3 +285,73 @@ gen9_media_fillfunc(struct intel_batchbuffer *batch,
gen8_media_kernel, sizeof(gen8_media_kernel));
}
+
+static void
+__gen11_media_vme_func(struct intel_batchbuffer *batch,
+ const struct igt_buf *src,
+ unsigned int width, unsigned int height,
+ const struct igt_buf *dst,
+ 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];
+
+ curbe_buffer = gen11_fill_curbe_buffer_data(batch);
+ interface_descriptor = gen11_fill_interface_descriptor(batch, src, dst,
+ kernel, kernel_size);
+ assert(batch->ptr < &batch->buffer[4095]);
+
+ /* media pipeline */
+ batch->ptr = batch->buffer;
+ OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA |
+ GEN9_FORCE_MEDIA_AWAKE_ENABLE |
+ GEN9_SAMPLER_DOP_GATE_DISABLE |
+ GEN9_PIPELINE_SELECTION_MASK |
+ GEN9_SAMPLER_DOP_GATE_MASK |
+ GEN9_FORCE_MEDIA_AWAKE_MASK);
+ gen9_emit_state_base_address(batch);
+
+ gen8_emit_vfe_state(batch, THREADS, MEDIA_URB_ENTRIES, MEDIA_URB_SIZE,
+ MEDIA_CURBE_SIZE);
+
+ gen7_emit_curbe_load(batch, curbe_buffer);
+
+ gen7_emit_interface_descriptor_load(batch, interface_descriptor);
+
+ gen7_emit_media_objects(batch, 0, 0, width, height);
+
+ OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA |
+ GEN9_FORCE_MEDIA_AWAKE_DISABLE |
+ GEN9_SAMPLER_DOP_GATE_ENABLE |
+ GEN9_PIPELINE_SELECTION_MASK |
+ GEN9_SAMPLER_DOP_GATE_MASK |
+ GEN9_FORCE_MEDIA_AWAKE_MASK);
+
+ OUT_BATCH(MI_BATCH_BUFFER_END);
+
+ batch_end = intel_batchbuffer_align(batch, 8);
+ assert(batch_end < BATCH_STATE_SPLIT);
+
+ gen7_render_flush(batch, batch_end);
+ intel_batchbuffer_reset(batch);
+}
+
+void
+gen11_media_vme_func(struct intel_batchbuffer *batch,
+ const struct igt_buf *src,
+ unsigned int width, unsigned int height,
+ const struct igt_buf *dst)
+{
+ __gen11_media_vme_func(batch,
+ src,
+ width, height,
+ dst,
+ gen11_media_vme_kernel,
+ sizeof(gen11_media_vme_kernel));
+}