This page describes how to use the kmsxx library and its Python bindings to test DRM/KMS drivers.
Setting up kmsxx
kmsxx has a number of dependencies:
- Python 3
- cmake (minimum version 2.8.11)
- a current build of libdrm; if your version is older than a couple of days, it is recommended to build a new one.
- a C++ compiler supporting C++11
Getting the source code
- Check out kmsxx from https://github.com/tomba/kmsxx
- Check out the pybind11 submodule:
git submodule update --init
mkdir build && cd build && cmake ..
For mode detailed instructions see the README.md file in https://github.com/tomba/kmsxx/blob/master/README.md.
Using kmsxx with the Python bindings
|Warning:||The Python bindings in mainline kmsxx are not complete. An more comprehensive set can be found here: https://github.com/uli/kmsxx/tree/topic-bindings|
It is now possible to access the driver API through kmsxx from Python:
# PYTHONPATH=build/py/:py/ python3 Python 3.4.2 (default, Oct 8 2014, 14:47:30) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pykms >>> card = pykms.Card() >>> conn = card.get_first_connected_connector() >>> crtc = conn.get_current_crtc() >>> crtc.mode.name '1024x768' [...]
A version of kmsxx that adds a handful of automated tests can be found here: https://github.com/uli/kmsxx/tree/autotest.
Invoke the test suite using
bash run_tests.sh. The output should look something like this:
aaa_sanity.py Testing connector VGA-1 PASS atomic_flip.py PASS atomic_set_plane.py FAIL atomic_small_dest.py PASS atomic_small_fb.py PASS fb_large.py PASS fb_small.py PASS mode_invalid.py PASS mode_reset.py PASS mode_set_all.py PASS 9 passed, 1 failed, 0 skipped
The test suite will exit with an error code if any tests have failed.
By default, tests are performed using the first available connector. It is possible to specify a different connector on the command line:
bash run_tests.sh 1, for instance, will use the second connector.