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: libdrm-free media pipeline creation
Date: Thu, 21 May 2020 09:48:20 +0200 [thread overview]
Message-ID: <20200521074823.18632-3-zbigniew.kempczynski@intel.com> (raw)
In-Reply-To: <20200521074823.18632-1-zbigniew.kempczynski@intel.com>
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>
---
lib/media_fill.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++
lib/media_fill.h | 29 ++++++++
2 files changed, 197 insertions(+)
diff --git a/lib/media_fill.c b/lib/media_fill.c
index b7d7f68c..0601f8f8 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
@@ -187,6 +188,49 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
intel_batchbuffer_reset(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,
@@ -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,
@@ -300,6 +387,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,
@@ -380,3 +536,15 @@ 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));
+}
+
diff --git a/lib/media_fill.h b/lib/media_fill.h
index a001482e..84fd460b 100644
--- a/lib/media_fill.h
+++ b/lib/media_fill.h
@@ -27,6 +27,7 @@
#include <stdint.h>
#include "intel_batchbuffer.h"
+#include "intel_bufops.h"
void
gen8_media_fillfunc(struct intel_batchbuffer *batch,
@@ -42,6 +43,20 @@ gen7_media_fillfunc(struct intel_batchbuffer *batch,
unsigned int width, unsigned int height,
uint8_t color);
+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);
+
+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);
+
void
gen9_media_fillfunc(struct intel_batchbuffer *batch,
const struct igt_buf *dst,
@@ -49,6 +64,13 @@ gen9_media_fillfunc(struct intel_batchbuffer *batch,
unsigned int width, unsigned int height,
uint8_t color);
+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);
+
void
gen11_media_vme_func(struct intel_batchbuffer *batch,
const struct igt_buf *src,
@@ -62,4 +84,11 @@ gen12_media_fillfunc(struct intel_batchbuffer *batch,
unsigned int width, unsigned int height,
uint8_t color);
+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);
+
#endif /* RENDE_MEDIA_FILL_H */
--
2.26.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next prev parent reply other threads:[~2020-05-21 7:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-21 7:48 [igt-dev] [PATCH i-g-t 0/5] Change media fill to be libdrm-free Zbigniew Kempczyński
2020-05-21 7:48 ` [igt-dev] [PATCH i-g-t 1/5] lib/gpu_cmds: Add media pipeline functions based on intel_bb Zbigniew Kempczyński
2020-05-21 7:48 ` Zbigniew Kempczyński [this message]
2020-05-21 7:48 ` [igt-dev] [PATCH i-g-t 3/5] lib/intel_batchbuffer: Add new media fillfunc v2 Zbigniew Kempczyński
2020-05-21 8:02 ` Chris Wilson
2020-05-21 7:48 ` [igt-dev] [PATCH i-g-t 4/5] i915/gem_media_fill: Remove libdrm dependency Zbigniew Kempczyński
2020-05-21 7:48 ` [igt-dev] [PATCH i-g-t 5/5] HAX: run media_fill in BAT only Zbigniew Kempczyński
2020-05-21 8:03 ` [igt-dev] ✓ Fi.CI.BAT: success for Change media fill to be libdrm-free Patchwork
2020-05-21 22:25 ` [igt-dev] ✓ Fi.CI.IGT: " 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=20200521074823.18632-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