[Intel-gfx] [PATCH 6/6] tests/kms_flip: free the test_output struct when counting modes
Daniel Vetter
daniel at ffwll.ch
Tue Jan 7 08:16:33 CET 2014
On Mon, Dec 30, 2013 at 01:56:53PM -0200, Paulo Zanoni wrote:
> From: Paulo Zanoni <paulo.r.zanoni at intel.com>
>
> Looks like we have to do a lot of work just to count the number of
> modes...
>
> Caught by Valgrind.
>
> Signed-off-by: Paulo Zanoni <paulo.r.zanoni at intel.com>
Nice set of patches, please push. I agree that the mode/output config
handling in our kms tests is still awful and too verbose, but I didn't
come up yet with a good idea ...
-Daniel
> ---
> tests/kms_flip.c | 17 +++++++++++++----
> 1 file changed, 13 insertions(+), 4 deletions(-)
>
> diff --git a/tests/kms_flip.c b/tests/kms_flip.c
> index c43a26f..7e5e355 100644
> --- a/tests/kms_flip.c
> +++ b/tests/kms_flip.c
> @@ -1129,6 +1129,16 @@ static unsigned event_loop(struct test_output *o, unsigned duration_ms)
> return end - start;
> }
>
> +static void free_test_output(struct test_output *o)
> +{
> + int i;
> +
> + for (i = 0; i < o->count; i++) {
> + drmModeFreeEncoder(o->kencoder[i]);
> + drmModeFreeConnector(o->kconnector[i]);
> + }
> +}
> +
> static void run_test_on_crtc_set(struct test_output *o, int *crtc_idxs,
> int crtc_count, int duration_ms)
> {
> @@ -1231,10 +1241,7 @@ out:
>
> last_connector = NULL;
>
> - for (i = 0; i < o->count; i++) {
> - drmModeFreeEncoder(o->kencoder[i]);
> - drmModeFreeConnector(o->kconnector[i]);
> - }
> + free_test_output(o);
> }
>
> static int run_test(int duration, int flags)
> @@ -1261,6 +1268,7 @@ static int run_test(int duration, int flags)
> if (o.mode_valid)
> modes++;
>
> + free_test_output(&o);
> }
> }
>
> @@ -1318,6 +1326,7 @@ static int run_pair(int duration, int flags)
> if (o.mode_valid)
> modes++;
>
> + free_test_output(&o);
> }
> }
> }
> --
> 1.8.3.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
More information about the Intel-gfx
mailing list