Commit 9a758d87 authored by Thomas Zimmermann's avatar Thomas Zimmermann

drm: Move nomodeset kernel parameter to drivers/video

Move the nomodeset kernel parameter to drivers/video to make it
available to non-DRM drivers. Adapt the interface, but keep the DRM
interface drm_firmware_drivers_only() to avoid churn within DRM. The
function should later be inlined into callers.

The parameter disables any DRM graphics driver that would replace a
driver for firmware-provided scanout buffers. It is an option to easily
fallback to basic graphics output if the hardware's native driver is
broken. Moving it to a more prominent location wil make it available
to fbdev as well.

v2:
	* clarify the meaning of the nomodeset parameter (Javier)
Signed-off-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221111133024.9897-2-tzimmermann@suse.de
parent 27c3e945
...@@ -3777,12 +3777,15 @@ ...@@ -3777,12 +3777,15 @@
shutdown the other cpus. Instead use the REBOOT_VECTOR shutdown the other cpus. Instead use the REBOOT_VECTOR
irq. irq.
nomodeset Disable kernel modesetting. DRM drivers will not perform nomodeset Disable kernel modesetting. Most systems' firmware
display-mode changes or accelerated rendering. Only the sets up a display mode and provides framebuffer memory
system framebuffer will be available for use if this was for output. With nomodeset, DRM and fbdev drivers will
set-up by the firmware or boot loader. not load if they could possibly displace the pre-
initialized output. Only the system framebuffer will
Useful as fallback, or for testing and debugging. be available for use. The respective drivers will not
perform display-mode changes or accelerated rendering.
Useful as error fallback, or for testing and debugging.
nomodule Disable module load nomodule Disable module load
......
...@@ -6701,8 +6701,10 @@ F: drivers/gpu/drm/drm_aperture.c ...@@ -6701,8 +6701,10 @@ F: drivers/gpu/drm/drm_aperture.c
F: drivers/gpu/drm/tiny/ofdrm.c F: drivers/gpu/drm/tiny/ofdrm.c
F: drivers/gpu/drm/tiny/simpledrm.c F: drivers/gpu/drm/tiny/simpledrm.c
F: drivers/video/aperture.c F: drivers/video/aperture.c
F: drivers/video/nomodeset.c
F: include/drm/drm_aperture.h F: include/drm/drm_aperture.h
F: include/linux/aperture.h F: include/linux/aperture.h
F: include/video/nomodeset.h
DRM DRIVER FOR SIS VIDEO CARDS DRM DRIVER FOR SIS VIDEO CARDS
S: Orphan / Obsolete S: Orphan / Obsolete
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
menuconfig DRM menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)" tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
select DRM_NOMODESET
select DRM_PANEL_ORIENTATION_QUIRKS select DRM_PANEL_ORIENTATION_QUIRKS
select HDMI select HDMI
select FB_CMDLINE select FB_CMDLINE
...@@ -19,6 +18,7 @@ menuconfig DRM ...@@ -19,6 +18,7 @@ menuconfig DRM
# gallium uses SYS_kcmp for os_same_file_description() to de-duplicate # gallium uses SYS_kcmp for os_same_file_description() to de-duplicate
# device and dmabuf fd. Let's make sure that is available for our userspace. # device and dmabuf fd. Let's make sure that is available for our userspace.
select KCMP select KCMP
select VIDEO_NOMODESET
help help
Kernel-level support for the Direct Rendering Infrastructure (DRI) Kernel-level support for the Direct Rendering Infrastructure (DRI)
introduced in XFree86 4.0. If you say Y here, you need to select introduced in XFree86 4.0. If you say Y here, you need to select
...@@ -514,11 +514,6 @@ config DRM_EXPORT_FOR_TESTS ...@@ -514,11 +514,6 @@ config DRM_EXPORT_FOR_TESTS
config DRM_PANEL_ORIENTATION_QUIRKS config DRM_PANEL_ORIENTATION_QUIRKS
tristate tristate
# Separate option because nomodeset parameter is global and expected built-in
config DRM_NOMODESET
bool
default n
config DRM_LIB_RANDOM config DRM_LIB_RANDOM
bool bool
default n default n
......
...@@ -72,7 +72,6 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += \ ...@@ -72,7 +72,6 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += \
drm_privacy_screen_x86.o drm_privacy_screen_x86.o
obj-$(CONFIG_DRM) += drm.o obj-$(CONFIG_DRM) += drm.o
obj-$(CONFIG_DRM_NOMODESET) += drm_nomodeset.o
obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
# #
......
...@@ -11,6 +11,10 @@ config APERTURE_HELPERS ...@@ -11,6 +11,10 @@ config APERTURE_HELPERS
Support tracking and hand-over of aperture ownership. Required Support tracking and hand-over of aperture ownership. Required
by graphics drivers for firmware-provided framebuffers. by graphics drivers for firmware-provided framebuffers.
config VIDEO_NOMODESET
bool
default n
if HAS_IOMEM if HAS_IOMEM
config HAVE_FB_ATMEL config HAVE_FB_ATMEL
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
obj-$(CONFIG_APERTURE_HELPERS) += aperture.o obj-$(CONFIG_APERTURE_HELPERS) += aperture.o
obj-$(CONFIG_VGASTATE) += vgastate.o obj-$(CONFIG_VGASTATE) += vgastate.o
obj-$(CONFIG_VIDEO_NOMODESET) += nomodeset.o
obj-$(CONFIG_HDMI) += hdmi.o obj-$(CONFIG_HDMI) += hdmi.o
obj-$(CONFIG_VT) += console/ obj-$(CONFIG_VT) += console/
......
...@@ -3,17 +3,19 @@ ...@@ -3,17 +3,19 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/types.h> #include <linux/types.h>
static bool drm_nomodeset; #include <video/nomodeset.h>
bool drm_firmware_drivers_only(void) static bool video_nomodeset;
bool video_firmware_drivers_only(void)
{ {
return drm_nomodeset; return video_nomodeset;
} }
EXPORT_SYMBOL(drm_firmware_drivers_only); EXPORT_SYMBOL(video_firmware_drivers_only);
static int __init disable_modeset(char *str) static int __init disable_modeset(char *str)
{ {
drm_nomodeset = true; video_nomodeset = true;
pr_warn("Booted with the nomodeset parameter. Only the system framebuffer will be available\n"); pr_warn("Booted with the nomodeset parameter. Only the system framebuffer will be available\n");
......
...@@ -30,6 +30,8 @@ ...@@ -30,6 +30,8 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/irqreturn.h> #include <linux/irqreturn.h>
#include <video/nomodeset.h>
#include <drm/drm_device.h> #include <drm/drm_device.h>
struct drm_file; struct drm_file;
...@@ -602,6 +604,10 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev) ...@@ -602,6 +604,10 @@ static inline bool drm_drv_uses_atomic_modeset(struct drm_device *dev)
int drm_dev_set_unique(struct drm_device *dev, const char *name); int drm_dev_set_unique(struct drm_device *dev, const char *name);
extern bool drm_firmware_drivers_only(void); /* TODO: Inline drm_firmware_drivers_only() in all its callers. */
static inline bool drm_firmware_drivers_only(void)
{
return video_firmware_drivers_only();
}
#endif #endif
/* SPDX-License-Identifier: MIT */
#ifndef VIDEO_NOMODESET_H
#define VIDEO_NOMODESET_H
bool video_firmware_drivers_only(void);
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment