Re: [PATCH v3 i-g-t] test/kms_plane_lowres: Fix display_commit_mode() so it returns the crc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 12, 2017 at 11:59:13AM +0100, Maarten Lankhorst wrote:
> From: Arkadiusz Hiler <arkadiusz.hiler@xxxxxxxxx>
> 
> Compiler complained on crc_lowres and crc_hires2 being uninitialized
> and indeed, display_commit_mode() seems to have intention of retruning
> the value through the parameter that is only a single pointer.
> 
> This couses only the local copy of the pointer, the one inside
> display_commit_mode(), to be overwritten.
> 
> Let's fix that!
> 
> Also add missing hires crc comparison (M. Kahola).
> 
> v2: make display_commit_mode return just the last CRC
> v3: Don't do memory allocations, it's hard. (Maarten)
> 
> Cc: Mika Kahola <mika.kahola@xxxxxxxxx>
> Cc: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@xxxxxxxxx>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> ---
> So sorry, didn't like the memory allocations, hope this works.. else I'll commit v2..
> 
> tests/kms_plane_lowres.c | 25 ++++++++++++++++---------
>  1 file changed, 16 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/kms_plane_lowres.c b/tests/kms_plane_lowres.c
> index 85d3145de4b6..f643bb4b0e8f 100644
> --- a/tests/kms_plane_lowres.c
> +++ b/tests/kms_plane_lowres.c
> @@ -125,11 +125,12 @@ test_fini(data_t *data, igt_output_t *output, enum pipe pipe)
>  	data->fb = NULL;
>  }
>  
> -static int
> +static void
>  display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,
> -		    enum pipe pipe, int flags, igt_crc_t *crc)
> +		    enum pipe pipe, int flags, igt_crc_t *out_crc)
>  {
>  	char buf[256];
> +	igt_crc_t *crcs;
>  	struct drm_event *e = (void *)buf;
>  	unsigned int vblank_start, vblank_stop;
>  	int n, ret;
> @@ -148,10 +149,12 @@ display_commit_mode(igt_display_t *display, igt_pipe_crc_t *pipe_crc,
>  	igt_assert_eq(e->type, DRM_EVENT_FLIP_COMPLETE);
>  	igt_reset_timeout();
>  
> -	n = igt_pipe_crc_get_crcs(pipe_crc, vblank_stop - vblank_start, &crc);
> +	n = igt_pipe_crc_get_crcs(pipe_crc, vblank_stop - vblank_start, &crcs);
>  	igt_assert_eq(n, vblank_stop - vblank_start);
>  
> -	return n;
> +	/* there is no need to return all the intermediary CRCs */
> +	/* so let's return just the last one */
> +	*out_crc = crcs[n-1];

free(crcs); ?

>  }
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux