[igt-dev] [PATCH i-g-t v2 3/5] lib: Adjust media_spin and gpu_fill to our code style
Katarzyna Dec
katarzyna.dec at intel.com
Fri Apr 27 10:03:40 UTC 2018
Let's adjust code to our coding style during refactoring
media_spin code.
v2: fixed minor typos
Signed-off-by: Katarzyna Dec <katarzyna.dec at intel.com>
Cc: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
Cc: Antonio Argenziano <antonio.argenziano at intel.com>
---
lib/gpgpu_fill.c | 15 +++++-------
lib/gpu_fill.c | 72 +++++++++++++++++++++++++++++++++-----------------------
lib/gpu_fill.h | 26 ++++++++++----------
lib/media_spin.c | 6 +++--
4 files changed, 66 insertions(+), 53 deletions(-)
diff --git a/lib/gpgpu_fill.c b/lib/gpgpu_fill.c
index 010dde06..52925a5c 100644
--- a/lib/gpgpu_fill.c
+++ b/lib/gpgpu_fill.c
@@ -112,9 +112,8 @@ gen7_gpgpu_fillfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
/*
- * const buffer needs to fill for every thread, but as we have just 1 thread
- * per every group, so need only one curbe data.
- *
+ * const buffer needs to fill for every thread, but as we have just 1
+ * thread per every group, so need only one curbe data.
* For each thread, just use thread group ID for buffer offset.
*/
curbe_buffer = gen7_fill_curbe_buffer_data(batch, color);
@@ -160,9 +159,8 @@ gen8_gpgpu_fillfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
/*
- * const buffer needs to fill for every thread, but as we have just 1 thread
- * per every group, so need only one curbe data.
- *
+ * const buffer needs to fill for every thread, but as we have just 1
+ * thread per every group, so need only one curbe data.
* For each thread, just use thread group ID for buffer offset.
*/
curbe_buffer = gen7_fill_curbe_buffer_data(batch, color);
@@ -208,9 +206,8 @@ gen9_gpgpu_fillfunc(struct intel_batchbuffer *batch,
batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
/*
- * const buffer needs to fill for every thread, but as we have just 1 thread
- * per every group, so need only one curbe data.
- *
+ * const buffer needs to fill for every thread, but as we have just 1
+ * thread per every group, so need only one curbe data.
* For each thread, just use thread group ID for buffer offset.
*/
curbe_buffer = gen7_fill_curbe_buffer_data(batch, color);
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 5335fe3f..abb3b4c3 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);
uint32_t
gen8_spin_curbe_buffer_data(struct intel_batchbuffer *batch,
@@ -99,7 +100,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);
@@ -118,15 +121,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..b323550a 100644
--- a/lib/media_spin.c
+++ b/lib/media_spin.c
@@ -81,7 +81,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 +120,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
More information about the igt-dev
mailing list