blob: feb43d7017ca9128fc59354a510aaa85f89f73d2 [file] [log] [blame] [view]
Tomi Valkeinen7785a212016-09-29 15:46:57 +03001[![Build Status](https://travis-ci.org/tomba/kmsxx.svg?branch=master)](https://travis-ci.org/tomba/kmsxx)
2
Tomi Valkeinen711a0b82016-06-11 20:37:17 +03003# kms++ - C++ library for kernel mode setting
Tomi Valkeinen6b04b302015-10-01 11:40:36 +03004
Tomi Valkeinen711a0b82016-06-11 20:37:17 +03005kms++ is a C++11 library for kernel mode setting.
Tomi Valkeinen6b04b302015-10-01 11:40:36 +03006
Tomi Valkeinen711a0b82016-06-11 20:37:17 +03007Also included are some simple utilities for KMS and python bindings for kms++.
Tomi Valkeinen6b04b302015-10-01 11:40:36 +03008
Tomi Valkeinendf77e4a2016-05-23 10:12:34 +03009## Utilities
Tomi Valkeinend8db8462015-11-30 15:33:11 +020010
Tomi Valkeinen86f3c442016-08-24 15:02:06 +030011- kmstest - set modes and planes and show test pattern on crtcs/planes, and test page flips
Tomi Valkeinend8db8462015-11-30 15:33:11 +020012- kmsprint - print information about DRM objects
Tomi Valkeinend8db8462015-11-30 15:33:11 +020013- kmsview - view raw images
Tomi Valkeinend8db8462015-11-30 15:33:11 +020014- kmscube - rotating 3D cube on crtcs/planes
Tomi Valkeinendf77e4a2016-05-23 10:12:34 +030015- kmscapture - show captured frames from a camera on screen
Tomi Valkeinend8db8462015-11-30 15:33:11 +020016
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030017## Dependencies:
18
19- libdrm
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030020- Python 3.x (for python bindings)
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030021
22## Build instructions:
23
Tomi Valkeinen5c21d852016-05-26 15:22:01 +030024To build the Python bindings you need to set up the git-submodule for pybind11:
25
26```
27git submodule update --init
28```
29
30And to compile:
31
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030032```
33$ mkdir build
34$ cd build
35$ cmake ..
36$ make -j4
37```
38
39## Cross compiling instructions:
40
Tomi Valkeinendf77e4a2016-05-23 10:12:34 +030041Directions for cross compiling depend on your environment.
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030042
Tomi Valkeinendf77e4a2016-05-23 10:12:34 +030043These are for mine with buildroot:
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030044
45```
Tomi Valkeinendf77e4a2016-05-23 10:12:34 +030046$ mkdir build
47$ cd build
48$ cmake -DCMAKE_TOOLCHAIN_FILE=<buildrootpath>/output/host/usr/share/buildroot/toolchainfile.cmake ..
49$ make -j4
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030050```
51
Tomi Valkeinenb6682002016-07-10 10:54:43 +030052Your environment may provide similar toolchainfile. If not, you can create a toolchainfile of your own, something along these lines:
53
54```
55SET(CMAKE_SYSTEM_NAME Linux)
56
57SET(BROOT "<buildroot>/output/")
58
59# specify the cross compiler
60SET(CMAKE_C_COMPILER ${BROOT}/host/usr/bin/arm-buildroot-linux-gnueabihf-gcc)
61SET(CMAKE_CXX_COMPILER ${BROOT}/host/usr/bin/arm-buildroot-linux-gnueabihf-g++)
62
63# where is the target environment
64SET(CMAKE_FIND_ROOT_PATH ${BROOT}/target ${BROOT}/host)
65
66SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
67SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
68SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
69```
70
Tomi Valkeinen6b04b302015-10-01 11:40:36 +030071## Build options
72
73You can use the following cmake flags to control the build. Use `-DFLAG=VALUE` to set them.
74
Alejandro Hernandez643d6782017-02-03 10:11:58 -050075Option name | Values | Default | Notes
76--------------------- | ------------- | --------------- | --------
77CMAKE_BUILD_TYPE | Release/Debug | Release |
78BUILD_SHARED_LIBS | ON/OFF | OFF |
79KMSXX_ENABLE_PYTHON | ON/OFF | ON |
80KMSXX_ENABLE_KMSCUBE | ON/OFF | OFF |
81KMSXX_PYTHON_VERSION | python3/python2 | python3;python2 | Name of the python pkgconfig file
Tomi Valkeinen894d6152015-10-22 10:21:03 +030082
83## Env variables
84
Tomi Valkeinen711a0b82016-06-11 20:37:17 +030085You can use the following runtime environmental variables to control the behavior of kms++.
Tomi Valkeinen894d6152015-10-22 10:21:03 +030086
87Variable | Description
88--------------------------------- | -------------
Tomi Valkeinen711a0b82016-06-11 20:37:17 +030089KMSXX_DISABLE_UNIVERSAL_PLANES | Set to disable the use of universal planes
90KMSXX_DISABLE_ATOMIC | Set to disable the use of atomic modesetting
Tomi Valkeinena5545df2019-07-30 11:27:37 +030091KMSXX_DEVICE | Path to the card device node to use
92KMSXX_DRIVER | Name of the driver to use. The format is either "drvname" or "drvname:idx"
Tomi Valkeinenf1123bf2017-01-27 11:07:02 +020093
94## Python notes
95
96You can run the python code directly from the build dir by defining PYTHONPATH env variable. For example:
97
98```
99PYTHONPATH=build/py py/tests/hpd.py
100
101```