Difference between revisions of "R-Car/Tests:KMS"

From eLinux.org
Jump to: navigation, search
m (Uli moved page User:Uli/Tests:KMS to Tests:KMS)
m (Uli moved page Tests:KMS to R-Car/Tests:KMS)
(No difference)

Revision as of 05:09, 22 June 2016

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

  1. Check out kmsxx from https://github.com/tomba/kmsxx.git
  2. Check out the pybind11 submodule: git submodule update --init

Installing pybind11

  1. cd ext/pybind11
  2. python3 setup.py install
  3. cd ../..

Building kmsxx

  1. mkdir build && cd build && cmake ..
  2. make -j4

Using kmsxx with the Python bindings

Warning 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

Automated testing

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:

Testing connector VGA-1
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.