Message ID | 1397175985-3328-4-git-send-email-matthew.d.roper@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Apr 10, 2014 at 05:26:25PM -0700, Matt Roper wrote: > Add a simple test to exercise universal plane support. > > Signed-off-by: Matt Roper <matthew.d.roper@intel.com> Looks like a good functional test, but I think we need to add a bit more api nastiness still. So no functional tests with CRCs, but just tests to make sure the kernel doesn't fall over. - primary plane set_plane calls vs. legacy setcrtc primary plane updates. We'll very likely have mixed userspace (e.g. boot splash vs. display manager). E.g. disable primary plane (but keep everything working), then setCrtc a new plane framebuffer. - primary plane vs. other ioctls. Might be easier to extend existing tests for this. E.g. doing a pageflip ioctl if the primary plane is off (might need to decide what we really want to do and if we decide that it should enable the primary plane then we need a CRC based test to make sure that the transition is perfect). Or primary plane changes vs. dpms and suspend/resume. For those functional checks based on CRC would be good to make sure we properly restore everything. - Maybe exercise some of the checks in the primary plane helper to make sure they work. In the future we'll probably lift those limitations (not on current hw afaik though), but then we can adjust those tests to skip on these platforms. - Anything else that was pointed out in review or was tricky while developing this stuff. Cheers, Daniel > --- > tests/Makefile.sources | 1 + > tests/kms_universal_plane.c | 211 ++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 212 insertions(+) > create mode 100644 tests/kms_universal_plane.c > > diff --git a/tests/Makefile.sources b/tests/Makefile.sources > index bf02a48..4911914 100644 > --- a/tests/Makefile.sources > +++ b/tests/Makefile.sources > @@ -63,6 +63,7 @@ TESTS_progs_M = \ > kms_plane \ > kms_render \ > kms_setmode \ > + kms_universal_plane \ > pm_lpsp \ > pm_pc8 \ > pm_rps \ > diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c > new file mode 100644 > index 0000000..f1ec6fb > --- /dev/null > +++ b/tests/kms_universal_plane.c > @@ -0,0 +1,211 @@ > +/* > + * Copyright © 2014 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 <errno.h> > +#include <stdbool.h> > +#include <stdio.h> > +#include <string.h> > + > +#include "drmtest.h" > +#include "igt_debugfs.h" > +#include "igt_kms.h" > + > +typedef struct { > + int drm_fd; > + igt_display_t display; > +} data_t; > + > +/* > + * Universal plane testing. > + * - Black primary plane via traditional interfaces, red sprite, grab CRC:1. > + * - Blue primary plane via traditional interfaces, red sprite, grab CRC:2. > + * - Yellow primary via traditional interfaces > + * - Blue primary plane, red sprite via universal planes, grab CRC:3 and compare > + * with CRC:2 (should be the same) > + * - Disable primary plane, grab CRC:4 (should be same as CRC:1) > + * - Reenable primary, grab CRC:5 (should be same as CRC:2 and CRC:3) > + */ > + > +typedef struct { > + data_t *data; > + igt_pipe_crc_t *pipe_crc; > + igt_crc_t crc_1, crc_2, crc_3, crc_4, crc_5; > + struct igt_fb red_fb, blue_fb, black_fb, yellow_fb; > +} test_t; > + > +static void > +test_init(test_t *test, igt_output_t *output, enum pipe pipe) > +{ > + data_t *data = test->data; > + drmModeModeInfo *mode; > + > + test->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO); > + > + igt_output_set_pipe(output, pipe); > + > + mode = igt_output_get_mode(output); > + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, > + DRM_FORMAT_XRGB8888, > + false, /* tiled */ > + 0.0, 0.0, 0.0, > + &test->black_fb); > + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, > + DRM_FORMAT_XRGB8888, > + false, /* tiled */ > + 0.0, 0.0, 1.0, > + &test->blue_fb); > + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, > + DRM_FORMAT_XRGB8888, > + false, /* tiled */ > + 1.0, 1.0, 0.0, > + &test->yellow_fb); > + igt_create_color_fb(data->drm_fd, 100, 100, > + DRM_FORMAT_XRGB8888, > + false, /* tiled */ > + 1.0, 0.0, 0.0, > + &test->red_fb); > +} > + > +static void > +test_fini(test_t *test, igt_output_t *output) > +{ > + igt_pipe_crc_free(test->pipe_crc); > + > + igt_remove_fb(test->data->drm_fd, &test->black_fb); > + igt_remove_fb(test->data->drm_fd, &test->blue_fb); > + igt_remove_fb(test->data->drm_fd, &test->red_fb); > + igt_remove_fb(test->data->drm_fd, &test->yellow_fb); > + > + igt_display_use_universal_commits(&test->data->display, false); > + igt_output_set_pipe(output, PIPE_ANY); > + igt_display_commit(&test->data->display); > +} > + > +static void > +test_pipe(data_t *data, enum pipe pipe, igt_output_t *output) > +{ > + test_t test = { .data = data }; > + igt_plane_t *primary, *sprite; > + > + igt_skip_on(pipe >= data->display.n_pipes); > + > + fprintf(stdout, "Testing connector %s using pipe %c\n", > + igt_output_name(output), pipe_name(pipe)); > + > + test_init(&test, output, pipe); > + > + primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); > + sprite = igt_output_get_plane(output, IGT_PLANE_2); > + if (!sprite) { > + test_fini(&test, output); > + igt_skip("No sprite plane available\n"); > + } > + > + igt_plane_set_position(sprite, 100, 100); > + > + /* Step 1: Legacy API's, black primary, red sprite (CRC 1) */ > + igt_plane_set_fb(primary, &test.black_fb); > + igt_plane_set_fb(sprite, &test.red_fb); > + igt_display_commit(&data->display); > + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_1); > + > + /* Step 2: Legacy API', blue primary, red sprite (CRC 2) */ > + igt_plane_set_fb(primary, &test.blue_fb); > + igt_plane_set_fb(sprite, &test.red_fb); > + igt_display_commit(&data->display); > + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_2); > + > + /* Step 3: Legacy API's, yellow primary */ > + igt_plane_set_fb(primary, &test.yellow_fb); > + igt_display_commit(&data->display); > + > + /* Step 4: Universal API's, blue primary, red sprite (CRC 3) */ > + igt_display_use_universal_commits(&test.data->display, true); > + igt_plane_set_fb(primary, &test.blue_fb); > + igt_plane_set_fb(sprite, &test.red_fb); > + igt_display_commit(&data->display); > + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_3); > + > + /* Step 5: Universal API's, disable primary plane (CRC 4) */ > + igt_plane_set_fb(primary, NULL); > + igt_display_commit(&data->display); > + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_4); > + > + /* Step 6: Universal API's, re-enable primary with blue (CRC 5) */ > + igt_display_use_universal_commits(&test.data->display, true); > + igt_plane_set_fb(primary, &test.blue_fb); > + igt_display_commit(&data->display); > + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_5); > + > + /* Blue bg + red sprite should be same under both types of API's */ > + igt_assert(igt_crc_equal(&test.crc_2, &test.crc_3)); > + > + /* Disabling primary plane should be same as black primary */ > + igt_assert(igt_crc_equal(&test.crc_1, &test.crc_4)); > + > + /* Re-enabling primary should return to blue properly */ > + igt_assert(igt_crc_equal(&test.crc_2, &test.crc_5)); > + > + igt_plane_set_fb(primary, NULL); > + igt_plane_set_fb(sprite, NULL); > + > + test_fini(&test, output); > +} > + > +static void > +run_tests_for_pipe(data_t *data, enum pipe pipe) > +{ > + igt_output_t *output; > + > + igt_assert(data->display.has_universal_planes); > + > + igt_subtest_f("universal-plane-pipe-%c", pipe_name(pipe)) > + for_each_connected_output(&data->display, output) > + test_pipe(data, pipe, output); > +} > + > +static data_t data; > + > +igt_main > +{ > + > + igt_skip_on_simulation(); > + > + igt_fixture { > + data.drm_fd = drm_open_any(); > + > + igt_set_vt_graphics_mode(); > + > + igt_require_pipe_crc(); > + igt_display_init(&data.display, data.drm_fd); > + > + igt_require(data.display.has_universal_planes); > + } > + > + for (int pipe = 0; pipe < 3; pipe++) > + run_tests_for_pipe(&data, pipe); > + > + igt_fixture { > + igt_display_fini(&data.display); > + } > +} > -- > 1.8.5.1 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Fri, Apr 11, 2014 at 11:22:39AM +0200, Daniel Vetter wrote: > On Thu, Apr 10, 2014 at 05:26:25PM -0700, Matt Roper wrote: > > Add a simple test to exercise universal plane support. > > > > Signed-off-by: Matt Roper <matthew.d.roper@intel.com> > > Looks like a good functional test, but I think we need to add a bit more > api nastiness still. So no functional tests with CRCs, but just tests to > make sure the kernel doesn't fall over. > > - primary plane set_plane calls vs. legacy setcrtc primary plane updates. > We'll very likely have mixed userspace (e.g. boot splash vs. display > manager). E.g. disable primary plane (but keep everything working), then > setCrtc a new plane framebuffer. > > - primary plane vs. other ioctls. Might be easier to extend existing tests > for this. E.g. doing a pageflip ioctl if the primary plane is off > (might need to decide what we really want to do and if we decide that it > should enable the primary plane then we need a CRC based test to make > sure that the transition is perfect). > > Or primary plane changes vs. dpms and suspend/resume. For those > functional checks based on CRC would be good to make sure we properly > restore everything. > > - Maybe exercise some of the checks in the primary plane helper to make > sure they work. In the future we'll probably lift those limitations (not > on current hw afaik though), but then we can adjust those tests to skip > on these platforms. > > - Anything else that was pointed out in review or was tricky while > developing this stuff. More ideas! My main concern is interactions with existing features when the primary plane is disabled and no other plane/cursor enabled, i.e. when we scan out a solid black. - solid black vs. dpms for all connector/pipe pairings. The modeset sequence is different for different connectors and my gut says not enabling the primary plane might cause trouble. - solid black vs. vblank events. When transition through a "no planes" situation we need to make sure that vblank events keep on working. A testcase (maybe in combination of some of the dpms and susped/resume case above too) would be good. I'll leave it to you to somewhat sensibly group all these ideas into real testcases ;-) For further inspiration maybe look at the corner cases existing kms_* tests exercise a bit. -Daniel
diff --git a/tests/Makefile.sources b/tests/Makefile.sources index bf02a48..4911914 100644 --- a/tests/Makefile.sources +++ b/tests/Makefile.sources @@ -63,6 +63,7 @@ TESTS_progs_M = \ kms_plane \ kms_render \ kms_setmode \ + kms_universal_plane \ pm_lpsp \ pm_pc8 \ pm_rps \ diff --git a/tests/kms_universal_plane.c b/tests/kms_universal_plane.c new file mode 100644 index 0000000..f1ec6fb --- /dev/null +++ b/tests/kms_universal_plane.c @@ -0,0 +1,211 @@ +/* + * Copyright © 2014 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 <errno.h> +#include <stdbool.h> +#include <stdio.h> +#include <string.h> + +#include "drmtest.h" +#include "igt_debugfs.h" +#include "igt_kms.h" + +typedef struct { + int drm_fd; + igt_display_t display; +} data_t; + +/* + * Universal plane testing. + * - Black primary plane via traditional interfaces, red sprite, grab CRC:1. + * - Blue primary plane via traditional interfaces, red sprite, grab CRC:2. + * - Yellow primary via traditional interfaces + * - Blue primary plane, red sprite via universal planes, grab CRC:3 and compare + * with CRC:2 (should be the same) + * - Disable primary plane, grab CRC:4 (should be same as CRC:1) + * - Reenable primary, grab CRC:5 (should be same as CRC:2 and CRC:3) + */ + +typedef struct { + data_t *data; + igt_pipe_crc_t *pipe_crc; + igt_crc_t crc_1, crc_2, crc_3, crc_4, crc_5; + struct igt_fb red_fb, blue_fb, black_fb, yellow_fb; +} test_t; + +static void +test_init(test_t *test, igt_output_t *output, enum pipe pipe) +{ + data_t *data = test->data; + drmModeModeInfo *mode; + + test->pipe_crc = igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO); + + igt_output_set_pipe(output, pipe); + + mode = igt_output_get_mode(output); + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + false, /* tiled */ + 0.0, 0.0, 0.0, + &test->black_fb); + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + false, /* tiled */ + 0.0, 0.0, 1.0, + &test->blue_fb); + igt_create_color_fb(data->drm_fd, mode->hdisplay, mode->vdisplay, + DRM_FORMAT_XRGB8888, + false, /* tiled */ + 1.0, 1.0, 0.0, + &test->yellow_fb); + igt_create_color_fb(data->drm_fd, 100, 100, + DRM_FORMAT_XRGB8888, + false, /* tiled */ + 1.0, 0.0, 0.0, + &test->red_fb); +} + +static void +test_fini(test_t *test, igt_output_t *output) +{ + igt_pipe_crc_free(test->pipe_crc); + + igt_remove_fb(test->data->drm_fd, &test->black_fb); + igt_remove_fb(test->data->drm_fd, &test->blue_fb); + igt_remove_fb(test->data->drm_fd, &test->red_fb); + igt_remove_fb(test->data->drm_fd, &test->yellow_fb); + + igt_display_use_universal_commits(&test->data->display, false); + igt_output_set_pipe(output, PIPE_ANY); + igt_display_commit(&test->data->display); +} + +static void +test_pipe(data_t *data, enum pipe pipe, igt_output_t *output) +{ + test_t test = { .data = data }; + igt_plane_t *primary, *sprite; + + igt_skip_on(pipe >= data->display.n_pipes); + + fprintf(stdout, "Testing connector %s using pipe %c\n", + igt_output_name(output), pipe_name(pipe)); + + test_init(&test, output, pipe); + + primary = igt_output_get_plane(output, IGT_PLANE_PRIMARY); + sprite = igt_output_get_plane(output, IGT_PLANE_2); + if (!sprite) { + test_fini(&test, output); + igt_skip("No sprite plane available\n"); + } + + igt_plane_set_position(sprite, 100, 100); + + /* Step 1: Legacy API's, black primary, red sprite (CRC 1) */ + igt_plane_set_fb(primary, &test.black_fb); + igt_plane_set_fb(sprite, &test.red_fb); + igt_display_commit(&data->display); + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_1); + + /* Step 2: Legacy API', blue primary, red sprite (CRC 2) */ + igt_plane_set_fb(primary, &test.blue_fb); + igt_plane_set_fb(sprite, &test.red_fb); + igt_display_commit(&data->display); + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_2); + + /* Step 3: Legacy API's, yellow primary */ + igt_plane_set_fb(primary, &test.yellow_fb); + igt_display_commit(&data->display); + + /* Step 4: Universal API's, blue primary, red sprite (CRC 3) */ + igt_display_use_universal_commits(&test.data->display, true); + igt_plane_set_fb(primary, &test.blue_fb); + igt_plane_set_fb(sprite, &test.red_fb); + igt_display_commit(&data->display); + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_3); + + /* Step 5: Universal API's, disable primary plane (CRC 4) */ + igt_plane_set_fb(primary, NULL); + igt_display_commit(&data->display); + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_4); + + /* Step 6: Universal API's, re-enable primary with blue (CRC 5) */ + igt_display_use_universal_commits(&test.data->display, true); + igt_plane_set_fb(primary, &test.blue_fb); + igt_display_commit(&data->display); + igt_pipe_crc_collect_crc(test.pipe_crc, &test.crc_5); + + /* Blue bg + red sprite should be same under both types of API's */ + igt_assert(igt_crc_equal(&test.crc_2, &test.crc_3)); + + /* Disabling primary plane should be same as black primary */ + igt_assert(igt_crc_equal(&test.crc_1, &test.crc_4)); + + /* Re-enabling primary should return to blue properly */ + igt_assert(igt_crc_equal(&test.crc_2, &test.crc_5)); + + igt_plane_set_fb(primary, NULL); + igt_plane_set_fb(sprite, NULL); + + test_fini(&test, output); +} + +static void +run_tests_for_pipe(data_t *data, enum pipe pipe) +{ + igt_output_t *output; + + igt_assert(data->display.has_universal_planes); + + igt_subtest_f("universal-plane-pipe-%c", pipe_name(pipe)) + for_each_connected_output(&data->display, output) + test_pipe(data, pipe, output); +} + +static data_t data; + +igt_main +{ + + igt_skip_on_simulation(); + + igt_fixture { + data.drm_fd = drm_open_any(); + + igt_set_vt_graphics_mode(); + + igt_require_pipe_crc(); + igt_display_init(&data.display, data.drm_fd); + + igt_require(data.display.has_universal_planes); + } + + for (int pipe = 0; pipe < 3; pipe++) + run_tests_for_pipe(&data, pipe); + + igt_fixture { + igt_display_fini(&data.display); + } +}
Add a simple test to exercise universal plane support. Signed-off-by: Matt Roper <matthew.d.roper@intel.com> --- tests/Makefile.sources | 1 + tests/kms_universal_plane.c | 211 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 212 insertions(+) create mode 100644 tests/kms_universal_plane.c