summaryrefslogtreecommitdiff
path: root/lib/media_fill.c
diff options
context:
space:
mode:
authorZbigniew Kempczyński <zbigniew.kempczynski@intel.com>2020-05-21 10:39:23 +0200
committerChris Wilson <chris@chris-wilson.co.uk>2020-05-21 20:26:53 +0100
commita8373e8069b9aff90f8980695ed15fc26bbf9413 (patch)
tree3ee3739be77e75ad24916468327c2c551f3dcd1a /lib/media_fill.c
parentbc50a54ba71972be175a58be4ae82b45aaa5ca27 (diff)
lib/media_fill: libdrm-free media pipeline creation
Add libdrm-free pipeline creation functions for media fill for all gens (gen7+). Until all gpu_cmds code will be rewritten to use intel_bb we have to keep libdrm-version code intact. Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com> Cc: Chris Wilson <chris@chris-wilson.co.uk> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/media_fill.c')
-rw-r--r--lib/media_fill.c167
1 files changed, 167 insertions, 0 deletions
diff --git a/lib/media_fill.c b/lib/media_fill.c
index b7d7f68c..bac3b9bf 100644
--- a/lib/media_fill.c
+++ b/lib/media_fill.c
@@ -135,6 +135,7 @@ static const uint32_t gen12_media_kernel[][4] = {
*
*/
+#define PAGE_SIZE 4096
#define BATCH_STATE_SPLIT 2048
/* VFE STATE params */
#define THREADS 1
@@ -188,6 +189,49 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
}
void
+gen7_media_fillfunc_v2(int i915,
+ struct intel_buf *buf,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height,
+ uint8_t color)
+{
+ struct intel_bb *ibb;
+ uint32_t curbe_buffer, interface_descriptor;
+
+ ibb = intel_bb_create(i915, PAGE_SIZE);
+ intel_bb_add_object(ibb, buf->handle, 0, true);
+
+ intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+ curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+ interface_descriptor = gen7_fill_interface_descriptor_v2(ibb, buf,
+ gen7_media_kernel,
+ sizeof(gen7_media_kernel));
+ intel_bb_ptr_set(ibb, 0);
+
+ /* media pipeline */
+ intel_bb_out(ibb, GEN7_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
+ gen7_emit_state_base_address_v2(ibb);
+
+ gen7_emit_vfe_state_v2(ibb, THREADS, MEDIA_URB_ENTRIES, MEDIA_URB_SIZE,
+ MEDIA_CURBE_SIZE, GEN7_VFE_STATE_MEDIA_MODE);
+
+ gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+
+ gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+
+ gen7_emit_media_objects_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_media_fillfunc(struct intel_batchbuffer *batch,
const struct igt_buf *dst,
unsigned int x, unsigned int y,
@@ -231,6 +275,49 @@ gen8_media_fillfunc(struct intel_batchbuffer *batch,
intel_batchbuffer_reset(batch);
}
+void
+gen8_media_fillfunc_v2(int i915,
+ struct intel_buf *buf,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height,
+ uint8_t color)
+{
+ struct intel_bb *ibb;
+ uint32_t curbe_buffer, interface_descriptor;
+
+ ibb = intel_bb_create(i915, PAGE_SIZE);
+ intel_bb_add_object(ibb, buf->handle, 0, true);
+
+ intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+ curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+ interface_descriptor = gen8_fill_interface_descriptor_v2(ibb, buf,
+ gen8_media_kernel,
+ sizeof(gen8_media_kernel));
+ intel_bb_ptr_set(ibb, 0);
+
+ /* media pipeline */
+ intel_bb_out(ibb, GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
+ gen8_emit_state_base_address_v2(ibb);
+
+ gen8_emit_vfe_state_v2(ibb, THREADS, MEDIA_URB_ENTRIES, MEDIA_URB_SIZE,
+ MEDIA_CURBE_SIZE);
+
+ gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+
+ gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+
+ gen7_emit_media_objects_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);
+}
+
static void
__gen9_media_fillfunc(struct intel_batchbuffer *batch,
const struct igt_buf *dst,
@@ -301,6 +388,75 @@ gen9_media_fillfunc(struct intel_batchbuffer *batch,
}
static void
+__gen9_media_fillfunc_v2(int i915,
+ struct intel_buf *buf,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height,
+ uint8_t color,
+ const uint32_t kernel[][4], size_t kernel_size)
+{
+ struct intel_bb *ibb;
+ uint32_t curbe_buffer, interface_descriptor;
+
+ ibb = intel_bb_create(i915, PAGE_SIZE);
+ intel_bb_add_object(ibb, buf->handle, 0, true);
+
+ /* setup states */
+ intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
+
+ curbe_buffer = gen7_fill_curbe_buffer_data_v2(ibb, color);
+ interface_descriptor = gen8_fill_interface_descriptor_v2(ibb, buf,
+ kernel,
+ kernel_size);
+ intel_bb_ptr_set(ibb, 0);
+
+ /* media pipeline */
+ intel_bb_out(ibb, 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_v2(ibb);
+
+ gen8_emit_vfe_state_v2(ibb, THREADS, MEDIA_URB_ENTRIES, MEDIA_URB_SIZE,
+ MEDIA_CURBE_SIZE);
+
+ gen7_emit_curbe_load_v2(ibb, curbe_buffer);
+
+ gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
+
+ gen7_emit_media_objects_v2(ibb, x, y, width, height);
+
+ intel_bb_out(ibb, 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);
+
+ 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
+gen9_media_fillfunc_v2(int i915,
+ struct intel_buf *buf,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height,
+ uint8_t color)
+{
+
+ __gen9_media_fillfunc_v2(i915, buf, x, y, width, height, color,
+ 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,
@@ -380,3 +536,14 @@ gen12_media_fillfunc(struct intel_batchbuffer *batch,
__gen9_media_fillfunc(batch, dst, x, y, width, height, color,
gen12_media_kernel, sizeof(gen12_media_kernel));
}
+
+void
+gen12_media_fillfunc_v2(int i915,
+ struct intel_buf *buf,
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height,
+ uint8_t color)
+{
+ __gen9_media_fillfunc_v2(i915, buf, x, y, width, height, color,
+ gen12_media_kernel, sizeof(gen12_media_kernel));
+}