The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] drm: make panel orientation quirks optional
@ 2026-07-16  6:51 Andrew Zhou
  2026-07-16  6:59 ` Thomas Zimmermann
  2026-08-15  4:13 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Zhou @ 2026-07-16  6:51 UTC (permalink / raw)
  To: dri-devel
  Cc: maarten.lankhorst, mripard, tzimmermann, airlied, simona,
	linux-kernel, 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.

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: make panel orientation quirks optional
  2026-07-16  6:51 [PATCH] drm: make panel orientation quirks optional Andrew Zhou
@ 2026-07-16  6:59 ` Thomas Zimmermann
  2026-08-15  4:13 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Zimmermann @ 2026-07-16  6:59 UTC (permalink / raw)
  To: Andrew Zhou, dri-devel
  Cc: maarten.lankhorst, mripard, airlied, simona, linux-kernel

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)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm: make panel orientation quirks optional
  2026-07-16  6:51 [PATCH] drm: make panel orientation quirks optional Andrew Zhou
  2026-07-16  6:59 ` Thomas Zimmermann
@ 2026-08-15  4:13 ` kernel test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-08-15  4:13 UTC (permalink / raw)
  To: Andrew Zhou, dri-devel
  Cc: oe-kbuild-all, maarten.lankhorst, mripard, tzimmermann, airlied,
	simona, linux-kernel, Andrew Zhou

Hi Andrew,

kernel test robot noticed the following build errors:

[auto build test ERROR on drm-misc/drm-misc-next]
[also build test ERROR on daeinki-drm-exynos/exynos-drm-next drm/drm-next drm-i915/for-linux-next drm-i915/for-linux-next-fixes drm-tip/drm-tip linus/master v7.2-rc7 next-20260813]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Andrew-Zhou/drm-make-panel-orientation-quirks-optional/20260815-090825
base:   https://gitlab.freedesktop.org/drm/misc/kernel.git drm-misc-next
patch link:    https://lore.kernel.org/r/20260716065106.150760-1-zhoulol888%40gmail.com
patch subject: [PATCH] drm: make panel orientation quirks optional
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20260815/202608151239.Mo46Llie-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260815/202608151239.Mo46Llie-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608151239.Mo46Llie-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/drm_panel_orientation_quirks.c:593:5: error: redefinition of 'drm_get_panel_orientation_quirk'
     593 | int drm_get_panel_orientation_quirk(int width, int height)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from drivers/gpu/drm/drm_panel_orientation_quirks.c:15:
   include/drm/drm_utils.h:21:19: note: previous definition of 'drm_get_panel_orientation_quirk' with type 'int(int,  int)'
      21 | static inline int drm_get_panel_orientation_quirk(int width, int height)
         |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/drm_get_panel_orientation_quirk +593 drivers/gpu/drm/drm_panel_orientation_quirks.c

404d1a3edc3873 Hans de Goede 2017-11-25  591  
8a445de79eeaed Andrew Zhou   2026-07-16  592  /* Fallback stub when DMI or the entire quirk module is disabled. */
404d1a3edc3873 Hans de Goede 2017-11-25 @593  int drm_get_panel_orientation_quirk(int width, int height)
404d1a3edc3873 Hans de Goede 2017-11-25  594  {
404d1a3edc3873 Hans de Goede 2017-11-25  595  	return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
404d1a3edc3873 Hans de Goede 2017-11-25  596  }
404d1a3edc3873 Hans de Goede 2017-11-25  597  EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
404d1a3edc3873 Hans de Goede 2017-11-25  598  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-15  4:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-16  6:51 [PATCH] drm: make panel orientation quirks optional Andrew Zhou
2026-07-16  6:59 ` Thomas Zimmermann
2026-08-15  4:13 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox