From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH i-g-t 3/3] kms_universal_plane: Universal plane testing Date: Fri, 11 Apr 2014 11:22:39 +0200 Message-ID: <20140411092239.GC9262@phenom.ffwll.local> References: <1397175876-3216-1-git-send-email-matthew.d.roper@intel.com> <1397175985-3328-1-git-send-email-matthew.d.roper@intel.com> <1397175985-3328-4-git-send-email-matthew.d.roper@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 4F1366E362 for ; Fri, 11 Apr 2014 02:22:43 -0700 (PDT) Received: by mail-ee0-f43.google.com with SMTP id e53so3884666eek.2 for ; Fri, 11 Apr 2014 02:22:41 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1397175985-3328-4-git-send-email-matthew.d.roper@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Matt Roper Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org 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 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 =3D \ > 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 =A9 2014 Intel Corporation > + * > + * Permission is hereby granted, free of charge, to any person obtaining= a > + * copy of this software and associated documentation files (the "Softwa= re"), > + * to deal in the Software without restriction, including without limita= tion > + * the rights to use, copy, modify, merge, publish, distribute, sublicen= se, > + * 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, EXPRE= SS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILI= TY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SH= ALL > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR = OTHER > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISI= NG > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER D= EALINGS > + * IN THE SOFTWARE. > + */ > + > +#include > +#include > +#include > +#include > + > +#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 C= RC:2. > + * - Yellow primary via traditional interfaces > + * - Blue primary plane, red sprite via universal planes, grab CRC:3 a= nd 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 =3D test->data; > + drmModeModeInfo *mode; > + > + test->pipe_crc =3D igt_pipe_crc_new(pipe, INTEL_PIPE_CRC_SOURCE_AUTO); > + > + igt_output_set_pipe(output, pipe); > + > + mode =3D 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 =3D { .data =3D data }; > + igt_plane_t *primary, *sprite; > + > + igt_skip_on(pipe >=3D 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 =3D igt_output_get_plane(output, IGT_PLANE_PRIMARY); > + sprite =3D 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 =3D 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 =3D 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 -- = Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch