1# SPDX-License-Identifier: GPL-2.0-only
2#
3# Drm device configuration
4#
5# This driver provides support for the
6# Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
7#
8menuconfig DRM
9	tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
10	depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
11	select DRM_PANEL_ORIENTATION_QUIRKS
12	select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
13	select FB_CORE if DRM_FBDEV_EMULATION
14	select FB_SYSMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION
15	select HDMI
16	select I2C
17	select DMA_SHARED_BUFFER
18	select SYNC_FILE
19# gallium uses SYS_kcmp for os_same_file_description() to de-duplicate
20# device and dmabuf fd. Let's make sure that is available for our userspace.
21	select KCMP
22	select VIDEO
23	help
24	  Kernel-level support for the Direct Rendering Infrastructure (DRI)
25	  introduced in XFree86 4.0. If you say Y here, you need to select
26	  the module that's right for your graphics card from the list below.
27	  These modules provide support for synchronization, security, and
28	  DMA transfers. Please see <http://dri.sourceforge.net/> for more
29	  details.  You should also select and configure AGP
30	  (/dev/agpgart) support if it is available for your platform.
31
32if DRM
33
34config DRM_MIPI_DBI
35	tristate
36	depends on DRM
37	select DRM_KMS_HELPER
38
39config DRM_MIPI_DSI
40	bool
41	depends on DRM
42
43config DRM_DEBUG_MM
44	bool "Insert extra checks and debug info into the DRM range managers"
45	default n
46	depends on DRM
47	depends on STACKTRACE_SUPPORT
48	select STACKDEPOT
49	help
50	  Enable allocation tracking of memory manager and leak detection on
51	  shutdown.
52
53	  Recommended for driver developers only.
54
55	  If in doubt, say "N".
56
57config DRM_USE_DYNAMIC_DEBUG
58	bool "use dynamic debug to implement drm.debug"
59	default n
60	depends on BROKEN
61	depends on DRM
62	depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE
63	depends on JUMP_LABEL
64	help
65	  Use dynamic-debug to avoid drm_debug_enabled() runtime overheads.
66	  Due to callsite counts in DRM drivers (~4k in amdgpu) and 56
67	  bytes per callsite, the .data costs can be substantial, and
68	  are therefore configurable.
69
70config DRM_KUNIT_TEST_HELPERS
71	tristate
72	depends on DRM && KUNIT
73	select DRM_KMS_HELPER
74	help
75	  KUnit Helpers for KMS drivers.
76
77config DRM_KUNIT_TEST
78	tristate "KUnit tests for DRM" if !KUNIT_ALL_TESTS
79	depends on DRM && KUNIT && MMU
80	select DRM_BUDDY
81	select DRM_DISPLAY_DP_HELPER
82	select DRM_DISPLAY_HDMI_STATE_HELPER
83	select DRM_DISPLAY_HELPER
84	select DRM_EXEC
85	select DRM_EXPORT_FOR_TESTS if m
86	select DRM_GEM_SHMEM_HELPER
87	select DRM_KUNIT_TEST_HELPERS
88	select DRM_LIB_RANDOM
89	select PRIME_NUMBERS
90	default KUNIT_ALL_TESTS
91	help
92	  This builds unit tests for DRM. This option is not useful for
93	  distributions or general kernels, but only for kernel
94	  developers working on DRM and associated drivers.
95
96	  For more information on KUnit and unit tests in general,
97	  please refer to the KUnit documentation in
98	  Documentation/dev-tools/kunit/.
99
100	  If in doubt, say "N".
101
102config DRM_KMS_HELPER
103	tristate
104	depends on DRM
105	help
106	  CRTC helpers for KMS drivers.
107
108config DRM_PANIC
109	bool "Display a user-friendly message when a kernel panic occurs"
110	depends on DRM
111	select FONT_SUPPORT
112	help
113	  Enable a drm panic handler, which will display a user-friendly message
114	  when a kernel panic occurs. It's useful when using a user-space
115	  console instead of fbcon.
116	  It will only work if your graphic driver supports this feature.
117	  To support Hi-DPI Display, you can enable bigger fonts like
118	  FONT_TER16x32
119
120config DRM_PANIC_FOREGROUND_COLOR
121	hex "Drm panic screen foreground color, in RGB"
122	depends on DRM_PANIC
123	default 0xffffff
124
125config DRM_PANIC_BACKGROUND_COLOR
126	hex "Drm panic screen background color, in RGB"
127	depends on DRM_PANIC
128	default 0x000000
129
130config DRM_PANIC_DEBUG
131	bool "Add a debug fs entry to trigger drm_panic"
132	depends on DRM_PANIC && DEBUG_FS
133	help
134	  Add dri/[device]/drm_panic_plane_x in the kernel debugfs, to force the
135	  panic handler to write the panic message to this plane scanout buffer.
136	  This is unsafe and should not be enabled on a production build.
137	  If in doubt, say "N".
138
139config DRM_PANIC_SCREEN
140	string "Panic screen formatter"
141	default "user"
142	depends on DRM_PANIC
143	help
144	  This option enable to choose what will be displayed when a kernel
145	  panic occurs. You can choose between "user", a short message telling
146	  the user to reboot the system, or "kmsg" which will display the last
147	  lines of kmsg.
148	  This can also be overridden by drm.panic_screen=xxxx kernel parameter
149	  or by writing to /sys/module/drm/parameters/panic_screen sysfs entry
150	  Default is "user"
151
152config DRM_PANIC_SCREEN_QR_CODE
153	bool "Add a panic screen with a QR code"
154	depends on DRM_PANIC && RUST
155	help
156	  This option adds a QR code generator, and a panic screen with a QR
157	  code. The QR code will contain the last lines of kmsg and other debug
158	  information. This should be easier for the user to report a kernel
159	  panic, with all debug information available.
160	  To use this panic screen, also set DRM_PANIC_SCREEN to "qr_code"
161
162config DRM_PANIC_SCREEN_QR_CODE_URL
163	string "Base URL of the QR code in the panic screen"
164	depends on DRM_PANIC_SCREEN_QR_CODE
165	help
166	  This option sets the base URL to report the kernel panic. If it's set
167	  the QR code will contain the URL and the kmsg compressed with zlib as
168	  a URL parameter. If it's empty, the QR code will contain the kmsg as
169	  uncompressed text only.
170	  There is a demo code in javascript, to decode and uncompress the kmsg
171	  data from the URL parameter at https://github.com/kdj0c/panic_report
172
173config DRM_PANIC_SCREEN_QR_VERSION
174	int "Maximum version (size) of the QR code."
175	depends on DRM_PANIC_SCREEN_QR_CODE
176	default 40
177	help
178	  This option limits the version (or size) of the QR code. QR code
179	  version ranges from Version 1 (21x21) to Version 40 (177x177).
180	  Smaller QR code are easier to read, but will contain less debugging
181	  data. Default is 40.
182
183config DRM_DEBUG_DP_MST_TOPOLOGY_REFS
184        bool "Enable refcount backtrace history in the DP MST helpers"
185	depends on STACKTRACE_SUPPORT
186        select STACKDEPOT
187        depends on DRM_KMS_HELPER
188        depends on DEBUG_KERNEL
189        depends on EXPERT
190        help
191          Enables debug tracing for topology refs in DRM's DP MST helpers. A
192          history of each topology reference/dereference will be printed to the
193          kernel log once a port or branch device's topology refcount reaches 0.
194
195          This has the potential to use a lot of memory and print some very
196          large kernel messages. If in doubt, say "N".
197
198config DRM_DEBUG_MODESET_LOCK
199	bool "Enable backtrace history for lock contention"
200	depends on STACKTRACE_SUPPORT
201	depends on DEBUG_KERNEL
202	depends on EXPERT
203	select STACKDEPOT
204	default y if DEBUG_WW_MUTEX_SLOWPATH
205	help
206	  Enable debug tracing of failures to gracefully handle drm modeset lock
207	  contention. A history of each drm modeset lock path hitting -EDEADLK
208	  will be saved until gracefully handled, and the backtrace will be
209	  printed when attempting to lock a contended lock.
210
211	  If in doubt, say "N".
212
213config DRM_FBDEV_EMULATION
214	bool "Enable legacy fbdev support for your modesetting driver"
215	depends on DRM
216	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
217	default FB
218	help
219	  Choose this option if you have a need for the legacy fbdev
220	  support. Note that this support also provides the linux console
221	  support on top of your modesetting driver.
222
223	  If in doubt, say "Y".
224
225config DRM_FBDEV_OVERALLOC
226	int "Overallocation of the fbdev buffer"
227	depends on DRM_FBDEV_EMULATION
228	default 100
229	help
230	  Defines the fbdev buffer overallocation in percent. Default
231	  is 100. Typical values for double buffering will be 200,
232	  triple buffering 300.
233
234config DRM_FBDEV_LEAK_PHYS_SMEM
235	bool "Shamelessly allow leaking of fbdev physical address (DANGEROUS)"
236	depends on DRM_FBDEV_EMULATION && EXPERT
237	default n
238	help
239	  In order to keep user-space compatibility, we want in certain
240	  use-cases to keep leaking the fbdev physical address to the
241	  user-space program handling the fbdev buffer.
242	  This affects, not only, Amlogic, Allwinner or Rockchip devices
243	  with ARM Mali GPUs using an userspace Blob.
244	  This option is not supported by upstream developers and should be
245	  removed as soon as possible and be considered as a broken and
246	  legacy behaviour from a modern fbdev device driver.
247
248	  Please send any bug reports when using this to your proprietary
249	  software vendor that requires this.
250
251	  If in doubt, say "N" or spread the word to your closed source
252	  library vendor.
253
254config DRM_LOAD_EDID_FIRMWARE
255	bool "Allow to specify an EDID data set instead of probing for it"
256	depends on DRM
257	help
258	  Say Y here, if you want to use EDID data to be loaded from the
259	  /lib/firmware directory or one of the provided built-in
260	  data sets. This may be necessary, if the graphics adapter or
261	  monitor are unable to provide appropriate EDID data. Since this
262	  feature is provided as a workaround for broken hardware, the
263	  default case is N. Details and instructions how to build your own
264	  EDID data are given in Documentation/admin-guide/edid.rst.
265
266source "drivers/gpu/drm/display/Kconfig"
267
268config DRM_TTM
269	tristate
270	depends on DRM && MMU
271	help
272	  GPU memory management subsystem for devices with multiple
273	  GPU memory types. Will be enabled automatically if a device driver
274	  uses it.
275
276config DRM_TTM_KUNIT_TEST
277        tristate "KUnit tests for TTM" if !KUNIT_ALL_TESTS
278        default n
279        depends on DRM && KUNIT && MMU && (UML || COMPILE_TEST)
280        select DRM_TTM
281        select DRM_BUDDY
282        select DRM_EXPORT_FOR_TESTS if m
283        select DRM_KUNIT_TEST_HELPERS
284        default KUNIT_ALL_TESTS
285        help
286          Enables unit tests for TTM, a GPU memory manager subsystem used
287          to manage memory buffers. This option is mostly useful for kernel
288          developers. It depends on (UML || COMPILE_TEST) since no other driver
289          which uses TTM can be loaded while running the tests.
290
291          If in doubt, say "N".
292
293config DRM_EXEC
294	tristate
295	depends on DRM
296	help
297	  Execution context for command submissions
298
299config DRM_GPUVM
300	tristate
301	depends on DRM
302	select DRM_EXEC
303	help
304	  GPU-VM representation providing helpers to manage a GPUs virtual
305	  address space
306
307config DRM_BUDDY
308	tristate
309	depends on DRM
310	help
311	  A page based buddy allocator
312
313config DRM_VRAM_HELPER
314	tristate
315	depends on DRM
316	help
317	  Helpers for VRAM memory management
318
319config DRM_TTM_HELPER
320	tristate
321	depends on DRM
322	select DRM_TTM
323	help
324	  Helpers for ttm-based gem objects
325
326config DRM_GEM_DMA_HELPER
327	tristate
328	depends on DRM
329	select FB_DMAMEM_HELPERS if DRM_FBDEV_EMULATION
330	help
331	  Choose this if you need the GEM DMA helper functions
332
333config DRM_GEM_SHMEM_HELPER
334	tristate
335	depends on DRM && MMU
336	help
337	  Choose this if you need the GEM shmem helper functions
338
339config DRM_SUBALLOC_HELPER
340	tristate
341	depends on DRM
342
343config DRM_SCHED
344	tristate
345	depends on DRM
346
347source "drivers/gpu/drm/i2c/Kconfig"
348
349source "drivers/gpu/drm/arm/Kconfig"
350
351source "drivers/gpu/drm/radeon/Kconfig"
352
353source "drivers/gpu/drm/amd/amdgpu/Kconfig"
354
355source "drivers/gpu/drm/nouveau/Kconfig"
356
357source "drivers/gpu/drm/i915/Kconfig"
358
359source "drivers/gpu/drm/xe/Kconfig"
360
361source "drivers/gpu/drm/kmb/Kconfig"
362
363config DRM_VGEM
364	tristate "Virtual GEM provider"
365	depends on DRM && MMU
366	select DRM_GEM_SHMEM_HELPER
367	help
368	  Choose this option to get a virtual graphics memory manager,
369	  as used by Mesa's software renderer for enhanced performance.
370	  If M is selected the module will be called vgem.
371
372source "drivers/gpu/drm/vkms/Kconfig"
373
374source "drivers/gpu/drm/exynos/Kconfig"
375
376source "drivers/gpu/drm/rockchip/Kconfig"
377
378source "drivers/gpu/drm/vmwgfx/Kconfig"
379
380source "drivers/gpu/drm/gma500/Kconfig"
381
382source "drivers/gpu/drm/udl/Kconfig"
383
384source "drivers/gpu/drm/ast/Kconfig"
385
386source "drivers/gpu/drm/mgag200/Kconfig"
387
388source "drivers/gpu/drm/armada/Kconfig"
389
390source "drivers/gpu/drm/atmel-hlcdc/Kconfig"
391
392source "drivers/gpu/drm/renesas/Kconfig"
393
394source "drivers/gpu/drm/sun4i/Kconfig"
395
396source "drivers/gpu/drm/omapdrm/Kconfig"
397
398source "drivers/gpu/drm/tilcdc/Kconfig"
399
400source "drivers/gpu/drm/qxl/Kconfig"
401
402source "drivers/gpu/drm/virtio/Kconfig"
403
404source "drivers/gpu/drm/msm/Kconfig"
405
406source "drivers/gpu/drm/fsl-dcu/Kconfig"
407
408source "drivers/gpu/drm/tegra/Kconfig"
409
410source "drivers/gpu/drm/stm/Kconfig"
411
412source "drivers/gpu/drm/panel/Kconfig"
413
414source "drivers/gpu/drm/bridge/Kconfig"
415
416source "drivers/gpu/drm/sti/Kconfig"
417
418source "drivers/gpu/drm/imx/Kconfig"
419
420source "drivers/gpu/drm/ingenic/Kconfig"
421
422source "drivers/gpu/drm/v3d/Kconfig"
423
424source "drivers/gpu/drm/vc4/Kconfig"
425
426source "drivers/gpu/drm/loongson/Kconfig"
427
428source "drivers/gpu/drm/etnaviv/Kconfig"
429
430source "drivers/gpu/drm/hisilicon/Kconfig"
431
432source "drivers/gpu/drm/logicvc/Kconfig"
433
434source "drivers/gpu/drm/mediatek/Kconfig"
435
436source "drivers/gpu/drm/mxsfb/Kconfig"
437
438source "drivers/gpu/drm/meson/Kconfig"
439
440source "drivers/gpu/drm/tiny/Kconfig"
441
442source "drivers/gpu/drm/pl111/Kconfig"
443
444source "drivers/gpu/drm/tve200/Kconfig"
445
446source "drivers/gpu/drm/xen/Kconfig"
447
448source "drivers/gpu/drm/vboxvideo/Kconfig"
449
450source "drivers/gpu/drm/lima/Kconfig"
451
452source "drivers/gpu/drm/panfrost/Kconfig"
453
454source "drivers/gpu/drm/panthor/Kconfig"
455
456source "drivers/gpu/drm/aspeed/Kconfig"
457
458source "drivers/gpu/drm/mcde/Kconfig"
459
460source "drivers/gpu/drm/tidss/Kconfig"
461
462source "drivers/gpu/drm/xlnx/Kconfig"
463
464source "drivers/gpu/drm/gud/Kconfig"
465
466source "drivers/gpu/drm/solomon/Kconfig"
467
468source "drivers/gpu/drm/sprd/Kconfig"
469
470source "drivers/gpu/drm/imagination/Kconfig"
471
472config DRM_HYPERV
473	tristate "DRM Support for Hyper-V synthetic video device"
474	depends on DRM && PCI && MMU && HYPERV
475	select DRM_KMS_HELPER
476	select DRM_GEM_SHMEM_HELPER
477	help
478	 This is a KMS driver for Hyper-V synthetic video device. Choose this
479	 option if you would like to enable drm driver for Hyper-V virtual
480	 machine. Unselect Hyper-V framebuffer driver (CONFIG_FB_HYPERV) so
481	 that DRM driver is used by default.
482
483	 If M is selected the module will be called hyperv_drm.
484
485config DRM_EXPORT_FOR_TESTS
486	bool
487
488config DRM_LIB_RANDOM
489	bool
490	default n
491
492config DRM_PRIVACY_SCREEN
493	bool
494	default n
495
496config DRM_WERROR
497	bool "Compile the drm subsystem with warnings as errors"
498	depends on DRM && EXPERT
499	depends on !WERROR
500	default n
501	help
502	  A kernel build should not cause any compiler warnings, and this
503	  enables the '-Werror' flag to enforce that rule in the drm subsystem.
504
505	  The drm subsystem enables more warnings than the kernel default, so
506	  this config option is disabled by default.
507
508	  If in doubt, say N.
509
510endif
511
512# Separate option because drm_panel_orientation_quirks.c is shared with fbdev
513config DRM_PANEL_ORIENTATION_QUIRKS
514	tristate
515