* [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library
@ 2018-04-25 13:26 Katarzyna Dec
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin Katarzyna Dec
` (4 more replies)
0 siblings, 5 replies; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-25 13:26 UTC (permalink / raw)
To: igt-dev
We are moving all helper functions to gpu_fill library without removing
duplicates. Few function names were extended with *_spin.
All duplications will be removed in next patch.
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
---
lib/gpu_fill.c | 226 ++++++++++++++++++++++++++++++++++++++
lib/gpu_fill.h | 42 +++++++
lib/media_spin.c | 329 ++-----------------------------------------------------
3 files changed, 278 insertions(+), 319 deletions(-)
diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
index f05d4eca..f4b33c05 100644
--- a/lib/gpu_fill.c
+++ b/lib/gpu_fill.c
@@ -351,6 +351,32 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
OUT_BATCH(0xffffffff);
}
+void
+gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
+{
+ int ret;
+
+ ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
+ if (ret == 0)
+ ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
+ batch_end, 0);
+ igt_assert_eq(ret, 0);
+}
+
+uint32_t
+gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
+ uint32_t iters)
+{
+ uint32_t *curbe_buffer;
+ uint32_t offset;
+
+ curbe_buffer = intel_batchbuffer_subdata_alloc(batch, 64, 64);
+ offset = intel_batchbuffer_subdata_offset(batch, curbe_buffer);
+ *curbe_buffer = iters;
+
+ return offset;
+}
+
uint32_t
gen8_fill_surface_state(struct intel_batchbuffer *batch,
struct igt_buf *buf,
@@ -402,6 +428,57 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
return offset;
}
+uint32_t
+gen8_spin_surface_state(struct intel_batchbuffer *batch,
+ struct igt_buf *buf,
+ uint32_t format,
+ int is_dst)
+{
+ struct gen8_surface_state *ss;
+ uint32_t write_domain, read_domain, offset;
+ int ret;
+
+ if (is_dst) {
+ write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
+ } else {
+ write_domain = 0;
+ read_domain = I915_GEM_DOMAIN_SAMPLER;
+ }
+
+ ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
+ offset = intel_batchbuffer_subdata_offset(batch, ss);
+
+ ss->ss0.surface_type = GEN8_SURFACE_2D;
+ ss->ss0.surface_format = format;
+ ss->ss0.render_cache_read_write = 1;
+ ss->ss0.vertical_alignment = 1; /* align 4 */
+ ss->ss0.horizontal_alignment = 1; /* align 4 */
+
+ if (buf->tiling == I915_TILING_X)
+ ss->ss0.tiled_mode = 2;
+ else if (buf->tiling == I915_TILING_Y)
+ ss->ss0.tiled_mode = 3;
+
+ ss->ss8.base_addr = buf->bo->offset;
+
+ ret = drm_intel_bo_emit_reloc(batch->bo,
+ intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
+ buf->bo, 0,
+ read_domain, write_domain);
+ igt_assert_eq(ret, 0);
+
+ ss->ss2.height = igt_buf_height(buf) - 1;
+ ss->ss2.width = igt_buf_width(buf) - 1;
+ ss->ss3.pitch = buf->stride - 1;
+
+ ss->ss7.shader_chanel_select_r = 4;
+ ss->ss7.shader_chanel_select_g = 5;
+ ss->ss7.shader_chanel_select_b = 6;
+ ss->ss7.shader_chanel_select_a = 7;
+
+ return offset;
+}
+
uint32_t
gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
{
@@ -434,6 +511,65 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
return offset;
}
+uint32_t
+gen8_spin_binding_table(struct intel_batchbuffer *batch,
+ struct igt_buf *dst)
+{
+ uint32_t *binding_table, offset;
+
+ binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
+ offset = intel_batchbuffer_subdata_offset(batch, binding_table);
+
+ binding_table[0] = gen8_spin_surface_state(batch, dst,
+ GEN8_SURFACEFORMAT_R8_UNORM, 1);
+
+ return offset;
+}
+
+uint32_t
+gen8_spin_media_kernel(struct intel_batchbuffer *batch,
+ const uint32_t kernel[][4],
+ size_t size)
+{
+ uint32_t offset;
+
+ offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
+
+ return offset;
+}
+
+uint32_t
+gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
+ struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
+{
+ struct gen8_interface_descriptor_data *idd;
+ uint32_t offset;
+ uint32_t binding_table_offset, kernel_offset;
+
+ binding_table_offset = gen8_spin_binding_table(batch, dst);
+ kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
+ sizeof(spin_kernel));
+
+ idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
+ offset = intel_batchbuffer_subdata_offset(batch, idd);
+
+ idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
+
+ idd->desc2.single_program_flow = 1;
+ idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
+
+ idd->desc3.sampler_count = 0; /* 0 samplers used */
+ idd->desc3.sampler_state_pointer = 0;
+
+ idd->desc4.binding_table_entry_count = 0;
+ idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
+
+ idd->desc5.constant_urb_entry_read_offset = 0;
+ idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
+
+ return offset;
+}
+
void
gen8_emit_state_base_address(struct intel_batchbuffer *batch)
{
@@ -525,6 +661,53 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
OUT_BATCH(0);
}
+void
+gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
+{
+ OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
+
+ /* scratch buffer */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+
+ /* number of threads & urb entries */
+ OUT_BATCH(2 << 8);
+
+ OUT_BATCH(0);
+
+ /* urb entry size & curbe size */
+ OUT_BATCH(2 << 16 |
+ 2);
+
+ /* scoreboard */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+}
+
+void
+gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
+{
+ OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
+ OUT_BATCH(0);
+ /* curbe total data length */
+ OUT_BATCH(64);
+ /* curbe data start address, is relative to the dynamics base address */
+ OUT_BATCH(curbe_buffer);
+}
+
+void
+gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
+ uint32_t interface_descriptor)
+{
+ OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
+ OUT_BATCH(0);
+ /* interface descriptor data length */
+ OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
+ /* interface descriptor address, is relative to the dynamics base address */
+ OUT_BATCH(interface_descriptor);
+}
+
void
gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
unsigned x, unsigned y,
@@ -585,6 +768,49 @@ gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
OUT_BATCH(0xffffffff);
}
+void
+gen8_emit_media_objects_spin(struct intel_batchbuffer *batch)
+{
+ OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
+
+ /* interface descriptor offset */
+ OUT_BATCH(0);
+
+ /* without indirect data */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+
+ /* scoreboard */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+
+ /* inline data (xoffset, yoffset) */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+ gen8_emit_media_state_flush(batch);
+}
+
+void
+gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch)
+{
+ OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
+
+ /* interface descriptor offset */
+ OUT_BATCH(0);
+
+ /* without indirect data */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+
+ /* scoreboard */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+
+ /* inline data (xoffset, yoffset) */
+ OUT_BATCH(0);
+ OUT_BATCH(0);
+}
+
void
gen9_emit_state_base_address(struct intel_batchbuffer *batch)
{
diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
index 067d4987..c6d9ffb3 100644
--- a/lib/gpu_fill.h
+++ b/lib/gpu_fill.h
@@ -88,15 +88,41 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
unsigned x, unsigned y,
unsigned width, unsigned height);
+void
+gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
+
+uint32_t
+gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
+ uint32_t iters);
+
uint32_t
gen8_fill_surface_state(struct intel_batchbuffer *batch,
struct igt_buf *buf,
uint32_t format,
int is_dst);
+uint32_t
+gen8_spin_surface_state(struct intel_batchbuffer *batch,
+ struct igt_buf *buf,
+ uint32_t format,
+ int is_dst);
+
uint32_t
gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
+uint32_t
+gen8_spin_binding_table(struct intel_batchbuffer *batch,
+ struct igt_buf *dst);
+
+uint32_t
+gen8_spin_media_kernel(struct intel_batchbuffer *batch,
+ const uint32_t kernel[][4],
+ size_t size);
+
+uint32_t
+gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
+ struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
+
void
gen8_emit_state_base_address(struct intel_batchbuffer *batch);
@@ -109,11 +135,27 @@ gen8_emit_vfe_state(struct intel_batchbuffer *batch);
void
gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
+void
+gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
+
+void
+gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
+
+void
+gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
+ uint32_t interface_descriptor);
+
void
gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
unsigned x, unsigned y,
unsigned width, unsigned height);
+void
+gen8_emit_media_objects_spin(struct intel_batchbuffer *batch);
+
+void
+gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch);
+
void
gen9_emit_state_base_address(struct intel_batchbuffer *batch);
diff --git a/lib/media_spin.c b/lib/media_spin.c
index d9e058b1..72009908 100644
--- a/lib/media_spin.c
+++ b/lib/media_spin.c
@@ -31,6 +31,7 @@
#include "intel_batchbuffer.h"
#include "gen8_media.h"
#include "media_spin.h"
+#include "gpu_fill.h"
static const uint32_t spin_kernel[][4] = {
{ 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
@@ -45,316 +46,6 @@ static const uint32_t spin_kernel[][4] = {
{ 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
};
-static void
-gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
-{
- int ret;
-
- ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
- if (ret == 0)
- ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
- batch_end, 0);
- igt_assert_eq(ret, 0);
-}
-
-static uint32_t
-gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
- uint32_t iters)
-{
- uint32_t *curbe_buffer;
- uint32_t offset;
-
- curbe_buffer = intel_batchbuffer_subdata_alloc(batch, 64, 64);
- offset = intel_batchbuffer_subdata_offset(batch, curbe_buffer);
- *curbe_buffer = iters;
-
- return offset;
-}
-
-static uint32_t
-gen8_spin_surface_state(struct intel_batchbuffer *batch,
- struct igt_buf *buf,
- uint32_t format,
- int is_dst)
-{
- struct gen8_surface_state *ss;
- uint32_t write_domain, read_domain, offset;
- int ret;
-
- if (is_dst) {
- write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
- } else {
- write_domain = 0;
- read_domain = I915_GEM_DOMAIN_SAMPLER;
- }
-
- ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
- offset = intel_batchbuffer_subdata_offset(batch, ss);
-
- ss->ss0.surface_type = GEN8_SURFACE_2D;
- ss->ss0.surface_format = format;
- ss->ss0.render_cache_read_write = 1;
- ss->ss0.vertical_alignment = 1; /* align 4 */
- ss->ss0.horizontal_alignment = 1; /* align 4 */
-
- if (buf->tiling == I915_TILING_X)
- ss->ss0.tiled_mode = 2;
- else if (buf->tiling == I915_TILING_Y)
- ss->ss0.tiled_mode = 3;
-
- ss->ss8.base_addr = buf->bo->offset;
-
- ret = drm_intel_bo_emit_reloc(batch->bo,
- intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
- buf->bo, 0,
- read_domain, write_domain);
- igt_assert_eq(ret, 0);
-
- ss->ss2.height = igt_buf_height(buf) - 1;
- ss->ss2.width = igt_buf_width(buf) - 1;
- ss->ss3.pitch = buf->stride - 1;
-
- ss->ss7.shader_chanel_select_r = 4;
- ss->ss7.shader_chanel_select_g = 5;
- ss->ss7.shader_chanel_select_b = 6;
- ss->ss7.shader_chanel_select_a = 7;
-
- return offset;
-}
-
-static uint32_t
-gen8_spin_binding_table(struct intel_batchbuffer *batch,
- struct igt_buf *dst)
-{
- uint32_t *binding_table, offset;
-
- binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
- offset = intel_batchbuffer_subdata_offset(batch, binding_table);
-
- binding_table[0] = gen8_spin_surface_state(batch, dst,
- GEN8_SURFACEFORMAT_R8_UNORM, 1);
-
- return offset;
-}
-
-static uint32_t
-gen8_spin_media_kernel(struct intel_batchbuffer *batch,
- const uint32_t kernel[][4],
- size_t size)
-{
- uint32_t offset;
-
- offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
-
- return offset;
-}
-
-static uint32_t
-gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
- struct igt_buf *dst)
-{
- struct gen8_interface_descriptor_data *idd;
- uint32_t offset;
- uint32_t binding_table_offset, kernel_offset;
-
- binding_table_offset = gen8_spin_binding_table(batch, dst);
- kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
- sizeof(spin_kernel));
-
- idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
- offset = intel_batchbuffer_subdata_offset(batch, idd);
-
- idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
-
- idd->desc2.single_program_flow = 1;
- idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
-
- idd->desc3.sampler_count = 0; /* 0 samplers used */
- idd->desc3.sampler_state_pointer = 0;
-
- idd->desc4.binding_table_entry_count = 0;
- idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
-
- idd->desc5.constant_urb_entry_read_offset = 0;
- idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
-
- return offset;
-}
-
-static void
-gen8_emit_state_base_address(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (16 - 2));
-
- /* general */
- OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
- OUT_BATCH(0);
-
- /* stateless data port */
- OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
-
- /* surface */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
-
- /* dynamic */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
- 0, BASE_ADDRESS_MODIFY);
-
- /* indirect */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* instruction */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
-
- /* general state buffer size */
- OUT_BATCH(0xfffff000 | 1);
- /* dynamic state buffer size */
- OUT_BATCH(1 << 12 | 1);
- /* indirect object buffer size */
- OUT_BATCH(0xfffff000 | 1);
- /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
- OUT_BATCH(1 << 12 | 1);
-}
-
-static void
-gen9_emit_state_base_address(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (19 - 2));
-
- /* general */
- OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
- OUT_BATCH(0);
-
- /* stateless data port */
- OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
-
- /* surface */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
-
- /* dynamic */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
- 0, BASE_ADDRESS_MODIFY);
-
- /* indirect */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* instruction */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
-
- /* general state buffer size */
- OUT_BATCH(0xfffff000 | 1);
- /* dynamic state buffer size */
- OUT_BATCH(1 << 12 | 1);
- /* indirect object buffer size */
- OUT_BATCH(0xfffff000 | 1);
- /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
- OUT_BATCH(1 << 12 | 1);
-
- /* Bindless surface state base address */
- OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
- OUT_BATCH(0);
- OUT_BATCH(0xfffff000);
-}
-
-static void
-gen8_emit_vfe_state(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
-
- /* scratch buffer */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* number of threads & urb entries */
- OUT_BATCH(2 << 8);
-
- OUT_BATCH(0);
-
- /* urb entry size & curbe size */
- OUT_BATCH(2 << 16 |
- 2);
-
- /* scoreboard */
- OUT_BATCH(0);
- OUT_BATCH(0);
- OUT_BATCH(0);
-}
-
-static void
-gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
-{
- OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
- OUT_BATCH(0);
- /* curbe total data length */
- OUT_BATCH(64);
- /* curbe data start address, is relative to the dynamics base address */
- OUT_BATCH(curbe_buffer);
-}
-
-static void
-gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
- uint32_t interface_descriptor)
-{
- OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
- OUT_BATCH(0);
- /* interface descriptor data length */
- OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
- /* interface descriptor address, is relative to the dynamics base address */
- OUT_BATCH(interface_descriptor);
-}
-
-static void
-gen8_emit_media_state_flush(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_MEDIA_STATE_FLUSH | (2 - 2));
- OUT_BATCH(0);
-}
-
-static void
-gen8_emit_media_objects(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
-
- /* interface descriptor offset */
- OUT_BATCH(0);
-
- /* without indirect data */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* scoreboard */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* inline data (xoffset, yoffset) */
- OUT_BATCH(0);
- OUT_BATCH(0);
- gen8_emit_media_state_flush(batch);
-}
-
-static void
-gen8lp_emit_media_objects(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
-
- /* interface descriptor offset */
- OUT_BATCH(0);
-
- /* without indirect data */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* scoreboard */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* inline data (xoffset, yoffset) */
- OUT_BATCH(0);
- OUT_BATCH(0);
-}
-
/*
* This sets up the media pipeline,
*
@@ -390,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
+ interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -398,13 +89,13 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
gen8_emit_state_base_address(batch);
- gen8_emit_vfe_state(batch);
+ gen8_emit_vfe_state_spin(batch);
gen8_emit_curbe_load(batch, curbe_buffer);
gen8_emit_interface_descriptor_load(batch, interface_descriptor);
- gen8_emit_media_objects(batch);
+ gen8_emit_media_objects_spin(batch);
OUT_BATCH(MI_BATCH_BUFFER_END);
@@ -428,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
+ interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -436,13 +127,13 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
gen8_emit_state_base_address(batch);
- gen8_emit_vfe_state(batch);
+ gen8_emit_vfe_state_spin(batch);
gen8_emit_curbe_load(batch, curbe_buffer);
gen8_emit_interface_descriptor_load(batch, interface_descriptor);
- gen8lp_emit_media_objects(batch);
+ gen8lp_emit_media_objects_spin(batch);
OUT_BATCH(MI_BATCH_BUFFER_END);
@@ -466,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
+ interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -479,13 +170,13 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
GEN9_FORCE_MEDIA_AWAKE_MASK);
gen9_emit_state_base_address(batch);
- gen8_emit_vfe_state(batch);
+ gen8_emit_vfe_state_spin(batch);
gen8_emit_curbe_load(batch, curbe_buffer);
gen8_emit_interface_descriptor_load(batch, interface_descriptor);
- gen8_emit_media_objects(batch);
+ gen8_emit_media_objects_spin(batch);
OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA |
GEN9_FORCE_MEDIA_AWAKE_DISABLE |
--
2.14.3
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
2018-04-25 13:26 [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library Katarzyna Dec
@ 2018-04-25 13:26 ` Katarzyna Dec
2018-04-25 21:49 ` Daniele Ceraolo Spurio
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function Katarzyna Dec
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-25 13:26 UTC (permalink / raw)
To: igt-dev
Let's remove duplications introduced by moving media_spin helper
functions to gpu_fill. These were mainly the same functions
as for Gen8 media/gpgpu fill. gen8_render_flush from media_spin
was replaced by gen7_render_flush. The only functions that were
left intact are gen8_emit_media_objects_spin and
gen8_spin_render_flush.
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
---
lib/gpu_fill.c | 145 -------------------------------------------------------
lib/gpu_fill.h | 28 +----------
lib/media_spin.c | 24 ++++-----
3 files changed, 13 insertions(+), 184 deletions(-)
diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
index f4b33c05..f5fc61bb 100644
--- a/lib/gpu_fill.c
+++ b/lib/gpu_fill.c
@@ -351,18 +351,6 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
OUT_BATCH(0xffffffff);
}
-void
-gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
-{
- int ret;
-
- ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
- if (ret == 0)
- ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
- batch_end, 0);
- igt_assert_eq(ret, 0);
-}
-
uint32_t
gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
uint32_t iters)
@@ -428,57 +416,6 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
return offset;
}
-uint32_t
-gen8_spin_surface_state(struct intel_batchbuffer *batch,
- struct igt_buf *buf,
- uint32_t format,
- int is_dst)
-{
- struct gen8_surface_state *ss;
- uint32_t write_domain, read_domain, offset;
- int ret;
-
- if (is_dst) {
- write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
- } else {
- write_domain = 0;
- read_domain = I915_GEM_DOMAIN_SAMPLER;
- }
-
- ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
- offset = intel_batchbuffer_subdata_offset(batch, ss);
-
- ss->ss0.surface_type = GEN8_SURFACE_2D;
- ss->ss0.surface_format = format;
- ss->ss0.render_cache_read_write = 1;
- ss->ss0.vertical_alignment = 1; /* align 4 */
- ss->ss0.horizontal_alignment = 1; /* align 4 */
-
- if (buf->tiling == I915_TILING_X)
- ss->ss0.tiled_mode = 2;
- else if (buf->tiling == I915_TILING_Y)
- ss->ss0.tiled_mode = 3;
-
- ss->ss8.base_addr = buf->bo->offset;
-
- ret = drm_intel_bo_emit_reloc(batch->bo,
- intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
- buf->bo, 0,
- read_domain, write_domain);
- igt_assert_eq(ret, 0);
-
- ss->ss2.height = igt_buf_height(buf) - 1;
- ss->ss2.width = igt_buf_width(buf) - 1;
- ss->ss3.pitch = buf->stride - 1;
-
- ss->ss7.shader_chanel_select_r = 4;
- ss->ss7.shader_chanel_select_g = 5;
- ss->ss7.shader_chanel_select_b = 6;
- ss->ss7.shader_chanel_select_a = 7;
-
- return offset;
-}
-
uint32_t
gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
{
@@ -511,65 +448,6 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
return offset;
}
-uint32_t
-gen8_spin_binding_table(struct intel_batchbuffer *batch,
- struct igt_buf *dst)
-{
- uint32_t *binding_table, offset;
-
- binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
- offset = intel_batchbuffer_subdata_offset(batch, binding_table);
-
- binding_table[0] = gen8_spin_surface_state(batch, dst,
- GEN8_SURFACEFORMAT_R8_UNORM, 1);
-
- return offset;
-}
-
-uint32_t
-gen8_spin_media_kernel(struct intel_batchbuffer *batch,
- const uint32_t kernel[][4],
- size_t size)
-{
- uint32_t offset;
-
- offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
-
- return offset;
-}
-
-uint32_t
-gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
- struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
-{
- struct gen8_interface_descriptor_data *idd;
- uint32_t offset;
- uint32_t binding_table_offset, kernel_offset;
-
- binding_table_offset = gen8_spin_binding_table(batch, dst);
- kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
- sizeof(spin_kernel));
-
- idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
- offset = intel_batchbuffer_subdata_offset(batch, idd);
-
- idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
-
- idd->desc2.single_program_flow = 1;
- idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
-
- idd->desc3.sampler_count = 0; /* 0 samplers used */
- idd->desc3.sampler_state_pointer = 0;
-
- idd->desc4.binding_table_entry_count = 0;
- idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
-
- idd->desc5.constant_urb_entry_read_offset = 0;
- idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
-
- return offset;
-}
-
void
gen8_emit_state_base_address(struct intel_batchbuffer *batch)
{
@@ -685,29 +563,6 @@ gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
OUT_BATCH(0);
}
-void
-gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
-{
- OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
- OUT_BATCH(0);
- /* curbe total data length */
- OUT_BATCH(64);
- /* curbe data start address, is relative to the dynamics base address */
- OUT_BATCH(curbe_buffer);
-}
-
-void
-gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
- uint32_t interface_descriptor)
-{
- OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
- OUT_BATCH(0);
- /* interface descriptor data length */
- OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
- /* interface descriptor address, is relative to the dynamics base address */
- OUT_BATCH(interface_descriptor);
-}
-
void
gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
unsigned x, unsigned y,
diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
index c6d9ffb3..f0f07661 100644
--- a/lib/gpu_fill.h
+++ b/lib/gpu_fill.h
@@ -89,7 +89,7 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
unsigned width, unsigned height);
void
-gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
+gen8_spin_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
uint32_t
gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
@@ -101,28 +101,9 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
uint32_t format,
int is_dst);
-uint32_t
-gen8_spin_surface_state(struct intel_batchbuffer *batch,
- struct igt_buf *buf,
- uint32_t format,
- int is_dst);
-
uint32_t
gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
-uint32_t
-gen8_spin_binding_table(struct intel_batchbuffer *batch,
- struct igt_buf *dst);
-
-uint32_t
-gen8_spin_media_kernel(struct intel_batchbuffer *batch,
- const uint32_t kernel[][4],
- size_t size);
-
-uint32_t
-gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
- struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
-
void
gen8_emit_state_base_address(struct intel_batchbuffer *batch);
@@ -138,13 +119,6 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
void
gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
-void
-gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
-
-void
-gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
- uint32_t interface_descriptor);
-
void
gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
unsigned x, unsigned y,
diff --git a/lib/media_spin.c b/lib/media_spin.c
index 72009908..16ea8483 100644
--- a/lib/media_spin.c
+++ b/lib/media_spin.c
@@ -81,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
+ interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -91,9 +91,9 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
gen8_emit_vfe_state_spin(batch);
- gen8_emit_curbe_load(batch, curbe_buffer);
+ gen7_emit_curbe_load(batch, curbe_buffer);
- gen8_emit_interface_descriptor_load(batch, interface_descriptor);
+ gen7_emit_interface_descriptor_load(batch, interface_descriptor);
gen8_emit_media_objects_spin(batch);
@@ -102,7 +102,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
batch_end = intel_batchbuffer_align(batch, 8);
igt_assert(batch_end < BATCH_STATE_SPLIT);
- gen8_render_flush(batch, batch_end);
+ gen7_render_flush(batch, batch_end);
intel_batchbuffer_reset(batch);
}
@@ -119,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
+ interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -129,9 +129,9 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
gen8_emit_vfe_state_spin(batch);
- gen8_emit_curbe_load(batch, curbe_buffer);
+ gen7_emit_curbe_load(batch, curbe_buffer);
- gen8_emit_interface_descriptor_load(batch, interface_descriptor);
+ gen7_emit_interface_descriptor_load(batch, interface_descriptor);
gen8lp_emit_media_objects_spin(batch);
@@ -140,7 +140,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
batch_end = intel_batchbuffer_align(batch, 8);
igt_assert(batch_end < BATCH_STATE_SPLIT);
- gen8_render_flush(batch, batch_end);
+ gen7_render_flush(batch, batch_end);
intel_batchbuffer_reset(batch);
}
@@ -157,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
+ interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -172,9 +172,9 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
gen8_emit_vfe_state_spin(batch);
- gen8_emit_curbe_load(batch, curbe_buffer);
+ gen7_emit_curbe_load(batch, curbe_buffer);
- gen8_emit_interface_descriptor_load(batch, interface_descriptor);
+ gen7_emit_interface_descriptor_load(batch, interface_descriptor);
gen8_emit_media_objects_spin(batch);
@@ -190,6 +190,6 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
batch_end = intel_batchbuffer_align(batch, 8);
igt_assert(batch_end < BATCH_STATE_SPLIT);
- gen8_render_flush(batch, batch_end);
+ gen7_render_flush(batch, batch_end);
intel_batchbuffer_reset(batch);
}
--
2.14.3
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function
2018-04-25 13:26 [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library Katarzyna Dec
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin Katarzyna Dec
@ 2018-04-25 13:26 ` Katarzyna Dec
2018-04-26 16:35 ` Daniele Ceraolo Spurio
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style Katarzyna Dec
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-25 13:26 UTC (permalink / raw)
To: igt-dev
Gen8lp function are duplicates of Gen8 with difference in
emit_media_objects - we cannot perform media_state_flush on CHT.
Similar changes were done previously for gpgpu_fill and media_fill.
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
---
lib/gpu_fill.c | 24 ++----------------------
lib/intel_batchbuffer.c | 4 +---
lib/media_spin.c | 38 --------------------------------------
lib/media_spin.h | 3 ---
4 files changed, 3 insertions(+), 66 deletions(-)
diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
index f5fc61bb..8dab39df 100644
--- a/lib/gpu_fill.c
+++ b/lib/gpu_fill.c
@@ -642,28 +642,8 @@ gen8_emit_media_objects_spin(struct intel_batchbuffer *batch)
/* inline data (xoffset, yoffset) */
OUT_BATCH(0);
OUT_BATCH(0);
- gen8_emit_media_state_flush(batch);
-}
-
-void
-gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch)
-{
- OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
-
- /* interface descriptor offset */
- OUT_BATCH(0);
-
- /* without indirect data */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* scoreboard */
- OUT_BATCH(0);
- OUT_BATCH(0);
-
- /* inline data (xoffset, yoffset) */
- OUT_BATCH(0);
- OUT_BATCH(0);
+ if (AT_LEAST_GEN(batch->devid, 8) && !IS_CHERRYVIEW(batch->devid))
+ gen8_emit_media_state_flush(batch);
}
void
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index f87e6bed..ef070d1a 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -906,10 +906,8 @@ igt_media_spinfunc_t igt_get_media_spinfunc(int devid)
if (IS_GEN9(devid))
spin = gen9_media_spinfunc;
- else if (IS_BROADWELL(devid))
+ else if (IS_BROADWELL(devid) || IS_CHERRYVIEW(devid))
spin = gen8_media_spinfunc;
- else if (IS_CHERRYVIEW(devid))
- spin = gen8lp_media_spinfunc;
return spin;
}
diff --git a/lib/media_spin.c b/lib/media_spin.c
index 16ea8483..b4414bee 100644
--- a/lib/media_spin.c
+++ b/lib/media_spin.c
@@ -106,44 +106,6 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
intel_batchbuffer_reset(batch);
}
-void
-gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
- struct igt_buf *dst, uint32_t spins)
-{
- uint32_t curbe_buffer, interface_descriptor;
- uint32_t batch_end;
-
- intel_batchbuffer_flush_with_context(batch, NULL);
-
- /* setup states */
- batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
-
- curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
- igt_assert(batch->ptr < &batch->buffer[4095]);
-
- /* media pipeline */
- batch->ptr = batch->buffer;
- OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
- gen8_emit_state_base_address(batch);
-
- gen8_emit_vfe_state_spin(batch);
-
- gen7_emit_curbe_load(batch, curbe_buffer);
-
- gen7_emit_interface_descriptor_load(batch, interface_descriptor);
-
- gen8lp_emit_media_objects_spin(batch);
-
- OUT_BATCH(MI_BATCH_BUFFER_END);
-
- batch_end = intel_batchbuffer_align(batch, 8);
- igt_assert(batch_end < BATCH_STATE_SPLIT);
-
- gen7_render_flush(batch, batch_end);
- intel_batchbuffer_reset(batch);
-}
-
void
gen9_media_spinfunc(struct intel_batchbuffer *batch,
struct igt_buf *dst, uint32_t spins)
diff --git a/lib/media_spin.h b/lib/media_spin.h
index 8bc48291..57d8c2e2 100644
--- a/lib/media_spin.h
+++ b/lib/media_spin.h
@@ -30,9 +30,6 @@
void gen8_media_spinfunc(struct intel_batchbuffer *batch,
struct igt_buf *dst, uint32_t spins);
-void gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
- struct igt_buf *dst, uint32_t spins);
-
void gen9_media_spinfunc(struct intel_batchbuffer *batch,
struct igt_buf *dst, uint32_t spins);
--
2.14.3
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style
2018-04-25 13:26 [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library Katarzyna Dec
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin Katarzyna Dec
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function Katarzyna Dec
@ 2018-04-25 13:26 ` Katarzyna Dec
2018-04-26 22:25 ` Antonio Argenziano
2018-04-25 13:50 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/media_spin: Move helper functions to gpu_fill library Patchwork
2018-04-25 20:01 ` [igt-dev] [PATCH i-g-t 1/4] " Daniele Ceraolo Spurio
4 siblings, 1 reply; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-25 13:26 UTC (permalink / raw)
To: igt-dev
Let's adjust code to our coding style during refactoring
media_spin code.
Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
---
lib/gpu_fill.c | 72 +++++++++++++++++++++++++++++++++-----------------------
lib/gpu_fill.h | 26 ++++++++++----------
lib/media_spin.c | 36 ++++++++++++++++++----------
3 files changed, 80 insertions(+), 54 deletions(-)
diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
index 8dab39df..25c0c810 100644
--- a/lib/gpu_fill.c
+++ b/lib/gpu_fill.c
@@ -132,8 +132,8 @@ gen7_fill_kernel(struct intel_batchbuffer *batch,
}
uint32_t
-gen7_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst,
- const uint32_t kernel[][4], size_t size)
+gen7_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf
+ *dst, const uint32_t kernel[][4], size_t size)
{
struct gen7_interface_descriptor_data *idd;
uint32_t offset;
@@ -171,16 +171,19 @@ gen7_emit_state_base_address(struct intel_batchbuffer *batch)
OUT_BATCH(0);
/* surface */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
+ BASE_ADDRESS_MODIFY);
/* dynamic */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
+ BASE_ADDRESS_MODIFY);
/* indirect */
OUT_BATCH(0);
/* instruction */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
+ BASE_ADDRESS_MODIFY);
/* general/dynamic/indirect/instruction access Bound */
OUT_BATCH(0);
@@ -204,8 +207,8 @@ gen7_emit_vfe_state(struct intel_batchbuffer *batch)
OUT_BATCH(0);
/* urb entry size & curbe size */
- OUT_BATCH(2 << 16 | /* in 256 bits unit */
- 2); /* in 256 bits unit */
+ OUT_BATCH(2 << 16 | /* in 256 bits unit */
+ 2); /* in 256 bits unit */
/* scoreboard */
OUT_BATCH(0);
@@ -229,7 +232,7 @@ gen7_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
OUT_BATCH(0);
/* urb entry size & curbe size */
- OUT_BATCH(0 << 16 | /* URB entry size in 256 bits unit */
+ OUT_BATCH(0 << 16 | /* URB entry size in 256 bits unit */
1); /* CURBE entry size in 256 bits unit */
/* scoreboard */
@@ -250,7 +253,8 @@ gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
}
void
-gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t interface_descriptor)
+gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
+ uint32_t interface_descriptor)
{
OUT_BATCH(GEN7_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
OUT_BATCH(0);
@@ -259,14 +263,16 @@ gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t in
OUT_BATCH(sizeof(struct gen7_interface_descriptor_data));
else
OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
- /* interface descriptor address, is relative to the dynamics base address */
+ /* interface descriptor address, is relative to the dynamics base
+ * address
+ */
OUT_BATCH(interface_descriptor);
}
void
gen7_emit_media_objects(struct intel_batchbuffer *batch,
- unsigned x, unsigned y,
- unsigned width, unsigned height)
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height)
{
int i, j;
@@ -288,7 +294,8 @@ gen7_emit_media_objects(struct intel_batchbuffer *batch,
/* inline data (xoffset, yoffset) */
OUT_BATCH(x + i * 16);
OUT_BATCH(y + j * 16);
- if (AT_LEAST_GEN(batch->devid, 8) && !IS_CHERRYVIEW(batch->devid))
+ if (AT_LEAST_GEN(batch->devid, 8) &&
+ !IS_CHERRYVIEW(batch->devid))
gen8_emit_media_state_flush(batch);
}
}
@@ -296,8 +303,8 @@ gen7_emit_media_objects(struct intel_batchbuffer *batch,
void
gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
- unsigned x, unsigned y,
- unsigned width, unsigned height)
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height)
{
uint32_t x_dim, y_dim, tmp, right_mask;
@@ -399,9 +406,8 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
ss->ss8.base_addr = buf->bo->offset;
ret = drm_intel_bo_emit_reloc(batch->bo,
- intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
- buf->bo, 0,
- read_domain, write_domain);
+ intel_batchbuffer_subdata_offset(batch, ss) +
+ 8 * 4, buf->bo, 0, read_domain, write_domain);
igt_assert(ret == 0);
ss->ss2.height = igt_buf_height(buf) - 1;
@@ -417,7 +423,9 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
}
uint32_t
-gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
+gen8_fill_interface_descriptor(struct intel_batchbuffer *batch,
+ struct igt_buf *dst, const uint32_t kernel[][4],
+ size_t size)
{
struct gen8_interface_descriptor_data *idd;
uint32_t offset;
@@ -464,15 +472,16 @@ gen8_emit_state_base_address(struct intel_batchbuffer *batch)
OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
/* dynamic */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
- 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER |
+ I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
/* indirect */
OUT_BATCH(0);
OUT_BATCH(0);
/* instruction */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
+ BASE_ADDRESS_MODIFY);
/* general state buffer size */
OUT_BATCH(0xfffff000 | 1);
@@ -480,7 +489,9 @@ gen8_emit_state_base_address(struct intel_batchbuffer *batch)
OUT_BATCH(1 << 12 | 1);
/* indirect object buffer size */
OUT_BATCH(0xfffff000 | 1);
- /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
+ /* instruction buffer size, must set modify enable bit, otherwise it may
+ * result in GPU hang
+ */
OUT_BATCH(1 << 12 | 1);
}
@@ -565,8 +576,8 @@ gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
void
gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
- unsigned x, unsigned y,
- unsigned width, unsigned height)
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height)
{
uint32_t x_dim, y_dim, tmp, right_mask;
@@ -662,15 +673,16 @@ gen9_emit_state_base_address(struct intel_batchbuffer *batch)
OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
/* dynamic */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
- 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER |
+ I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
/* indirect */
OUT_BATCH(0);
OUT_BATCH(0);
/* instruction */
- OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
+ OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0,
+ BASE_ADDRESS_MODIFY);
/* general state buffer size */
OUT_BATCH(0xfffff000 | 1);
@@ -678,7 +690,9 @@ gen9_emit_state_base_address(struct intel_batchbuffer *batch)
OUT_BATCH(1 << 12 | 1);
/* indirect object buffer size */
OUT_BATCH(0xfffff000 | 1);
- /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
+ /* intruction buffer size, must set modify enable bit, otherwise it may
+ * result in GPU hang
+ */
OUT_BATCH(1 << 12 | 1);
/* Bindless surface state base address */
diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
index f0f07661..8d219699 100644
--- a/lib/gpu_fill.h
+++ b/lib/gpu_fill.h
@@ -60,8 +60,8 @@ gen7_fill_kernel(struct intel_batchbuffer *batch,
size_t size);
uint32_t
-gen7_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst,
- const uint32_t kernel[][4], size_t size);
+gen7_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf
+ *dst, const uint32_t kernel[][4], size_t size);
void
gen7_emit_state_base_address(struct intel_batchbuffer *batch);
@@ -76,17 +76,18 @@ void
gen7_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
void
-gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch, uint32_t interface_descriptor);
+gen7_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
+ uint32_t interface_descriptor);
void
gen7_emit_media_objects(struct intel_batchbuffer *batch,
- unsigned x, unsigned y,
- unsigned width, unsigned height);
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height);
void
gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
- unsigned x, unsigned y,
- unsigned width, unsigned height);
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height);
void
gen8_spin_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
@@ -102,7 +103,9 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
int is_dst);
uint32_t
-gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
+gen8_fill_interface_descriptor(struct intel_batchbuffer *batch,
+ struct igt_buf *dst, const uint32_t kernel[][4],
+ size_t size);
void
gen8_emit_state_base_address(struct intel_batchbuffer *batch);
@@ -121,15 +124,12 @@ gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
void
gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
- unsigned x, unsigned y,
- unsigned width, unsigned height);
+ unsigned int x, unsigned int y,
+ unsigned int width, unsigned int height);
void
gen8_emit_media_objects_spin(struct intel_batchbuffer *batch);
-void
-gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch);
-
void
gen9_emit_state_base_address(struct intel_batchbuffer *batch);
diff --git a/lib/media_spin.c b/lib/media_spin.c
index b4414bee..e203b25c 100644
--- a/lib/media_spin.c
+++ b/lib/media_spin.c
@@ -34,16 +34,26 @@
#include "gpu_fill.h"
static const uint32_t spin_kernel[][4] = {
- { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
- { 0x00200001, 0x20800208, 0x00450040, 0x00000000 }, /* mov (2)r4.0<1>.ud r2.0<2;2;1>:ud */
- { 0x00000001, 0x20880608, 0x00000000, 0x00000003 }, /* mov (1)r4.8<1>:ud 0x3 */
- { 0x00000001, 0x20a00608, 0x00000000, 0x00000000 }, /* mov (1)r5.0<1>:ud 0 */
- { 0x00000040, 0x20a00208, 0x060000a0, 0x00000001 }, /* add (1)r5.0<1>:ud r5.0<0;1;0>:ud 1 */
- { 0x01000010, 0x20000200, 0x02000020, 0x000000a0 }, /* cmp.e.f0.0 (1)null<1> r1<0;1;0> r5<0;1;0> */
- { 0x00110027, 0x00000000, 0x00000000, 0xffffffe0 }, /* ~f0.0 while (1) -32 */
- { 0x0c800031, 0x20000a00, 0x0e000080, 0x040a8000 }, /* send.dcdp1 (16)null<1> r4.0<0;1;0> 0x040a8000 */
- { 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 }, /* mov (8)r112<1>:ud r0.0<8;8;1>:ud */
- { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
+ /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
+ { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 },
+ /* mov (2)r4.0<1>.ud r2.0<2;2;1>:ud */
+ { 0x00200001, 0x20800208, 0x00450040, 0x00000000 },
+ /* mov (1)r4.8<1>:ud 0x3 */
+ { 0x00000001, 0x20880608, 0x00000000, 0x00000003 },
+ /* mov (1)r5.0<1>:ud 0 */
+ { 0x00000001, 0x20a00608, 0x00000000, 0x00000000 },
+ /* add (1)r5.0<1>:ud r5.0<0;1;0>:ud 1 */
+ { 0x00000040, 0x20a00208, 0x060000a0, 0x00000001 },
+ /* cmp.e.f0.0 (1)null<1> r1<0;1;0> r5<0;1;0> */
+ { 0x01000010, 0x20000200, 0x02000020, 0x000000a0 },
+ /* ~f0.0 while (1) -32 */
+ { 0x00110027, 0x00000000, 0x00000000, 0xffffffe0 },
+ /* send.dcdp1 (16)null<1> r4.0<0;1;0> 0x040a8000 */
+ { 0x0c800031, 0x20000a00, 0x0e000080, 0x040a8000 },
+ /* mov (8)r112<1>:ud r0.0<8;8;1>:ud */
+ { 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 },
+ /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
+ { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 },
};
/*
@@ -81,7 +91,8 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
+ interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
+ spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
@@ -119,7 +130,8 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
- interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
+ interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
+ spin_kernel, sizeof(spin_kernel));
igt_assert(batch->ptr < &batch->buffer[4095]);
/* media pipeline */
--
2.14.3
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/media_spin: Move helper functions to gpu_fill library
2018-04-25 13:26 [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library Katarzyna Dec
` (2 preceding siblings ...)
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style Katarzyna Dec
@ 2018-04-25 13:50 ` Patchwork
2018-04-25 20:01 ` [igt-dev] [PATCH i-g-t 1/4] " Daniele Ceraolo Spurio
4 siblings, 0 replies; 12+ messages in thread
From: Patchwork @ 2018-04-25 13:50 UTC (permalink / raw)
To: Katarzyna Dec; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,1/4] lib/media_spin: Move helper functions to gpu_fill library
URL : https://patchwork.freedesktop.org/series/42292/
State : failure
== Summary ==
= CI Bug Log - changes from CI_DRM_4093 -> IGTPW_1301 =
== Summary - FAILURE ==
Serious unknown changes coming with IGTPW_1301 absolutely need to be
verified manually.
If you think the reported changes have nothing to do with the changes
introduced in IGTPW_1301, please notify your bug team to allow them
to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/42292/revisions/1/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in IGTPW_1301:
=== IGT changes ===
==== Possible regressions ====
igt@kms_pipe_crc_basic@bad-source:
fi-glk-j4005: PASS -> DMESG-WARN
== Known issues ==
Here are the changes found in IGTPW_1301 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@gem_exec_suspend@basic-s3:
fi-ivb-3520m: PASS -> DMESG-WARN (fdo#106084) +1
igt@gem_ringfill@basic-default-hang:
fi-pnv-d510: NOTRUN -> DMESG-WARN (fdo#101600)
igt@kms_flip@basic-plain-flip:
fi-glk-j4005: PASS -> DMESG-WARN (fdo#106097) +1
==== Possible fixes ====
igt@kms_chamelium@dp-edid-read:
fi-kbl-7500u: FAIL (fdo#103841) -> PASS
igt@kms_pipe_crc_basic@suspend-read-crc-pipe-b:
fi-ivb-3520m: DMESG-WARN (fdo#106084) -> PASS
igt@prime_vgem@basic-fence-flip:
fi-glk-j4005: DMESG-WARN (fdo#106235) -> PASS
fdo#101600 https://bugs.freedesktop.org/show_bug.cgi?id=101600
fdo#103841 https://bugs.freedesktop.org/show_bug.cgi?id=103841
fdo#106084 https://bugs.freedesktop.org/show_bug.cgi?id=106084
fdo#106097 https://bugs.freedesktop.org/show_bug.cgi?id=106097
fdo#106235 https://bugs.freedesktop.org/show_bug.cgi?id=106235
== Participating hosts (38 -> 36) ==
Additional (1): fi-pnv-d510
Missing (3): fi-ctg-p8600 fi-ilk-m540 fi-skl-6700hq
== Build changes ==
* IGT: IGT_4446 -> IGTPW_1301
* Piglit: piglit_4446 -> piglit_4447
CI_DRM_4093: a47694a9464b96e17b12f0bdb1085d10a61c57e9 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1301: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1301/
IGT_4446: e5e8dafc991ee922ec159491c680caff0cfe9235 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
piglit_4446: a2f486679f467cd6e82578384f56d4aabaa8cf2e @ git://anongit.freedesktop.org/piglit
piglit_4447: 1a4372adb07ede41e35ff4786b9b034fc603b105 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1301/issues.html
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library
2018-04-25 13:26 [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library Katarzyna Dec
` (3 preceding siblings ...)
2018-04-25 13:50 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/media_spin: Move helper functions to gpu_fill library Patchwork
@ 2018-04-25 20:01 ` Daniele Ceraolo Spurio
2018-04-26 11:08 ` Katarzyna Dec
4 siblings, 1 reply; 12+ messages in thread
From: Daniele Ceraolo Spurio @ 2018-04-25 20:01 UTC (permalink / raw)
To: igt-dev
General comment for the first 2 patches:
It is a bit confusing to have functions for a "spin" workload with
"spin" in their name in a file named "gpu_fill", so we should rename the
file to something more appropriate (gpu_cmds? gpu_workload_cmds?
gpu_workload_helpers?). My naming sense sucks, so I'll leave it to you
to pick a nice name :P.
Also, there is no need to move the functions to the common file before
dropping them, we can drop them where they are, so you can squash the
first 2 patches into one to make life easier for the reviewers. If
you're up for a slight rework, the cleanest ordering (and easiest to
review) IMO would be a patch to drop all the duplicated code from
media_spin followed by a patch to move whatever is left to the common
file, but since the remaining "spin" functions seem to be minimal I'm ok
with it all being in a single patch.
I'm not going to do a full review of the function move done by this
patch for now because most of the functions are going to disappear in
the next patch. I'll have a proper look after the squash ;)
Thanks,
Daniele
On 25/04/18 06:26, Katarzyna Dec wrote:
> We are moving all helper functions to gpu_fill library without removing
> duplicates. Few function names were extended with *_spin.
> All duplications will be removed in next patch.
>
> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> ---
> lib/gpu_fill.c | 226 ++++++++++++++++++++++++++++++++++++++
> lib/gpu_fill.h | 42 +++++++
> lib/media_spin.c | 329 ++-----------------------------------------------------
> 3 files changed, 278 insertions(+), 319 deletions(-)
>
> diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> index f05d4eca..f4b33c05 100644
> --- a/lib/gpu_fill.c
> +++ b/lib/gpu_fill.c
> @@ -351,6 +351,32 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> OUT_BATCH(0xffffffff);
> }
>
> +void
> +gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> +{
> + int ret;
> +
> + ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> + if (ret == 0)
> + ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> + batch_end, 0);
> + igt_assert_eq(ret, 0);
> +}
> +
> +uint32_t
> +gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> + uint32_t iters)
> +{
> + uint32_t *curbe_buffer;
> + uint32_t offset;
> +
> + curbe_buffer = intel_batchbuffer_subdata_alloc(batch, 64, 64);
> + offset = intel_batchbuffer_subdata_offset(batch, curbe_buffer);
> + *curbe_buffer = iters;
> +
> + return offset;
> +}
> +
> uint32_t
> gen8_fill_surface_state(struct intel_batchbuffer *batch,
> struct igt_buf *buf,
> @@ -402,6 +428,57 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> return offset;
> }
>
> +uint32_t
> +gen8_spin_surface_state(struct intel_batchbuffer *batch,
> + struct igt_buf *buf,
> + uint32_t format,
> + int is_dst)
> +{
> + struct gen8_surface_state *ss;
> + uint32_t write_domain, read_domain, offset;
> + int ret;
> +
> + if (is_dst) {
> + write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> + } else {
> + write_domain = 0;
> + read_domain = I915_GEM_DOMAIN_SAMPLER;
> + }
> +
> + ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> + offset = intel_batchbuffer_subdata_offset(batch, ss);
> +
> + ss->ss0.surface_type = GEN8_SURFACE_2D;
> + ss->ss0.surface_format = format;
> + ss->ss0.render_cache_read_write = 1;
> + ss->ss0.vertical_alignment = 1; /* align 4 */
> + ss->ss0.horizontal_alignment = 1; /* align 4 */
> +
> + if (buf->tiling == I915_TILING_X)
> + ss->ss0.tiled_mode = 2;
> + else if (buf->tiling == I915_TILING_Y)
> + ss->ss0.tiled_mode = 3;
> +
> + ss->ss8.base_addr = buf->bo->offset;
> +
> + ret = drm_intel_bo_emit_reloc(batch->bo,
> + intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> + buf->bo, 0,
> + read_domain, write_domain);
> + igt_assert_eq(ret, 0);
> +
> + ss->ss2.height = igt_buf_height(buf) - 1;
> + ss->ss2.width = igt_buf_width(buf) - 1;
> + ss->ss3.pitch = buf->stride - 1;
> +
> + ss->ss7.shader_chanel_select_r = 4;
> + ss->ss7.shader_chanel_select_g = 5;
> + ss->ss7.shader_chanel_select_b = 6;
> + ss->ss7.shader_chanel_select_a = 7;
> +
> + return offset;
> +}
> +
> uint32_t
> gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
> {
> @@ -434,6 +511,65 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
> return offset;
> }
>
> +uint32_t
> +gen8_spin_binding_table(struct intel_batchbuffer *batch,
> + struct igt_buf *dst)
> +{
> + uint32_t *binding_table, offset;
> +
> + binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> + offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> +
> + binding_table[0] = gen8_spin_surface_state(batch, dst,
> + GEN8_SURFACEFORMAT_R8_UNORM, 1);
> +
> + return offset;
> +}
> +
> +uint32_t
> +gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> + const uint32_t kernel[][4],
> + size_t size)
> +{
> + uint32_t offset;
> +
> + offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> +
> + return offset;
> +}
> +
> +uint32_t
> +gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> + struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
> +{
> + struct gen8_interface_descriptor_data *idd;
> + uint32_t offset;
> + uint32_t binding_table_offset, kernel_offset;
> +
> + binding_table_offset = gen8_spin_binding_table(batch, dst);
> + kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> + sizeof(spin_kernel));
> +
> + idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> + offset = intel_batchbuffer_subdata_offset(batch, idd);
> +
> + idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> +
> + idd->desc2.single_program_flow = 1;
> + idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> +
> + idd->desc3.sampler_count = 0; /* 0 samplers used */
> + idd->desc3.sampler_state_pointer = 0;
> +
> + idd->desc4.binding_table_entry_count = 0;
> + idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> +
> + idd->desc5.constant_urb_entry_read_offset = 0;
> + idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> +
> + return offset;
> +}
> +
> void
> gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> {
> @@ -525,6 +661,53 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
> OUT_BATCH(0);
> }
>
> +void
> +gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
> +{
> + OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
> +
> + /* scratch buffer */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +
> + /* number of threads & urb entries */
> + OUT_BATCH(2 << 8);
> +
> + OUT_BATCH(0);
> +
> + /* urb entry size & curbe size */
> + OUT_BATCH(2 << 16 |
> + 2);
> +
> + /* scoreboard */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +}
> +
> +void
> +gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> +{
> + OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> + OUT_BATCH(0);
> + /* curbe total data length */
> + OUT_BATCH(64);
> + /* curbe data start address, is relative to the dynamics base address */
> + OUT_BATCH(curbe_buffer);
> +}
> +
> +void
> +gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> + uint32_t interface_descriptor)
> +{
> + OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> + OUT_BATCH(0);
> + /* interface descriptor data length */
> + OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> + /* interface descriptor address, is relative to the dynamics base address */
> + OUT_BATCH(interface_descriptor);
> +}
> +
> void
> gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> @@ -585,6 +768,49 @@ gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> OUT_BATCH(0xffffffff);
> }
>
> +void
> +gen8_emit_media_objects_spin(struct intel_batchbuffer *batch)
> +{
> + OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> +
> + /* interface descriptor offset */
> + OUT_BATCH(0);
> +
> + /* without indirect data */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +
> + /* scoreboard */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +
> + /* inline data (xoffset, yoffset) */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> + gen8_emit_media_state_flush(batch);
> +}
> +
> +void
> +gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch)
> +{
> + OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> +
> + /* interface descriptor offset */
> + OUT_BATCH(0);
> +
> + /* without indirect data */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +
> + /* scoreboard */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +
> + /* inline data (xoffset, yoffset) */
> + OUT_BATCH(0);
> + OUT_BATCH(0);
> +}
> +
> void
> gen9_emit_state_base_address(struct intel_batchbuffer *batch)
> {
> diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
> index 067d4987..c6d9ffb3 100644
> --- a/lib/gpu_fill.h
> +++ b/lib/gpu_fill.h
> @@ -88,15 +88,41 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> unsigned width, unsigned height);
>
> +void
> +gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> +
> +uint32_t
> +gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> + uint32_t iters);
> +
> uint32_t
> gen8_fill_surface_state(struct intel_batchbuffer *batch,
> struct igt_buf *buf,
> uint32_t format,
> int is_dst);
>
> +uint32_t
> +gen8_spin_surface_state(struct intel_batchbuffer *batch,
> + struct igt_buf *buf,
> + uint32_t format,
> + int is_dst);
> +
> uint32_t
> gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
>
> +uint32_t
> +gen8_spin_binding_table(struct intel_batchbuffer *batch,
> + struct igt_buf *dst);
> +
> +uint32_t
> +gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> + const uint32_t kernel[][4],
> + size_t size);
> +
> +uint32_t
> +gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> + struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> +
> void
> gen8_emit_state_base_address(struct intel_batchbuffer *batch);
>
> @@ -109,11 +135,27 @@ gen8_emit_vfe_state(struct intel_batchbuffer *batch);
> void
> gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
>
> +void
> +gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
> +
> +void
> +gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> +
> +void
> +gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> + uint32_t interface_descriptor);
> +
> void
> gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> unsigned width, unsigned height);
>
> +void
> +gen8_emit_media_objects_spin(struct intel_batchbuffer *batch);
> +
> +void
> +gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch);
> +
> void
> gen9_emit_state_base_address(struct intel_batchbuffer *batch);
>
> diff --git a/lib/media_spin.c b/lib/media_spin.c
> index d9e058b1..72009908 100644
> --- a/lib/media_spin.c
> +++ b/lib/media_spin.c
> @@ -31,6 +31,7 @@
> #include "intel_batchbuffer.h"
> #include "gen8_media.h"
> #include "media_spin.h"
> +#include "gpu_fill.h"
>
> static const uint32_t spin_kernel[][4] = {
> { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
> @@ -45,316 +46,6 @@ static const uint32_t spin_kernel[][4] = {
> { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
> };
>
> -static void
> -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> -{
> - int ret;
> -
> - ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> - if (ret == 0)
> - ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> - batch_end, 0);
> - igt_assert_eq(ret, 0);
> -}
> -
> -static uint32_t
> -gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> - uint32_t iters)
> -{
> - uint32_t *curbe_buffer;
> - uint32_t offset;
> -
> - curbe_buffer = intel_batchbuffer_subdata_alloc(batch, 64, 64);
> - offset = intel_batchbuffer_subdata_offset(batch, curbe_buffer);
> - *curbe_buffer = iters;
> -
> - return offset;
> -}
> -
> -static uint32_t
> -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> - struct igt_buf *buf,
> - uint32_t format,
> - int is_dst)
> -{
> - struct gen8_surface_state *ss;
> - uint32_t write_domain, read_domain, offset;
> - int ret;
> -
> - if (is_dst) {
> - write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> - } else {
> - write_domain = 0;
> - read_domain = I915_GEM_DOMAIN_SAMPLER;
> - }
> -
> - ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> - offset = intel_batchbuffer_subdata_offset(batch, ss);
> -
> - ss->ss0.surface_type = GEN8_SURFACE_2D;
> - ss->ss0.surface_format = format;
> - ss->ss0.render_cache_read_write = 1;
> - ss->ss0.vertical_alignment = 1; /* align 4 */
> - ss->ss0.horizontal_alignment = 1; /* align 4 */
> -
> - if (buf->tiling == I915_TILING_X)
> - ss->ss0.tiled_mode = 2;
> - else if (buf->tiling == I915_TILING_Y)
> - ss->ss0.tiled_mode = 3;
> -
> - ss->ss8.base_addr = buf->bo->offset;
> -
> - ret = drm_intel_bo_emit_reloc(batch->bo,
> - intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> - buf->bo, 0,
> - read_domain, write_domain);
> - igt_assert_eq(ret, 0);
> -
> - ss->ss2.height = igt_buf_height(buf) - 1;
> - ss->ss2.width = igt_buf_width(buf) - 1;
> - ss->ss3.pitch = buf->stride - 1;
> -
> - ss->ss7.shader_chanel_select_r = 4;
> - ss->ss7.shader_chanel_select_g = 5;
> - ss->ss7.shader_chanel_select_b = 6;
> - ss->ss7.shader_chanel_select_a = 7;
> -
> - return offset;
> -}
> -
> -static uint32_t
> -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> - struct igt_buf *dst)
> -{
> - uint32_t *binding_table, offset;
> -
> - binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> - offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> -
> - binding_table[0] = gen8_spin_surface_state(batch, dst,
> - GEN8_SURFACEFORMAT_R8_UNORM, 1);
> -
> - return offset;
> -}
> -
> -static uint32_t
> -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> - const uint32_t kernel[][4],
> - size_t size)
> -{
> - uint32_t offset;
> -
> - offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> -
> - return offset;
> -}
> -
> -static uint32_t
> -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> - struct igt_buf *dst)
> -{
> - struct gen8_interface_descriptor_data *idd;
> - uint32_t offset;
> - uint32_t binding_table_offset, kernel_offset;
> -
> - binding_table_offset = gen8_spin_binding_table(batch, dst);
> - kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> - sizeof(spin_kernel));
> -
> - idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> - offset = intel_batchbuffer_subdata_offset(batch, idd);
> -
> - idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> -
> - idd->desc2.single_program_flow = 1;
> - idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> -
> - idd->desc3.sampler_count = 0; /* 0 samplers used */
> - idd->desc3.sampler_state_pointer = 0;
> -
> - idd->desc4.binding_table_entry_count = 0;
> - idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> -
> - idd->desc5.constant_urb_entry_read_offset = 0;
> - idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> -
> - return offset;
> -}
> -
> -static void
> -gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (16 - 2));
> -
> - /* general */
> - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> - OUT_BATCH(0);
> -
> - /* stateless data port */
> - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> -
> - /* surface */
> - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
> -
> - /* dynamic */
> - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
> - 0, BASE_ADDRESS_MODIFY);
> -
> - /* indirect */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* instruction */
> - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
> -
> - /* general state buffer size */
> - OUT_BATCH(0xfffff000 | 1);
> - /* dynamic state buffer size */
> - OUT_BATCH(1 << 12 | 1);
> - /* indirect object buffer size */
> - OUT_BATCH(0xfffff000 | 1);
> - /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
> - OUT_BATCH(1 << 12 | 1);
> -}
> -
> -static void
> -gen9_emit_state_base_address(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (19 - 2));
> -
> - /* general */
> - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> - OUT_BATCH(0);
> -
> - /* stateless data port */
> - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> -
> - /* surface */
> - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
> -
> - /* dynamic */
> - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
> - 0, BASE_ADDRESS_MODIFY);
> -
> - /* indirect */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* instruction */
> - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
> -
> - /* general state buffer size */
> - OUT_BATCH(0xfffff000 | 1);
> - /* dynamic state buffer size */
> - OUT_BATCH(1 << 12 | 1);
> - /* indirect object buffer size */
> - OUT_BATCH(0xfffff000 | 1);
> - /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
> - OUT_BATCH(1 << 12 | 1);
> -
> - /* Bindless surface state base address */
> - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> - OUT_BATCH(0);
> - OUT_BATCH(0xfffff000);
> -}
> -
> -static void
> -gen8_emit_vfe_state(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
> -
> - /* scratch buffer */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* number of threads & urb entries */
> - OUT_BATCH(2 << 8);
> -
> - OUT_BATCH(0);
> -
> - /* urb entry size & curbe size */
> - OUT_BATCH(2 << 16 |
> - 2);
> -
> - /* scoreboard */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -}
> -
> -static void
> -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> -{
> - OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> - OUT_BATCH(0);
> - /* curbe total data length */
> - OUT_BATCH(64);
> - /* curbe data start address, is relative to the dynamics base address */
> - OUT_BATCH(curbe_buffer);
> -}
> -
> -static void
> -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> - uint32_t interface_descriptor)
> -{
> - OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> - OUT_BATCH(0);
> - /* interface descriptor data length */
> - OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> - /* interface descriptor address, is relative to the dynamics base address */
> - OUT_BATCH(interface_descriptor);
> -}
> -
> -static void
> -gen8_emit_media_state_flush(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_MEDIA_STATE_FLUSH | (2 - 2));
> - OUT_BATCH(0);
> -}
> -
> -static void
> -gen8_emit_media_objects(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> -
> - /* interface descriptor offset */
> - OUT_BATCH(0);
> -
> - /* without indirect data */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* scoreboard */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* inline data (xoffset, yoffset) */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> - gen8_emit_media_state_flush(batch);
> -}
> -
> -static void
> -gen8lp_emit_media_objects(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> -
> - /* interface descriptor offset */
> - OUT_BATCH(0);
> -
> - /* without indirect data */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* scoreboard */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* inline data (xoffset, yoffset) */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -}
> -
> /*
> * This sets up the media pipeline,
> *
> @@ -390,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
> + interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -398,13 +89,13 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
> gen8_emit_state_base_address(batch);
>
> - gen8_emit_vfe_state(batch);
> + gen8_emit_vfe_state_spin(batch);
>
> gen8_emit_curbe_load(batch, curbe_buffer);
>
> gen8_emit_interface_descriptor_load(batch, interface_descriptor);
>
> - gen8_emit_media_objects(batch);
> + gen8_emit_media_objects_spin(batch);
>
> OUT_BATCH(MI_BATCH_BUFFER_END);
>
> @@ -428,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
> + interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -436,13 +127,13 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
> gen8_emit_state_base_address(batch);
>
> - gen8_emit_vfe_state(batch);
> + gen8_emit_vfe_state_spin(batch);
>
> gen8_emit_curbe_load(batch, curbe_buffer);
>
> gen8_emit_interface_descriptor_load(batch, interface_descriptor);
>
> - gen8lp_emit_media_objects(batch);
> + gen8lp_emit_media_objects_spin(batch);
>
> OUT_BATCH(MI_BATCH_BUFFER_END);
>
> @@ -466,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
> + interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -479,13 +170,13 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> GEN9_FORCE_MEDIA_AWAKE_MASK);
> gen9_emit_state_base_address(batch);
>
> - gen8_emit_vfe_state(batch);
> + gen8_emit_vfe_state_spin(batch);
>
> gen8_emit_curbe_load(batch, curbe_buffer);
>
> gen8_emit_interface_descriptor_load(batch, interface_descriptor);
>
> - gen8_emit_media_objects(batch);
> + gen8_emit_media_objects_spin(batch);
>
> OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA |
> GEN9_FORCE_MEDIA_AWAKE_DISABLE |
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin Katarzyna Dec
@ 2018-04-25 21:49 ` Daniele Ceraolo Spurio
2018-04-26 11:11 ` Katarzyna Dec
2018-04-26 13:32 ` Katarzyna Dec
0 siblings, 2 replies; 12+ messages in thread
From: Daniele Ceraolo Spurio @ 2018-04-25 21:49 UTC (permalink / raw)
To: Katarzyna Dec, igt-dev
On 25/04/18 06:26, Katarzyna Dec wrote:
> Let's remove duplications introduced by moving media_spin helper
> functions to gpu_fill. These were mainly the same functions
> as for Gen8 media/gpgpu fill. gen8_render_flush from media_spin
> was replaced by gen7_render_flush. The only functions that were
> left intact are gen8_emit_media_objects_spin and
> gen8_spin_render_flush.
This is going to be a bit long since I have several comments that don't
apply to a specific place in the code, apologies in advance :)
I can see gen8_spin_render_flush in the header but it is not implemented
or called from anywhere. Did you miss something from your git commit or
can we actually drop it? This isn't tied to any gen (it just does an
execbuf) so I guess it is probably the latter.
gen8_emit_media_objects_spin is also very similar to what is in the
inner loop of the gen7 version, maybe we can do something like:
void emit_media_object(struct intel_batchbuffer *batch,
unsigned xoff, unsigned yoff)
{
OUT_BATCH(GEN7_MEDIA_OBJECT | (8 - 2));
/* interface descriptor offset */
OUT_BATCH(0);
/* without indirect data */
OUT_BATCH(0);
OUT_BATCH(0);
/* scoreboard */
OUT_BATCH(0);
OUT_BATCH(0);
/* inline data (xoffset, yoffset) */
OUT_BATCH(xoff);
OUT_BATCH(yoff);
if (AT_LEAST_GEN(batch->devid, 8) &&
!IS_CHERRYVIEW(batch->devid))
gen8_emit_media_state_flush(batch);
}
void
gen7_emit_media_objects(struct intel_batchbuffer *batch,
unsigned x, unsigned y,
unsigned width, unsigned height)
{
int i, j;
for (i = 0; i < width / 16; i++)
for (j = 0; j < height / 16; j++)
emit_media_object(batch,
x + i * 16,
y + j * 16);
}
And from the spin file just call emit_media_object(batch, 0, 0).
I'm happy if you do this on top as an additional patch if you don't want
to mess with this one.
Regarding remaining "spin" functions, I also see
gen8_emit_vfe_state_spin and gen8_spin_curbe_buffer_data. Including the
_spin one, there are 3 variants of gen8_emit_vfe_state which we could
probably unify by passing in some params, something like:
void
gen8_emit_vfe_state(struct intel_batchbuffer *batch,
uint32_t threads, uint32_t urb_entries,
uint32_t urb_entry_size, uint32_t urb_alloc_size)
{
/* number of threads & urb entries */
OUT_BATCH(threads << 16 | urb_entries << 8);
OUT_BATCH(0);
/* urb entry size & curbe size */
OUT_BATCH(urb_entry_size << 16 | urb_alloc_size);
/* scoreboard */
OUT_BATCH(0);
OUT_BATCH(0);
OUT_BATCH(0);
}
Lastly, for gen8_spin_curbe_buffer_data the only 2 differences with
gen7_fill_curbe_buffer_data are the type of the variable used (u8 vs
u32) and the size of the allocation. Using u32 in both cases shouldn't
be an issue and we can potentially pass the size in as a parameter, thus
allowing us to drop another duplicated function.
Both of those cleanups can also can go later in the series with new
patches (possibly before the reformatting).
One final comment: in the media_spin file we now mix calls to "spin"
functions and "fill" functions. For functions that are generic and not
specific to media/gpgpu fill we can maybe drop the "fill" tag to avoid
confusion. One more patch on the pile
Suggestions/ramblings aside, the changes in this patch LGTM.
Daniele
>
> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> ---
> lib/gpu_fill.c | 145 -------------------------------------------------------
> lib/gpu_fill.h | 28 +----------
> lib/media_spin.c | 24 ++++-----
> 3 files changed, 13 insertions(+), 184 deletions(-)
>
> diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> index f4b33c05..f5fc61bb 100644
> --- a/lib/gpu_fill.c
> +++ b/lib/gpu_fill.c
> @@ -351,18 +351,6 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> OUT_BATCH(0xffffffff);
> }
>
> -void
> -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> -{
> - int ret;
> -
> - ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> - if (ret == 0)
> - ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> - batch_end, 0);
> - igt_assert_eq(ret, 0);
> -}
> -
> uint32_t
> gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> uint32_t iters)
> @@ -428,57 +416,6 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> return offset;
> }
>
> -uint32_t
> -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> - struct igt_buf *buf,
> - uint32_t format,
> - int is_dst)
> -{
> - struct gen8_surface_state *ss;
> - uint32_t write_domain, read_domain, offset;
> - int ret;
> -
> - if (is_dst) {
> - write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> - } else {
> - write_domain = 0;
> - read_domain = I915_GEM_DOMAIN_SAMPLER;
> - }
> -
> - ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> - offset = intel_batchbuffer_subdata_offset(batch, ss);
> -
> - ss->ss0.surface_type = GEN8_SURFACE_2D;
> - ss->ss0.surface_format = format;
> - ss->ss0.render_cache_read_write = 1;
> - ss->ss0.vertical_alignment = 1; /* align 4 */
> - ss->ss0.horizontal_alignment = 1; /* align 4 */
> -
> - if (buf->tiling == I915_TILING_X)
> - ss->ss0.tiled_mode = 2;
> - else if (buf->tiling == I915_TILING_Y)
> - ss->ss0.tiled_mode = 3;
> -
> - ss->ss8.base_addr = buf->bo->offset;
> -
> - ret = drm_intel_bo_emit_reloc(batch->bo,
> - intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> - buf->bo, 0,
> - read_domain, write_domain);
> - igt_assert_eq(ret, 0);
> -
> - ss->ss2.height = igt_buf_height(buf) - 1;
> - ss->ss2.width = igt_buf_width(buf) - 1;
> - ss->ss3.pitch = buf->stride - 1;
> -
> - ss->ss7.shader_chanel_select_r = 4;
> - ss->ss7.shader_chanel_select_g = 5;
> - ss->ss7.shader_chanel_select_b = 6;
> - ss->ss7.shader_chanel_select_a = 7;
> -
> - return offset;
> -}
> -
> uint32_t
> gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
> {
> @@ -511,65 +448,6 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
> return offset;
> }
>
> -uint32_t
> -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> - struct igt_buf *dst)
> -{
> - uint32_t *binding_table, offset;
> -
> - binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> - offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> -
> - binding_table[0] = gen8_spin_surface_state(batch, dst,
> - GEN8_SURFACEFORMAT_R8_UNORM, 1);
> -
> - return offset;
> -}
> -
> -uint32_t
> -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> - const uint32_t kernel[][4],
> - size_t size)
> -{
> - uint32_t offset;
> -
> - offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> -
> - return offset;
> -}
> -
> -uint32_t
> -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> - struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
> -{
> - struct gen8_interface_descriptor_data *idd;
> - uint32_t offset;
> - uint32_t binding_table_offset, kernel_offset;
> -
> - binding_table_offset = gen8_spin_binding_table(batch, dst);
> - kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> - sizeof(spin_kernel));
> -
> - idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> - offset = intel_batchbuffer_subdata_offset(batch, idd);
> -
> - idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> -
> - idd->desc2.single_program_flow = 1;
> - idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> -
> - idd->desc3.sampler_count = 0; /* 0 samplers used */
> - idd->desc3.sampler_state_pointer = 0;
> -
> - idd->desc4.binding_table_entry_count = 0;
> - idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> -
> - idd->desc5.constant_urb_entry_read_offset = 0;
> - idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> -
> - return offset;
> -}
> -
> void
> gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> {
> @@ -685,29 +563,6 @@ gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
> OUT_BATCH(0);
> }
>
> -void
> -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> -{
> - OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> - OUT_BATCH(0);
> - /* curbe total data length */
> - OUT_BATCH(64);
> - /* curbe data start address, is relative to the dynamics base address */
> - OUT_BATCH(curbe_buffer);
> -}
> -
> -void
> -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> - uint32_t interface_descriptor)
> -{
> - OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> - OUT_BATCH(0);
> - /* interface descriptor data length */
> - OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> - /* interface descriptor address, is relative to the dynamics base address */
> - OUT_BATCH(interface_descriptor);
> -}
> -
> void
> gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
> index c6d9ffb3..f0f07661 100644
> --- a/lib/gpu_fill.h
> +++ b/lib/gpu_fill.h
> @@ -89,7 +89,7 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> unsigned width, unsigned height);
>
> void
> -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> +gen8_spin_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
>
> uint32_t
> gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> @@ -101,28 +101,9 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> uint32_t format,
> int is_dst);
>
> -uint32_t
> -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> - struct igt_buf *buf,
> - uint32_t format,
> - int is_dst);
> -
> uint32_t
> gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
>
> -uint32_t
> -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> - struct igt_buf *dst);
> -
> -uint32_t
> -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> - const uint32_t kernel[][4],
> - size_t size);
> -
> -uint32_t
> -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> - struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> -
> void
> gen8_emit_state_base_address(struct intel_batchbuffer *batch);
>
> @@ -138,13 +119,6 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
> void
> gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
>
> -void
> -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> -
> -void
> -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> - uint32_t interface_descriptor);
> -
> void
> gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> diff --git a/lib/media_spin.c b/lib/media_spin.c
> index 72009908..16ea8483 100644
> --- a/lib/media_spin.c
> +++ b/lib/media_spin.c
> @@ -81,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -91,9 +91,9 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
>
> gen8_emit_vfe_state_spin(batch);
>
> - gen8_emit_curbe_load(batch, curbe_buffer);
> + gen7_emit_curbe_load(batch, curbe_buffer);
>
> - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
>
> gen8_emit_media_objects_spin(batch);
>
> @@ -102,7 +102,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> batch_end = intel_batchbuffer_align(batch, 8);
> igt_assert(batch_end < BATCH_STATE_SPLIT);
>
> - gen8_render_flush(batch, batch_end);
> + gen7_render_flush(batch, batch_end);
> intel_batchbuffer_reset(batch);
> }
>
> @@ -119,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -129,9 +129,9 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
>
> gen8_emit_vfe_state_spin(batch);
>
> - gen8_emit_curbe_load(batch, curbe_buffer);
> + gen7_emit_curbe_load(batch, curbe_buffer);
>
> - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
>
> gen8lp_emit_media_objects_spin(batch);
>
> @@ -140,7 +140,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> batch_end = intel_batchbuffer_align(batch, 8);
> igt_assert(batch_end < BATCH_STATE_SPLIT);
>
> - gen8_render_flush(batch, batch_end);
> + gen7_render_flush(batch, batch_end);
> intel_batchbuffer_reset(batch);
> }
>
> @@ -157,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -172,9 +172,9 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
>
> gen8_emit_vfe_state_spin(batch);
>
> - gen8_emit_curbe_load(batch, curbe_buffer);
> + gen7_emit_curbe_load(batch, curbe_buffer);
>
> - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
>
> gen8_emit_media_objects_spin(batch);
>
> @@ -190,6 +190,6 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> batch_end = intel_batchbuffer_align(batch, 8);
> igt_assert(batch_end < BATCH_STATE_SPLIT);
>
> - gen8_render_flush(batch, batch_end);
> + gen7_render_flush(batch, batch_end);
> intel_batchbuffer_reset(batch);
> }
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library
2018-04-25 20:01 ` [igt-dev] [PATCH i-g-t 1/4] " Daniele Ceraolo Spurio
@ 2018-04-26 11:08 ` Katarzyna Dec
0 siblings, 0 replies; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-26 11:08 UTC (permalink / raw)
To: Daniele Ceraolo Spurio; +Cc: igt-dev
On Wed, Apr 25, 2018 at 01:01:38PM -0700, Daniele Ceraolo Spurio wrote:
> General comment for the first 2 patches:
>
> It is a bit confusing to have functions for a "spin" workload with "spin" in
> their name in a file named "gpu_fill", so we should rename the file to
> something more appropriate (gpu_cmds? gpu_workload_cmds?
> gpu_workload_helpers?). My naming sense sucks, so I'll leave it to you to
> pick a nice name :P.
Renaming makes a lot of sense, I will do that in separate patch to avoid
rebasing.
>
> Also, there is no need to move the functions to the common file before
> dropping them, we can drop them where they are, so you can squash the first
> 2 patches into one to make life easier for the reviewers. If you're up for a
> slight rework, the cleanest ordering (and easiest to review) IMO would be a
> patch to drop all the duplicated code from media_spin followed by a patch to
> move whatever is left to the common file, but since the remaining "spin"
> functions seem to be minimal I'm ok with it all being in a single patch.
>
> I'm not going to do a full review of the function move done by this patch
> for now because most of the functions are going to disappear in the next
> patch. I'll have a proper look after the squash ;)
>
I've squashed these 2 patches into one.
Kasia
> Thanks,
> Daniele
>
> On 25/04/18 06:26, Katarzyna Dec wrote:
> > We are moving all helper functions to gpu_fill library without removing
> > duplicates. Few function names were extended with *_spin.
> > All duplications will be removed in next patch.
> >
> > Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> > Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> > Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> > ---
> > lib/gpu_fill.c | 226 ++++++++++++++++++++++++++++++++++++++
> > lib/gpu_fill.h | 42 +++++++
> > lib/media_spin.c | 329 ++-----------------------------------------------------
> > 3 files changed, 278 insertions(+), 319 deletions(-)
> >
> > diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> > index f05d4eca..f4b33c05 100644
> > --- a/lib/gpu_fill.c
> > +++ b/lib/gpu_fill.c
> > @@ -351,6 +351,32 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > OUT_BATCH(0xffffffff);
> > }
> > +void
> > +gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> > +{
> > + int ret;
> > +
> > + ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> > + if (ret == 0)
> > + ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> > + batch_end, 0);
> > + igt_assert_eq(ret, 0);
> > +}
> > +
> > +uint32_t
> > +gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > + uint32_t iters)
> > +{
> > + uint32_t *curbe_buffer;
> > + uint32_t offset;
> > +
> > + curbe_buffer = intel_batchbuffer_subdata_alloc(batch, 64, 64);
> > + offset = intel_batchbuffer_subdata_offset(batch, curbe_buffer);
> > + *curbe_buffer = iters;
> > +
> > + return offset;
> > +}
> > +
> > uint32_t
> > gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > struct igt_buf *buf,
> > @@ -402,6 +428,57 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > return offset;
> > }
> > +uint32_t
> > +gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > + struct igt_buf *buf,
> > + uint32_t format,
> > + int is_dst)
> > +{
> > + struct gen8_surface_state *ss;
> > + uint32_t write_domain, read_domain, offset;
> > + int ret;
> > +
> > + if (is_dst) {
> > + write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> > + } else {
> > + write_domain = 0;
> > + read_domain = I915_GEM_DOMAIN_SAMPLER;
> > + }
> > +
> > + ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> > + offset = intel_batchbuffer_subdata_offset(batch, ss);
> > +
> > + ss->ss0.surface_type = GEN8_SURFACE_2D;
> > + ss->ss0.surface_format = format;
> > + ss->ss0.render_cache_read_write = 1;
> > + ss->ss0.vertical_alignment = 1; /* align 4 */
> > + ss->ss0.horizontal_alignment = 1; /* align 4 */
> > +
> > + if (buf->tiling == I915_TILING_X)
> > + ss->ss0.tiled_mode = 2;
> > + else if (buf->tiling == I915_TILING_Y)
> > + ss->ss0.tiled_mode = 3;
> > +
> > + ss->ss8.base_addr = buf->bo->offset;
> > +
> > + ret = drm_intel_bo_emit_reloc(batch->bo,
> > + intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> > + buf->bo, 0,
> > + read_domain, write_domain);
> > + igt_assert_eq(ret, 0);
> > +
> > + ss->ss2.height = igt_buf_height(buf) - 1;
> > + ss->ss2.width = igt_buf_width(buf) - 1;
> > + ss->ss3.pitch = buf->stride - 1;
> > +
> > + ss->ss7.shader_chanel_select_r = 4;
> > + ss->ss7.shader_chanel_select_g = 5;
> > + ss->ss7.shader_chanel_select_b = 6;
> > + ss->ss7.shader_chanel_select_a = 7;
> > +
> > + return offset;
> > +}
> > +
> > uint32_t
> > gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
> > {
> > @@ -434,6 +511,65 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
> > return offset;
> > }
> > +uint32_t
> > +gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > + struct igt_buf *dst)
> > +{
> > + uint32_t *binding_table, offset;
> > +
> > + binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> > + offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> > +
> > + binding_table[0] = gen8_spin_surface_state(batch, dst,
> > + GEN8_SURFACEFORMAT_R8_UNORM, 1);
> > +
> > + return offset;
> > +}
> > +
> > +uint32_t
> > +gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > + const uint32_t kernel[][4],
> > + size_t size)
> > +{
> > + uint32_t offset;
> > +
> > + offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> > +
> > + return offset;
> > +}
> > +
> > +uint32_t
> > +gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > + struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
> > +{
> > + struct gen8_interface_descriptor_data *idd;
> > + uint32_t offset;
> > + uint32_t binding_table_offset, kernel_offset;
> > +
> > + binding_table_offset = gen8_spin_binding_table(batch, dst);
> > + kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> > + sizeof(spin_kernel));
> > +
> > + idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> > + offset = intel_batchbuffer_subdata_offset(batch, idd);
> > +
> > + idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> > +
> > + idd->desc2.single_program_flow = 1;
> > + idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> > +
> > + idd->desc3.sampler_count = 0; /* 0 samplers used */
> > + idd->desc3.sampler_state_pointer = 0;
> > +
> > + idd->desc4.binding_table_entry_count = 0;
> > + idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> > +
> > + idd->desc5.constant_urb_entry_read_offset = 0;
> > + idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> > +
> > + return offset;
> > +}
> > +
> > void
> > gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> > {
> > @@ -525,6 +661,53 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch)
> > OUT_BATCH(0);
> > }
> > +void
> > +gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
> > +{
> > + OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
> > +
> > + /* scratch buffer */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +
> > + /* number of threads & urb entries */
> > + OUT_BATCH(2 << 8);
> > +
> > + OUT_BATCH(0);
> > +
> > + /* urb entry size & curbe size */
> > + OUT_BATCH(2 << 16 |
> > + 2);
> > +
> > + /* scoreboard */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +}
> > +
> > +void
> > +gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> > +{
> > + OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> > + OUT_BATCH(0);
> > + /* curbe total data length */
> > + OUT_BATCH(64);
> > + /* curbe data start address, is relative to the dynamics base address */
> > + OUT_BATCH(curbe_buffer);
> > +}
> > +
> > +void
> > +gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > + uint32_t interface_descriptor)
> > +{
> > + OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> > + OUT_BATCH(0);
> > + /* interface descriptor data length */
> > + OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> > + /* interface descriptor address, is relative to the dynamics base address */
> > + OUT_BATCH(interface_descriptor);
> > +}
> > +
> > void
> > gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > @@ -585,6 +768,49 @@ gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > OUT_BATCH(0xffffffff);
> > }
> > +void
> > +gen8_emit_media_objects_spin(struct intel_batchbuffer *batch)
> > +{
> > + OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> > +
> > + /* interface descriptor offset */
> > + OUT_BATCH(0);
> > +
> > + /* without indirect data */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +
> > + /* scoreboard */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +
> > + /* inline data (xoffset, yoffset) */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > + gen8_emit_media_state_flush(batch);
> > +}
> > +
> > +void
> > +gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch)
> > +{
> > + OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> > +
> > + /* interface descriptor offset */
> > + OUT_BATCH(0);
> > +
> > + /* without indirect data */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +
> > + /* scoreboard */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +
> > + /* inline data (xoffset, yoffset) */
> > + OUT_BATCH(0);
> > + OUT_BATCH(0);
> > +}
> > +
> > void
> > gen9_emit_state_base_address(struct intel_batchbuffer *batch)
> > {
> > diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
> > index 067d4987..c6d9ffb3 100644
> > --- a/lib/gpu_fill.h
> > +++ b/lib/gpu_fill.h
> > @@ -88,15 +88,41 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > unsigned width, unsigned height);
> > +void
> > +gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> > +
> > +uint32_t
> > +gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > + uint32_t iters);
> > +
> > uint32_t
> > gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > struct igt_buf *buf,
> > uint32_t format,
> > int is_dst);
> > +uint32_t
> > +gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > + struct igt_buf *buf,
> > + uint32_t format,
> > + int is_dst);
> > +
> > uint32_t
> > gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> > +uint32_t
> > +gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > + struct igt_buf *dst);
> > +
> > +uint32_t
> > +gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > + const uint32_t kernel[][4],
> > + size_t size);
> > +
> > +uint32_t
> > +gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > + struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> > +
> > void
> > gen8_emit_state_base_address(struct intel_batchbuffer *batch);
> > @@ -109,11 +135,27 @@ gen8_emit_vfe_state(struct intel_batchbuffer *batch);
> > void
> > gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
> > +void
> > +gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
> > +
> > +void
> > +gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> > +
> > +void
> > +gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > + uint32_t interface_descriptor);
> > +
> > void
> > gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > unsigned width, unsigned height);
> > +void
> > +gen8_emit_media_objects_spin(struct intel_batchbuffer *batch);
> > +
> > +void
> > +gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch);
> > +
> > void
> > gen9_emit_state_base_address(struct intel_batchbuffer *batch);
> > diff --git a/lib/media_spin.c b/lib/media_spin.c
> > index d9e058b1..72009908 100644
> > --- a/lib/media_spin.c
> > +++ b/lib/media_spin.c
> > @@ -31,6 +31,7 @@
> > #include "intel_batchbuffer.h"
> > #include "gen8_media.h"
> > #include "media_spin.h"
> > +#include "gpu_fill.h"
> > static const uint32_t spin_kernel[][4] = {
> > { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
> > @@ -45,316 +46,6 @@ static const uint32_t spin_kernel[][4] = {
> > { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
> > };
> > -static void
> > -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> > -{
> > - int ret;
> > -
> > - ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> > - if (ret == 0)
> > - ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> > - batch_end, 0);
> > - igt_assert_eq(ret, 0);
> > -}
> > -
> > -static uint32_t
> > -gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > - uint32_t iters)
> > -{
> > - uint32_t *curbe_buffer;
> > - uint32_t offset;
> > -
> > - curbe_buffer = intel_batchbuffer_subdata_alloc(batch, 64, 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, curbe_buffer);
> > - *curbe_buffer = iters;
> > -
> > - return offset;
> > -}
> > -
> > -static uint32_t
> > -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > - struct igt_buf *buf,
> > - uint32_t format,
> > - int is_dst)
> > -{
> > - struct gen8_surface_state *ss;
> > - uint32_t write_domain, read_domain, offset;
> > - int ret;
> > -
> > - if (is_dst) {
> > - write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> > - } else {
> > - write_domain = 0;
> > - read_domain = I915_GEM_DOMAIN_SAMPLER;
> > - }
> > -
> > - ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, ss);
> > -
> > - ss->ss0.surface_type = GEN8_SURFACE_2D;
> > - ss->ss0.surface_format = format;
> > - ss->ss0.render_cache_read_write = 1;
> > - ss->ss0.vertical_alignment = 1; /* align 4 */
> > - ss->ss0.horizontal_alignment = 1; /* align 4 */
> > -
> > - if (buf->tiling == I915_TILING_X)
> > - ss->ss0.tiled_mode = 2;
> > - else if (buf->tiling == I915_TILING_Y)
> > - ss->ss0.tiled_mode = 3;
> > -
> > - ss->ss8.base_addr = buf->bo->offset;
> > -
> > - ret = drm_intel_bo_emit_reloc(batch->bo,
> > - intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> > - buf->bo, 0,
> > - read_domain, write_domain);
> > - igt_assert_eq(ret, 0);
> > -
> > - ss->ss2.height = igt_buf_height(buf) - 1;
> > - ss->ss2.width = igt_buf_width(buf) - 1;
> > - ss->ss3.pitch = buf->stride - 1;
> > -
> > - ss->ss7.shader_chanel_select_r = 4;
> > - ss->ss7.shader_chanel_select_g = 5;
> > - ss->ss7.shader_chanel_select_b = 6;
> > - ss->ss7.shader_chanel_select_a = 7;
> > -
> > - return offset;
> > -}
> > -
> > -static uint32_t
> > -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst)
> > -{
> > - uint32_t *binding_table, offset;
> > -
> > - binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> > -
> > - binding_table[0] = gen8_spin_surface_state(batch, dst,
> > - GEN8_SURFACEFORMAT_R8_UNORM, 1);
> > -
> > - return offset;
> > -}
> > -
> > -static uint32_t
> > -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > - const uint32_t kernel[][4],
> > - size_t size)
> > -{
> > - uint32_t offset;
> > -
> > - offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> > -
> > - return offset;
> > -}
> > -
> > -static uint32_t
> > -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst)
> > -{
> > - struct gen8_interface_descriptor_data *idd;
> > - uint32_t offset;
> > - uint32_t binding_table_offset, kernel_offset;
> > -
> > - binding_table_offset = gen8_spin_binding_table(batch, dst);
> > - kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> > - sizeof(spin_kernel));
> > -
> > - idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, idd);
> > -
> > - idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> > -
> > - idd->desc2.single_program_flow = 1;
> > - idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> > -
> > - idd->desc3.sampler_count = 0; /* 0 samplers used */
> > - idd->desc3.sampler_state_pointer = 0;
> > -
> > - idd->desc4.binding_table_entry_count = 0;
> > - idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> > -
> > - idd->desc5.constant_urb_entry_read_offset = 0;
> > - idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> > -
> > - return offset;
> > -}
> > -
> > -static void
> > -gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> > -{
> > - OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (16 - 2));
> > -
> > - /* general */
> > - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> > - OUT_BATCH(0);
> > -
> > - /* stateless data port */
> > - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> > -
> > - /* surface */
> > - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
> > -
> > - /* dynamic */
> > - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
> > - 0, BASE_ADDRESS_MODIFY);
> > -
> > - /* indirect */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* instruction */
> > - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
> > -
> > - /* general state buffer size */
> > - OUT_BATCH(0xfffff000 | 1);
> > - /* dynamic state buffer size */
> > - OUT_BATCH(1 << 12 | 1);
> > - /* indirect object buffer size */
> > - OUT_BATCH(0xfffff000 | 1);
> > - /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
> > - OUT_BATCH(1 << 12 | 1);
> > -}
> > -
> > -static void
> > -gen9_emit_state_base_address(struct intel_batchbuffer *batch)
> > -{
> > - OUT_BATCH(GEN8_STATE_BASE_ADDRESS | (19 - 2));
> > -
> > - /* general */
> > - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> > - OUT_BATCH(0);
> > -
> > - /* stateless data port */
> > - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> > -
> > - /* surface */
> > - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_SAMPLER, 0, BASE_ADDRESS_MODIFY);
> > -
> > - /* dynamic */
> > - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_RENDER | I915_GEM_DOMAIN_INSTRUCTION,
> > - 0, BASE_ADDRESS_MODIFY);
> > -
> > - /* indirect */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* instruction */
> > - OUT_RELOC(batch->bo, I915_GEM_DOMAIN_INSTRUCTION, 0, BASE_ADDRESS_MODIFY);
> > -
> > - /* general state buffer size */
> > - OUT_BATCH(0xfffff000 | 1);
> > - /* dynamic state buffer size */
> > - OUT_BATCH(1 << 12 | 1);
> > - /* indirect object buffer size */
> > - OUT_BATCH(0xfffff000 | 1);
> > - /* intruction buffer size, must set modify enable bit, otherwise it may result in GPU hang */
> > - OUT_BATCH(1 << 12 | 1);
> > -
> > - /* Bindless surface state base address */
> > - OUT_BATCH(0 | BASE_ADDRESS_MODIFY);
> > - OUT_BATCH(0);
> > - OUT_BATCH(0xfffff000);
> > -}
> > -
> > -static void
> > -gen8_emit_vfe_state(struct intel_batchbuffer *batch)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_VFE_STATE | (9 - 2));
> > -
> > - /* scratch buffer */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* number of threads & urb entries */
> > - OUT_BATCH(2 << 8);
> > -
> > - OUT_BATCH(0);
> > -
> > - /* urb entry size & curbe size */
> > - OUT_BATCH(2 << 16 |
> > - 2);
> > -
> > - /* scoreboard */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -}
> > -
> > -static void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> > - OUT_BATCH(0);
> > - /* curbe total data length */
> > - OUT_BATCH(64);
> > - /* curbe data start address, is relative to the dynamics base address */
> > - OUT_BATCH(curbe_buffer);
> > -}
> > -
> > -static void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > - uint32_t interface_descriptor)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> > - OUT_BATCH(0);
> > - /* interface descriptor data length */
> > - OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> > - /* interface descriptor address, is relative to the dynamics base address */
> > - OUT_BATCH(interface_descriptor);
> > -}
> > -
> > -static void
> > -gen8_emit_media_state_flush(struct intel_batchbuffer *batch)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_STATE_FLUSH | (2 - 2));
> > - OUT_BATCH(0);
> > -}
> > -
> > -static void
> > -gen8_emit_media_objects(struct intel_batchbuffer *batch)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> > -
> > - /* interface descriptor offset */
> > - OUT_BATCH(0);
> > -
> > - /* without indirect data */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* scoreboard */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* inline data (xoffset, yoffset) */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > - gen8_emit_media_state_flush(batch);
> > -}
> > -
> > -static void
> > -gen8lp_emit_media_objects(struct intel_batchbuffer *batch)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> > -
> > - /* interface descriptor offset */
> > - OUT_BATCH(0);
> > -
> > - /* without indirect data */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* scoreboard */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -
> > - /* inline data (xoffset, yoffset) */
> > - OUT_BATCH(0);
> > - OUT_BATCH(0);
> > -}
> > -
> > /*
> > * This sets up the media pipeline,
> > *
> > @@ -390,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
> > + interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -398,13 +89,13 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
> > gen8_emit_state_base_address(batch);
> > - gen8_emit_vfe_state(batch);
> > + gen8_emit_vfe_state_spin(batch);
> > gen8_emit_curbe_load(batch, curbe_buffer);
> > gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > - gen8_emit_media_objects(batch);
> > + gen8_emit_media_objects_spin(batch);
> > OUT_BATCH(MI_BATCH_BUFFER_END);
> > @@ -428,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
> > + interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -436,13 +127,13 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
> > gen8_emit_state_base_address(batch);
> > - gen8_emit_vfe_state(batch);
> > + gen8_emit_vfe_state_spin(batch);
> > gen8_emit_curbe_load(batch, curbe_buffer);
> > gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > - gen8lp_emit_media_objects(batch);
> > + gen8lp_emit_media_objects_spin(batch);
> > OUT_BATCH(MI_BATCH_BUFFER_END);
> > @@ -466,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst);
> > + interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -479,13 +170,13 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > GEN9_FORCE_MEDIA_AWAKE_MASK);
> > gen9_emit_state_base_address(batch);
> > - gen8_emit_vfe_state(batch);
> > + gen8_emit_vfe_state_spin(batch);
> > gen8_emit_curbe_load(batch, curbe_buffer);
> > gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > - gen8_emit_media_objects(batch);
> > + gen8_emit_media_objects_spin(batch);
> > OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA |
> > GEN9_FORCE_MEDIA_AWAKE_DISABLE |
> >
> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
2018-04-25 21:49 ` Daniele Ceraolo Spurio
@ 2018-04-26 11:11 ` Katarzyna Dec
2018-04-26 13:32 ` Katarzyna Dec
1 sibling, 0 replies; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-26 11:11 UTC (permalink / raw)
To: Daniele Ceraolo Spurio; +Cc: igt-dev
On Wed, Apr 25, 2018 at 02:49:02PM -0700, Daniele Ceraolo Spurio wrote:
>
>
> On 25/04/18 06:26, Katarzyna Dec wrote:
> > Let's remove duplications introduced by moving media_spin helper
> > functions to gpu_fill. These were mainly the same functions
> > as for Gen8 media/gpgpu fill. gen8_render_flush from media_spin
> > was replaced by gen7_render_flush. The only functions that were
> > left intact are gen8_emit_media_objects_spin and
> > gen8_spin_render_flush.
>
> This is going to be a bit long since I have several comments that don't
> apply to a specific place in the code, apologies in advance :)
>
> I can see gen8_spin_render_flush in the header but it is not implemented or
> called from anywhere. Did you miss something from your git commit or can we
> actually drop it? This isn't tied to any gen (it just does an execbuf) so I
> guess it is probably the latter.
>
> gen8_emit_media_objects_spin is also very similar to what is in the inner
> loop of the gen7 version, maybe we can do something like:
>
> void emit_media_object(struct intel_batchbuffer *batch,
> unsigned xoff, unsigned yoff)
> {
> OUT_BATCH(GEN7_MEDIA_OBJECT | (8 - 2));
>
> /* interface descriptor offset */
> OUT_BATCH(0);
>
> /* without indirect data */
> OUT_BATCH(0);
> OUT_BATCH(0);
>
> /* scoreboard */
> OUT_BATCH(0);
> OUT_BATCH(0);
>
> /* inline data (xoffset, yoffset) */
> OUT_BATCH(xoff);
> OUT_BATCH(yoff);
>
> if (AT_LEAST_GEN(batch->devid, 8) &&
> !IS_CHERRYVIEW(batch->devid))
> gen8_emit_media_state_flush(batch);
> }
>
> void
> gen7_emit_media_objects(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> unsigned width, unsigned height)
> {
> int i, j;
>
> for (i = 0; i < width / 16; i++)
> for (j = 0; j < height / 16; j++)
> emit_media_object(batch,
> x + i * 16,
> y + j * 16);
> }
>
> And from the spin file just call emit_media_object(batch, 0, 0).
> I'm happy if you do this on top as an additional patch if you don't want to
> mess with this one.
>
> Regarding remaining "spin" functions, I also see gen8_emit_vfe_state_spin
> and gen8_spin_curbe_buffer_data. Including the _spin one, there are 3
> variants of gen8_emit_vfe_state which we could probably unify by passing in
> some params, something like:
>
> void
> gen8_emit_vfe_state(struct intel_batchbuffer *batch,
> uint32_t threads, uint32_t urb_entries,
> uint32_t urb_entry_size, uint32_t urb_alloc_size)
> {
> /* number of threads & urb entries */
> OUT_BATCH(threads << 16 | urb_entries << 8);
>
> OUT_BATCH(0);
>
> /* urb entry size & curbe size */
> OUT_BATCH(urb_entry_size << 16 | urb_alloc_size);
>
> /* scoreboard */
> OUT_BATCH(0);
> OUT_BATCH(0);
> OUT_BATCH(0);
> }
>
> Lastly, for gen8_spin_curbe_buffer_data the only 2 differences with
> gen7_fill_curbe_buffer_data are the type of the variable used (u8 vs u32)
> and the size of the allocation. Using u32 in both cases shouldn't be an
> issue and we can potentially pass the size in as a parameter, thus allowing
> us to drop another duplicated function.
> Both of those cleanups can also can go later in the series with new patches
> (possibly before the reformatting).
>
> One final comment: in the media_spin file we now mix calls to "spin"
> functions and "fill" functions. For functions that are generic and not
> specific to media/gpgpu fill we can maybe drop the "fill" tag to avoid
> confusion. One more patch on the pile
>
> Suggestions/ramblings aside, the changes in this patch LGTM.
>
> Daniele
>
Thanks for such a long input :) These are really nice ideas to implement.
I will introduce them in separate patch on top of coding style changes to
avoid rebasing.
Kasia
> >
> > Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> > Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> > Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> > ---
> > lib/gpu_fill.c | 145 -------------------------------------------------------
> > lib/gpu_fill.h | 28 +----------
> > lib/media_spin.c | 24 ++++-----
> > 3 files changed, 13 insertions(+), 184 deletions(-)
> >
> > diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> > index f4b33c05..f5fc61bb 100644
> > --- a/lib/gpu_fill.c
> > +++ b/lib/gpu_fill.c
> > @@ -351,18 +351,6 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > OUT_BATCH(0xffffffff);
> > }
> > -void
> > -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> > -{
> > - int ret;
> > -
> > - ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> > - if (ret == 0)
> > - ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> > - batch_end, 0);
> > - igt_assert_eq(ret, 0);
> > -}
> > -
> > uint32_t
> > gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > uint32_t iters)
> > @@ -428,57 +416,6 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > return offset;
> > }
> > -uint32_t
> > -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > - struct igt_buf *buf,
> > - uint32_t format,
> > - int is_dst)
> > -{
> > - struct gen8_surface_state *ss;
> > - uint32_t write_domain, read_domain, offset;
> > - int ret;
> > -
> > - if (is_dst) {
> > - write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> > - } else {
> > - write_domain = 0;
> > - read_domain = I915_GEM_DOMAIN_SAMPLER;
> > - }
> > -
> > - ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, ss);
> > -
> > - ss->ss0.surface_type = GEN8_SURFACE_2D;
> > - ss->ss0.surface_format = format;
> > - ss->ss0.render_cache_read_write = 1;
> > - ss->ss0.vertical_alignment = 1; /* align 4 */
> > - ss->ss0.horizontal_alignment = 1; /* align 4 */
> > -
> > - if (buf->tiling == I915_TILING_X)
> > - ss->ss0.tiled_mode = 2;
> > - else if (buf->tiling == I915_TILING_Y)
> > - ss->ss0.tiled_mode = 3;
> > -
> > - ss->ss8.base_addr = buf->bo->offset;
> > -
> > - ret = drm_intel_bo_emit_reloc(batch->bo,
> > - intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> > - buf->bo, 0,
> > - read_domain, write_domain);
> > - igt_assert_eq(ret, 0);
> > -
> > - ss->ss2.height = igt_buf_height(buf) - 1;
> > - ss->ss2.width = igt_buf_width(buf) - 1;
> > - ss->ss3.pitch = buf->stride - 1;
> > -
> > - ss->ss7.shader_chanel_select_r = 4;
> > - ss->ss7.shader_chanel_select_g = 5;
> > - ss->ss7.shader_chanel_select_b = 6;
> > - ss->ss7.shader_chanel_select_a = 7;
> > -
> > - return offset;
> > -}
> > -
> > uint32_t
> > gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
> > {
> > @@ -511,65 +448,6 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
> > return offset;
> > }
> > -uint32_t
> > -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst)
> > -{
> > - uint32_t *binding_table, offset;
> > -
> > - binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> > -
> > - binding_table[0] = gen8_spin_surface_state(batch, dst,
> > - GEN8_SURFACEFORMAT_R8_UNORM, 1);
> > -
> > - return offset;
> > -}
> > -
> > -uint32_t
> > -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > - const uint32_t kernel[][4],
> > - size_t size)
> > -{
> > - uint32_t offset;
> > -
> > - offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> > -
> > - return offset;
> > -}
> > -
> > -uint32_t
> > -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
> > -{
> > - struct gen8_interface_descriptor_data *idd;
> > - uint32_t offset;
> > - uint32_t binding_table_offset, kernel_offset;
> > -
> > - binding_table_offset = gen8_spin_binding_table(batch, dst);
> > - kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> > - sizeof(spin_kernel));
> > -
> > - idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, idd);
> > -
> > - idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> > -
> > - idd->desc2.single_program_flow = 1;
> > - idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> > -
> > - idd->desc3.sampler_count = 0; /* 0 samplers used */
> > - idd->desc3.sampler_state_pointer = 0;
> > -
> > - idd->desc4.binding_table_entry_count = 0;
> > - idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> > -
> > - idd->desc5.constant_urb_entry_read_offset = 0;
> > - idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> > -
> > - return offset;
> > -}
> > -
> > void
> > gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> > {
> > @@ -685,29 +563,6 @@ gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
> > OUT_BATCH(0);
> > }
> > -void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> > - OUT_BATCH(0);
> > - /* curbe total data length */
> > - OUT_BATCH(64);
> > - /* curbe data start address, is relative to the dynamics base address */
> > - OUT_BATCH(curbe_buffer);
> > -}
> > -
> > -void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > - uint32_t interface_descriptor)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> > - OUT_BATCH(0);
> > - /* interface descriptor data length */
> > - OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> > - /* interface descriptor address, is relative to the dynamics base address */
> > - OUT_BATCH(interface_descriptor);
> > -}
> > -
> > void
> > gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
> > index c6d9ffb3..f0f07661 100644
> > --- a/lib/gpu_fill.h
> > +++ b/lib/gpu_fill.h
> > @@ -89,7 +89,7 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned width, unsigned height);
> > void
> > -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> > +gen8_spin_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> > uint32_t
> > gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > @@ -101,28 +101,9 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > uint32_t format,
> > int is_dst);
> > -uint32_t
> > -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > - struct igt_buf *buf,
> > - uint32_t format,
> > - int is_dst);
> > -
> > uint32_t
> > gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> > -uint32_t
> > -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst);
> > -
> > -uint32_t
> > -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > - const uint32_t kernel[][4],
> > - size_t size);
> > -
> > -uint32_t
> > -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> > -
> > void
> > gen8_emit_state_base_address(struct intel_batchbuffer *batch);
> > @@ -138,13 +119,6 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
> > void
> > gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
> > -void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> > -
> > -void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > - uint32_t interface_descriptor);
> > -
> > void
> > gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > diff --git a/lib/media_spin.c b/lib/media_spin.c
> > index 72009908..16ea8483 100644
> > --- a/lib/media_spin.c
> > +++ b/lib/media_spin.c
> > @@ -81,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -91,9 +91,9 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > gen8_emit_vfe_state_spin(batch);
> > - gen8_emit_curbe_load(batch, curbe_buffer);
> > + gen7_emit_curbe_load(batch, curbe_buffer);
> > - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > gen8_emit_media_objects_spin(batch);
> > @@ -102,7 +102,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > batch_end = intel_batchbuffer_align(batch, 8);
> > igt_assert(batch_end < BATCH_STATE_SPLIT);
> > - gen8_render_flush(batch, batch_end);
> > + gen7_render_flush(batch, batch_end);
> > intel_batchbuffer_reset(batch);
> > }
> > @@ -119,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -129,9 +129,9 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > gen8_emit_vfe_state_spin(batch);
> > - gen8_emit_curbe_load(batch, curbe_buffer);
> > + gen7_emit_curbe_load(batch, curbe_buffer);
> > - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > gen8lp_emit_media_objects_spin(batch);
> > @@ -140,7 +140,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > batch_end = intel_batchbuffer_align(batch, 8);
> > igt_assert(batch_end < BATCH_STATE_SPLIT);
> > - gen8_render_flush(batch, batch_end);
> > + gen7_render_flush(batch, batch_end);
> > intel_batchbuffer_reset(batch);
> > }
> > @@ -157,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -172,9 +172,9 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > gen8_emit_vfe_state_spin(batch);
> > - gen8_emit_curbe_load(batch, curbe_buffer);
> > + gen7_emit_curbe_load(batch, curbe_buffer);
> > - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > gen8_emit_media_objects_spin(batch);
> > @@ -190,6 +190,6 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > batch_end = intel_batchbuffer_align(batch, 8);
> > igt_assert(batch_end < BATCH_STATE_SPLIT);
> > - gen8_render_flush(batch, batch_end);
> > + gen7_render_flush(batch, batch_end);
> > intel_batchbuffer_reset(batch);
> > }
> >
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
2018-04-25 21:49 ` Daniele Ceraolo Spurio
2018-04-26 11:11 ` Katarzyna Dec
@ 2018-04-26 13:32 ` Katarzyna Dec
1 sibling, 0 replies; 12+ messages in thread
From: Katarzyna Dec @ 2018-04-26 13:32 UTC (permalink / raw)
To: Daniele Ceraolo Spurio; +Cc: igt-dev
On Wed, Apr 25, 2018 at 02:49:02PM -0700, Daniele Ceraolo Spurio wrote:
>
>
> On 25/04/18 06:26, Katarzyna Dec wrote:
> > Let's remove duplications introduced by moving media_spin helper
> > functions to gpu_fill. These were mainly the same functions
> > as for Gen8 media/gpgpu fill. gen8_render_flush from media_spin
> > was replaced by gen7_render_flush. The only functions that were
> > left intact are gen8_emit_media_objects_spin and
> > gen8_spin_render_flush.
>
> This is going to be a bit long since I have several comments that don't
> apply to a specific place in the code, apologies in advance :)
>
> I can see gen8_spin_render_flush in the header but it is not implemented or
> called from anywhere. Did you miss something from your git commit or can we
> actually drop it? This isn't tied to any gen (it just does an execbuf) so I
> guess it is probably the latter.
>
> gen8_emit_media_objects_spin is also very similar to what is in the inner
> loop of the gen7 version, maybe we can do something like:
>
> void emit_media_object(struct intel_batchbuffer *batch,
> unsigned xoff, unsigned yoff)
> {
> OUT_BATCH(GEN7_MEDIA_OBJECT | (8 - 2));
>
> /* interface descriptor offset */
> OUT_BATCH(0);
>
> /* without indirect data */
> OUT_BATCH(0);
> OUT_BATCH(0);
>
> /* scoreboard */
> OUT_BATCH(0);
> OUT_BATCH(0);
>
> /* inline data (xoffset, yoffset) */
> OUT_BATCH(xoff);
> OUT_BATCH(yoff);
>
> if (AT_LEAST_GEN(batch->devid, 8) &&
> !IS_CHERRYVIEW(batch->devid))
> gen8_emit_media_state_flush(batch);
> }
>
> void
> gen7_emit_media_objects(struct intel_batchbuffer *batch,
> unsigned x, unsigned y,
> unsigned width, unsigned height)
> {
> int i, j;
>
> for (i = 0; i < width / 16; i++)
> for (j = 0; j < height / 16; j++)
> emit_media_object(batch,
> x + i * 16,
> y + j * 16);
> }
>
> And from the spin file just call emit_media_object(batch, 0, 0).
> I'm happy if you do this on top as an additional patch if you don't want to
> mess with this one.
>
> Regarding remaining "spin" functions, I also see gen8_emit_vfe_state_spin
> and gen8_spin_curbe_buffer_data. Including the _spin one, there are 3
> variants of gen8_emit_vfe_state which we could probably unify by passing in
> some params, something like:
>
> void
> gen8_emit_vfe_state(struct intel_batchbuffer *batch,
> uint32_t threads, uint32_t urb_entries,
> uint32_t urb_entry_size, uint32_t urb_alloc_size)
> {
> /* number of threads & urb entries */
> OUT_BATCH(threads << 16 | urb_entries << 8);
>
> OUT_BATCH(0);
>
> /* urb entry size & curbe size */
> OUT_BATCH(urb_entry_size << 16 | urb_alloc_size);
>
> /* scoreboard */
> OUT_BATCH(0);
> OUT_BATCH(0);
> OUT_BATCH(0);
> }
>
> Lastly, for gen8_spin_curbe_buffer_data the only 2 differences with
> gen7_fill_curbe_buffer_data are the type of the variable used (u8 vs u32)
> and the size of the allocation. Using u32 in both cases shouldn't be an
> issue and we can potentially pass the size in as a parameter, thus allowing
> us to drop another duplicated function.
> Both of those cleanups can also can go later in the series with new patches
> (possibly before the reformatting).
>
I have investigated possible changes in fill_curbe_buffer and it looks like
making changes in variable type will affect proccesing shaders in gpgpu/media/render
tests. Maybe we can live with having these 2 similar functions.
Kasia
> One final comment: in the media_spin file we now mix calls to "spin"
> functions and "fill" functions. For functions that are generic and not
> specific to media/gpgpu fill we can maybe drop the "fill" tag to avoid
> confusion. One more patch on the pile
>
> Suggestions/ramblings aside, the changes in this patch LGTM.
>
> Daniele
>
> >
> > Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> > Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> > Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> > ---
> > lib/gpu_fill.c | 145 -------------------------------------------------------
> > lib/gpu_fill.h | 28 +----------
> > lib/media_spin.c | 24 ++++-----
> > 3 files changed, 13 insertions(+), 184 deletions(-)
> >
> > diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> > index f4b33c05..f5fc61bb 100644
> > --- a/lib/gpu_fill.c
> > +++ b/lib/gpu_fill.c
> > @@ -351,18 +351,6 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > OUT_BATCH(0xffffffff);
> > }
> > -void
> > -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end)
> > -{
> > - int ret;
> > -
> > - ret = drm_intel_bo_subdata(batch->bo, 0, 4096, batch->buffer);
> > - if (ret == 0)
> > - ret = drm_intel_gem_bo_context_exec(batch->bo, NULL,
> > - batch_end, 0);
> > - igt_assert_eq(ret, 0);
> > -}
> > -
> > uint32_t
> > gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > uint32_t iters)
> > @@ -428,57 +416,6 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > return offset;
> > }
> > -uint32_t
> > -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > - struct igt_buf *buf,
> > - uint32_t format,
> > - int is_dst)
> > -{
> > - struct gen8_surface_state *ss;
> > - uint32_t write_domain, read_domain, offset;
> > - int ret;
> > -
> > - if (is_dst) {
> > - write_domain = read_domain = I915_GEM_DOMAIN_RENDER;
> > - } else {
> > - write_domain = 0;
> > - read_domain = I915_GEM_DOMAIN_SAMPLER;
> > - }
> > -
> > - ss = intel_batchbuffer_subdata_alloc(batch, sizeof(*ss), 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, ss);
> > -
> > - ss->ss0.surface_type = GEN8_SURFACE_2D;
> > - ss->ss0.surface_format = format;
> > - ss->ss0.render_cache_read_write = 1;
> > - ss->ss0.vertical_alignment = 1; /* align 4 */
> > - ss->ss0.horizontal_alignment = 1; /* align 4 */
> > -
> > - if (buf->tiling == I915_TILING_X)
> > - ss->ss0.tiled_mode = 2;
> > - else if (buf->tiling == I915_TILING_Y)
> > - ss->ss0.tiled_mode = 3;
> > -
> > - ss->ss8.base_addr = buf->bo->offset;
> > -
> > - ret = drm_intel_bo_emit_reloc(batch->bo,
> > - intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> > - buf->bo, 0,
> > - read_domain, write_domain);
> > - igt_assert_eq(ret, 0);
> > -
> > - ss->ss2.height = igt_buf_height(buf) - 1;
> > - ss->ss2.width = igt_buf_width(buf) - 1;
> > - ss->ss3.pitch = buf->stride - 1;
> > -
> > - ss->ss7.shader_chanel_select_r = 4;
> > - ss->ss7.shader_chanel_select_g = 5;
> > - ss->ss7.shader_chanel_select_b = 6;
> > - ss->ss7.shader_chanel_select_a = 7;
> > -
> > - return offset;
> > -}
> > -
> > uint32_t
> > gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size)
> > {
> > @@ -511,65 +448,6 @@ gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *
> > return offset;
> > }
> > -uint32_t
> > -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst)
> > -{
> > - uint32_t *binding_table, offset;
> > -
> > - binding_table = intel_batchbuffer_subdata_alloc(batch, 32, 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, binding_table);
> > -
> > - binding_table[0] = gen8_spin_surface_state(batch, dst,
> > - GEN8_SURFACEFORMAT_R8_UNORM, 1);
> > -
> > - return offset;
> > -}
> > -
> > -uint32_t
> > -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > - const uint32_t kernel[][4],
> > - size_t size)
> > -{
> > - uint32_t offset;
> > -
> > - offset = intel_batchbuffer_copy_data(batch, kernel, size, 64);
> > -
> > - return offset;
> > -}
> > -
> > -uint32_t
> > -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst, const uint32_t spin_kernel[][4], size_t size)
> > -{
> > - struct gen8_interface_descriptor_data *idd;
> > - uint32_t offset;
> > - uint32_t binding_table_offset, kernel_offset;
> > -
> > - binding_table_offset = gen8_spin_binding_table(batch, dst);
> > - kernel_offset = gen8_spin_media_kernel(batch, spin_kernel,
> > - sizeof(spin_kernel));
> > -
> > - idd = intel_batchbuffer_subdata_alloc(batch, sizeof(*idd), 64);
> > - offset = intel_batchbuffer_subdata_offset(batch, idd);
> > -
> > - idd->desc0.kernel_start_pointer = (kernel_offset >> 6);
> > -
> > - idd->desc2.single_program_flow = 1;
> > - idd->desc2.floating_point_mode = GEN8_FLOATING_POINT_IEEE_754;
> > -
> > - idd->desc3.sampler_count = 0; /* 0 samplers used */
> > - idd->desc3.sampler_state_pointer = 0;
> > -
> > - idd->desc4.binding_table_entry_count = 0;
> > - idd->desc4.binding_table_pointer = (binding_table_offset >> 5);
> > -
> > - idd->desc5.constant_urb_entry_read_offset = 0;
> > - idd->desc5.constant_urb_entry_read_length = 1; /* grf 1 */
> > -
> > - return offset;
> > -}
> > -
> > void
> > gen8_emit_state_base_address(struct intel_batchbuffer *batch)
> > {
> > @@ -685,29 +563,6 @@ gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch)
> > OUT_BATCH(0);
> > }
> > -void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_CURBE_LOAD | (4 - 2));
> > - OUT_BATCH(0);
> > - /* curbe total data length */
> > - OUT_BATCH(64);
> > - /* curbe data start address, is relative to the dynamics base address */
> > - OUT_BATCH(curbe_buffer);
> > -}
> > -
> > -void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > - uint32_t interface_descriptor)
> > -{
> > - OUT_BATCH(GEN8_MEDIA_INTERFACE_DESCRIPTOR_LOAD | (4 - 2));
> > - OUT_BATCH(0);
> > - /* interface descriptor data length */
> > - OUT_BATCH(sizeof(struct gen8_interface_descriptor_data));
> > - /* interface descriptor address, is relative to the dynamics base address */
> > - OUT_BATCH(interface_descriptor);
> > -}
> > -
> > void
> > gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > diff --git a/lib/gpu_fill.h b/lib/gpu_fill.h
> > index c6d9ffb3..f0f07661 100644
> > --- a/lib/gpu_fill.h
> > +++ b/lib/gpu_fill.h
> > @@ -89,7 +89,7 @@ gen7_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned width, unsigned height);
> > void
> > -gen8_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> > +gen8_spin_render_flush(struct intel_batchbuffer *batch, uint32_t batch_end);
> > uint32_t
> > gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
> > @@ -101,28 +101,9 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> > uint32_t format,
> > int is_dst);
> > -uint32_t
> > -gen8_spin_surface_state(struct intel_batchbuffer *batch,
> > - struct igt_buf *buf,
> > - uint32_t format,
> > - int is_dst);
> > -
> > uint32_t
> > gen8_fill_interface_descriptor(struct intel_batchbuffer *batch, struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> > -uint32_t
> > -gen8_spin_binding_table(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst);
> > -
> > -uint32_t
> > -gen8_spin_media_kernel(struct intel_batchbuffer *batch,
> > - const uint32_t kernel[][4],
> > - size_t size);
> > -
> > -uint32_t
> > -gen8_spin_interface_descriptor(struct intel_batchbuffer *batch,
> > - struct igt_buf *dst, const uint32_t kernel[][4], size_t size);
> > -
> > void
> > gen8_emit_state_base_address(struct intel_batchbuffer *batch);
> > @@ -138,13 +119,6 @@ gen8_emit_vfe_state_gpgpu(struct intel_batchbuffer *batch);
> > void
> > gen8_emit_vfe_state_spin(struct intel_batchbuffer *batch);
> > -void
> > -gen8_emit_curbe_load(struct intel_batchbuffer *batch, uint32_t curbe_buffer);
> > -
> > -void
> > -gen8_emit_interface_descriptor_load(struct intel_batchbuffer *batch,
> > - uint32_t interface_descriptor);
> > -
> > void
> > gen8_emit_gpgpu_walk(struct intel_batchbuffer *batch,
> > unsigned x, unsigned y,
> > diff --git a/lib/media_spin.c b/lib/media_spin.c
> > index 72009908..16ea8483 100644
> > --- a/lib/media_spin.c
> > +++ b/lib/media_spin.c
> > @@ -81,7 +81,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -91,9 +91,9 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > gen8_emit_vfe_state_spin(batch);
> > - gen8_emit_curbe_load(batch, curbe_buffer);
> > + gen7_emit_curbe_load(batch, curbe_buffer);
> > - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > gen8_emit_media_objects_spin(batch);
> > @@ -102,7 +102,7 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> > batch_end = intel_batchbuffer_align(batch, 8);
> > igt_assert(batch_end < BATCH_STATE_SPLIT);
> > - gen8_render_flush(batch, batch_end);
> > + gen7_render_flush(batch, batch_end);
> > intel_batchbuffer_reset(batch);
> > }
> > @@ -119,7 +119,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -129,9 +129,9 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > gen8_emit_vfe_state_spin(batch);
> > - gen8_emit_curbe_load(batch, curbe_buffer);
> > + gen7_emit_curbe_load(batch, curbe_buffer);
> > - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > gen8lp_emit_media_objects_spin(batch);
> > @@ -140,7 +140,7 @@ gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> > batch_end = intel_batchbuffer_align(batch, 8);
> > igt_assert(batch_end < BATCH_STATE_SPLIT);
> > - gen8_render_flush(batch, batch_end);
> > + gen7_render_flush(batch, batch_end);
> > intel_batchbuffer_reset(batch);
> > }
> > @@ -157,7 +157,7 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> > curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> > - interface_descriptor = gen8_spin_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > + interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> > igt_assert(batch->ptr < &batch->buffer[4095]);
> > /* media pipeline */
> > @@ -172,9 +172,9 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > gen8_emit_vfe_state_spin(batch);
> > - gen8_emit_curbe_load(batch, curbe_buffer);
> > + gen7_emit_curbe_load(batch, curbe_buffer);
> > - gen8_emit_interface_descriptor_load(batch, interface_descriptor);
> > + gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> > gen8_emit_media_objects_spin(batch);
> > @@ -190,6 +190,6 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> > batch_end = intel_batchbuffer_align(batch, 8);
> > igt_assert(batch_end < BATCH_STATE_SPLIT);
> > - gen8_render_flush(batch, batch_end);
> > + gen7_render_flush(batch, batch_end);
> > intel_batchbuffer_reset(batch);
> > }
> >
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function Katarzyna Dec
@ 2018-04-26 16:35 ` Daniele Ceraolo Spurio
0 siblings, 0 replies; 12+ messages in thread
From: Daniele Ceraolo Spurio @ 2018-04-26 16:35 UTC (permalink / raw)
To: Katarzyna Dec, igt-dev
On 25/04/18 06:26, Katarzyna Dec wrote:
> Gen8lp function are duplicates of Gen8 with difference in
> emit_media_objects - we cannot perform media_state_flush on CHT.
> Similar changes were done previously for gpgpu_fill and media_fill.
>
> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Antonio Argenziano <antonio.argenziano@intel.com>
> ---
> lib/gpu_fill.c | 24 ++----------------------
> lib/intel_batchbuffer.c | 4 +---
> lib/media_spin.c | 38 --------------------------------------
> lib/media_spin.h | 3 ---
> 4 files changed, 3 insertions(+), 66 deletions(-)
>
> diff --git a/lib/gpu_fill.c b/lib/gpu_fill.c
> index f5fc61bb..8dab39df 100644
> --- a/lib/gpu_fill.c
> +++ b/lib/gpu_fill.c
> @@ -642,28 +642,8 @@ gen8_emit_media_objects_spin(struct intel_batchbuffer *batch)
> /* inline data (xoffset, yoffset) */
> OUT_BATCH(0);
> OUT_BATCH(0);
> - gen8_emit_media_state_flush(batch);
> -}
> -
> -void
> -gen8lp_emit_media_objects_spin(struct intel_batchbuffer *batch)
> -{
> - OUT_BATCH(GEN8_MEDIA_OBJECT | (8 - 2));
> -
> - /* interface descriptor offset */
> - OUT_BATCH(0);
> -
> - /* without indirect data */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* scoreboard */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> -
> - /* inline data (xoffset, yoffset) */
> - OUT_BATCH(0);
> - OUT_BATCH(0);
> + if (AT_LEAST_GEN(batch->devid, 8) && !IS_CHERRYVIEW(batch->devid))
> + gen8_emit_media_state_flush(batch);
> }
>
> void
> diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
> index f87e6bed..ef070d1a 100644
> --- a/lib/intel_batchbuffer.c
> +++ b/lib/intel_batchbuffer.c
> @@ -906,10 +906,8 @@ igt_media_spinfunc_t igt_get_media_spinfunc(int devid)
>
> if (IS_GEN9(devid))
> spin = gen9_media_spinfunc;
> - else if (IS_BROADWELL(devid))
> + else if (IS_BROADWELL(devid) || IS_CHERRYVIEW(devid))
You can use IS_GEN8(devid) here
Daniele
> spin = gen8_media_spinfunc;
> - else if (IS_CHERRYVIEW(devid))
> - spin = gen8lp_media_spinfunc;
>
> return spin;
> }
> diff --git a/lib/media_spin.c b/lib/media_spin.c
> index 16ea8483..b4414bee 100644
> --- a/lib/media_spin.c
> +++ b/lib/media_spin.c
> @@ -106,44 +106,6 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> intel_batchbuffer_reset(batch);
> }
>
> -void
> -gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> - struct igt_buf *dst, uint32_t spins)
> -{
> - uint32_t curbe_buffer, interface_descriptor;
> - uint32_t batch_end;
> -
> - intel_batchbuffer_flush_with_context(batch, NULL);
> -
> - /* setup states */
> - batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
> -
> - curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> - igt_assert(batch->ptr < &batch->buffer[4095]);
> -
> - /* media pipeline */
> - batch->ptr = batch->buffer;
> - OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA);
> - gen8_emit_state_base_address(batch);
> -
> - gen8_emit_vfe_state_spin(batch);
> -
> - gen7_emit_curbe_load(batch, curbe_buffer);
> -
> - gen7_emit_interface_descriptor_load(batch, interface_descriptor);
> -
> - gen8lp_emit_media_objects_spin(batch);
> -
> - OUT_BATCH(MI_BATCH_BUFFER_END);
> -
> - batch_end = intel_batchbuffer_align(batch, 8);
> - igt_assert(batch_end < BATCH_STATE_SPLIT);
> -
> - gen7_render_flush(batch, batch_end);
> - intel_batchbuffer_reset(batch);
> -}
> -
> void
> gen9_media_spinfunc(struct intel_batchbuffer *batch,
> struct igt_buf *dst, uint32_t spins)
> diff --git a/lib/media_spin.h b/lib/media_spin.h
> index 8bc48291..57d8c2e2 100644
> --- a/lib/media_spin.h
> +++ b/lib/media_spin.h
> @@ -30,9 +30,6 @@
> void gen8_media_spinfunc(struct intel_batchbuffer *batch,
> struct igt_buf *dst, uint32_t spins);
>
> -void gen8lp_media_spinfunc(struct intel_batchbuffer *batch,
> - struct igt_buf *dst, uint32_t spins);
> -
> void gen9_media_spinfunc(struct intel_batchbuffer *batch,
> struct igt_buf *dst, uint32_t spins);
>
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style Katarzyna Dec
@ 2018-04-26 22:25 ` Antonio Argenziano
0 siblings, 0 replies; 12+ messages in thread
From: Antonio Argenziano @ 2018-04-26 22:25 UTC (permalink / raw)
To: Katarzyna Dec, igt-dev
On 25/04/18 06:26, Katarzyna Dec wrote:
> Let's adjust code to our coding style during refactoring
> media_spin code.
>
> Signed-off-by: Katarzyna Dec <katarzyna.dec@intel.com>
> Cc: Lukasz Kalamarz <lukasz.kalamarz@intel.com>
> Cc: Antonio Argenziano <antonio.argenziano@intel.com>
>
> @@ -399,9 +406,8 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
> ss->ss8.base_addr = buf->bo->offset;
>
> ret = drm_intel_bo_emit_reloc(batch->bo,
> - intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> - buf->bo, 0,
> - read_domain, write_domain);
> + intel_batchbuffer_subdata_offset(batch, ss) +
> + 8 * 4, buf->bo, 0, read_domain, write_domain);
Here I would have kept the 'add' statement on one single line to
increase readability.
> igt_assert(ret == 0);
>
> ss->ss2.height = igt_buf_height(buf) - 1;
>
> diff --git a/lib/media_spin.c b/lib/media_spin.c
> index b4414bee..e203b25c 100644
> --- a/lib/media_spin.c
> +++ b/lib/media_spin.c
> @@ -34,16 +34,26 @@
> #include "gpu_fill.h"
>
> static const uint32_t spin_kernel[][4] = {
> - { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
> - { 0x00200001, 0x20800208, 0x00450040, 0x00000000 }, /* mov (2)r4.0<1>.ud r2.0<2;2;1>:ud */
> - { 0x00000001, 0x20880608, 0x00000000, 0x00000003 }, /* mov (1)r4.8<1>:ud 0x3 */
> - { 0x00000001, 0x20a00608, 0x00000000, 0x00000000 }, /* mov (1)r5.0<1>:ud 0 */
> - { 0x00000040, 0x20a00208, 0x060000a0, 0x00000001 }, /* add (1)r5.0<1>:ud r5.0<0;1;0>:ud 1 */
> - { 0x01000010, 0x20000200, 0x02000020, 0x000000a0 }, /* cmp.e.f0.0 (1)null<1> r1<0;1;0> r5<0;1;0> */
> - { 0x00110027, 0x00000000, 0x00000000, 0xffffffe0 }, /* ~f0.0 while (1) -32 */
> - { 0x0c800031, 0x20000a00, 0x0e000080, 0x040a8000 }, /* send.dcdp1 (16)null<1> r4.0<0;1;0> 0x040a8000 */
> - { 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 }, /* mov (8)r112<1>:ud r0.0<8;8;1>:ud */
> - { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
I think the format above is more readable than the one below.
Thanks,
Antonio
> + /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
> + { 0x00600001, 0x20800208, 0x008d0000, 0x00000000 },
> + /* mov (2)r4.0<1>.ud r2.0<2;2;1>:ud */
> + { 0x00200001, 0x20800208, 0x00450040, 0x00000000 },
> + /* mov (1)r4.8<1>:ud 0x3 */
> + { 0x00000001, 0x20880608, 0x00000000, 0x00000003 },
> + /* mov (1)r5.0<1>:ud 0 */
> + { 0x00000001, 0x20a00608, 0x00000000, 0x00000000 },
> + /* add (1)r5.0<1>:ud r5.0<0;1;0>:ud 1 */
> + { 0x00000040, 0x20a00208, 0x060000a0, 0x00000001 },
> + /* cmp.e.f0.0 (1)null<1> r1<0;1;0> r5<0;1;0> */
> + { 0x01000010, 0x20000200, 0x02000020, 0x000000a0 },
> + /* ~f0.0 while (1) -32 */
> + { 0x00110027, 0x00000000, 0x00000000, 0xffffffe0 },
> + /* send.dcdp1 (16)null<1> r4.0<0;1;0> 0x040a8000 */
> + { 0x0c800031, 0x20000a00, 0x0e000080, 0x040a8000 },
> + /* mov (8)r112<1>:ud r0.0<8;8;1>:ud */
> + { 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 },
> + /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
> + { 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 },
> };
>
> /*
> @@ -81,7 +91,8 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> + interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> + spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
> @@ -119,7 +130,8 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
> batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>
> curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> - interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> + interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> + spin_kernel, sizeof(spin_kernel));
> igt_assert(batch->ptr < &batch->buffer[4095]);
>
> /* media pipeline */
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2018-04-26 22:25 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-25 13:26 [igt-dev] [PATCH i-g-t 1/4] lib/media_spin: Move helper functions to gpu_fill library Katarzyna Dec
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin Katarzyna Dec
2018-04-25 21:49 ` Daniele Ceraolo Spurio
2018-04-26 11:11 ` Katarzyna Dec
2018-04-26 13:32 ` Katarzyna Dec
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function Katarzyna Dec
2018-04-26 16:35 ` Daniele Ceraolo Spurio
2018-04-25 13:26 ` [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style Katarzyna Dec
2018-04-26 22:25 ` Antonio Argenziano
2018-04-25 13:50 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/4] lib/media_spin: Move helper functions to gpu_fill library Patchwork
2018-04-25 20:01 ` [igt-dev] [PATCH i-g-t 1/4] " Daniele Ceraolo Spurio
2018-04-26 11:08 ` Katarzyna Dec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox