Re: [Intel-gfx] [PATCH i-g-t v5] tests/kms_plane_multiple: CRC based atomic correctness test
Thanks for the review. On Mon, 2016-11-07 at 14:04 +0100, Maarten Lankhorst wrote: > Op 02-11-16 om 10:32 schreef Mika Kahola: > > > > This is a testcase with multiple planes. The idea here is the > > following > > > > - draw a uniform frame with blue color > > - grab crc for reference > > - put planes randomly on top with the same blue color > > - punch holes with black color into the primary framebuffer > > - ideally the planes should cover these holes so that the output > > is the > > identical to reference crc > > - composite all with one ioctl call > > - grab crc and verify that the reference crc is equal > > - repeat this for dozen iterations to maximize coverage > > > > v5: Remove limit for max number of iterations and add possibility > > to > > loop forever (Daniel) > > Remove IN_RANGE() macro (Maarten) > > Remove log file and show random number seed on screen instead > > (Maarten) > > Split legacy and atomic plane tests on own functions (Maarten) > > remove test_atomic() function and pass test mode info as > > parameter (Maarten) > > Use bigger rectangle size (256x256) for non-cursor planes and > > smaller (128x128) size for cursor plane (Maarten) > > > > v4: For atomic test enable crc capturing before entering into a > > iteration loop. After each iteration, check that page flip > > didn't take no more than 1 vblank, fetch all crc's and check > > the values. > > > > Introduce new command line parameter for the number of > > iterations. > > The test run from 1 to 256 iterations. > > > > v3: Cleanup by removing separate plane array > > For atomic, pass DRM_MODE_PAGE_FLIP_EVENT > > Grab crc by using igt_pipe_crc_get_crc instead of > > igt_pipe_crc_collect_crc > > Rename nplanes variable to max_planes > > To optimize test execution, run iterations after the modeset > > > > v2: Keep a logfile on random number seeds per subtest that are not > > skipped > > due to unmet test requirements > > > > Signed-off-by: Mika Kahola> > --- > > tests/Makefile.sources | 1 + > > tests/kms_plane_multiple.c | 506 > > + > > 2 files changed, 507 insertions(+) > > create mode 100644 tests/kms_plane_multiple.c > > > > diff --git a/tests/Makefile.sources b/tests/Makefile.sources > > index 6d081c3..ffd59c1 100644 > > --- a/tests/Makefile.sources > > +++ b/tests/Makefile.sources > > @@ -105,6 +105,7 @@ TESTS_progs_M = \ > > kms_pipe_color \ > > kms_pipe_crc_basic \ > > kms_plane \ > > + kms_plane_multiple \ > > kms_properties \ > > kms_psr_sink_crc \ > > kms_render \ > > diff --git a/tests/kms_plane_multiple.c > > b/tests/kms_plane_multiple.c > > new file mode 100644 > > index 000..d13ce1c > > --- /dev/null > > +++ b/tests/kms_plane_multiple.c > > @@ -0,0 +1,506 @@ > > +/* > > + * Copyright © 2016 Intel Corporation > > + * > > + * Permission is hereby granted, free of charge, to any person > > obtaining a > > + * copy of this software and associated documentation files (the > > "Software"), > > + * to deal in the Software without restriction, including without > > limitation > > + * the rights to use, copy, modify, merge, publish, distribute, > > sublicense, > > + * and/or sell copies of the Software, and to permit persons to > > whom the > > + * Software is furnished to do so, subject to the following > > conditions: > > + * > > + * The above copyright notice and this permission notice > > (including the next > > + * paragraph) shall be included in all copies or substantial > > portions of the > > + * Software. > > + * > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > > EXPRESS OR > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > > MERCHANTABILITY, > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO > > EVENT SHALL > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, > > DAMAGES OR OTHER > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > > ARISING > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > > OTHER DEALINGS > > + * IN THE SOFTWARE. > > + * > > + */ > > + > > +#include "igt.h" > > +#include "drmtest.h" > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +IGT_TEST_DESCRIPTION("Test atomic mode setting with multiple > > planes "); > > + > > +#define MAX_CRCS 1 > > +#define SIZE_PLANE 256 > > +#define SIZE_CURSOR 128 > > +#define LOOP_FOREVER -1 > > + > > +typedef struct { > > + float red; > > + float green; > > + float blue; > > +} color_t; > > + > > +typedef struct { > > + int drm_fd; > > + igt_display_t display; > > + igt_pipe_crc_t *pipe_crc; > > + igt_plane_t *plane[IGT_MAX_PLANES]; > > + struct igt_fb fb[IGT_MAX_PLANES]; > > +} data_t; > > + > > +typedef struct { > > + data_t *data; > > + igt_crc_t reference_crc; > > +}
Re: [Intel-gfx] [PATCH i-g-t v5] tests/kms_plane_multiple: CRC based atomic correctness test
Op 02-11-16 om 10:32 schreef Mika Kahola: > This is a testcase with multiple planes. The idea here is the following > > - draw a uniform frame with blue color > - grab crc for reference > - put planes randomly on top with the same blue color > - punch holes with black color into the primary framebuffer > - ideally the planes should cover these holes so that the output is the >identical to reference crc > - composite all with one ioctl call > - grab crc and verify that the reference crc is equal > - repeat this for dozen iterations to maximize coverage > > v5: Remove limit for max number of iterations and add possibility to > loop forever (Daniel) > Remove IN_RANGE() macro (Maarten) > Remove log file and show random number seed on screen instead (Maarten) > Split legacy and atomic plane tests on own functions (Maarten) > remove test_atomic() function and pass test mode info as > parameter (Maarten) > Use bigger rectangle size (256x256) for non-cursor planes and > smaller (128x128) size for cursor plane (Maarten) > > v4: For atomic test enable crc capturing before entering into a > iteration loop. After each iteration, check that page flip > didn't take no more than 1 vblank, fetch all crc's and check > the values. > > Introduce new command line parameter for the number of iterations. > The test run from 1 to 256 iterations. > > v3: Cleanup by removing separate plane array > For atomic, pass DRM_MODE_PAGE_FLIP_EVENT > Grab crc by using igt_pipe_crc_get_crc instead of igt_pipe_crc_collect_crc > Rename nplanes variable to max_planes > To optimize test execution, run iterations after the modeset > > v2: Keep a logfile on random number seeds per subtest that are not skipped > due to unmet test requirements > > Signed-off-by: Mika Kahola> --- > tests/Makefile.sources | 1 + > tests/kms_plane_multiple.c | 506 > + > 2 files changed, 507 insertions(+) > create mode 100644 tests/kms_plane_multiple.c > > diff --git a/tests/Makefile.sources b/tests/Makefile.sources > index 6d081c3..ffd59c1 100644 > --- a/tests/Makefile.sources > +++ b/tests/Makefile.sources > @@ -105,6 +105,7 @@ TESTS_progs_M = \ > kms_pipe_color \ > kms_pipe_crc_basic \ > kms_plane \ > + kms_plane_multiple \ > kms_properties \ > kms_psr_sink_crc \ > kms_render \ > diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c > new file mode 100644 > index 000..d13ce1c > --- /dev/null > +++ b/tests/kms_plane_multiple.c > @@ -0,0 +1,506 @@ > +/* > + * Copyright © 2016 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice (including the next > + * paragraph) shall be included in all copies or substantial portions of the > + * Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER > DEALINGS > + * IN THE SOFTWARE. > + * > + */ > + > +#include "igt.h" > +#include "drmtest.h" > +#include > +#include > +#include > +#include > +#include > + > +IGT_TEST_DESCRIPTION("Test atomic mode setting with multiple planes "); > + > +#define MAX_CRCS 1 > +#define SIZE_PLANE 256 > +#define SIZE_CURSOR 128 > +#define LOOP_FOREVER -1 > + > +typedef struct { > + float red; > + float green; > + float blue; > +} color_t; > + > +typedef struct { > + int drm_fd; > + igt_display_t display; > + igt_pipe_crc_t *pipe_crc; > + igt_plane_t *plane[IGT_MAX_PLANES]; > + struct igt_fb fb[IGT_MAX_PLANES]; > +} data_t; > + > +typedef struct { > + data_t *data; > + igt_crc_t reference_crc; > +} test_position_t; > + > +/* Command line parameters. */ > +struct { > + int iterations; > + bool user_seed; > + int seed; > +} opt = { > + .iterations = 64, > + .user_seed = false, > + .seed = 1, > +}; > + > +static inline uint32_t pipe_select(int pipe) > +{ > + if (pipe > 1) > + return pipe << DRM_VBLANK_HIGH_CRTC_SHIFT; > + else if (pipe > 0) > +
[Intel-gfx] [PATCH i-g-t v5] tests/kms_plane_multiple: CRC based atomic correctness test
This is a testcase with multiple planes. The idea here is the following - draw a uniform frame with blue color - grab crc for reference - put planes randomly on top with the same blue color - punch holes with black color into the primary framebuffer - ideally the planes should cover these holes so that the output is the identical to reference crc - composite all with one ioctl call - grab crc and verify that the reference crc is equal - repeat this for dozen iterations to maximize coverage v5: Remove limit for max number of iterations and add possibility to loop forever (Daniel) Remove IN_RANGE() macro (Maarten) Remove log file and show random number seed on screen instead (Maarten) Split legacy and atomic plane tests on own functions (Maarten) remove test_atomic() function and pass test mode info as parameter (Maarten) Use bigger rectangle size (256x256) for non-cursor planes and smaller (128x128) size for cursor plane (Maarten) v4: For atomic test enable crc capturing before entering into a iteration loop. After each iteration, check that page flip didn't take no more than 1 vblank, fetch all crc's and check the values. Introduce new command line parameter for the number of iterations. The test run from 1 to 256 iterations. v3: Cleanup by removing separate plane array For atomic, pass DRM_MODE_PAGE_FLIP_EVENT Grab crc by using igt_pipe_crc_get_crc instead of igt_pipe_crc_collect_crc Rename nplanes variable to max_planes To optimize test execution, run iterations after the modeset v2: Keep a logfile on random number seeds per subtest that are not skipped due to unmet test requirements Signed-off-by: Mika Kahola--- tests/Makefile.sources | 1 + tests/kms_plane_multiple.c | 506 + 2 files changed, 507 insertions(+) create mode 100644 tests/kms_plane_multiple.c diff --git a/tests/Makefile.sources b/tests/Makefile.sources index 6d081c3..ffd59c1 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -105,6 +105,7 @@ TESTS_progs_M = \ kms_pipe_color \ kms_pipe_crc_basic \ kms_plane \ + kms_plane_multiple \ kms_properties \ kms_psr_sink_crc \ kms_render \ diff --git a/tests/kms_plane_multiple.c b/tests/kms_plane_multiple.c new file mode 100644 index 000..d13ce1c --- /dev/null +++ b/tests/kms_plane_multiple.c @@ -0,0 +1,506 @@ +/* + * Copyright © 2016 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#include "igt.h" +#include "drmtest.h" +#include +#include +#include +#include +#include + +IGT_TEST_DESCRIPTION("Test atomic mode setting with multiple planes "); + +#define MAX_CRCS 1 +#define SIZE_PLANE 256 +#define SIZE_CURSOR 128 +#define LOOP_FOREVER -1 + +typedef struct { + float red; + float green; + float blue; +} color_t; + +typedef struct { + int drm_fd; + igt_display_t display; + igt_pipe_crc_t *pipe_crc; + igt_plane_t *plane[IGT_MAX_PLANES]; + struct igt_fb fb[IGT_MAX_PLANES]; +} data_t; + +typedef struct { + data_t *data; + igt_crc_t reference_crc; +} test_position_t; + +/* Command line parameters. */ +struct { + int iterations; + bool user_seed; + int seed; +} opt = { + .iterations = 64, + .user_seed = false, + .seed = 1, +}; + +static inline uint32_t pipe_select(int pipe) +{ + if (pipe > 1) + return pipe << DRM_VBLANK_HIGH_CRTC_SHIFT; + else if (pipe > 0) + return DRM_VBLANK_SECONDARY; + else + return 0; +} + +static unsigned int get_vblank(int fd, int pipe, unsigned int flags) +{ + union drm_wait_vblank vbl; + + memset(, 0, sizeof(vbl)); + vbl.request.type = DRM_VBLANK_RELATIVE |