public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Subject: [igt-dev] [PATCH i-g-t 2/5] lib/media_fill: Migrate gen11 media pipeline creation to intel_bb
Date: Tue, 26 May 2020 10:14:48 +0200	[thread overview]
Message-ID: <20200526081451.2045-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20200526081451.2045-1-zbigniew.kempczynski@intel.com>

Function is now libdrm-free, but mixes calls to replaced and "_v2"
versions. This cleanup and old code removal will be addressed
in the another commit.

Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/media_fill.c | 78 +++++++++++++++++++++++++-----------------------
 lib/media_fill.h |  7 +++--
 2 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/lib/media_fill.c b/lib/media_fill.c
index bac3b9bf..53d63b4b 100644
--- a/lib/media_fill.c
+++ b/lib/media_fill.c
@@ -457,68 +457,72 @@ gen9_media_fillfunc_v2(int i915,
 }
 
 static void
-__gen11_media_vme_func(struct intel_batchbuffer *batch,
-		       const struct igt_buf *src,
+__gen11_media_vme_func(int i915,
+		       uint32_t ctx,
+		       struct intel_buf *src,
 		       unsigned int width, unsigned int height,
-		       const struct igt_buf *dst,
+		       struct intel_buf *dst,
 		       const uint32_t kernel[][4],
 		       size_t kernel_size)
 {
+	struct intel_bb *ibb;
 	uint32_t curbe_buffer, interface_descriptor;
-	uint32_t batch_end;
 
-	intel_batchbuffer_flush(batch);
+	ibb = intel_bb_create(i915, PAGE_SIZE);
+	intel_bb_add_object(ibb, dst->handle, 0, true);
+	intel_bb_add_object(ibb, src->handle, 0, false);
 
 	/* setup states */
-	batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
+	intel_bb_ptr_set(ibb, BATCH_STATE_SPLIT);
 
-	curbe_buffer = gen11_fill_curbe_buffer_data(batch);
-	interface_descriptor = gen11_fill_interface_descriptor(batch, src, dst,
+	curbe_buffer = gen11_fill_curbe_buffer_data(ibb);
+	interface_descriptor = gen11_fill_interface_descriptor(ibb, src, dst,
 					kernel, kernel_size);
-	assert(batch->ptr < &batch->buffer[4095]);
+
+	intel_bb_ptr_set(ibb, 0);
 
 	/* 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);
+	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(batch, THREADS, MEDIA_URB_ENTRIES, MEDIA_URB_SIZE,
+	gen8_emit_vfe_state_v2(ibb, THREADS, MEDIA_URB_ENTRIES, MEDIA_URB_SIZE,
 			    MEDIA_CURBE_SIZE);
 
-	gen7_emit_curbe_load(batch, curbe_buffer);
+	gen7_emit_curbe_load_v2(ibb, curbe_buffer);
 
-	gen7_emit_interface_descriptor_load(batch, interface_descriptor);
+	gen7_emit_interface_descriptor_load_v2(ibb, interface_descriptor);
 
-	gen7_emit_media_objects(batch, 0, 0, width, height);
+	gen7_emit_media_objects_v2(ibb, 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);
+	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);
 
-	batch_end = intel_batchbuffer_align(batch, 8);
-	assert(batch_end < BATCH_STATE_SPLIT);
+	intel_bb_out(ibb, MI_BATCH_BUFFER_END);
+	intel_bb_ptr_align(ibb, 32);
 
-	gen7_render_context_flush(batch, batch_end);
-	intel_batchbuffer_reset(batch);
+	intel_bb_exec_with_context(ibb, intel_bb_offset(ibb), ctx,
+				   I915_EXEC_DEFAULT | I915_EXEC_NO_RELOC,
+				   false);
+	intel_bb_destroy(ibb);
 }
 
 void
-gen11_media_vme_func(struct intel_batchbuffer *batch,
-		     const struct igt_buf *src,
+gen11_media_vme_func(int i915,
+		     uint32_t ctx,
+		     struct intel_buf *src,
 		     unsigned int width, unsigned int height,
-		     const struct igt_buf *dst)
+		     struct intel_buf *dst)
 {
-	__gen11_media_vme_func(batch,
+	__gen11_media_vme_func(i915, ctx,
 			       src,
 			       width, height,
 			       dst,
diff --git a/lib/media_fill.h b/lib/media_fill.h
index 84fd460b..851a9915 100644
--- a/lib/media_fill.h
+++ b/lib/media_fill.h
@@ -72,10 +72,11 @@ gen9_media_fillfunc_v2(int i915,
 		       uint8_t color);
 
 void
-gen11_media_vme_func(struct intel_batchbuffer *batch,
-		     const struct igt_buf *src,
+gen11_media_vme_func(int i915,
+		     uint32_t ctx,
+		     struct intel_buf *src,
 		     unsigned int width, unsigned int height,
-		     const struct igt_buf *dst);
+		     struct intel_buf *dst);
 
 void
 gen12_media_fillfunc(struct intel_batchbuffer *batch,
-- 
2.26.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2020-05-26  8:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  8:14 [igt-dev] [PATCH i-g-t 0/5] Make gem_media_vme libdrm-free Zbigniew Kempczyński
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 1/5] lib/gpu_cmds: Change gpu commands to use intel_bb Zbigniew Kempczyński
2020-05-26  8:14 ` Zbigniew Kempczyński [this message]
2020-05-26 14:09   ` [igt-dev] [PATCH i-g-t 2/5] lib/media_fill: Migrate gen11 media pipeline creation to intel_bb Chris Wilson
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 3/5] lib/intel_batchbuffer: Change media vme function prototype Zbigniew Kempczyński
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 4/5] tests/gem_media_vme: Remove libdrm dependency Zbigniew Kempczyński
2020-05-26  8:14 ` [igt-dev] [PATCH i-g-t 5/5] HAX: run media_vme in BAT only Zbigniew Kempczyński
2020-05-26  8:31 ` [igt-dev] ✓ Fi.CI.BAT: success for Make gem_media_vme libdrm-free Patchwork
2020-05-26  9:33 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2020-05-26 11:01 ` Patchwork
2020-05-26 11:08 ` [igt-dev] ✓ Fi.CI.BAT: success for Make gem_media_vme libdrm-free (rev2) Patchwork
2020-05-26 14:28 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200526081451.2045-3-zbigniew.kempczynski@intel.com \
    --to=zbigniew.kempczynski@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox