lib/media_spin: Move helper functions to gpu_fill library
PATCH 1/4 lib/media_spin: Move helper functions to gpu_fill library
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.
--- lib/gpu_fill.c | 226 ++++++++++++++++++++++++++++++++++++++ lib/gpu_fill.h | 42 +++++++ lib/media_spin.c | 329 ++----------------------------------------------------- 3 files changed, 278 insertions(+), 319 deletions(-)
lib/gpu_fill.c +226 -0
@@ -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) {
lib/gpu_fill.h +42 -0
68 lines not on this page · raw message
lib/media_spin.c +10 -319
392 lines not on this page · raw message
Signature · 6 lines
2.14.3 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 2/4 lib: Remove duplications in gpu_fill used by media_spin
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.
--- lib/gpu_fill.c | 145 ------------------------------------------------------- lib/gpu_fill.h | 28 +---------- lib/media_spin.c | 24 ++++----- 3 files changed, 13 insertions(+), 184 deletions(-)
lib/gpu_fill.c +0 -145
@@ -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,
lib/gpu_fill.h +1 -27
@@ -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,
lib/media_spin.c +12 -12
@@ -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); }
Signature · 6 lines
2.14.3 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 3/4 lib/media_spin: Remove gen8lp_media_spin function
In reply to Katarzyna DecGen8lp 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.
--- 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(-)
lib/gpu_fill.c +2 -22
@@ -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
lib/intel_batchbuffer.c +1 -3
@@ -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; }
lib/media_spin.c +0 -38
@@ -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)
lib/media_spin.h +0 -3
@@ -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);
Signature · 6 lines
2.14.3 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
PATCH 4/4 lib: Adjust media_spin and gpu_fill to our code style
In reply to Katarzyna DecLet's adjust code to our coding style during refactoring media_spin code.
--- lib/gpu_fill.c | 72 +++++++++++++++++++++++++++++++++----------------------- lib/gpu_fill.h | 26 ++++++++++---------- lib/media_spin.c | 36 ++++++++++++++++++---------- 3 files changed, 80 insertions(+), 54 deletions(-)
lib/gpu_fill.c +43 -29
@@ -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 inOUT_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 */
lib/gpu_fill.h +13 -13
@@ -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);
lib/media_spin.c +24 -12
@@ -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 */
Signature · 6 lines
2.14.3 _______________________________________________ igt-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[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
In reply to Katarzyna Dec== Series Details ==
== 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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/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
Quoted 747 lines · Katarzyna Dec
We are moving all helper functions to
gpu_filllibrary without removing duplicates. Few function names were extended with*_spin. All duplications will be removed in next patch.Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>--- lib/gpu_fill.c | 226 ++++++++++++++++++++++++++++++++++++++ lib/gpu_fill.h | 42 +++++++ lib/media_spin.c | 329 ++----------------------------------------------------- 3 files changed, 278 insertions(+), 319 deletions(-)lib/gpu_fill.c +226
-0@@ -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) {lib/gpu_fill.h +42
-0@@ -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);lib/media_spin.c +9
-318@@ -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);
lib/media_spin.c gen9_media_spinfunc(struct intel_batchbuffer *batch, · line 182
Quoted 10 lines
lib/media_spin.c +1
-1gen8_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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
In reply to Katarzyna DecQuoted 6 lines · Katarzyna Dec
Let's remove duplications introduced by moving
media_spinhelper functions togpu_fill. These were mainly the same functions as for Gen8 media/gpgpu fill.gen8_render_flushfrommedia_spinwas replaced bygen7_render_flush. The only functions that were left intact aregen8_emit_media_objects_spinandgen8_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
Quoted 330 lines
Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>--- lib/gpu_fill.c | 145 ------------------------------------------------------- lib/gpu_fill.h | 28 +---------- lib/media_spin.c | 24 ++++----- 3 files changed, 13 insertions(+), 184 deletions(-)lib/gpu_fill.c +0
-145@@ -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,lib/gpu_fill.h +1
-27@@ -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,lib/media_spin.c +11
-11@@ -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);
lib/media_spin.c gen9_media_spinfunc(struct intel_batchbuffer *batch, · line 195
Quoted 7 lines
lib/media_spin.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 7 lines · Daniele Ceraolo Spurio
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.
Quoted 9 lines
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_spinfollowed 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.
Quoted 4 lines
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
Quoted 720 lines
Thanks,
DanieleQuoted 716 lines · Katarzyna Dec
We are moving all helper functions to
gpu_filllibrary without removing duplicates. Few function names were extended with*_spin. All duplications will be removed in next patch.Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>--- lib/gpu_fill.c | 226 ++++++++++++++++++++++++++++++++++++++ lib/gpu_fill.h | 42 +++++++ lib/media_spin.c | 329 ++----------------------------------------------------- 3 files changed, 278 insertions(+), 319 deletions(-)lib/gpu_fill.c +226
-0@@ -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) {lib/gpu_fill.h +42
-0@@ -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);lib/media_spin.c +9
-319@@ -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);
Quoted 8 lines
lib/media_spin.c gen9_media_spinfunc(struct intel_batchbuffer *batch,
Quoted 4 lines
lib/media_spin.c +1
-0+gen8_emit_media_objects_spin (batch); OUT_BATCH(GEN8_PIPELINE_SELECT | PIPELINE_SELECT_MEDIA | GEN9_FORCE_MEDIA_AWAKE_DISABLE |_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
In reply to Daniele Ceraolo SpurioQuoted 96 lines · Daniele Ceraolo Spurio
Quoted 6 lines · Katarzyna Dec
Let's remove duplications introduced by moving
media_spinhelper functions togpu_fill. These were mainly the same functions as for Gen8 media/gpgpu fill.gen8_render_flushfrommedia_spinwas replaced bygen7_render_flush. The only functions that were left intact aregen8_emit_media_objects_spinandgen8_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_flushin 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_spinis 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(structintel_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_spinandgen8_spin_curbe_buffer_data. Including the_spinone, there are 3 variants ofgen8_emit_vfe_statewhich we could probably unify by passing in some params, something like:void
gen8_emit_vfe_state(structintel_batchbuffer*batch,
uint32_tthreads,uint32_turb_entries,uint32_turb_entry_size,uint32_turb_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_datathe only 2 differences withgen7_fill_curbe_buffer_dataare 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).
Quoted 9 lines
One final comment: in the
media_spinfile 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 pileSuggestions/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
Quoted 293 lines
Quoted 293 lines
Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>--- lib/gpu_fill.c | 145 ------------------------------------------------------- lib/gpu_fill.h | 28 +---------- lib/media_spin.c | 24 ++++----- 3 files changed, 13 insertions(+), 184 deletions(-)lib/gpu_fill.c +0
-145@@ -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,lib/gpu_fill.h +1
-27@@ -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,lib/media_spin.c +11
-11@@ -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);
Quoted 8 lines
lib/media_spin.c gen9_media_spinfunc(struct intel_batchbuffer *batch, · line 195
Quoted 8 lines
lib/media_spin.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 2/4] lib: Remove duplications in gpu_fill used by media_spin
In reply to Daniele Ceraolo SpurioQuoted 88 lines · Daniele Ceraolo Spurio
Quoted 6 lines · Katarzyna Dec
Let's remove duplications introduced by moving
media_spinhelper functions togpu_fill. These were mainly the same functions as for Gen8 media/gpgpu fill.gen8_render_flushfrommedia_spinwas replaced bygen7_render_flush. The only functions that were left intact aregen8_emit_media_objects_spinandgen8_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_flushin 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_spinis 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(structintel_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_spinandgen8_spin_curbe_buffer_data. Including the_spinone, there are 3 variants ofgen8_emit_vfe_statewhich we could probably unify by passing in some params, something like:void
gen8_emit_vfe_state(structintel_batchbuffer*batch,
uint32_tthreads,uint32_turb_entries,uint32_turb_entry_size,uint32_turb_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); }
Quoted 8 lines
Lastly, for
gen8_spin_curbe_buffer_datathe only 2 differences withgen7_fill_curbe_buffer_dataare 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
Quoted 302 lines
One final comment: in the
media_spinfile 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 pileSuggestions/ramblings aside, the changes in this patch LGTM.
Daniele
Quoted 293 lines
Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>--- lib/gpu_fill.c | 145 ------------------------------------------------------- lib/gpu_fill.h | 28 +---------- lib/media_spin.c | 24 ++++----- 3 files changed, 13 insertions(+), 184 deletions(-)lib/gpu_fill.c +0
-145@@ -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,lib/gpu_fill.h +1
-27@@ -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,lib/media_spin.c +11
-11@@ -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);
Quoted 8 lines
lib/media_spin.c gen9_media_spinfunc(struct intel_batchbuffer *batch, · line 195
Quoted 8 lines
lib/media_spin.c +1
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 3/4] lib/media_spin: Remove gen8lp_media_spin function
In reply to Katarzyna DecQuoted 54 lines · Katarzyna Dec
Gen8lp function are duplicates of Gen8 with difference in
emit_media_objects- we cannot performmedia_state_flushon CHT. Similar changes were done previously forgpgpu_fillandmedia_fill.Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>--- 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(-)lib/gpu_fill.c +2
-22@@ -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 lib/intel_batchbuffer.c +0
-0
lib/intel_batchbuffer.c igt_media_spinfunc_t igt_get_media_spinfunc(int devid) · line 909
Quoted 5 lines
lib/intel_batchbuffer.c +1
-1@@ -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
Quoted 61 lines
lib/intel_batchbuffer.c +0
-2spin = gen8_media_spinfunc; - else if (IS_CHERRYVIEW(devid)) - spin = gen8lp_media_spinfunc;return spin; }lib/media_spin.c +0
-38@@ -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)lib/media_spin.h +0
-0
lib/media_spin.h line 35
Quoted 9 lines
lib/media_spin.h +0
-3@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Re: [igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style
In reply to Katarzyna DecQuoted 9 lines · Katarzyna Dec
Let's adjust code to our coding style during refactoring
media_spincode.Signed-off-by Katarzyna Dec <[email protected]>Cc Lukasz Kalamarz <[email protected]>Cc Antonio Argenziano <[email protected]>
lib/gpu_fill.c gen8_fill_surface_state(struct intel_batchbuffer *batch, · line 410
Quoted 8 lines
lib/gpu_fill.c +2
-3@@ -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.
Quoted 13 lines
lib/gpu_fill.c +0
-0igt_assert (ret ==0 ); ss->ss2.height =igt_buf_height (buf) -1 ;lib/media_spin.c +0
-0@@ -34,16 +34,26 @@#include "gpu_fill.h" static const uint32_t spin_kernel[][4 ] = {
lib/media_spin.c line 46
Quoted 10 lines
lib/media_spin.c +0
-10- { 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
Quoted 35 lines
lib/media_spin.c +22
-1+/* 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 */
lib/media_spin.c gen9_media_spinfunc(struct intel_batchbuffer *batch, · line 137
Quoted 9 lines
lib/media_spin.c +2
-1@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev