[Intel-gfx] Modeset API for KMS tests
Damien Lespiau
damien.lespiau at intel.com
Fri Feb 7 15:48:44 CET 2014
The goal of that series is to introduce a small mode setting API to write our
KMS tests, port kms_pipe_crc_basic and kms_cursor_crc to it and introduce a
new kms_plane test. To be more precise, the goals are:
- Fewer lines per test,
- Be able to switch between a "legacy" backend and an "atomic" one to help
landing the latter (still has to be written).
- Have a convenience place to put common KMS facilities and testing
Here an example of the look and feel of the API:
igt_display_t display;
igt_output_t output;
igt_display_init(&display);
for_each_connected_output(&display, output) {
drmModeModeInfo *mode;
struct kmstest_fb green_fb;
igt_plane_t *primary;
/*
* Create a green fb and display it on the primary plane
*/
mode = igt_output_get_mode(output);
kmstest_create_color_fb(drm_fd,
mode->hdisplay, mode->vdisplay,
DRM_FORMAT_XRGB8888,
false, /* tiled */
0.0, 1.0, 0.0,
&green_fb);
igt_output_set_pipe(output, PIPE_B);
primary = igt_ouput_get_plane(output, 0);
igt_plane_set_fb(primary, &green_fb);
}
/* commit the display configuration */
igt_display_commit(&display);
igt_display_fini(&display);
A few interesting things about that API:
- It exposes primary and cursor planes as igt_plane_t
- It's possible to grab a debug output by defining IGT_DISPLAY_VERBOSE.
This gives something like:
display: A.0: plane_set_fb(32)
display: A.2: plane_set_fb(33)
display: A.2: plane_set_position(132,132)
display: commit {
display: LVDS-1: Selecting pipe A
display: LVDS-1: SetCrtc pipe A, fb 32, panning (0, 0), mode 1366x768
display: LVDS-1: SetCursor pipe A, fb 2 64x64
display: LVDS-1: MoveCursor pipe A, (132, 132)
display: }
- It's possible to stop at every commit() to inspect what is displayed,
waiting for keypress with IGT_DISPLAY_WAIT_AT_COMMIT=1
For instance, one can run:
$ sudo IGT_DISPLAY_VERBOSE=1 IGT_DISPLAY_WAIT_AT_COMMIT=1 ./tests/kms_plane --run-subtest plane-position-hole-pipe-A-plane-2
HTH,
--
Damien
More information about the Intel-gfx
mailing list