drivers/gpu/drm/Kconfig | 14 ++++++++++++-- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++-- include/drm/drm_utils.h | 8 ++++++++ 3 files changed, 24 insertions(+), 4 deletions(-)
DRM currently selects DRM_PANEL_ORIENTATION_QUIRKS unconditionally,
forcing all DRM users to compile embedded LCD panel quirk detection.
This is unnecessary on desktop and server systems with external
monitors.
Add a static inline stub in drm_utils.h that returns
DRM_MODE_PANEL_ORIENTATION_UNKNOWN when the option is disabled,
and make the Kconfig option user-visible with a description.
Compile-tested with CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y and =n.
Boot-tested in QEMU with TinyCorePure64.
Signed-off-by: Andrew Zhou <zhoulol888@gmail.com>
---
drivers/gpu/drm/Kconfig | 14 ++++++++++++--
drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++--
include/drm/drm_utils.h | 8 ++++++++
3 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 323422861e8f..da4ac94bbf61 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -8,7 +8,6 @@
menuconfig DRM
tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
- select DRM_PANEL_ORIENTATION_QUIRKS
select HDMI
select I2C
select DMA_SHARED_BUFFER
@@ -369,4 +368,15 @@ endif
# Separate option because drm_panel_orientation_quirks.c is shared with fbdev
config DRM_PANEL_ORIENTATION_QUIRKS
- tristate
+ tristate "Panel orientation quirks for DMI-based detection"
+ depends on DRM
+ help
+ Enable DMI-based quirk detection for devices where the
+ built-in LCD panel is mounted in a non-standard orientation
+ relative to the casing (e.g., handheld PCs, tablets).
+
+ This allows userspace to automatically rotate the display
+ to match the physical orientation of the device.
+
+ Desktop and server systems with external monitors do not
+ need this. If unsure, say N.
diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
index 3a218fb592ce..fb09078a831a 100644
--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
+++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
@@ -14,7 +14,7 @@
#include <drm/drm_connector.h>
#include <drm/drm_utils.h>
-#ifdef CONFIG_DMI
+#if defined(CONFIG_DMI) && defined(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS)
/*
* Some x86 clamshell design devices use portrait tablet screens and a display
@@ -589,7 +589,7 @@ EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
#else
-/* There are no quirks for non x86 devices yet */
+/* Fallback stub when DMI or the entire quirk module is disabled. */
int drm_get_panel_orientation_quirk(int width, int height)
{
return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
@@ -598,5 +598,7 @@ EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
#endif
+#ifdef CONFIG_DRM_PANEL_ORIENTATION_QUIRKS
MODULE_DESCRIPTION("Quirks for non-normal panel orientation");
MODULE_LICENSE("Dual MIT/GPL");
+#endif
diff --git a/include/drm/drm_utils.h b/include/drm/drm_utils.h
index 6a46f755daba..947b8e71260e 100644
--- a/include/drm/drm_utils.h
+++ b/include/drm/drm_utils.h
@@ -11,10 +11,18 @@
#define __DRM_UTILS_H__
#include <linux/types.h>
+#include <drm/drm_connector.h>
struct drm_edid;
+#ifdef CONFIG_DRM_PANEL_ORIENTATION_QUIRKS
int drm_get_panel_orientation_quirk(int width, int height);
+#else
+static inline int drm_get_panel_orientation_quirk(int width, int height)
+{
+ return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
+}
+#endif
struct drm_panel_backlight_quirk {
u16 min_brightness;
--
2.54.0
Hi
Am 16.07.26 um 08:51 schrieb Andrew Zhou:
> DRM currently selects DRM_PANEL_ORIENTATION_QUIRKS unconditionally,
> forcing all DRM users to compile embedded LCD panel quirk detection.
> This is unnecessary on desktop and server systems with external
> monitors.
>
> Add a static inline stub in drm_utils.h that returns
> DRM_MODE_PANEL_ORIENTATION_UNKNOWN when the option is disabled,
> and make the Kconfig option user-visible with a description.
>
> Compile-tested with CONFIG_DRM_PANEL_ORIENTATION_QUIRKS=y and =n.
> Boot-tested in QEMU with TinyCorePure64.
NAK. We also need these quirks on desktops, and disabling error
workarounds makes little sense IMHO.
Best regards
Thomas
>
> Signed-off-by: Andrew Zhou <zhoulol888@gmail.com>
> ---
> drivers/gpu/drm/Kconfig | 14 ++++++++++++--
> drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++--
> include/drm/drm_utils.h | 8 ++++++++
> 3 files changed, 24 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 323422861e8f..da4ac94bbf61 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -8,7 +8,6 @@
> menuconfig DRM
> tristate "Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)"
> depends on (AGP || AGP=n) && !EMULATED_CMPXCHG && HAS_DMA
> - select DRM_PANEL_ORIENTATION_QUIRKS
> select HDMI
> select I2C
> select DMA_SHARED_BUFFER
> @@ -369,4 +368,15 @@ endif
>
> # Separate option because drm_panel_orientation_quirks.c is shared with fbdev
> config DRM_PANEL_ORIENTATION_QUIRKS
> - tristate
> + tristate "Panel orientation quirks for DMI-based detection"
> + depends on DRM
> + help
> + Enable DMI-based quirk detection for devices where the
> + built-in LCD panel is mounted in a non-standard orientation
> + relative to the casing (e.g., handheld PCs, tablets).
> +
> + This allows userspace to automatically rotate the display
> + to match the physical orientation of the device.
> +
> + Desktop and server systems with external monitors do not
> + need this. If unsure, say N.
> diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> index 3a218fb592ce..fb09078a831a 100644
> --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
> +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
> @@ -14,7 +14,7 @@
> #include <drm/drm_connector.h>
> #include <drm/drm_utils.h>
>
> -#ifdef CONFIG_DMI
> +#if defined(CONFIG_DMI) && defined(CONFIG_DRM_PANEL_ORIENTATION_QUIRKS)
>
> /*
> * Some x86 clamshell design devices use portrait tablet screens and a display
> @@ -589,7 +589,7 @@ EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
>
> #else
>
> -/* There are no quirks for non x86 devices yet */
> +/* Fallback stub when DMI or the entire quirk module is disabled. */
> int drm_get_panel_orientation_quirk(int width, int height)
> {
> return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> @@ -598,5 +598,7 @@ EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
>
> #endif
>
> +#ifdef CONFIG_DRM_PANEL_ORIENTATION_QUIRKS
> MODULE_DESCRIPTION("Quirks for non-normal panel orientation");
> MODULE_LICENSE("Dual MIT/GPL");
> +#endif
> diff --git a/include/drm/drm_utils.h b/include/drm/drm_utils.h
> index 6a46f755daba..947b8e71260e 100644
> --- a/include/drm/drm_utils.h
> +++ b/include/drm/drm_utils.h
> @@ -11,10 +11,18 @@
> #define __DRM_UTILS_H__
>
> #include <linux/types.h>
> +#include <drm/drm_connector.h>
>
> struct drm_edid;
>
> +#ifdef CONFIG_DRM_PANEL_ORIENTATION_QUIRKS
> int drm_get_panel_orientation_quirk(int width, int height);
> +#else
> +static inline int drm_get_panel_orientation_quirk(int width, int height)
> +{
> + return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
> +}
> +#endif
>
> struct drm_panel_backlight_quirk {
> u16 min_brightness;
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
© 2016 - 2026 Red Hat, Inc.