RE: [PATCH v3 11/12] drm/client: Make client support optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Intel-xe <intel-xe-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Thomas Zimmermann
Sent: Tuesday, October 8, 2024 5:00 AM
To: simona@xxxxxxxx; airlied@xxxxxxxxx; javierm@xxxxxxxxxx; jfalempe@xxxxxxxxxx
Cc: dri-devel@xxxxxxxxxxxxxxxxxxxxx; amd-gfx@xxxxxxxxxxxxxxxxxxxxx; intel-gfx@xxxxxxxxxxxxxxxxxxxxx; intel-xe@xxxxxxxxxxxxxxxxxxxxx; Thomas Zimmermann <tzimmermann@xxxxxxx>; Alex Deucher <alexander.deucher@xxxxxxx>; Christian König <christian.koenig@xxxxxxx>; Xinhui Pan <Xinhui.Pan@xxxxxxx>
Subject: [PATCH v3 11/12] drm/client: Make client support optional
> 
> 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.
> 
> v3:
> - provide empty drm_client_debugfs_init() if DRM_CLIENT=n (kernel
>   test robot)
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Cc: "Christian König" <christian.koenig@xxxxxxx>
> Cc: Xinhui Pan <Xinhui.Pan@xxxxxxx>

LGTM.

Reviewed-by: Jonathan Cavitt <jonathan.cavitt@xxxxxxxxx>
-Jonathan Cavitt

> ---
>  drivers/gpu/drm/Kconfig            | 10 ++++++++++
>  drivers/gpu/drm/Makefile           |  7 ++++---
>  drivers/gpu/drm/amd/amdgpu/Kconfig |  1 +
>  drivers/gpu/drm/drm_client_event.c |  2 ++
>  drivers/gpu/drm/drm_debugfs.c      |  1 -
>  drivers/gpu/drm/drm_internal.h     |  8 ++++++++
>  include/drm/drm_client.h           |  2 --
>  include/drm/drm_client_event.h     | 13 +++++++++++++
>  8 files changed, 38 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 88c4837d070c..ea1cc924528c 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/drivers/gpu/drm/drm_client_event.c b/drivers/gpu/drm/drm_client_event.c
> index c52e93643672..e303de564485 100644
> --- a/drivers/gpu/drm/drm_client_event.c
> +++ b/drivers/gpu/drm/drm_client_event.c
> @@ -14,6 +14,8 @@
>  #include <drm/drm_drv.h>
>  #include <drm/drm_print.h>
>  
> +#include "drm_internal.h"
> +
>  /**
>   * drm_client_dev_unregister - Unregister clients
>   * @dev: DRM device
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 9d3e6dd68810..5844a9234d9f 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -32,7 +32,6 @@
>  #include <drm/drm_atomic.h>
>  #include <drm/drm_auth.h>
>  #include <drm/drm_bridge.h>
> -#include <drm/drm_client.h>
>  #include <drm/drm_debugfs.h>
>  #include <drm/drm_device.h>
>  #include <drm/drm_drv.h>
> diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h
> index 9af72bab86d1..0bfcba6949b0 100644
> --- a/drivers/gpu/drm/drm_internal.h
> +++ b/drivers/gpu/drm/drm_internal.h
> @@ -48,6 +48,14 @@ struct drm_prime_file_private;
>  struct drm_printer;
>  struct drm_vblank_crtc;
>  
> +/* drm_client_event.c */
> +#if defined(CONFIG_DRM_CLIENT)
> +void drm_client_debugfs_init(struct drm_device *dev);
> +#else
> +static inline void drm_client_debugfs_init(struct drm_device *dev)
> +{ }
> +#endif
> +
>  /* drm_file.c */
>  extern struct mutex drm_global_mutex;
>  bool drm_dev_needs_global_mutex(struct drm_device *dev);
> diff --git a/include/drm/drm_client.h b/include/drm/drm_client.h
> index c03c4b0f3e94..3b13cf29ed55 100644
> --- a/include/drm/drm_client.h
> +++ b/include/drm/drm_client.h
> @@ -236,6 +236,4 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode);
>  	drm_for_each_connector_iter(connector, iter) \
>  		if (connector->connector_type != DRM_MODE_CONNECTOR_WRITEBACK)
>  
> -void drm_client_debugfs_init(struct drm_device *dev);
> -
>  #endif
> 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
> -- 
> 2.46.0
> 
> 




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux