IGT support for nuclear pageflip
cover IGT support for nuclear pageflip
These patches add support for nuclear pageflip to the IGT testsuite to help exercise the kernel patches just posted.
Note that nuclear pageflip (and eventually full atomic modeset) support requires a very new libdrm that hasn't yet gone upstream; you can find a copy in Rob Clark's repo here:
https://github.com/robclark/libdrm.git atomic
All of the nuclear/atomic code is contained inside #ifdef blocks managed by autoconf, so everything should continue to work properly if you build/run against an older libdrm that does not have atomic support.
The actual kms_nuclear test added here is a quick copy/paste of parts of the universal_plane test; it's enough to exercise the nuclear interface and sanity test that things are hooked up, but it will definitely need to be signficantly extended to try out all of the corner cases before I'd really consider it "done."
Matt Roper (3):
lib/kms: Let display commits wait for keypress while debugging lib/kms: Add nuclear pageflip commit style
tests: Introduce kms_nuclear
configure.ac | 3 + lib/igt_kms.c | 170 ++++++++++++++++++++++++-- lib/igt_kms.h | 19 ++- tests/Makefile.sources | 1 + tests/kms_nuclear.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 501 insertions(+), 10 deletions(-) create mode 100644 tests/kms_nuclear.c
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/3 lib/kms: Let display commits wait for keypress while debugging
Add a call to igt_debug_wait_for_keypress() immediately before we commit new hardware state to help simplify display debugging.
To use this, just set the environment variable:
IGT_DEBUG_INTERACTIVE=commit
--- lib/igt_kms.c | 1 + 1 file changed, 1 insertion(+)
lib/igt_kms.c +1 -0
@@ -1551,6 +1551,7 @@ static int do_display_commit(igt_display_t *display,LOG_INDENT (display,"commit" ); +igt_debug_wait_for_keypress ("commit" );igt_display_refresh (display);for (i =0 ; i < display->n_outputs; i++) {
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/3 lib/kms: Add nuclear pageflip commit style
In reply to Matt RoperThis commit style only covers the "nuclear pageflip" subset of the atomic API (i.e., single CRTC, plane updates only). In the future when our kernel driver has full atomic modeset support, we'll add another commit style 'atomic' which will re-use the same plane commit calls added here, but will generate and commit property sets in the display's commit handler rather than the output's commit handler.
Since nuclear pageflip (and full atomic eventually) depend on very new (currently unreleased) libdrm, use autoconf to check for support so that we can still run with just legacy + universal styles when built with older libdrm's.
--- configure.ac | 3 ++ lib/igt_kms.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- lib/igt_kms.h | 19 ++++++- 3 files changed, 181 insertions(+), 10 deletions(-)
configure.ac +3 -0
@@ -87,6 +87,9 @@ PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10]) PKG_CHECK_MODULES(OVERLAY_XVLIB, [xv x11 xext dri2proto >= 2.6], enable_overlay_xvlib=yes, enable_overlay_xvlib=no) PKG_CHECK_MODULES(OVERLAY_XLIB, [cairo-xlib dri2proto >= 2.6], enable_overlay_xlib=yes, enable_overlay_xlib=no) +# Check for atomic modeset support in libdrm +AC_CHECK_LIB(drm, drmModePropertySetCommit, AC_DEFINE(HAVE_ATOMIC, [], [Atomic modeset supported])) + AM_CONDITIONAL(BUILD_OVERLAY_XVLIB, [test "x$enable_overlay_xvlib" = xyes]) AM_CONDITIONAL(BUILD_OVERLAY_XLIB, [test "x$enable_overlay_xlib" = xyes]) AM_CONDITIONAL(BUILD_OVERLAY, [test "x$enable_overlay_xlib" = xyes -o "x$enable_overlay_xvlib"])
lib/igt_kms.c +160 -9
234 lines not on this page · raw message
lib/igt_kms.h +18 -1
@@ -154,7 +154,8 @@ void kmstest_unset_all_crtcs(int drm_fd, drmModeResPtr resources);enum igt_commit_style {COMMIT_LEGACY =0 ,COMMIT_UNIVERSAL , -/* We'll add atomic here eventually. */ +COMMIT_NUCLEAR ,/* atomic plane operations on single crtc only */ +/* We'll add full atomic here eventually. */ };typedef struct igt_display igt_display_t ;
@@ -189,6 +190,16 @@ typedef struct {struct igt_fb *fb;uint32_t rotation_property; +uint32_t fb_property; +uint32_t crtc_property; +uint32_t dstx_property; +uint32_t dsty_property; +uint32_t dstw_property; +uint32_t dsth_property; +uint32_t srcx_property; +uint32_t srcy_property; +uint32_t srcw_property; +uint32_t srch_property;/* position within pipe_src_w x pipe_src_h */ int crtc_x, crtc_y;
@@ -216,6 +227,11 @@ typedef struct {char *name;bool valid;unsigned long pending_crtc_idx_mask; + +#ifdef HAVE_ATOMIC +/* Property set for nuclear pageflip */ +drmModePropertySetPtr set; +#endif } igt_output_t;struct igt_display {
@@ -227,6 +243,7 @@ struct igt_display {igt_output_t *outputs;igt_pipe_t pipes[I915_MAX_PIPES ];bool has_universal_planes; +bool has_atomic_props; };void igt_display_init (igt_display_t *display,int drm_fd);
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 2/3] lib/kms: Add nuclear pageflip commit style
Quoted 18 lines · Matt Roper
This commit style only covers the "nuclear pageflip" subset of the atomic API (i.e., single CRTC, plane updates only). In the future when our kernel driver has full atomic modeset support, we'll add another commit style 'atomic' which will re-use the same plane commit calls added here, but will generate and commit property sets in the display's commit handler rather than the output's commit handler.
Since nuclear pageflip (and full atomic eventually) depend on very new (currently unreleased) libdrm, use autoconf to check for support so that we can still run with just legacy + universal styles when built with older libdrm's.
Signed-off-by Matt Roper <[email protected]>--- configure.ac | 3 ++ lib/igt_kms.c | 169 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- lib/igt_kms.h | 19 ++++++- 3 files changed, 181 insertions(+), 10 deletions(-)
[...]
Quoted 4 lines
lib/igt_kms.h +0
-0
[...]
lib/igt_kms.h typedef struct { · line 235
Quoted 10 lines
lib/igt_kms.h +5
-0@@ -216,6 +227,11 @@ typedef struct {char *name;bool valid;unsigned long pending_crtc_idx_mask; + +#ifdef HAVE_ATOMIC +/* Property set for nuclear pageflip */ +drmModePropertySetPtr set; +#endif } igt_output_t;
Need to include config.h in the header file, otherwise code that depends on the size of igt_output_t on the tests might do the wrong thing.
Ander
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 tests: Introduce kms_nuclear
In reply to Matt RoperA very simple testcase to exercise nuclear pageflip. We'll definitely want to expand upon this in the future, but this is a good starting point to sanity check nuclear pageflip support.
--- tests/Makefile.sources | 1 + tests/kms_nuclear.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 319 insertions(+) create mode 100644 tests/kms_nuclear.c
tests/Makefile.sources +1 -0
@@ -70,6 +70,7 @@ TESTS_progs_M = \ kms_flip_event_leak \ kms_flip_tiling \ kms_mmio_vs_cs_flip \ + kms_nuclear \ kms_pipe_crc_basic \ kms_plane \ kms_psr_sink_crc \
tests/kms_nuclear.c new file +318 -0
318 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH i-g-t 3/3] tests: Introduce kms_nuclear
Quoted 3 lines · Matt Roper
A very simple testcase to exercise nuclear pageflip. We'll definitely want to expand upon this in the future, but this is a good starting point to sanity check nuclear pageflip support.
Just a few comments from an i-g-t perspective: could you add a short description of the test using IGT_TEST_DESCRIPTION and also add the binary to .gitignore?
Quoted 329 lines
Signed-off-by Matt Roper <[email protected]>--- tests/Makefile.sources | 1 + tests/kms_nuclear.c | 318 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 319 insertions(+) create mode 100644 tests/kms_nuclear.ctests/Makefile.sources +1
-0@@ -70,6 +70,7 @@ TESTS_progs_M = \ kms_flip_event_leak \ kms_flip_tiling \ kms_mmio_vs_cs_flip \ + kms_nuclear \ kms_pipe_crc_basic \ kms_plane \ kms_psr_sink_crc \tests/kms_nuclear.c new file +303
-0@@ -0,0 +1,318 @@ +/* +* Copyright © 2015 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 ; + +typedef struct { +data_t *data; +igt_pipe_crc_t *pipe_crc; +igt_crc_t crc_1, crc_2, crc_3, crc_4, crc_5, crc_6, crc_7, crc_8, + crc_9, crc_10; +struct igt_fb red_fb, blue_fb, black_fb, yellow_fb; +drmModeModeInfo *mode; +}functional_test_t ; + +typedef struct { +data_t *data; +drmModeResPtr moderes; +struct igt_fb blue_fb, oversized_fb, undersized_fb; +}sanity_test_t ; + +typedef struct { +data_t *data; +struct igt_fb red_fb, blue_fb; +}pageflip_test_t ; + +static void +functional_test_init (functional_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); + + test->mode = mode; +} + +static void +functional_test_fini (functional_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_output_set_pipe (output,PIPE_ANY ); +igt_display_commit2 (&test->data->display,COMMIT_LEGACY ); +} + +/* +* Nuclear pageflip functional 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) +* - Yellow primary, no sprite +* - Disable CRTC +* - Program red sprite (while CRTC off) +* - Program blue primary (while CRTC off) +* - Enable CRTC, grab CRC:6 (should be same as CRC:2) +*/ +static void +functional_test_pipe (data_t *data,enum pipe pipe,igt_output_t *output) +{ +functional_test_t test = { .data = data }; +igt_display_t *display = &data->display; +igt_plane_t *primary, *sprite; + +igt_skip_on (pipe >= display->n_pipes); + +igt_info ("Testing connector %s using pipe %s\n" ,igt_output_name (output), +kmstest_pipe_name (pipe)); + +functional_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) { +functional_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_commit2 (display,COMMIT_LEGACY ); +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_commit2 (display,COMMIT_LEGACY ); +igt_pipe_crc_collect_crc (test.pipe_crc, &test.crc_2); + +/* Step 3: Legacy API's, yellow primary (CRC 3) */ +igt_plane_set_fb (primary, &test.yellow_fb); +igt_display_commit2 (display,COMMIT_LEGACY ); +igt_pipe_crc_collect_crc (test.pipe_crc, &test.crc_3); + +/* Step 4: Nuclear pageflip, blue primary, red sprite (CRC 4) */ +igt_plane_set_fb (primary, &test.blue_fb); +igt_plane_set_fb (sprite, &test.red_fb); +igt_display_commit2 (display,COMMIT_NUCLEAR ); +igt_pipe_crc_collect_crc (test.pipe_crc, &test.crc_4); + +/* Step 5: Nuclear pageflip, disable primary plane (CRC 5) */ +igt_plane_set_fb (primary,NULL ); +igt_display_commit2 (display,COMMIT_NUCLEAR ); +igt_pipe_crc_collect_crc (test.pipe_crc, &test.crc_5); + +/* Step 6: Nuclear pageflip, re-enable primary with blue (CRC 6) */ +igt_plane_set_fb (primary, &test.blue_fb); +igt_display_commit2 (display,COMMIT_NUCLEAR ); +igt_pipe_crc_collect_crc (test.pipe_crc, &test.crc_6); + +/* Step 7: Disable CRTC */ +igt_plane_set_fb (primary,NULL ); +igt_display_commit2 (display,COMMIT_LEGACY ); + +/* Blue bg + red sprite should be same under both types of API's */ +igt_assert (igt_crc_equal (&test.crc_2, &test.crc_4)); + +/* Disabling primary plane should be same as black primary */ +igt_assert (igt_crc_equal (&test.crc_1, &test.crc_5)); + +/* Re-enabling primary should return to blue properly */ +igt_assert (igt_crc_equal (&test.crc_2, &test.crc_6)); + +igt_plane_set_fb (primary,NULL ); +igt_plane_set_fb (sprite,NULL ); + +functional_test_fini (&test, output); +} + +static void +sanity_test_init (sanity_test_t *test,igt_output_t *output,enum pipe pipe) +{ +data_t *data = test->data; +drmModeModeInfo *mode; + +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 ,1.0 , + &test->blue_fb); +igt_create_color_fb (data->drm_fd, + mode->hdisplay +100 , mode->vdisplay +100 , +DRM_FORMAT_XRGB8888 , + false,/* tiled */ +0.0 ,0.0 ,1.0 , + &test->oversized_fb); +igt_create_color_fb (data->drm_fd, + mode->hdisplay -100 , mode->vdisplay -100 , +DRM_FORMAT_XRGB8888 , + false,/* tiled */ +0.0 ,0.0 ,1.0 , + &test->undersized_fb); + + test->moderes =drmModeGetResources (data->drm_fd); +} + +static void +sanity_test_fini (sanity_test_t *test,igt_output_t *output) +{ +drmModeFreeResources (test->moderes); + +igt_remove_fb (test->data->drm_fd, &test->oversized_fb); +igt_remove_fb (test->data->drm_fd, &test->undersized_fb); +igt_remove_fb (test->data->drm_fd, &test->blue_fb); + +igt_output_set_pipe (output,PIPE_ANY ); +igt_display_commit2 (&test->data->display,COMMIT_LEGACY ); +} + +static void +sanity_test_pipe (data_t *data,enum pipe pipe,igt_output_t *output) +{ +sanity_test_t test = { .data = data }; +igt_plane_t *primary; +int ret =0 ; + +igt_output_set_pipe (output, pipe); + +sanity_test_init (&test, output, pipe); + + primary =igt_output_get_plane (output,IGT_PLANE_PRIMARY ); + +/* Use legacy API to set a mode with a blue FB */ +igt_plane_set_fb (primary, &test.blue_fb); +igt_display_commit2 (&data->display,COMMIT_LEGACY ); + +/* +* Try to use nuclear pageflip API to set primary plane that +* doesn't cover CRTC (should fail). +*/ +igt_plane_set_fb (primary, &test.undersized_fb); + ret =igt_display_try_commit2 (&data->display,COMMIT_NUCLEAR ); +igt_assert (ret == -EINVAL ); + +/* Same as above, but different plane positioning. */ +igt_plane_set_position (primary,100 ,100 ); + ret =igt_display_try_commit2 (&data->display,COMMIT_NUCLEAR ); +igt_assert (ret == -EINVAL ); + +igt_plane_set_position (primary,0 ,0 ); +igt_plane_set_fb (primary,NULL ); +sanity_test_fini (&test, output); +} + +static void +run_tests_for_pipe (data_t *data,enum pipe pipe) +{ +igt_output_t *output; + +igt_subtest_f ("nuclear-pageflip-pipe-%s-functional" , + kmstest_pipe_name(pipe)) +for_each_connected_output (&data->display, output) +functional_test_pipe (data, pipe, output); + +igt_subtest_f ("nuclear-pageflip-pipe-%s-sanity" , + kmstest_pipe_name(pipe)) +for_each_connected_output (&data->display, output) +sanity_test_pipe (data, pipe, output); +} + +static data_t data; + +igt_main +{ +int num_pipes; + +igt_skip_on_simulation (); + + igt_fixture { + data.drm_fd =drm_open_any_master (); + +kmstest_set_vt_graphics_mode (); +
tests/kms_nuclear.c line 313
Quoted 10 lines
tests/kms_nuclear.c new file +10
-0+igt_require_pipe_crc (); +igt_display_init (&data.display, data.drm_fd); + +igt_require (data.display.has_universal_planes); +igt_require (data.display.has_atomic_props); + } + + num_pipes =igt_display_get_n_pipes (&data.display); +for (int pipe =0 ; pipe < num_pipes; pipe++) +run_tests_for_pipe (&data, pipe);
Using data.display here means that --list-subtests doesn't list any subtests. The igt_fixture blocks (and the subtests themselves) are not run when enumerating subtests, which means data.display is not initialised.
Quoted 8 lines
tests/kms_nuclear.c new file +5
-1+ + igt_fixture { +igt_display_fini (&data.display); + } +} --1.8.5.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 tests: Introduce kms_nuclear (v2)
A very simple testcase to exercise nuclear pageflip. We'll definitely want to expand upon this in the future, but this is a good starting point to sanity check nuclear pageflip support.
v2:
- Add IGT_TEST_DESCRIPTION() (Thomas Wood)
- Don't use fixture-generated pipe number for main loop since this will prevent proper test enumeration. Just assume three pipes for the main loop and skip inside the tests if we have fewer. (Thomas Wood)
- Add to .gitignore (Thomas Wood)
--- tests/.gitignore | 1 + tests/Makefile.sources | 1 + tests/kms_nuclear.c | 320 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 322 insertions(+) create mode 100644 tests/kms_nuclear.c
tests/.gitignore +1 -0
@@ -128,6 +128,7 @@ kms_flip_event_leak kms_flip_tiling kms_force_connector kms_mmio_vs_cs_flip +kms_nuclear kms_pipe_crc_basic kms_plane kms_psr_sink_crc
tests/Makefile.sources +1 -0
@@ -70,6 +70,7 @@ TESTS_progs_M = \ kms_flip_event_leak \ kms_flip_tiling \ kms_mmio_vs_cs_flip \ + kms_nuclear \ kms_pipe_crc_basic \ kms_plane \ kms_psr_sink_crc \
tests/kms_nuclear.c new file +320 -0
320 lines not on this page · raw message
Signature · 6 lines
1.8.5.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx