[igt-dev] [PATCH] tests/kms_cursor_legacy: Add missing munmap

Chris Wilson chris at chris-wilson.co.uk
Fri Mar 1 19:17:34 UTC 2019


Quoting Nischala Yelchuri (2019-03-01 19:49:00)
> Added munmap, removed extra assert in two_screens_flip_vs_cursor().
> Replaced hard-coded values with PAGE_SIZE macro.
> 
> Cc: Easwar Hariharan <easwar.hariharan at intel.com>
> Cc: Ashutosh Dixit <ashutosh.dixit at intel.com>
> Signed-off-by: Nischala Yelchuri <nischala.yelchuri at intel.com>
> ---
>  tests/kms_cursor_legacy.c | 26 ++++++++++++++------------
>  1 file changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/tests/kms_cursor_legacy.c b/tests/kms_cursor_legacy.c
> index 79df79a3..770e8f14 100644
> --- a/tests/kms_cursor_legacy.c
> +++ b/tests/kms_cursor_legacy.c
> @@ -43,6 +43,8 @@
>  #define DRM_CAP_CURSOR_HEIGHT 0x9
>  #endif
>  
> +#define PAGE_SIZE      4096

When the time comes to do s/4096/sysconf(_SC_PAGE_SIZE)/ I apologise.

> @@ -870,7 +872,7 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
>                 igt_require(drmGetCap(display->drm_fd, DRM_CAP_CRTC_IN_VBLANK_EVENT, &val) == 0);
>         }
>  
> -       shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
> +       shared = mmap(NULL, PAGE_SIZE, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
>         igt_assert(shared != MAP_FAILED);
>  
>         igt_fail_on(modeset && !atomic);
> @@ -932,7 +934,6 @@ static void two_screens_flip_vs_cursor(igt_display_t *display, int nloops, bool
>  
>                                 igt_set_timeout(35, "Stuck modeset");
>                                 igt_assert_eq(read(display->drm_fd, &vbl, sizeof(vbl)), sizeof(vbl));
> -                               igt_assert_eq(read(display->drm_fd, &vbl, sizeof(vbl)), sizeof(vbl));
>                                 igt_reset_timeout();
>  
>                                 if (!nloops)
> @@ -1020,6 +1021,7 @@ done:
>         igt_remove_fb(display->drm_fd, &fb_info);
>         igt_remove_fb(display->drm_fd, &fb2_info);
>         igt_remove_fb(display->drm_fd, &cursor_fb);
> +       munmap((void *)shared, PAGE_SIZE);
>  }

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list