{{Short description|Operation that activates display mode in a computer}} thumb|300px|Regulating access to the hardware is a fundamental kernel task. The Direct Rendering Manager and '''KMS''' are part of the Linux kernel. The KMS does only the mode setting.
'''Mode setting''' is a software operation that activates a display mode (screen resolution, color depth, and refresh rate) for a computer's display controller by using VESA BIOS Extensions or UEFI Graphics extensions (on more modern computers).
The display mode is set by the kernel. In ''user-space mode-setting'' (UMS), the display mode is set by a user-space process.
Kernel mode-setting is more flexible and allows displaying of an error in the case of a fatal system error in the kernel, even when using a user-space display server.
User-space mode setting would require superuser privileges for direct hardware access, so kernel-based mode setting shuns such requirement for the user-space graphics server.
On the hardware side, the GPU consists of multiple components, among which are ''render engine'', i.e. the component of the GPU responsible for executing OpenGL/Vulkan commands, and the ''display engine'', i.e. the component of the GPU responsible for sending a "video stream" to the screen, as opposed to the part performing rendering.<ref name="Simon Ser"/>
To improve performance, many GPUs come with a feature called hardware planes. Planes can make the display engine perform the composition. This is called ''direct scan-out'' and allows the compositor to avoid copying entirely. libliftoff is a library making better use of such hardware ability.<ref name="Simon Ser">{{cite web |last1=Ser |first1=Simon |title=XDC 2019 wrap-up · emersion |url=https://emersion.fr/blog/2019/xdc2019-wrap-up/ |website=emersion.fr |access-date=14 November 2025 |date=10 October 2019}}{{Creative Commons text attribution notice|cc=by4|from this source=yes}}</ref>
== Implementation ==
For "old" cards, support might change from distribution to distribution according to random criteria without apparent reason leaving the card unsupported.<ref>https://linux-hardware.org/index.php?id=pci:8086-9bc8-1043-8694</ref>
=== Microsoft Windows === Microsoft Windows versions that are NT-based use kernel mode setting. The kernel error display made possible by kernel mode setting is officially called "bug check", but more commonly known as the Blue Screen of Death.
=== Linux ===
{{Multiple image | align = right | direction = vertical | header = The role of KMS (Kernel mode-setting), Linux example | image1 = Linux Graphics Stack 2013.svg | alt1 = The Linux Graphics Stack 2013 | caption1 = Wayland compositors require KMS (and also OpenGL ES and EGL) | image2 = Free and open-source-software display servers and UI toolkits.svg | alt2 = The place of certain Linux kernel modules | caption2 = evdev was the Linux kernel module that receives data from various Input devices such as Keyboard, Mouse, Touch-Pad, etc. Nowadays, this is the libinput module (for X and Wayland). The data is passed to the Display server (e.g. the X.Org Server or some Wayland compositor only to be passed further to the Wayland client respectively X client. Some applications require minimal latency. }} {{Main article|Direct Rendering Manager}} {{anchor|Linux}} <!-- Try anchor. Previous section should not be top of p. -->
The Linux kernel got the prerequisite for kernel-based mode setting by accepting Intel GEM in version 2.6.28, released in December 2008.<ref name="kernelnewbies-1"/> This will be{{Update after|2014|08|11|reason=hasn't this already happened?}} replaced by Tungstens Graphics TTM (Translation Table Maps) memory manager which supports the GEM API.<ref name="Larabel-1"/> TTM was developed for the free and open-source drivers for Radeon and S3 Graphics graphic chipsets (''see Free and open-source graphics device driver'').<ref name="Larabel-2"/> Support for Intel GMA graphic chipsets was accepted in version 2.6.29, released on March 23, 2009.<ref name="kernelnewbies-2"/> Support for pre-R600 ATI Radeon graphics cards was accepted in version 2.6.31, released on September 9, 2009.<ref name="kernelnewbies-3"/> Support for R600 and R700 was in development within DRM and was merged in version 2.6.32.<ref name="Larabel-3"/> Support for Evergreen (R800) was merged in version 2.6.34. As Nvidia did not release all the needed documentation for its graphics chip, development proceeded under the nouveau project, which uses reverse engineering to build a working open-source driver for Nvidia cards. Nouveau was accepted in version 2.6.33 of the kernel, released on December 10, 2009. Kernel-based mode setting is not only supported by the nouveau driver, it is required.<ref name="freedesktop-nouveau" /> Wayland compositors (e.g. Weston) and kmscon depend on kernel mode setting via ioctl.
=== FreeBSD === FreeBSD has support for both kernel-based mode setting and GEM for later generations of Intel GPUs (IronLake, SandyBridge, and IvyBridge) starting with version 9.1.<ref name="FreeBSD"/>
Support of Intel card is limited. Some random Intel cards such as Device 'Intel CometLake-S GT2 [UHD Graphics 630]' does not work with FreeBSD.<ref>https://bsd-hardware.info/?id=pci:8086-9bc8</ref> Some cards where driver is supported but not supported actively and does not work suffer such kind of issues.<ref>https://dgpu-docs.intel.com/devices/hardware-table.html#gpus-with-unsupported-drivers</ref>
=== NetBSD === NetBSD has support for kernel-based mode setting and accelerated graphics for Intel and Radeon devices. This implementation was introduced in version 7.0 by porting the Linux 3.15 DRM/KMS code.<ref name="NetBSD"/>
=== OpenBSD === OpenBSD has kernel-based mode setting support for Intel and Radeon GPUs. Starting with version 5.4 of OpenBSD, support for Intel GPUs is available. With the release of version 5.5, the implementation has been extended to add support for Radeon chipsets as well.
== Alternatives == {{Update|section|date=August 2014}} The following alternatives have been presented during the Linux Plumbers Conference 2013: * It was suggested to split GEM and KMS.<ref>{{cite web |url=http://www.linuxplumbersconf.org/2013/ocw/sessions/1107 |title=Splitting DRM/KMS device nodes / Linux Plumbers Conference: Developing the Kernel, Libraries and Utilities |website=www.linuxplumbersconf.org |url-status=dead |archive-url=https://web.archive.org/web/20131030181540/http://www.linuxplumbersconf.org/2013/ocw/sessions/1107 |archive-date=2013-10-30}} </ref> * Atomic Display Framework, by Google's Android-Team.<ref>{{Cite web|url=http://www.linuxplumbersconf.org/2013/ocw/proposals/1551|title = Atomic Display Framework / Linux Plumbers Conference: Developing the Kernel, Libraries and Utilities}}</ref><ref>{{Cite web |url=http://www.linuxplumbersconf.org/2013/ocw/sessions/1467 |title=KMS HWComposer issues, the Atomic Display Framework and other KMS {{sic|nolink=y|reason=error in source|Extentions}} / Linux Plumbers Conference: Developing the Kernel, Libraries and Utilities |access-date=2013-08-29 |archive-date=2015-08-31 |archive-url=https://web.archive.org/web/20150831010218/http://www.linuxplumbersconf.org/2013/ocw/sessions/1467 |url-status=dead }}</ref> * Common Display Framework.<ref>{{cite web |url=http://www.linuxplumbersconf.org/2013/ocw/sessions/1317 |title=Common Display Framework / Linux Plumbers Conference: Developing the Kernel, Libraries and Utilities |website=www.linuxplumbersconf.org |url-status=dead |archive-url=https://web.archive.org/web/20160312020747/http://www.linuxplumbersconf.org/2013/ocw/sessions/1317 |archive-date=2016-03-12}} </ref>
== See also == * Screens of death
== References == {{Reflist|refs= <ref name="kernelnewbies-1">{{ cite web | url = http://kernelnewbies.org/Linux_2_6_28#head-b957b19f6139b6bbbfabaf790bf643b1746985d6 | title = Linux 2 6 28 | publisher = Linux Kernel Newbies |date = | accessdate = 2013-02-14 }}</ref> <ref name="Larabel-1">{{ cite web | url = https://www.phoronix.com/scan.php?page=news_item&px=NjY3Ng | title = A GEM-ified TTM Manager For Radeon | first = Michael | last = Larabel | publisher = Phoronix | date = 2008-08-26 | accessdate = 2013-02-14 }}</ref> <ref name="Larabel-2">{{ cite web | url = https://www.phoronix.com/scan.php?page=news_item&px=NzMxOA | title = TTM Memory Manager Gets Ready For Release | first = Michael | last = Larabel | publisher = Phoronix | date = 2009-06-10 | accessdate = 2013-02-14 }}</ref> <ref name="kernelnewbies-2">{{ cite web | url = http://kernelnewbies.org/Linux_2_6_29#head-e1bab8dc862e3b477cc38d87e8ddc779a66509d1 | title = Linux 2 6 29 | publisher = Linux Kernel Newbies | date = | accessdate = 2013-02-14 }}</ref> <ref name="kernelnewbies-3">{{ cite web | url = http://kernelnewbies.org/Linux_2_6_31#head-78158343fc06e5e289f2ccaf51d6a30090a46524 | title = Linux 2 6 31 | publisher = Linux Kernel Newbies | date = 2009-09-09 | accessdate = 2013-02-14 }}</ref> <ref name="Larabel-3">{{ cite web | url = https://www.phoronix.com/scan.php?page=article&item=amd_r600_r700_2d | title = AMD R600/700 2D Performance: Open vs. Closed Drivers | first = Michael | last = Larabel | publisher = Phoronix | date = 2009-09-30 | accessdate = 2013-02-14 }}</ref> <ref name="FreeBSD">{{ cite web | title = FreeBSD 9.1-RELEASE Release Notes | url= http://www.freebsd.org/releases/9.1R/relnotes.html | date = 30 December 2012 | publisher = FreeBSD Foundation }}</ref> <ref name="NetBSD">{{ cite web | title = Announcing NetBSD 7.0 | url = https://netbsd.org/releases/formal-7/NetBSD-7.0.html | date = 25 September 2015 | publisher = The NetBSD Project | accessdate = 25 April 2016 }}</ref> <ref name="freedesktop-nouveau">{{ cite web | url=http://nouveau.freedesktop.org/wiki/KernelModeSetting/ | title=nouveau/ KernelModeSetting | publisher=freedesktop.org | date=24 August 2013 | accessdate=2014-08-11 }}</ref> <!-- Hide unnamed refs, kept here for completeness --> <!-- ref name="Larabel-4">{{ cite web | url = https://www.phoronix.com/scan.php?page=news_item&px=NzA5Mg | title = Gallium3D, EGL Now Buildable On FreeBSD | first = Michael | last = Larabel | date = February 25, 2009 | accessdate = 2013-02-14 | publisher = Phoronix }}</ref> --> <!-- ref name="Larabel-5">{{ cite web | url = https://www.phoronix.com/scan.php?page=news_item&px=MTMzMDA | title = Intel KMS/DRM Driver Readied For OpenBSD | first = Michael | last = Larabel | date = March 18, 2013 | accessdate = 2013-04-03 | publisher = Phoronix }}</ref> End of hide --> }}
== External links == * [http://www.x.org/wiki/ModeSetting Mode Setting] on the X.org wiki * [http://www.x.org/wiki/IntelGraphicsDriver Intel Graphics Driver] on the X.org wiki * [http://www.x.org/wiki/RadeonFeature ATI Radeon driver] on the X.org wiki * [http://fedoraproject.org/wiki/Features/KernelModesetting Kernel Mode Setting] on the Fedora project wiki
Category:Device drivers Category:Graphics hardware Category:Operating system technology