* [PATCH 1/4] drm: Add helper module for working with pixel data
2026-10-19 15:32 [PATCH 0/4] drm: Move drawing to pixel-helper module Thomas Zimmermann
@ 2026-10-19 15:32 ` Thomas Zimmermann
2026-10-19 15:32 ` [PATCH 2/4] drm/pixel: Link format helpers into drm_pixel_helper.ko Thomas Zimmermann
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2026-10-19 15:32 UTC (permalink / raw)
To: jfalempe, maarten.lankhorst, mripard, airlied, simona
Cc: dri-devel, amd-gfx, linux-hyperv, intel-gfx, imx,
linux-arm-kernel, nouveau, linux-renesas-soc, virtualization,
sashiko-reviews, Thomas Zimmermann
Add drm_pixel_helper.ko. This module will contain helpers that copy
and process pixel data, such as framebuffers. Drivers that want to
use the helpers should select DRM_PIXEL_HELPER.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/Kconfig | 6 ++++++
drivers/gpu/drm/Makefile | 4 ++++
drivers/gpu/drm/drm_pixel_helper_common.c | 6 ++++++
3 files changed, 16 insertions(+)
create mode 100644 drivers/gpu/drm/drm_pixel_helper_common.c
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 61111d50b1c6..dce5e25671ee 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -49,6 +49,12 @@ config DRM_KMS_HELPER
help
CRTC helpers for KMS drivers.
+config DRM_PIXEL_HELPER
+ tristate
+ depends on DRM
+ help
+ Helpers for working with pixel data in DRM.
+
config DRM_DRAW
bool
depends on DRM
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 2c6bc093a923..5f555a2c1a4c 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -99,6 +99,10 @@ obj-$(CONFIG_DRM_PANEL) += drm_panel.o
obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
+drm_pixel_helper-y := \
+ drm_pixel_helper_common.o
+obj-$(CONFIG_DRM_PIXEL_HELPER) += drm_pixel_helper.o
+
#
# Memory-management helpers
#
diff --git a/drivers/gpu/drm/drm_pixel_helper_common.c b/drivers/gpu/drm/drm_pixel_helper_common.c
new file mode 100644
index 000000000000..743846e1e003
--- /dev/null
+++ b/drivers/gpu/drm/drm_pixel_helper_common.c
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0 or MIT
+
+#include <linux/module.h>
+
+MODULE_DESCRIPTION("DRM pixel-data helpers");
+MODULE_LICENSE("GPL and additional rights");
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/4] drm/pixel: Link format helpers into drm_pixel_helper.ko
2026-10-19 15:32 [PATCH 0/4] drm: Move drawing to pixel-helper module Thomas Zimmermann
2026-10-19 15:32 ` [PATCH 1/4] drm: Add helper module for working with pixel data Thomas Zimmermann
@ 2026-10-19 15:32 ` Thomas Zimmermann
2026-10-19 16:11 ` sashiko-bot
2026-10-19 15:32 ` [PATCH 3/4] drm/pixel: Link panic " Thomas Zimmermann
2026-10-19 15:32 ` [PATCH 4/4] drm/pixel: Link draw " Thomas Zimmermann
3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2026-10-19 15:32 UTC (permalink / raw)
To: jfalempe, maarten.lankhorst, mripard, airlied, simona
Cc: dri-devel, amd-gfx, linux-hyperv, intel-gfx, imx,
linux-arm-kernel, nouveau, linux-renesas-soc, virtualization,
sashiko-reviews, Thomas Zimmermann
Move drm_format_helper.o from drm_kms_helper.ko to drm_pixel_helper.ko.
Select DRM_PIXEL_HELPER from the drivers that use the format helpers.
While at it, include <drm/drm_format_helper.h> in a few places where it
is missing.
Format helpers copy pixel data from a DRM framebuffer to a hardware
scanout buffer or some other destination. They can transform the color
format as part of the copying operation. A number of drivers require
this functionality as part of their display update.
The format helpers are currently part of drm_kms_helper.ko, which is
for mode-setting helpers (i.e, helpers that modify the display pipeline).
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/Kconfig | 1 +
drivers/gpu/drm/Kconfig.debug | 1 +
drivers/gpu/drm/Makefile | 2 +-
drivers/gpu/drm/ast/Kconfig | 1 +
drivers/gpu/drm/gud/Kconfig | 1 +
drivers/gpu/drm/hisilicon/hibmc/Kconfig | 1 +
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c | 1 +
drivers/gpu/drm/hyperv/Kconfig | 1 +
drivers/gpu/drm/mgag200/Kconfig | 1 +
drivers/gpu/drm/sitronix/Kconfig | 2 ++
drivers/gpu/drm/solomon/Kconfig | 1 +
drivers/gpu/drm/sysfb/Kconfig | 1 +
drivers/gpu/drm/sysfb/drm_sysfb_modeset.c | 1 +
drivers/gpu/drm/tiny/Kconfig | 6 ++++++
drivers/gpu/drm/tiny/bochs.c | 1 +
15 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index dce5e25671ee..8e4a588e9111 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -37,6 +37,7 @@ config DRM_MIPI_DBI
tristate
depends on DRM
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
config DRM_MIPI_DSI
bool
diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
index b909cd0a619f..1afb9cad850f 100644
--- a/drivers/gpu/drm/Kconfig.debug
+++ b/drivers/gpu/drm/Kconfig.debug
@@ -70,6 +70,7 @@ config DRM_KUNIT_TEST
select DRM_GEM_SHMEM_HELPER
select DRM_KUNIT_TEST_HELPERS
select DRM_PANIC_HELPER
+ select DRM_PIXEL_HELPER
select DRM_SYSFB_HELPER
select PRIME_NUMBERS
default KUNIT_ALL_TESTS
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 5f555a2c1a4c..fbc643747110 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -100,6 +100,7 @@ obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
drm_pixel_helper-y := \
+ drm_format_helper.o \
drm_pixel_helper_common.o
obj-$(CONFIG_DRM_PIXEL_HELPER) += drm_pixel_helper.o
@@ -150,7 +151,6 @@ drm_kms_helper-y := \
drm_crtc_helper.o \
drm_damage_helper.o \
drm_flip_work.o \
- drm_format_helper.o \
drm_gem_atomic_helper.o \
drm_gem_framebuffer_helper.o \
drm_kms_helper_common.o \
diff --git a/drivers/gpu/drm/ast/Kconfig b/drivers/gpu/drm/ast/Kconfig
index 242fbccdf844..1758debb8317 100644
--- a/drivers/gpu/drm/ast/Kconfig
+++ b/drivers/gpu/drm/ast/Kconfig
@@ -5,6 +5,7 @@ config DRM_AST
select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
select I2C
select I2C_ALGOBIT
help
diff --git a/drivers/gpu/drm/gud/Kconfig b/drivers/gpu/drm/gud/Kconfig
index b4d2136942f0..385702103633 100644
--- a/drivers/gpu/drm/gud/Kconfig
+++ b/drivers/gpu/drm/gud/Kconfig
@@ -7,6 +7,7 @@ config DRM_GUD
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
+ select DRM_PIXEL_HELPER
select BACKLIGHT_CLASS_DEVICE
help
This is a DRM display driver for GUD USB Displays or display
diff --git a/drivers/gpu/drm/hisilicon/hibmc/Kconfig b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
index adf4516bf8f6..f896f8cb8689 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/Kconfig
+++ b/drivers/gpu/drm/hisilicon/hibmc/Kconfig
@@ -7,6 +7,7 @@ config DRM_HISI_HIBMC
select DRM_DISPLAY_DP_HELPER
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
select I2C
select I2C_ALGOBIT
help
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
index 7849abd0488e..aaef70153f7e 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
@@ -17,6 +17,7 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_fourcc.h>
+#include <drm/drm_format_helper.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_vblank.h>
diff --git a/drivers/gpu/drm/hyperv/Kconfig b/drivers/gpu/drm/hyperv/Kconfig
index 86234f6a73f2..21146ed294e3 100644
--- a/drivers/gpu/drm/hyperv/Kconfig
+++ b/drivers/gpu/drm/hyperv/Kconfig
@@ -5,6 +5,7 @@ config DRM_HYPERV
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
+ select DRM_PIXEL_HELPER
help
This is a KMS driver for Hyper-V synthetic video device. Choose this
option if you would like to enable drm driver for Hyper-V virtual
diff --git a/drivers/gpu/drm/mgag200/Kconfig b/drivers/gpu/drm/mgag200/Kconfig
index a962ae564a75..06bb23a888f9 100644
--- a/drivers/gpu/drm/mgag200/Kconfig
+++ b/drivers/gpu/drm/mgag200/Kconfig
@@ -5,6 +5,7 @@ config DRM_MGAG200
select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
select I2C
select I2C_ALGOBIT
help
diff --git a/drivers/gpu/drm/sitronix/Kconfig b/drivers/gpu/drm/sitronix/Kconfig
index 41a428ef8295..c4b54f4f4f69 100644
--- a/drivers/gpu/drm/sitronix/Kconfig
+++ b/drivers/gpu/drm/sitronix/Kconfig
@@ -4,6 +4,7 @@ config DRM_ST7571
select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
select VIDEOMODE_HELPERS
help
Sitronix ST7571 is a driver and controller for 4-level gray
@@ -46,6 +47,7 @@ config DRM_ST7586
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
select DRM_MIPI_DBI
+ select DRM_PIXEL_HELPER
help
DRM driver for the following Sitronix ST7586 panels:
* LEGO MINDSTORMS EV3
diff --git a/drivers/gpu/drm/solomon/Kconfig b/drivers/gpu/drm/solomon/Kconfig
index 400a6cab3a67..b65daabb2e96 100644
--- a/drivers/gpu/drm/solomon/Kconfig
+++ b/drivers/gpu/drm/solomon/Kconfig
@@ -5,6 +5,7 @@ config DRM_SSD130X
select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
help
DRM driver for the SSD13xx Solomon and SINO WEALTH SH110x OLED
controllers. This is only for the core driver, a driver for the
diff --git a/drivers/gpu/drm/sysfb/Kconfig b/drivers/gpu/drm/sysfb/Kconfig
index f7e48178885e..eaf6b8d1cd51 100644
--- a/drivers/gpu/drm/sysfb/Kconfig
+++ b/drivers/gpu/drm/sysfb/Kconfig
@@ -5,6 +5,7 @@ menu "Drivers for system framebuffers"
config DRM_SYSFB_HELPER
tristate
+ select DRM_PIXEL_HELPER
depends on DRM
config DRM_COREBOOTDRM
diff --git a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
index 13df0925163a..c403c168c4c3 100644
--- a/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
+++ b/drivers/gpu/drm/sysfb/drm_sysfb_modeset.c
@@ -10,6 +10,7 @@
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_fourcc.h>
+#include <drm/drm_format_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_panic.h>
diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig
index f0e72d4b6a47..176d75ce17ea 100644
--- a/drivers/gpu/drm/tiny/Kconfig
+++ b/drivers/gpu/drm/tiny/Kconfig
@@ -6,6 +6,7 @@ config DRM_APPLETBDRM
depends on X86 || COMPILE_TEST
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
help
Say Y here if you want support for the display of Touch Bars on x86
MacBook Pros.
@@ -30,6 +31,7 @@ config DRM_BOCHS
select DRM_CLIENT_SELECTION
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
help
This is a KMS driver for qemu's stdvga output. Choose this option
for qemu.
@@ -42,6 +44,7 @@ config DRM_CIRRUS_QEMU
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
+ select DRM_PIXEL_HELPER
help
This is a KMS driver for emulated cirrus device in qemu.
It is *NOT* intended for real cirrus devices. This requires
@@ -62,6 +65,7 @@ config DRM_GM12U320
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
+ select DRM_PIXEL_HELPER
help
This is a KMS driver for projectors which use the GM12U320 chipset
for video transfer over USB2/3, such as the Acer C120 mini projector.
@@ -186,6 +190,7 @@ config TINYDRM_REPAPER
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER
+ select DRM_PIXEL_HELPER
help
DRM driver for the following Pervasive Displays panels:
1.44" TFT EPD Panel (E1144CS021)
@@ -201,6 +206,7 @@ config TINYDRM_SHARP_MEMORY
select DRM_CLIENT_SELECTION
select DRM_GEM_DMA_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER
help
DRM Driver for the following Sharp Memory Panels:
* 1.00" Sharp Memory LCD (LS010B7DH04)
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index 8192decddbc1..2744fe26dbeb 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -13,6 +13,7 @@
#include <drm/drm_edid.h>
#include <drm/drm_fbdev_shmem.h>
#include <drm/drm_fourcc.h>
+#include <drm/drm_format_helper.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] drm/pixel: Link format helpers into drm_pixel_helper.ko
2026-10-19 15:32 ` [PATCH 2/4] drm/pixel: Link format helpers into drm_pixel_helper.ko Thomas Zimmermann
@ 2026-10-19 16:11 ` sashiko-bot
0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-10-19 16:11 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: dri-devel, linux-hyperv, intel-gfx, imx, virtualization, Frank.Li,
wsa+renesas, Michael S. Tsirkin, Eugenio Perez
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] drm: undefined drm_format_conv_state_*() references in drm_kms_helper
- [Low] drm/sitronix: missing DRM_PIXEL_HELPER select in config DRM_ST7920
--
commit 5297070737eb21b200d62be5b5e13861b6e29b57
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/pixel: Link format helpers into drm_pixel_helper.ko
This commit moves drm_format_helper.o from drm_kms_helper.ko into
drm_pixel_helper.ko and updates drivers using format helpers to select
DRM_PIXEL_HELPER and include <drm/drm_format_helper.h>.
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 5f555a2c1a4c8..fbc643747110f 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -100,6 +100,7 @@ obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
> obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
>
> drm_pixel_helper-y := \
> + drm_format_helper.o \
> drm_pixel_helper_common.o
> obj-$(CONFIG_DRM_PIXEL_HELPER) += drm_pixel_helper.o
>
> @@ -150,7 +151,6 @@ drm_kms_helper-y := \
> drm_crtc_helper.o \
> drm_damage_helper.o \
> drm_flip_work.o \
> - drm_format_helper.o \
> drm_gem_atomic_helper.o \
> drm_gem_framebuffer_helper.o \
> drm_kms_helper_common.o \
[Severity: Low]
Will moving drm_format_helper.o to drm_pixel_helper-y while leaving
drm_gem_atomic_helper.o in drm_kms_helper-y cause undefined symbol references
when CONFIG_DRM_KMS_HELPER is enabled without CONFIG_DRM_PIXEL_HELPER (or when
CONFIG_DRM_KMS_HELPER=y and CONFIG_DRM_PIXEL_HELPER=m)?
In drivers/gpu/drm/drm_gem_atomic_helper.c, the shadow plane helpers call
functions defined in drivers/gpu/drm/drm_format_helper.c:
drivers/gpu/drm/drm_gem_atomic_helper.c:
__drm_gem_shadow_plane_state_init()
__drm_atomic_helper_plane_state_init(&shadow_plane_state->base, plane);
drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
__drm_gem_duplicate_shadow_plane_state()
drm_format_conv_state_copy(&new_shadow_plane_state->fmtcnv_state,
&shadow_plane_state->fmtcnv_state);
__drm_gem_destroy_shadow_plane_state()
drm_format_conv_state_release(&shadow_plane_state->fmtcnv_state);
__drm_atomic_helper_plane_destroy_state(&shadow_plane_state->base);
Because config DRM_KMS_HELPER in drivers/gpu/drm/Kconfig does not select
DRM_PIXEL_HELPER, linking drm_kms_helper fails with undefined references to
drm_format_conv_state_init(), drm_format_conv_state_copy(), and
drm_format_conv_state_release().
[ ... ]
> diff --git a/drivers/gpu/drm/sitronix/Kconfig b/drivers/gpu/drm/sitronix/Kconfig
> index 41a428ef8295e..c4b54f4f4f69a 100644
> --- a/drivers/gpu/drm/sitronix/Kconfig
> +++ b/drivers/gpu/drm/sitronix/Kconfig
> @@ -4,6 +4,7 @@ config DRM_ST7571
> select DRM_CLIENT_SELECTION
> select DRM_GEM_SHMEM_HELPER
> select DRM_KMS_HELPER
> + select DRM_PIXEL_HELPER
> select VIDEOMODE_HELPERS
> help
> Sitronix ST7571 is a driver and controller for 4-level gray
> @@ -46,6 +47,7 @@ config DRM_ST7586
> select DRM_KMS_HELPER
> select DRM_GEM_DMA_HELPER
> select DRM_MIPI_DBI
> + select DRM_PIXEL_HELPER
> help
> DRM driver for the following Sitronix ST7586 panels:
> * LEGO MINDSTORMS EV3
[Severity: Low]
Should config DRM_ST7920 in drivers/gpu/drm/sitronix/Kconfig also select
DRM_PIXEL_HELPER (and include <drm/drm_format_helper.h> in
drivers/gpu/drm/sitronix/st7920.c)?
In drivers/gpu/drm/sitronix/st7920.c, the driver calls format helpers
directly:
st7920_fb_blit_rect()
iosys_map_set_vaddr(&dst, buf);
drm_fb_xrgb8888_to_mono(&dst, &dst_pitch, vmap, fb, rect, fmtcnv_state);
st7920_primary_plane_atomic_check()
/* format conversion necessary; reserve buffer */
buf = drm_format_conv_state_reserve(&shadow_plane_state->fmtcnv_state,
pitch, GFP_KERNEL);
Without selecting DRM_PIXEL_HELPER in DRM_ST7920, building st7920 when
CONFIG_DRM_PIXEL_HELPER is disabled (or when CONFIG_DRM_ST7920=y and
CONFIG_DRM_PIXEL_HELPER=m) fails with undefined references to
drm_fb_xrgb8888_to_mono() and drm_format_conv_state_reserve().
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019154612.777074-1-tzimmermann@suse.de?part=2
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/4] drm/pixel: Link panic helpers into drm_pixel_helper.ko
2026-10-19 15:32 [PATCH 0/4] drm: Move drawing to pixel-helper module Thomas Zimmermann
2026-10-19 15:32 ` [PATCH 1/4] drm: Add helper module for working with pixel data Thomas Zimmermann
2026-10-19 15:32 ` [PATCH 2/4] drm/pixel: Link format helpers into drm_pixel_helper.ko Thomas Zimmermann
@ 2026-10-19 15:32 ` Thomas Zimmermann
2026-10-19 16:19 ` sashiko-bot
2026-10-19 15:32 ` [PATCH 4/4] drm/pixel: Link draw " Thomas Zimmermann
3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2026-10-19 15:32 UTC (permalink / raw)
To: jfalempe, maarten.lankhorst, mripard, airlied, simona
Cc: dri-devel, amd-gfx, linux-hyperv, intel-gfx, imx,
linux-arm-kernel, nouveau, linux-renesas-soc, virtualization,
sashiko-reviews, Thomas Zimmermann
Move panic helpers from drm_kms_helper to drm_pixel_helper.ko. Select
DRM_PIXEL_HELPER in the drivers that use the panic helpers.
Drop the Kconfig option DRM_PANIC_HELPER. With the user selecting
panic support via DRM_PANIC, panic helpers will become available to
drivers.
Related module init and exit functions are now declared in the new
header file drm_pixel_helper_internal.h. Other internal functions for
pixel helpers can later go there as well.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/Kconfig | 9 ++-------
drivers/gpu/drm/Kconfig.debug | 1 -
drivers/gpu/drm/Makefile | 4 ++--
drivers/gpu/drm/amd/amdgpu/Kconfig | 1 +
drivers/gpu/drm/drm_kms_helper_common.c | 13 -------------
drivers/gpu/drm/drm_panic_helper.c | 1 +
drivers/gpu/drm/drm_panic_internal.h | 14 --------------
drivers/gpu/drm/drm_pixel_helper_common.c | 14 ++++++++++++++
drivers/gpu/drm/drm_pixel_helper_internal.h | 20 ++++++++++++++++++++
drivers/gpu/drm/i915/Kconfig | 1 +
drivers/gpu/drm/imx/ipuv3/Kconfig | 1 +
drivers/gpu/drm/nouveau/Kconfig | 1 +
drivers/gpu/drm/renesas/rcar-du/Kconfig | 1 +
drivers/gpu/drm/renesas/shmobile/Kconfig | 1 +
drivers/gpu/drm/tidss/Kconfig | 1 +
drivers/gpu/drm/virtio/Kconfig | 1 +
16 files changed, 47 insertions(+), 37 deletions(-)
create mode 100644 drivers/gpu/drm/drm_pixel_helper_internal.h
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 8e4a588e9111..bf7c59944340 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -46,13 +46,14 @@ config DRM_MIPI_DSI
config DRM_KMS_HELPER
tristate
depends on DRM
- select DRM_PANIC_HELPER if DRM_PANIC
help
CRTC helpers for KMS drivers.
config DRM_PIXEL_HELPER
tristate
depends on DRM
+ select DRM_DRAW if DRM_PANIC
+ select FONT_SUPPORT if DRM_PANIC
help
Helpers for working with pixel data in DRM.
@@ -135,12 +136,6 @@ config DRM_PANIC_SCREEN_QR_VERSION
Smaller QR code are easier to read, but will contain less debugging
data. Default is 40.
-config DRM_PANIC_HELPER
- bool
- depends on DRM
- select DRM_DRAW
- select FONT_SUPPORT
-
config DRM_RAS
bool "DRM RAS support"
depends on DRM
diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
index 1afb9cad850f..4573cad368a2 100644
--- a/drivers/gpu/drm/Kconfig.debug
+++ b/drivers/gpu/drm/Kconfig.debug
@@ -69,7 +69,6 @@ config DRM_KUNIT_TEST
select DRM_EXPORT_FOR_TESTS if m
select DRM_GEM_SHMEM_HELPER
select DRM_KUNIT_TEST_HELPERS
- select DRM_PANIC_HELPER
select DRM_PIXEL_HELPER
select DRM_SYSFB_HELPER
select PRIME_NUMBERS
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index fbc643747110..18a5a5baf029 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -102,6 +102,8 @@ obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
drm_pixel_helper-y := \
drm_format_helper.o \
drm_pixel_helper_common.o
+drm_pixel_helper-$(CONFIG_DRM_PANIC) += drm_panic_helper.o
+drm_pixel_helper-$(CONFIG_DRM_PANIC_SCREEN_QR_CODE) += drm_panic_helper_qr.o
obj-$(CONFIG_DRM_PIXEL_HELPER) += drm_pixel_helper.o
#
@@ -160,8 +162,6 @@ drm_kms_helper-y := \
drm_self_refresh_helper.o \
drm_simple_kms_helper.o \
drm_vblank_helper.o
-drm_kms_helper-$(CONFIG_DRM_PANIC_HELPER) += drm_panic_helper.o
-drm_kms_helper-$(CONFIG_DRM_PANIC_SCREEN_QR_CODE) += drm_panic_helper_qr.o
obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
#
diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig b/drivers/gpu/drm/amd/amdgpu/Kconfig
index 12e4a41bf1f0..78584d8aeb52 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -12,6 +12,7 @@ config DRM_AMDGPU
select DRM_DISPLAY_HDCP_HELPER
select DRM_DISPLAY_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER if DRM_PANIC
select DRM_SCHED
select DRM_TTM
select DRM_TTM_HELPER
diff --git a/drivers/gpu/drm/drm_kms_helper_common.c b/drivers/gpu/drm/drm_kms_helper_common.c
index 1e55ecac4698..76c7297b24e9 100644
--- a/drivers/gpu/drm/drm_kms_helper_common.c
+++ b/drivers/gpu/drm/drm_kms_helper_common.c
@@ -30,7 +30,6 @@
#include <linux/moduleparam.h>
#include "drm_crtc_helper_internal.h"
-#include "drm_panic_internal.h"
#if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION)
bool drm_fbdev_emulation = true;
@@ -68,18 +67,6 @@ MODULE_PARM_DESC(drm_leak_fbdev_smem,
#endif
-static int __init drm_kms_helper_init(void)
-{
- return drm_panic_helper_init();
-}
-module_init(drm_kms_helper_init);
-
-static void __exit drm_kms_helper_exit(void)
-{
- drm_panic_helper_exit();
-}
-module_exit(drm_kms_helper_exit);
-
MODULE_AUTHOR("David Airlie, Jesse Barnes");
MODULE_DESCRIPTION("DRM KMS helper");
MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/gpu/drm/drm_panic_helper.c b/drivers/gpu/drm/drm_panic_helper.c
index 8913c3d22e8d..6f0d3a2df6b3 100644
--- a/drivers/gpu/drm/drm_panic_helper.c
+++ b/drivers/gpu/drm/drm_panic_helper.c
@@ -20,6 +20,7 @@
#include "drm_draw_internal.h"
#include "drm_panic_internal.h"
+#include "drm_pixel_helper_internal.h"
struct drm_panic_line {
u32 len;
diff --git a/drivers/gpu/drm/drm_panic_internal.h b/drivers/gpu/drm/drm_panic_internal.h
index fe6d514a0833..c68d64c56e15 100644
--- a/drivers/gpu/drm/drm_panic_internal.h
+++ b/drivers/gpu/drm/drm_panic_internal.h
@@ -52,18 +52,4 @@ static inline void drm_panic_lock(struct drm_device *dev, unsigned long flags) {
static inline void drm_panic_unlock(struct drm_device *dev, unsigned long flags) {}
#endif
-#if IS_ENABLED(CONFIG_DRM_PANIC_HELPER)
-/* drm_panic_helper.c */
-int __init drm_panic_helper_init(void);
-void __exit drm_panic_helper_exit(void);
-#else
-static inline int __init drm_panic_helper_init(void)
-{
- return 0;
-}
-
-static inline void __exit drm_panic_helper_exit(void)
-{ }
-#endif
-
#endif /* __DRM_PANIC_INTERNAL_H__ */
diff --git a/drivers/gpu/drm/drm_pixel_helper_common.c b/drivers/gpu/drm/drm_pixel_helper_common.c
index 743846e1e003..0213c59b82f0 100644
--- a/drivers/gpu/drm/drm_pixel_helper_common.c
+++ b/drivers/gpu/drm/drm_pixel_helper_common.c
@@ -2,5 +2,19 @@
#include <linux/module.h>
+#include "drm_pixel_helper_internal.h"
+
+static int __init drm_pixel_helper_init(void)
+{
+ return drm_panic_helper_init();
+}
+module_init(drm_pixel_helper_init);
+
+static void __exit drm_pixel_helper_exit(void)
+{
+ drm_panic_helper_exit();
+}
+module_exit(drm_pixel_helper_exit);
+
MODULE_DESCRIPTION("DRM pixel-data helpers");
MODULE_LICENSE("GPL and additional rights");
diff --git a/drivers/gpu/drm/drm_pixel_helper_internal.h b/drivers/gpu/drm/drm_pixel_helper_internal.h
new file mode 100644
index 000000000000..1606cbb0a460
--- /dev/null
+++ b/drivers/gpu/drm/drm_pixel_helper_internal.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 or MIT */
+
+#ifndef DRM_PIXEL_HELPER_INTERNAL_H
+#define DRM_PIXEL_HELPER_INTERNAL_H
+
+#if IS_ENABLED(CONFIG_DRM_PANIC)
+/* drm_panic_helper.c */
+int __init drm_panic_helper_init(void);
+void __exit drm_panic_helper_exit(void);
+#else
+static inline int __init drm_panic_helper_init(void)
+{
+ return 0;
+}
+
+static inline void __exit drm_panic_helper_exit(void)
+{ }
+#endif
+
+#endif
diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
index 5e939004b646..1c65b14bf0f4 100644
--- a/drivers/gpu/drm/i915/Kconfig
+++ b/drivers/gpu/drm/i915/Kconfig
@@ -19,6 +19,7 @@ config DRM_I915
select DRM_KMS_HELPER
select DRM_PANEL
select DRM_MIPI_DSI
+ select DRM_PIXEL_HELPER if DRM_PANIC
select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
select RELAY
select I2C
diff --git a/drivers/gpu/drm/imx/ipuv3/Kconfig b/drivers/gpu/drm/imx/ipuv3/Kconfig
index 3ca237515e46..19b51835cdd3 100644
--- a/drivers/gpu/drm/imx/ipuv3/Kconfig
+++ b/drivers/gpu/drm/imx/ipuv3/Kconfig
@@ -3,6 +3,7 @@ config DRM_IMX
tristate "DRM Support for Freescale i.MX"
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER if DRM_PANIC
select VIDEOMODE_HELPERS
select DRM_GEM_DMA_HELPER
depends on DRM && (ARCH_MXC || COMPILE_TEST)
diff --git a/drivers/gpu/drm/nouveau/Kconfig b/drivers/gpu/drm/nouveau/Kconfig
index 3b5757aed9c8..3850b27861fa 100644
--- a/drivers/gpu/drm/nouveau/Kconfig
+++ b/drivers/gpu/drm/nouveau/Kconfig
@@ -10,6 +10,7 @@ config DRM_NOUVEAU
select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HELPER
select DRM_KMS_HELPER
+ select DRM_PIXEL_HELPER if DRM_PANIC
select DRM_TTM
select DRM_TTM_HELPER
select DRM_EXEC
diff --git a/drivers/gpu/drm/renesas/rcar-du/Kconfig b/drivers/gpu/drm/renesas/rcar-du/Kconfig
index 80bd770ae0f6..33337ff84c2e 100644
--- a/drivers/gpu/drm/renesas/rcar-du/Kconfig
+++ b/drivers/gpu/drm/renesas/rcar-du/Kconfig
@@ -9,6 +9,7 @@ config DRM_RCAR_DU
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
select DRM_GEM_DMA_HELPER
+ select DRM_PIXEL_HELPER if DRM_PANIC
select VIDEOMODE_HELPERS
help
Choose this option if you have an R-Car chipset.
diff --git a/drivers/gpu/drm/renesas/shmobile/Kconfig b/drivers/gpu/drm/renesas/shmobile/Kconfig
index 52e160464001..dbb86f068499 100644
--- a/drivers/gpu/drm/renesas/shmobile/Kconfig
+++ b/drivers/gpu/drm/renesas/shmobile/Kconfig
@@ -9,6 +9,7 @@ config DRM_SHMOBILE
select DRM_DISPLAY_HELPER
select DRM_BRIDGE_CONNECTOR
select DRM_GEM_DMA_HELPER
+ select DRM_PIXEL_HELPER if DRM_PANIC
select VIDEOMODE_HELPERS
help
Choose this option if you have an SH Mobile chipset.
diff --git a/drivers/gpu/drm/tidss/Kconfig b/drivers/gpu/drm/tidss/Kconfig
index 52a64fa1ad5d..be60ec720544 100644
--- a/drivers/gpu/drm/tidss/Kconfig
+++ b/drivers/gpu/drm/tidss/Kconfig
@@ -8,6 +8,7 @@ config DRM_TIDSS
select DRM_BRIDGE_CONNECTOR
select DRM_GEM_DMA_HELPER
select DRM_PANEL
+ select DRM_PIXEL_HELPER if DRM_PANIC
help
The TI Keystone family SoCs introduced a new generation of
Display SubSystem. There is currently three Keystone family
diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
index fc884fb57b7e..6440a8f39e04 100644
--- a/drivers/gpu/drm/virtio/Kconfig
+++ b/drivers/gpu/drm/virtio/Kconfig
@@ -6,6 +6,7 @@ config DRM_VIRTIO_GPU
select DRM_CLIENT_SELECTION
select DRM_KMS_HELPER
select DRM_GEM_SHMEM_HELPER
+ select DRM_PIXEL_HELPER if DRM_PANIC
select VIRTIO_DMA_SHARED_BUFFER
help
This is the virtual GPU driver for virtio. It can be used with
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 3/4] drm/pixel: Link panic helpers into drm_pixel_helper.ko
2026-10-19 15:32 ` [PATCH 3/4] drm/pixel: Link panic " Thomas Zimmermann
@ 2026-10-19 16:19 ` sashiko-bot
2026-10-19 16:32 ` Thomas Zimmermann
0 siblings, 1 reply; 9+ messages in thread
From: sashiko-bot @ 2026-10-19 16:19 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: dri-devel, linux-hyperv, intel-gfx, imx, virtualization, Frank.Li,
wsa+renesas, Michael S. Tsirkin, Eugenio Perez
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Low] drm: missing DRM_PIXEL_HELPER select in DRM_KMS_HELPER for drm_crtc_init()
- [Low] drm/tests: link failure in drm_panic_helper_test when CONFIG_DRM_PANIC=n
- [Low] drm/xe: missing DRM_PIXEL_HELPER dependency when DRM_PANIC=y
--
commit d010f0f67d242682650aa0651dfd5a1e57612943
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/pixel: Link panic helpers into drm_pixel_helper.ko
This commit moves the DRM panic helpers from drm_kms_helper into
drm_pixel_helper.ko, drops the DRM_PANIC_HELPER Kconfig option, and
selects DRM_PIXEL_HELPER in drivers using the panic helpers.
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 8e4a588e9111d..bf7c599443403 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -46,13 +46,14 @@ config DRM_MIPI_DSI
> config DRM_KMS_HELPER
> tristate
> depends on DRM
> - select DRM_PANIC_HELPER if DRM_PANIC
> help
> CRTC helpers for KMS drivers.
[Severity: Low]
Does DRM_KMS_HELPER also need to select DRM_PIXEL_HELPER if DRM_PANIC?
drivers/gpu/drm/drm_modeset_helper.c is unconditionally compiled into
drm_kms_helper, and its primary_plane_funcs structure (used by
drm_crtc_init()) includes DRM_PANIC_PLANE_FUNCS:
drivers/gpu/drm/drm_modeset_helper.c:
static const struct drm_plane_funcs primary_plane_funcs = {
DRM_PLANE_NON_ATOMIC_FUNCS,
DRM_PANIC_PLANE_FUNCS,
};
When CONFIG_DRM_PANIC is enabled, DRM_PANIC_PLANE_FUNCS expands in
include/drm/drm_panic_helper.h to reference
drm_plane_helper_display_panic_screen, which is now built into
drm_pixel_helper. If CONFIG_DRM_PANIC=y and DRM_KMS_HELPER is enabled
without a matching built-in or modular DRM_PIXEL_HELPER, linking fails
with an undefined reference to drm_plane_helper_display_panic_screen.
[ ... ]
> diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
> index 1afb9cad850f6..4573cad368a28 100644
> --- a/drivers/gpu/drm/Kconfig.debug
> +++ b/drivers/gpu/drm/Kconfig.debug
> @@ -69,7 +69,6 @@ config DRM_KUNIT_TEST
> select DRM_EXPORT_FOR_TESTS if m
> select DRM_GEM_SHMEM_HELPER
> select DRM_KUNIT_TEST_HELPERS
> - select DRM_PANIC_HELPER
> select DRM_PIXEL_HELPER
> select DRM_SYSFB_HELPER
> select PRIME_NUMBERS
[Severity: Low]
Can removing select DRM_PANIC_HELPER from DRM_KUNIT_TEST cause a link
failure when CONFIG_DRM_PANIC is disabled?
With this change, drm_panic_helper.o is only built into drm_pixel_helper
when CONFIG_DRM_PANIC is enabled:
drivers/gpu/drm/Makefile:
drm_pixel_helper-$(CONFIG_DRM_PANIC) += drm_panic_helper.o
However, drivers/gpu/drm/tests/Makefile still builds
drm_panic_helper_test.o unconditionally under obj-$(CONFIG_DRM_KUNIT_TEST),
and functions such as drm_panic_helper_draw_screen_user_default() in
drivers/gpu/drm/tests/drm_panic_helper_test.c call
drm_panic_helper_draw_screen_user(), drm_panic_helper_draw_screen_kmsg(),
drm_panic_helper_set_description(), and
drm_panic_helper_clear_description(). When CONFIG_DRM_KUNIT_TEST is enabled
and CONFIG_DRM_PANIC=n, linking fails with undefined references to those
symbols.
[ ... ]
> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
> index 71426b9c91f00..f698d3c8daa9e 100644
> --- a/drivers/gpu/drm/i915/Kconfig
> +++ b/drivers/gpu/drm/i915/Kconfig
> @@ -19,6 +19,7 @@ config DRM_I915
> select DRM_KMS_HELPER
> select DRM_PANEL
> select DRM_MIPI_DSI
> + select DRM_PIXEL_HELPER if DRM_PANIC
> select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
> select RELAY
> select I2C
[Severity: Low]
Should DRM_XE or DRM_XE_DISPLAY in drivers/gpu/drm/xe/Kconfig also select
DRM_PIXEL_HELPER if DRM_PANIC?
When CONFIG_DRM_XE_DISPLAY=y, drivers/gpu/drm/xe/Makefile compiles
drivers/gpu/drm/i915/display/skl_universal_plane.c into xe.ko, where
skl_plane_funcs, icl_plane_funcs, and tgl_plane_funcs use
DRM_PANIC_PLANE_FUNCS:
drivers/gpu/drm/i915/display/skl_universal_plane.c:
static const struct drm_plane_funcs skl_plane_funcs = {
...
DRM_PANIC_PLANE_FUNCS,
};
If CONFIG_DRM_XE=m, CONFIG_DRM_XE_DISPLAY=y, and CONFIG_DRM_PANIC=y are
enabled while CONFIG_DRM_PIXEL_HELPER=n, modpost fails with an undefined
reference to drm_plane_helper_display_panic_screen in xe.ko.
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019154612.777074-1-tzimmermann@suse.de?part=3
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH 3/4] drm/pixel: Link panic helpers into drm_pixel_helper.ko
2026-10-19 16:19 ` sashiko-bot
@ 2026-10-19 16:32 ` Thomas Zimmermann
0 siblings, 0 replies; 9+ messages in thread
From: Thomas Zimmermann @ 2026-10-19 16:32 UTC (permalink / raw)
To: sashiko-reviews
Cc: dri-devel, linux-hyperv, intel-gfx, imx, virtualization, Frank.Li,
wsa+renesas, Michael S. Tsirkin, Eugenio Perez
Am 19.10.26 um 18:19 schrieb sashiko-bot@kernel.org:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [Low] drm: missing DRM_PIXEL_HELPER select in DRM_KMS_HELPER for drm_crtc_init()
I see this is still an issue. The fix here is to move drm_crtc_init()
into drivers. The only remaining callers of drm_crtc_init() are in
radeon and amdgpu. There was recently a patch to move the helper there,
[1] but the effort appears to have stalled.
[1]
https://lore.kernel.org/dri-devel/20260903071409.427010-1-oushixiong1025@163.com/
I'll do this before continuing with the pixel helpers.
> - [Low] drm/tests: link failure in drm_panic_helper_test when CONFIG_DRM_PANIC=n
> - [Low] drm/xe: missing DRM_PIXEL_HELPER dependency when DRM_PANIC=y
> --
>
> commit d010f0f67d242682650aa0651dfd5a1e57612943
> Author: Thomas Zimmermann <tzimmermann@suse.de>
>
> drm/pixel: Link panic helpers into drm_pixel_helper.ko
>
> This commit moves the DRM panic helpers from drm_kms_helper into
> drm_pixel_helper.ko, drops the DRM_PANIC_HELPER Kconfig option, and
> selects DRM_PIXEL_HELPER in drivers using the panic helpers.
>
>> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
>> index 8e4a588e9111d..bf7c599443403 100644
>> --- a/drivers/gpu/drm/Kconfig
>> +++ b/drivers/gpu/drm/Kconfig
>> @@ -46,13 +46,14 @@ config DRM_MIPI_DSI
>> config DRM_KMS_HELPER
>> tristate
>> depends on DRM
>> - select DRM_PANIC_HELPER if DRM_PANIC
>> help
>> CRTC helpers for KMS drivers.
> [Severity: Low]
> Does DRM_KMS_HELPER also need to select DRM_PIXEL_HELPER if DRM_PANIC?
>
> drivers/gpu/drm/drm_modeset_helper.c is unconditionally compiled into
> drm_kms_helper, and its primary_plane_funcs structure (used by
> drm_crtc_init()) includes DRM_PANIC_PLANE_FUNCS:
>
> drivers/gpu/drm/drm_modeset_helper.c:
> static const struct drm_plane_funcs primary_plane_funcs = {
> DRM_PLANE_NON_ATOMIC_FUNCS,
> DRM_PANIC_PLANE_FUNCS,
> };
>
> When CONFIG_DRM_PANIC is enabled, DRM_PANIC_PLANE_FUNCS expands in
> include/drm/drm_panic_helper.h to reference
> drm_plane_helper_display_panic_screen, which is now built into
> drm_pixel_helper. If CONFIG_DRM_PANIC=y and DRM_KMS_HELPER is enabled
> without a matching built-in or modular DRM_PIXEL_HELPER, linking fails
> with an undefined reference to drm_plane_helper_display_panic_screen.
>
> [ ... ]
>
>> diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
>> index 1afb9cad850f6..4573cad368a28 100644
>> --- a/drivers/gpu/drm/Kconfig.debug
>> +++ b/drivers/gpu/drm/Kconfig.debug
>> @@ -69,7 +69,6 @@ config DRM_KUNIT_TEST
>> select DRM_EXPORT_FOR_TESTS if m
>> select DRM_GEM_SHMEM_HELPER
>> select DRM_KUNIT_TEST_HELPERS
>> - select DRM_PANIC_HELPER
>> select DRM_PIXEL_HELPER
>> select DRM_SYSFB_HELPER
>> select PRIME_NUMBERS
> [Severity: Low]
> Can removing select DRM_PANIC_HELPER from DRM_KUNIT_TEST cause a link
> failure when CONFIG_DRM_PANIC is disabled?
>
> With this change, drm_panic_helper.o is only built into drm_pixel_helper
> when CONFIG_DRM_PANIC is enabled:
>
> drivers/gpu/drm/Makefile:
> drm_pixel_helper-$(CONFIG_DRM_PANIC) += drm_panic_helper.o
>
> However, drivers/gpu/drm/tests/Makefile still builds
> drm_panic_helper_test.o unconditionally under obj-$(CONFIG_DRM_KUNIT_TEST),
> and functions such as drm_panic_helper_draw_screen_user_default() in
> drivers/gpu/drm/tests/drm_panic_helper_test.c call
> drm_panic_helper_draw_screen_user(), drm_panic_helper_draw_screen_kmsg(),
> drm_panic_helper_set_description(), and
> drm_panic_helper_clear_description(). When CONFIG_DRM_KUNIT_TEST is enabled
> and CONFIG_DRM_PANIC=n, linking fails with undefined references to those
> symbols.
>
> [ ... ]
>
>> diff --git a/drivers/gpu/drm/i915/Kconfig b/drivers/gpu/drm/i915/Kconfig
>> index 71426b9c91f00..f698d3c8daa9e 100644
>> --- a/drivers/gpu/drm/i915/Kconfig
>> +++ b/drivers/gpu/drm/i915/Kconfig
>> @@ -19,6 +19,7 @@ config DRM_I915
>> select DRM_KMS_HELPER
>> select DRM_PANEL
>> select DRM_MIPI_DSI
>> + select DRM_PIXEL_HELPER if DRM_PANIC
>> select FB_IOMEM_HELPERS if DRM_FBDEV_EMULATION
>> select RELAY
>> select I2C
> [Severity: Low]
> Should DRM_XE or DRM_XE_DISPLAY in drivers/gpu/drm/xe/Kconfig also select
> DRM_PIXEL_HELPER if DRM_PANIC?
>
> When CONFIG_DRM_XE_DISPLAY=y, drivers/gpu/drm/xe/Makefile compiles
> drivers/gpu/drm/i915/display/skl_universal_plane.c into xe.ko, where
> skl_plane_funcs, icl_plane_funcs, and tgl_plane_funcs use
> DRM_PANIC_PLANE_FUNCS:
>
> drivers/gpu/drm/i915/display/skl_universal_plane.c:
> static const struct drm_plane_funcs skl_plane_funcs = {
> ...
> DRM_PANIC_PLANE_FUNCS,
> };
>
> If CONFIG_DRM_XE=m, CONFIG_DRM_XE_DISPLAY=y, and CONFIG_DRM_PANIC=y are
> enabled while CONFIG_DRM_PIXEL_HELPER=n, modpost fails with an undefined
> reference to drm_plane_helper_display_panic_screen in xe.ko.
>
> [ ... ]
>
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Stefan Gaiser, Jochen Jaser, Abhinav Puri, (HRB 36809, AG Nürnberg)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 4/4] drm/pixel: Link draw helpers into drm_pixel_helper.ko
2026-10-19 15:32 [PATCH 0/4] drm: Move drawing to pixel-helper module Thomas Zimmermann
` (2 preceding siblings ...)
2026-10-19 15:32 ` [PATCH 3/4] drm/pixel: Link panic " Thomas Zimmermann
@ 2026-10-19 15:32 ` Thomas Zimmermann
2026-10-19 16:32 ` sashiko-bot
3 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2026-10-19 15:32 UTC (permalink / raw)
To: jfalempe, maarten.lankhorst, mripard, airlied, simona
Cc: dri-devel, amd-gfx, linux-hyperv, intel-gfx, imx,
linux-arm-kernel, nouveau, linux-renesas-soc, virtualization,
sashiko-reviews, Thomas Zimmermann
Move drm_draw.o from the DRM core to drm_pixel_helper.ko. Remove the
Kconfig option DRM_DRAW and provide the draw helpers unconditionally.
Having draw code in the DRM core is a left-over fro when panic handling
was entirely located in the DRM core as well. With all the panic drawing
in drm_pixel_helper.ko, the drawing helpers can go there as well. DRM's
log clients also uses the drawing helpers for output. Update the Kconfig
rules to select DRM_PIXEL_HELPER instead of DRM_DRAW for this client.
The format and the draw helpers share the per-pixel color-format code
from drm_format_internal. Putting it all into one place will hopefully
help with sharing more code in the future.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
drivers/gpu/drm/Kconfig | 5 -----
drivers/gpu/drm/Makefile | 2 +-
drivers/gpu/drm/clients/Kconfig | 2 +-
drivers/gpu/drm/{drm_draw.c => drm_draw_helper.c} | 0
4 files changed, 2 insertions(+), 7 deletions(-)
rename drivers/gpu/drm/{drm_draw.c => drm_draw_helper.c} (100%)
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index bf7c59944340..1b16e6101a53 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -52,15 +52,10 @@ config DRM_KMS_HELPER
config DRM_PIXEL_HELPER
tristate
depends on DRM
- select DRM_DRAW if DRM_PANIC
select FONT_SUPPORT if DRM_PANIC
help
Helpers for working with pixel data in DRM.
-config DRM_DRAW
- bool
- depends on DRM
-
config DRM_PANIC
bool "Display a user-friendly message when a kernel panic occurs"
depends on DRM && PRINTK
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 18a5a5baf029..ab9eb4c21264 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -91,7 +91,6 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += \
drm_privacy_screen_x86.o
drm-$(CONFIG_DRM_ACCEL) += ../../accel/drm_accel.o
drm-$(CONFIG_DRM_PANIC) += drm_panic.o
-drm-$(CONFIG_DRM_DRAW) += drm_draw.o
drm-$(CONFIG_DRM_RAS) += drm_ras.o drm_ras_nl.o drm_ras_genl_family.o
obj-$(CONFIG_DRM) += drm.o
@@ -100,6 +99,7 @@ obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
drm_pixel_helper-y := \
+ drm_draw_helper.o \
drm_format_helper.o \
drm_pixel_helper_common.o
drm_pixel_helper-$(CONFIG_DRM_PANIC) += drm_panic_helper.o
diff --git a/drivers/gpu/drm/clients/Kconfig b/drivers/gpu/drm/clients/Kconfig
index 6096c623d9d5..8d21edc4cc5b 100644
--- a/drivers/gpu/drm/clients/Kconfig
+++ b/drivers/gpu/drm/clients/Kconfig
@@ -3,6 +3,7 @@
config DRM_CLIENT_LIB
tristate
depends on DRM
+ select DRM_PIXEL_HELPER if DRM_CLIENT_LOG
select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
select FB_CORE if DRM_FBDEV_EMULATION
help
@@ -76,7 +77,6 @@ config DRM_CLIENT_LOG
depends on DRM_CLIENT_SELECTION
select DRM_CLIENT
select DRM_CLIENT_SETUP
- select DRM_DRAW
select FONT_SUPPORT
help
This enable a drm logger, that will print the kernel messages to the
diff --git a/drivers/gpu/drm/drm_draw.c b/drivers/gpu/drm/drm_draw_helper.c
similarity index 100%
rename from drivers/gpu/drm/drm_draw.c
rename to drivers/gpu/drm/drm_draw_helper.c
--
2.56.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH 4/4] drm/pixel: Link draw helpers into drm_pixel_helper.ko
2026-10-19 15:32 ` [PATCH 4/4] drm/pixel: Link draw " Thomas Zimmermann
@ 2026-10-19 16:32 ` sashiko-bot
0 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-10-19 16:32 UTC (permalink / raw)
To: Thomas Zimmermann
Cc: dri-devel, linux-hyperv, intel-gfx, imx, virtualization, Frank.Li,
wsa+renesas, Michael S. Tsirkin, Eugenio Perez
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
- [High] drm: missing DRM_PIXEL_HELPER dependency in DRM_KMS_HELPER
- [Medium] drm/pixel: missing DRM_PIXEL_HELPER select in DRM_ST7920, DRM_XE, and DRM_KMS_HELPER
- [Low] drm/pixel: stale drm_draw.c reference in MAINTAINERS after rename
- [Low] drm: drm_panic_helper.o omitted when DRM_KUNIT_TEST=y and DRM_PANIC=n
--
commit 8f1149ac31f00f33aec39cba3d1477d5b9456a23
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/pixel: Link draw helpers into drm_pixel_helper.ko
This commit moves drm_draw.c (renamed to drm_draw_helper.c) from the DRM
core into drm_pixel_helper.ko, removes the DRM_DRAW Kconfig symbol, and
updates DRM_CLIENT_LIB to select DRM_PIXEL_HELPER when DRM_CLIENT_LOG is
enabled.
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index bf7c599443403..1b16e6101a53a 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -52,15 +52,10 @@ config DRM_KMS_HELPER
> config DRM_PIXEL_HELPER
> tristate
> depends on DRM
> - select DRM_DRAW if DRM_PANIC
> select FONT_SUPPORT if DRM_PANIC
> help
> Helpers for working with pixel data in DRM.
>
> -config DRM_DRAW
> - bool
> - depends on DRM
> -
> config DRM_PANIC
> bool "Display a user-friendly message when a kernel panic occurs"
> depends on DRM && PRINTK
[Severity: High]
With drm_format_helper.o and drm_panic_helper.o moved from drm_kms_helper.ko
into drm_pixel_helper.ko in this series, does DRM_KMS_HELPER in
drivers/gpu/drm/Kconfig also need to select DRM_PIXEL_HELPER?
In drivers/gpu/drm/Makefile, drm_kms_helper.o unconditionally links in
drm_gem_atomic_helper.o and drm_modeset_helper.o.
In drivers/gpu/drm/drm_gem_atomic_helper.c, the shadow plane helpers call
format conversion functions that are now in drm_pixel_helper.ko:
drivers/gpu/drm/drm_gem_atomic_helper.c:__drm_gem_shadow_plane_state_init() {
__drm_atomic_helper_plane_state_init(&shadow_plane_state->base, plane);
drm_format_conv_state_init(&shadow_plane_state->fmtcnv_state);
}
Along with drm_format_conv_state_copy() in
__drm_gem_duplicate_shadow_plane_state() and
drm_format_conv_state_release() in __drm_gem_destroy_shadow_plane_state().
Similarly, in drivers/gpu/drm/drm_modeset_helper.c, primary_plane_funcs uses
DRM_PANIC_PLANE_FUNCS:
static const struct drm_plane_funcs primary_plane_funcs = {
DRM_PLANE_NON_ATOMIC_FUNCS,
DRM_PANIC_PLANE_FUNCS,
};
When CONFIG_DRM_PANIC=y, DRM_PANIC_PLANE_FUNCS references
drm_plane_helper_display_panic_screen(), which is now defined in
drm_panic_helper.c inside drm_pixel_helper.ko.
Without DRM_KMS_HELPER selecting DRM_PIXEL_HELPER, won't configurations with
CONFIG_DRM_KMS_HELPER enabled and CONFIG_DRM_PIXEL_HELPER=n (or
CONFIG_DRM_KMS_HELPER=y and CONFIG_DRM_PIXEL_HELPER=m) fail to link with
undefined references to drm_format_conv_state_init(),
drm_format_conv_state_copy(), drm_format_conv_state_release(), and
drm_plane_helper_display_panic_screen()?
[Severity: Medium]
Are there also a couple of drivers missing a select of DRM_PIXEL_HELPER
after moving the format and panic helpers into drm_pixel_helper.ko?
1. In drivers/gpu/drm/sitronix/Kconfig, DRM_ST7571 and DRM_ST7586 were
updated to select DRM_PIXEL_HELPER, but DRM_ST7920 was not:
config DRM_ST7920
tristate "DRM support for Sitronix ST7920 LCD displays"
depends on DRM && SPI && MMU
select DRM_GEM_SHMEM_HELPER
select DRM_KMS_HELPER
select REGMAP_SPI
However, drivers/gpu/drm/sitronix/st7920.c calls drm_fb_xrgb8888_to_mono()
in st7920_fb_blit_rect() and drm_format_conv_state_reserve() in
st7920_primary_plane_atomic_check(), both of which are in
drm_format_helper.c.
2. In drivers/gpu/drm/xe/Kconfig, neither DRM_XE nor DRM_XE_DISPLAY selects
DRM_PIXEL_HELPER if DRM_PANIC (unlike DRM_I915), even though
drivers/gpu/drm/xe/Makefile compiles i915-display/skl_universal_plane.o
into xe.ko when CONFIG_DRM_XE_DISPLAY=y, which uses DRM_PANIC_PLANE_FUNCS
and references drm_plane_helper_display_panic_screen().
Could these cause link failures when building DRM_ST7920 or DRM_XE without
DRM_PIXEL_HELPER enabled?
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 18a5a5baf0293..ab9eb4c212648 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -91,7 +91,6 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += \
> drm_privacy_screen_x86.o
> drm-$(CONFIG_DRM_ACCEL) += ../../accel/drm_accel.o
> drm-$(CONFIG_DRM_PANIC) += drm_panic.o
> -drm-$(CONFIG_DRM_DRAW) += drm_draw.o
> drm-$(CONFIG_DRM_RAS) += drm_ras.o drm_ras_nl.o drm_ras_genl_family.o
> obj-$(CONFIG_DRM) += drm.o
>
> @@ -100,6 +99,7 @@ obj-$(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS) += drm_panel_orientation_quirks.o
> obj-$(CONFIG_DRM_PANEL_BACKLIGHT_QUIRKS) += drm_panel_backlight_quirks.o
>
> drm_pixel_helper-y := \
> + drm_draw_helper.o \
> drm_format_helper.o \
> drm_pixel_helper_common.o
> drm_pixel_helper-$(CONFIG_DRM_PANIC) += drm_panic_helper.o
[Severity: Low]
What happens when CONFIG_DRM_KUNIT_TEST is enabled while CONFIG_DRM_PANIC=n
(such as with the default drivers/gpu/drm/tests/.kunitconfig)?
In drivers/gpu/drm/tests/Makefile, drm_panic_helper_test.o is built
unconditionally under CONFIG_DRM_KUNIT_TEST, and
drivers/gpu/drm/tests/drm_panic_helper_test.c calls
drm_panic_helper_draw_screen_user(), drm_panic_helper_draw_screen_kmsg(),
drm_panic_helper_set_description(), and
drm_panic_helper_clear_description():
static int drm_panic_helper_draw_screen_user_default(struct drm_scanout_buffer *sb)
{
return drm_panic_helper_draw_screen_user(sb, 0x00ffffff, 0x00000000);
}
Previously, DRM_KUNIT_TEST selected DRM_PANIC_HELPER, which built
drm_panic_helper.o and selected FONT_SUPPORT even when CONFIG_DRM_PANIC=n.
Now that DRM_KUNIT_TEST in drivers/gpu/drm/Kconfig.debug selects
DRM_PIXEL_HELPER instead of DRM_PANIC_HELPER, and drm_panic_helper.o is only
compiled into drm_pixel_helper when CONFIG_DRM_PANIC is enabled (and
DRM_PIXEL_HELPER only selects FONT_SUPPORT if DRM_PANIC), won't building
DRM_KUNIT_TEST with CONFIG_DRM_PANIC=n fail at link time with undefined
references to the drm_panic_helper_* functions?
[ ... ]
> diff --git a/drivers/gpu/drm/drm_draw.c b/drivers/gpu/drm/drm_draw_helper.c
> similarity index 100%
> rename from drivers/gpu/drm/drm_draw.c
> rename to drivers/gpu/drm/drm_draw_helper.c
[Severity: Low]
Should theDRM PANIC entry in MAINTAINERS also be updated to reflect the
rename from drivers/gpu/drm/drm_draw.c to drivers/gpu/drm/drm_draw_helper.c?
DRM PANIC
M: Jocelyn Falempe <jfalempe@redhat.com>
M: Javier Martinez Canillas <javierm@redhat.com>
L: dri-devel@lists.freedesktop.org
S: Supported
T: git https://gitlab.freedesktop.org/drm/misc/kernel.git
F: drivers/gpu/drm/drm_draw.c
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261019154612.777074-1-tzimmermann@suse.de?part=4
^ permalink raw reply [flat|nested] 9+ messages in thread