[igt-dev] [PATCH i-g-t 04/11] tests/kms_lease: Get pipe from crtc for enable pipes

Arkadiusz Hiler arkadiusz.hiler at intel.com
Mon Jul 20 08:39:10 UTC 2020


On Fri, Jul 17, 2020 at 03:40:54PM +0000, Mohammed Khajapasha wrote:
> Get pipe from drm crtc for enabled pipes only.
> 
> v2:
>     Using for_each_pipe() macro for enable pipes <Hiler, Arkadiusz>
> 
> Signed-off-by: Mohammed Khajapasha <mohammed.khajapasha at intel.com>
> ---
>  tests/kms_lease.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/kms_lease.c b/tests/kms_lease.c
> index 2e6cf9b0..0481bba7 100644
> --- a/tests/kms_lease.c
> +++ b/tests/kms_lease.c
> @@ -683,7 +683,10 @@ static void lease_unleased_crtc(data_t *data)
>  
>  	/* Find another CRTC that we don't control */
>  	bad_crtc_id = 0;
> -	for (p = 0; bad_crtc_id == 0 && p < data->master.display.n_pipes; p++) {
> +
> +	for_each_pipe(&data->master.display, p) {
> +		if (bad_crtc_id != 0)
> +			continue;

Would be better to make it 'break' as it would short circuit the whole
loop instead of going though al all the noop interation with 'continue',
but in the end it donesn't really matter that much.

>  		if (pipe_to_crtc_id(&data->master.display, p) != data->crtc_id)
>  			bad_crtc_id = pipe_to_crtc_id(&data->master.display, p);
>  	}
> -- 
> 2.25.1
> 


More information about the igt-dev mailing list