1 .. _vkms: 1 .. _vkms: 2 2 3 ========================================== 3 ========================================== 4 drm/vkms Virtual Kernel Modesetting 4 drm/vkms Virtual Kernel Modesetting 5 ========================================== 5 ========================================== 6 6 7 .. kernel-doc:: drivers/gpu/drm/vkms/vkms_drv. 7 .. kernel-doc:: drivers/gpu/drm/vkms/vkms_drv.c 8 :doc: vkms (Virtual Kernel Modesetting) 8 :doc: vkms (Virtual Kernel Modesetting) 9 9 10 Setup 10 Setup 11 ===== 11 ===== 12 12 13 The VKMS driver can be setup with the followin 13 The VKMS driver can be setup with the following steps: 14 14 15 To check if VKMS is loaded, run:: 15 To check if VKMS is loaded, run:: 16 16 17 lsmod | grep vkms 17 lsmod | grep vkms 18 18 19 This should list the VKMS driver. If no output 19 This should list the VKMS driver. If no output is obtained, then 20 you need to enable and/or load the VKMS driver 20 you need to enable and/or load the VKMS driver. 21 Ensure that the VKMS driver has been set as a 21 Ensure that the VKMS driver has been set as a loadable module in your 22 kernel config file. Do:: 22 kernel config file. Do:: 23 23 24 make nconfig 24 make nconfig 25 25 26 Go to `Device Drivers> Graphics support` 26 Go to `Device Drivers> Graphics support` 27 27 28 Enable `Virtual KMS (EXPERIMENTAL)` 28 Enable `Virtual KMS (EXPERIMENTAL)` 29 29 30 Compile and build the kernel for the changes t 30 Compile and build the kernel for the changes to get reflected. 31 Now, to load the driver, use:: 31 Now, to load the driver, use:: 32 32 33 sudo modprobe vkms 33 sudo modprobe vkms 34 34 35 On running the lsmod command now, the VKMS dri 35 On running the lsmod command now, the VKMS driver will appear listed. 36 You can also observe the driver being loaded i 36 You can also observe the driver being loaded in the dmesg logs. 37 37 38 The VKMS driver has optional features to simul 38 The VKMS driver has optional features to simulate different kinds of hardware, 39 which are exposed as module options. You can u 39 which are exposed as module options. You can use the `modinfo` command 40 to see the module options for vkms:: 40 to see the module options for vkms:: 41 41 42 modinfo vkms 42 modinfo vkms 43 43 44 Module options are helpful when testing, and e 44 Module options are helpful when testing, and enabling modules 45 can be done while loading vkms. For example, t 45 can be done while loading vkms. For example, to load vkms with cursor enabled, 46 use:: 46 use:: 47 47 48 sudo modprobe vkms enable_cursor=1 48 sudo modprobe vkms enable_cursor=1 49 49 50 To disable the driver, use :: 50 To disable the driver, use :: 51 51 52 sudo modprobe -r vkms 52 sudo modprobe -r vkms 53 53 54 Testing With IGT 54 Testing With IGT 55 ================ 55 ================ 56 56 57 The IGT GPU Tools is a test suite used specifi 57 The IGT GPU Tools is a test suite used specifically for debugging and 58 development of the DRM drivers. 58 development of the DRM drivers. 59 The IGT Tools can be installed from 59 The IGT Tools can be installed from 60 `here <https://gitlab.freedesktop.org/drm/igt- 60 `here <https://gitlab.freedesktop.org/drm/igt-gpu-tools>`_ . 61 61 62 The tests need to be run without a compositor, 62 The tests need to be run without a compositor, so you need to switch to text 63 only mode. You can do this by:: 63 only mode. You can do this by:: 64 64 65 sudo systemctl isolate multi-user.target 65 sudo systemctl isolate multi-user.target 66 66 67 To return to graphical mode, do:: 67 To return to graphical mode, do:: 68 68 69 sudo systemctl isolate graphical.target 69 sudo systemctl isolate graphical.target 70 70 71 Once you are in text only mode, you can run te 71 Once you are in text only mode, you can run tests using the --device switch 72 or IGT_DEVICE variable to specify the device f 72 or IGT_DEVICE variable to specify the device filter for the driver we want 73 to test. IGT_DEVICE can also be used with the 73 to test. IGT_DEVICE can also be used with the run-test.sh script to run the 74 tests for a specific driver:: 74 tests for a specific driver:: 75 75 76 sudo ./build/tests/<name of test> --device " 76 sudo ./build/tests/<name of test> --device "sys:/sys/devices/platform/vkms" 77 sudo IGT_DEVICE="sys:/sys/devices/platform/v 77 sudo IGT_DEVICE="sys:/sys/devices/platform/vkms" ./build/tests/<name of test> 78 sudo IGT_DEVICE="sys:/sys/devices/platform/v 78 sudo IGT_DEVICE="sys:/sys/devices/platform/vkms" ./scripts/run-tests.sh -t <name of test> 79 79 80 For example, to test the functionality of the 80 For example, to test the functionality of the writeback library, 81 we can run the kms_writeback test:: 81 we can run the kms_writeback test:: 82 82 83 sudo ./build/tests/kms_writeback --device "s 83 sudo ./build/tests/kms_writeback --device "sys:/sys/devices/platform/vkms" 84 sudo IGT_DEVICE="sys:/sys/devices/platform/v 84 sudo IGT_DEVICE="sys:/sys/devices/platform/vkms" ./build/tests/kms_writeback 85 sudo IGT_DEVICE="sys:/sys/devices/platform/v 85 sudo IGT_DEVICE="sys:/sys/devices/platform/vkms" ./scripts/run-tests.sh -t kms_writeback 86 86 87 You can also run subtests if you do not want t 87 You can also run subtests if you do not want to run the entire test:: 88 88 89 sudo ./build/tests/kms_flip --run-subtest ba 89 sudo ./build/tests/kms_flip --run-subtest basic-plain-flip --device "sys:/sys/devices/platform/vkms" 90 sudo IGT_DEVICE="sys:/sys/devices/platform/v 90 sudo IGT_DEVICE="sys:/sys/devices/platform/vkms" ./build/tests/kms_flip --run-subtest basic-plain-flip 91 91 92 TODO 92 TODO 93 ==== 93 ==== 94 94 95 If you want to do any of the items listed belo 95 If you want to do any of the items listed below, please share your interest 96 with VKMS maintainers. 96 with VKMS maintainers. 97 97 98 IGT better support 98 IGT better support 99 ------------------ 99 ------------------ 100 100 101 Debugging: 101 Debugging: 102 102 103 - kms_plane: some test cases are failing due t 103 - kms_plane: some test cases are failing due to timeout on capturing CRC; 104 104 105 Virtual hardware (vblank-less) mode: 105 Virtual hardware (vblank-less) mode: 106 106 107 - VKMS already has support for vblanks simulat 107 - VKMS already has support for vblanks simulated via hrtimers, which can be 108 tested with kms_flip test; in some way, we c 108 tested with kms_flip test; in some way, we can say that VKMS already mimics 109 the real hardware vblank. However, we also h 109 the real hardware vblank. However, we also have virtual hardware that does 110 not support vblank interrupt and completes p 110 not support vblank interrupt and completes page_flip events right away; in 111 this case, compositor developers may end up 111 this case, compositor developers may end up creating a busy loop on virtual 112 hardware. It would be useful to support Virt 112 hardware. It would be useful to support Virtual Hardware behavior in VKMS 113 because this can help compositor developers 113 because this can help compositor developers to test their features in 114 multiple scenarios. 114 multiple scenarios. 115 115 116 Add Plane Features 116 Add Plane Features 117 ------------------ 117 ------------------ 118 118 119 There's lots of plane features we could add su 119 There's lots of plane features we could add support for: 120 120 >> 121 - ARGB format on primary plane: blend the primary plane into background with >> 122 translucent alpha. >> 123 121 - Add background color KMS property[Good to ge 124 - Add background color KMS property[Good to get started]. 122 125 123 - Scaling. !! 126 - Full alpha blending on all planes. >> 127 >> 128 - Rotation, scaling. 124 129 125 - Additional buffer formats, especially YUV fo 130 - Additional buffer formats, especially YUV formats for video like NV12. 126 Low/high bpp RGB formats would also be inter 131 Low/high bpp RGB formats would also be interesting. 127 132 128 - Async updates (currently only possible on cu 133 - Async updates (currently only possible on cursor plane using the legacy 129 cursor api). 134 cursor api). 130 135 131 For all of these, we also want to review the i 136 For all of these, we also want to review the igt test coverage and make sure 132 all relevant igt testcases work on vkms. They 137 all relevant igt testcases work on vkms. They are good options for internship 133 project. 138 project. 134 139 135 Runtime Configuration 140 Runtime Configuration 136 --------------------- 141 --------------------- 137 142 138 We want to be able to reconfigure vkms instanc 143 We want to be able to reconfigure vkms instance without having to reload the 139 module. Use/Test-cases: 144 module. Use/Test-cases: 140 145 141 - Hotplug/hotremove connectors on the fly (to 146 - Hotplug/hotremove connectors on the fly (to be able to test DP MST handling 142 of compositors). 147 of compositors). 143 148 144 - Configure planes/crtcs/connectors (we'd need 149 - Configure planes/crtcs/connectors (we'd need some code to have more than 1 of 145 them first). 150 them first). 146 151 147 - Change output configuration: Plug/unplug scr 152 - Change output configuration: Plug/unplug screens, change EDID, allow changing 148 the refresh rate. 153 the refresh rate. 149 154 150 The currently proposed solution is to expose v 155 The currently proposed solution is to expose vkms configuration through 151 configfs. All existing module options should b 156 configfs. All existing module options should be supported through configfs 152 too. 157 too. 153 158 154 Writeback support 159 Writeback support 155 ----------------- 160 ----------------- 156 161 157 - The writeback and CRC capture operations sha 162 - The writeback and CRC capture operations share the use of composer_enabled 158 boolean to ensure vblanks. Probably, when th 163 boolean to ensure vblanks. Probably, when these operations work together, 159 composer_enabled needs to refcounting the co 164 composer_enabled needs to refcounting the composer state to proper work. 160 [Good to get started] 165 [Good to get started] 161 166 162 - Add support for cloned writeback outputs and 167 - Add support for cloned writeback outputs and related test cases using a 163 cloned output in the IGT kms_writeback. 168 cloned output in the IGT kms_writeback. 164 169 165 - As a v4l device. This is useful for debuggin 170 - As a v4l device. This is useful for debugging compositors on special vkms 166 configurations, so that developers see what' 171 configurations, so that developers see what's really going on. 167 172 168 Output Features 173 Output Features 169 --------------- 174 --------------- 170 175 171 - Variable refresh rate/freesync support. This 176 - Variable refresh rate/freesync support. This probably needs prime buffer 172 sharing support, so that we can use vgem fen 177 sharing support, so that we can use vgem fences to simulate rendering in 173 testing. Also needs support to specify the E 178 testing. Also needs support to specify the EDID. 174 179 175 - Add support for link status, so that composi 180 - Add support for link status, so that compositors can validate their runtime 176 fallbacks when e.g. a Display Port link goes 181 fallbacks when e.g. a Display Port link goes bad. 177 182 178 CRC API Improvements 183 CRC API Improvements 179 -------------------- 184 -------------------- 180 185 181 - Optimize CRC computation ``compute_crc()`` a 186 - Optimize CRC computation ``compute_crc()`` and plane blending ``blend()`` 182 187 183 Atomic Check using eBPF 188 Atomic Check using eBPF 184 ----------------------- 189 ----------------------- 185 190 186 Atomic drivers have lots of restrictions which 191 Atomic drivers have lots of restrictions which are not exposed to userspace in 187 any explicit form through e.g. possible proper 192 any explicit form through e.g. possible property values. Userspace can only 188 inquiry about these limits through the atomic 193 inquiry about these limits through the atomic IOCTL, possibly using the 189 TEST_ONLY flag. Trying to add configurable cod 194 TEST_ONLY flag. Trying to add configurable code for all these limits, to allow 190 compositors to be tested against them, would b 195 compositors to be tested against them, would be rather futile exercise. Instead 191 we could add support for eBPF to validate any 196 we could add support for eBPF to validate any kind of atomic state, and 192 implement a library of different restrictions. 197 implement a library of different restrictions. 193 198 194 This needs a bunch of features (plane composit 199 This needs a bunch of features (plane compositing, multiple outputs, ...) 195 enabled already to make sense. 200 enabled already to make sense.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.