diff mbox series

[v2,10/11] drm/client: Make client support optional

Message ID 20241002131306.288618-11-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Introduce DRM client library | expand

Commit Message

Thomas Zimmermann Oct. 2, 2024, 1:04 p.m. UTC
Only build client code if DRM_CLIENT has been selected. Automatially
do so if one of the default clients has been enabled. If client support
has been disabled, the helpers for client-related events are empty and
the regular client functions are not present.

Amdgpu has an internal DRM client, so it has to select DRM_CLIENT by
itself unconditionally.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Xinhui Pan <Xinhui.Pan@amd.com>
---
 drivers/gpu/drm/Kconfig            | 10 ++++++++++
 drivers/gpu/drm/Makefile           |  7 ++++---
 drivers/gpu/drm/amd/amdgpu/Kconfig |  1 +
 include/drm/drm_client_event.h     | 13 +++++++++++++
 4 files changed, 28 insertions(+), 3 deletions(-)

Comments

kernel test robot Oct. 5, 2024, 1:34 a.m. UTC | #1
Hi Thomas,

kernel test robot noticed the following build errors:

[auto build test ERROR on next-20241002]
[cannot apply to drm-xe/drm-xe-next drm/drm-next drm-exynos/exynos-drm-next drm-intel/for-linux-next drm-intel/for-linux-next-fixes drm-misc/drm-misc-next drm-tip/drm-tip linus/master v6.12-rc1 v6.11 v6.11-rc7 v6.12-rc1]
[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/Thomas-Zimmermann/drm-i915-Select-DRM_CLIENT_SELECTION/20241002-211520
base:   next-20241002
patch link:    https://lore.kernel.org/r/20241002131306.288618-11-tzimmermann%40suse.de
patch subject: [PATCH v2 10/11] drm/client: Make client support optional
config: nios2-randconfig-r051-20241005 (https://download.01.org/0day-ci/archive/20241005/202410050927.Hgk0Kazl-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241005/202410050927.Hgk0Kazl-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/202410050927.Hgk0Kazl-lkp@intel.com/

All errors (new ones prefixed by >>):

   nios2-linux-ld: drivers/gpu/drm/drm_debugfs.o: in function `drm_debugfs_dev_register':
>> drivers/gpu/drm/drm_debugfs.c:313:(.text+0x1240): undefined reference to `drm_client_debugfs_init'
>> drivers/gpu/drm/drm_debugfs.c:313:(.text+0x1240): relocation truncated to fit: R_NIOS2_CALL26 against `drm_client_debugfs_init'

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for GET_FREE_REGION
   Depends on [n]: SPARSEMEM [=n]
   Selected by [y]:
   - RESOURCE_KUNIT_TEST [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]


vim +313 drivers/gpu/drm/drm_debugfs.c

0b30d57acafcaa Christian König  2023-08-29  306  
0b30d57acafcaa Christian König  2023-08-29  307  void drm_debugfs_dev_register(struct drm_device *dev)
0b30d57acafcaa Christian König  2023-08-29  308  {
0b30d57acafcaa Christian König  2023-08-29  309  	drm_debugfs_add_files(dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES);
0b30d57acafcaa Christian König  2023-08-29  310  
0b30d57acafcaa Christian König  2023-08-29  311  	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
0b30d57acafcaa Christian König  2023-08-29  312  		drm_framebuffer_debugfs_init(dev);
0b30d57acafcaa Christian König  2023-08-29 @313  		drm_client_debugfs_init(dev);
0b30d57acafcaa Christian König  2023-08-29  314  	}
d0b3c318e04cc6 Dmitry Baryshkov 2023-12-03  315  	if (drm_drv_uses_atomic_modeset(dev))
0b30d57acafcaa Christian König  2023-08-29  316  		drm_atomic_debugfs_init(dev);
0b30d57acafcaa Christian König  2023-08-29  317  }
0b30d57acafcaa Christian König  2023-08-29  318
diff mbox series

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 88b2ba55fe16..86e5b0194100 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -209,6 +209,15 @@  config DRM_DEBUG_MODESET_LOCK
 
 	  If in doubt, say "N".
 
+config DRM_CLIENT
+	bool
+	depends on DRM
+	help
+	  Enables support for DRM clients. DRM drivers that need
+	  struct drm_client_dev and its interfaces should select this
+	  option. Drivers that support the default clients should
+	  select DRM_CLIENT_SELECTION instead.
+
 config DRM_CLIENT_SELECTION
 	bool
 	depends on DRM
@@ -224,6 +233,7 @@  config DRM_CLIENT_SETUP
 config DRM_FBDEV_EMULATION
 	bool "Enable legacy fbdev support for your modesetting driver"
 	depends on DRM
+	select DRM_CLIENT
 	select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
 	default FB
 	help
diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
index 6b7d168ca790..c3e5d353588e 100644
--- a/drivers/gpu/drm/Makefile
+++ b/drivers/gpu/drm/Makefile
@@ -41,9 +41,6 @@  drm-y := \
 	drm_blend.o \
 	drm_bridge.o \
 	drm_cache.o \
-	drm_client.o \
-	drm_client_event.o \
-	drm_client_modeset.o \
 	drm_color_mgmt.o \
 	drm_connector.o \
 	drm_crtc.o \
@@ -77,6 +74,10 @@  drm-y := \
 	drm_vblank_work.o \
 	drm_vma_manager.o \
 	drm_writeback.o
+drm-$(CONFIG_DRM_CLIENT) += \
+	drm_client.o \
+	drm_client_event.o \
+	drm_client_modeset.o
 drm-$(CONFIG_DRM_LIB_RANDOM) += lib/drm_random.o
 drm-$(CONFIG_COMPAT) += drm_ioc32.o
 drm-$(CONFIG_DRM_PANEL) += drm_panel.o
diff --git a/drivers/gpu/drm/amd/amdgpu/Kconfig b/drivers/gpu/drm/amd/amdgpu/Kconfig
index 680a94c361ba..41fa3377d9cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/Kconfig
+++ b/drivers/gpu/drm/amd/amdgpu/Kconfig
@@ -5,6 +5,7 @@  config DRM_AMDGPU
 	depends on DRM && PCI && MMU
 	depends on !UML
 	select FW_LOADER
+	select DRM_CLIENT
 	select DRM_CLIENT_SELECTION
 	select DRM_DISPLAY_DP_HELPER
 	select DRM_DISPLAY_DSC_HELPER
diff --git a/include/drm/drm_client_event.h b/include/drm/drm_client_event.h
index 72c97d111169..99863554b055 100644
--- a/include/drm/drm_client_event.h
+++ b/include/drm/drm_client_event.h
@@ -5,10 +5,23 @@ 
 
 struct drm_device;
 
+#if defined(CONFIG_DRM_CLIENT)
 void drm_client_dev_unregister(struct drm_device *dev);
 void drm_client_dev_hotplug(struct drm_device *dev);
 void drm_client_dev_restore(struct drm_device *dev);
 void drm_client_dev_suspend(struct drm_device *dev, bool holds_console_lock);
 void drm_client_dev_resume(struct drm_device *dev, bool holds_console_lock);
+#else
+static inline void drm_client_dev_unregister(struct drm_device *dev)
+{ }
+static inline void drm_client_dev_hotplug(struct drm_device *dev)
+{ }
+static inline void drm_client_dev_restore(struct drm_device *dev)
+{ }
+static inline void drm_client_dev_suspend(struct drm_device *dev, bool holds_console_lock)
+{ }
+static inline void drm_client_dev_resume(struct drm_device *dev, bool holds_console_lock)
+{ }
+#endif
 
 #endif