[igt-dev] [PATCH i-g-t 4/4] lib: Adjust media_spin and gpu_fill to our code style

Antonio Argenziano antonio.argenziano at intel.com
Thu Apr 26 22:25:43 UTC 2018



On 25/04/18 06:26, Katarzyna Dec wrote:
> Let's adjust code to our coding style during refactoring
> media_spin code.
> 
> Signed-off-by: Katarzyna Dec <katarzyna.dec at intel.com>
> Cc: Lukasz Kalamarz <lukasz.kalamarz at intel.com>
> Cc: Antonio Argenziano <antonio.argenziano at intel.com>

>   
> @@ -399,9 +406,8 @@ gen8_fill_surface_state(struct intel_batchbuffer *batch,
>   	ss->ss8.base_addr = buf->bo->offset;
>   
>   	ret = drm_intel_bo_emit_reloc(batch->bo,
> -				intel_batchbuffer_subdata_offset(batch, ss) + 8 * 4,
> -				buf->bo, 0,
> -				read_domain, write_domain);
> +				intel_batchbuffer_subdata_offset(batch, ss) +
> +				8 * 4, buf->bo, 0, read_domain, write_domain);

Here I would have kept the 'add' statement on one single line to 
increase readability.

>   	igt_assert(ret == 0);
>   
>   	ss->ss2.height = igt_buf_height(buf) - 1;

>   
> diff --git a/lib/media_spin.c b/lib/media_spin.c
> index b4414bee..e203b25c 100644
> --- a/lib/media_spin.c
> +++ b/lib/media_spin.c
> @@ -34,16 +34,26 @@
>   #include "gpu_fill.h"
>   
>   static const uint32_t spin_kernel[][4] = {
> -	{ 0x00600001, 0x20800208, 0x008d0000, 0x00000000 }, /* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
> -	{ 0x00200001, 0x20800208, 0x00450040, 0x00000000 }, /* mov (2)r4.0<1>.ud r2.0<2;2;1>:ud */
> -	{ 0x00000001, 0x20880608, 0x00000000, 0x00000003 }, /* mov (1)r4.8<1>:ud 0x3 */
> -	{ 0x00000001, 0x20a00608, 0x00000000, 0x00000000 }, /* mov (1)r5.0<1>:ud 0 */
> -	{ 0x00000040, 0x20a00208, 0x060000a0, 0x00000001 }, /* add (1)r5.0<1>:ud r5.0<0;1;0>:ud 1 */
> -	{ 0x01000010, 0x20000200, 0x02000020, 0x000000a0 }, /* cmp.e.f0.0 (1)null<1> r1<0;1;0> r5<0;1;0> */
> -	{ 0x00110027, 0x00000000, 0x00000000, 0xffffffe0 }, /* ~f0.0 while (1) -32 */
> -	{ 0x0c800031, 0x20000a00, 0x0e000080, 0x040a8000 }, /* send.dcdp1 (16)null<1> r4.0<0;1;0> 0x040a8000 */
> -	{ 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 }, /* mov (8)r112<1>:ud r0.0<8;8;1>:ud */
> -	{ 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 }, /* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */

I think the format above is more readable than the one below.

Thanks,
Antonio

> +	/* mov (8)r4.0<1>:ud r0.0<8;8;1>:ud */
> +	{ 0x00600001, 0x20800208, 0x008d0000, 0x00000000 },
> +	/* mov (2)r4.0<1>.ud r2.0<2;2;1>:ud */
> +	{ 0x00200001, 0x20800208, 0x00450040, 0x00000000 },
> +	/* mov (1)r4.8<1>:ud 0x3 */
> +	{ 0x00000001, 0x20880608, 0x00000000, 0x00000003 },
> +	/* mov (1)r5.0<1>:ud 0 */
> +	{ 0x00000001, 0x20a00608, 0x00000000, 0x00000000 },
> +	/* add (1)r5.0<1>:ud r5.0<0;1;0>:ud 1 */
> +	{ 0x00000040, 0x20a00208, 0x060000a0, 0x00000001 },
> +	/* cmp.e.f0.0 (1)null<1> r1<0;1;0> r5<0;1;0> */
> +	{ 0x01000010, 0x20000200, 0x02000020, 0x000000a0 },
> +	/* ~f0.0 while (1) -32 */
> +	{ 0x00110027, 0x00000000, 0x00000000, 0xffffffe0 },
> +	/* send.dcdp1 (16)null<1> r4.0<0;1;0> 0x040a8000 */
> +	{ 0x0c800031, 0x20000a00, 0x0e000080, 0x040a8000 },
> +	/* mov (8)r112<1>:ud r0.0<8;8;1>:ud */
> +	{ 0x00600001, 0x2e000208, 0x008d0000, 0x00000000 },
> +	/* send.ts (16)null<1> r112<0;1;0>:d 0x82000010 */
> +	{ 0x07800031, 0x20000a40, 0x0e000e00, 0x82000010 },
>   };
>   
>   /*
> @@ -81,7 +91,8 @@ gen8_media_spinfunc(struct intel_batchbuffer *batch,
>   	batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>   
>   	curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> -	interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> +	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> +					      spin_kernel, sizeof(spin_kernel));
>   	igt_assert(batch->ptr < &batch->buffer[4095]);
>   
>   	/* media pipeline */
> @@ -119,7 +130,8 @@ gen9_media_spinfunc(struct intel_batchbuffer *batch,
>   	batch->ptr = &batch->buffer[BATCH_STATE_SPLIT];
>   
>   	curbe_buffer = gen8_spin_curbe_buffer_data(batch, spins);
> -	interface_descriptor = gen8_fill_interface_descriptor(batch, dst, spin_kernel, sizeof(spin_kernel));
> +	interface_descriptor = gen8_fill_interface_descriptor(batch, dst,
> +					      spin_kernel, sizeof(spin_kernel));
>   	igt_assert(batch->ptr < &batch->buffer[4095]);
>   
>   	/* media pipeline */
> 


More information about the igt-dev mailing list