From: Jocelyn Falempe <jfalempe@redhat.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
simona@ffwll.ch, airlied@gmail.com, javierm@redhat.com
Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm: Add client-lib module
Date: Mon, 30 Sep 2024 13:55:16 +0200 [thread overview]
Message-ID: <d4da8265-5bbc-44fc-95cc-385b6216b47b@redhat.com> (raw)
In-Reply-To: <20240927144252.31813-6-tzimmermann@suse.de>
On 27/09/2024 16:37, Thomas Zimmermann wrote:
> Add drm_client_lib.ko to contain most of the client code. Move the
> existing client for fbdev emulation into the new module. Protect the
> new module behind CONFIG_DRM_CLIENT.
>
> The Kconfig rules separate the DRM drivers from the DRM clients. A
> driver can opt into the default clients, but the user configures
> each client individually. To do so, DRM drivers still select
> DRM_CLIENT_SELECTION. The option is now a tristate that further
> selects all dependencies of the enabled DRM clients. There's
> a menu option for each client. Enabling at least one client also
> selects DRM_CLIENT_SETUP, so that drivers call drm_client_setup().
> New DRM clients should depend on DRM_CLIENT_SELECTION.
>
> The KMS-helper module now exports handful of symbols needed by the
> DRM client library.
>
> There are existing kernel options in drm_fb_helper.o, so leave this
> file in the KMS-helper module for now.
>
> Amdgpu has an internal DRM client, so it has to select DRM_CLIENT by
> itself unconditionally.
Thanks, I found a typo in the Makefile (see below), other than that it
looks good to me.
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
>
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---
> drivers/gpu/drm/Kconfig | 31 ++++++++++++++++++++++++------
> drivers/gpu/drm/Makefile | 19 +++++++++++++-----
> drivers/gpu/drm/amd/amdgpu/Kconfig | 1 +
> drivers/gpu/drm/drm_client.c | 3 +++
> drivers/gpu/drm/drm_dumb_buffers.c | 2 ++
> drivers/gpu/drm/drm_file.c | 2 ++
> drivers/gpu/drm/drm_framebuffer.c | 2 ++
> drivers/gpu/drm/drm_gem.c | 2 ++
> 8 files changed, 51 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 88b2ba55fe16..379fccf3a6ea 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -9,8 +9,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 DRM_KMS_HELPER if DRM_FBDEV_EMULATION
> - select FB_CORE if DRM_FBDEV_EMULATION
> select HDMI
> select I2C
> select DMA_SHARED_BUFFER
> @@ -209,21 +207,40 @@ config DRM_DEBUG_MODESET_LOCK
>
> If in doubt, say "N".
>
> +config DRM_CLIENT
> + tristate
> + depends on DRM
> + help
> + Enables the DRM client-lib module. 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
> + tristate
> depends on DRM
> - select DRM_CLIENT_SETUP if DRM_FBDEV_EMULATION
> + select DRM_CLIENT if DRM_FBDEV_EMULATION
> + select DRM_KMS_HELPER if DRM_FBDEV_EMULATION
> + select FB_CORE if DRM_FBDEV_EMULATION
> help
> Drivers that support in-kernel DRM clients have to select this
> - option.
> + option. It selects all modules and components according to the
> + enabled clients.
>
> config DRM_CLIENT_SETUP
> bool
> depends on DRM_CLIENT_SELECTION
> + help
> + Enables the DRM client selection. DRM drivers that support the
> + default clients should select DRM_CLIENT_SELECTION instead.
> +
> +menu "Supported DRM clients"
> + depends on DRM_CLIENT_SELECTION
>
> config DRM_FBDEV_EMULATION
> bool "Enable legacy fbdev support for your modesetting driver"
> - depends on DRM
> + depends on DRM_CLIENT_SELECTION
> + select DRM_CLIENT_SETUP
> select FRAMEBUFFER_CONSOLE_DETECT_PRIMARY if FRAMEBUFFER_CONSOLE
> default FB
> help
> @@ -262,6 +279,8 @@ config DRM_FBDEV_LEAK_PHYS_SMEM
> If in doubt, say "N" or spread the word to your closed source
> library vendor.
>
> +endmenu
> +
> config DRM_LOAD_EDID_FIRMWARE
> bool "Allow to specify an EDID data set instead of probing for it"
> depends on DRM
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index c50443756457..419208b97f57 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -41,9 +41,7 @@ drm-y := \
> drm_blend.o \
> drm_bridge.o \
> drm_cache.o \
> - drm_client.o \
> drm_client_dev.o \
> - drm_client_modeset.o \
> drm_color_mgmt.o \
> drm_connector.o \
> drm_crtc.o \
> @@ -144,14 +142,25 @@ drm_kms_helper-y := \
> drm_probe_helper.o \
> drm_self_refresh_helper.o \
> drm_simple_kms_helper.o
> -drm_kms_helper-$(CONFIG_DRM_CLIENT_SETUP) += \
> - drm_client_setup.o
> drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
> drm_kms_helper-$(CONFIG_DRM_FBDEV_EMULATION) += \
> - drm_fbdev_client.o \
> drm_fb_helper.o
> +drm_kms_helper-$(CONFIG_DRM_PANEL_BRIDGE) += bridge/panel.o
> obj-$(CONFIG_DRM_KMS_HELPER) += drm_kms_helper.o
>
> +#
> +# DRM clients
> +#
> +
> +drm_client_lib-y := \
> + drm_client.o \
> + drm_client_modeset.o
> +drm_client_lib-$(CONFIG_DRM_CLIENT_SETUP) += \
> + drm_client_setup.o
> +drm_client_lib-$(CONFIG_DRM_FBDEV_EMULATION) += \
> + drm_fbdev_client.o
> +obj-$(CONFIG_DRM_CLIENT) += drm_client_lib.o
> +
> #
> # Drivers and the rest
> #
> 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.c b/drivers/gpu/drm/drm_client.c
> index 549b28a5918c..864ee96e48cf 100644
> --- a/drivers/gpu/drm/drm_client.c
> +++ b/drivers/gpu/drm/drm_client.c
> @@ -490,3 +490,6 @@ int drm_client_framebuffer_flush(struct drm_client_buffer *buffer, struct drm_re
> 0, 0, NULL, 0);
> }
> EXPORT_SYMBOL(drm_client_framebuffer_flush);
> +
> +MODULE_DESCRIPTION("In-kernel DRM clients");
> +MODULE_LICENSE("GPL and additional rights");
> diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c
> index 70032bba1c97..7ed8f05a8d5c 100644
> --- a/drivers/gpu/drm/drm_dumb_buffers.c
> +++ b/drivers/gpu/drm/drm_dumb_buffers.c
> @@ -95,6 +95,7 @@ int drm_mode_create_dumb(struct drm_device *dev,
>
> return dev->driver->dumb_create(file_priv, dev, args);
> }
> +EXPORT_SYMBOL(drm_mode_create_dumb);
>
> int drm_mode_create_dumb_ioctl(struct drm_device *dev,
> void *data, struct drm_file *file_priv)
> @@ -141,6 +142,7 @@ int drm_mode_destroy_dumb(struct drm_device *dev, u32 handle,
>
> return drm_gem_handle_delete(file_priv, handle);
> }
> +EXPORT_SYMBOL(drm_mode_destroy_dumb);
>
> int drm_mode_destroy_dumb_ioctl(struct drm_device *dev,
> void *data, struct drm_file *file_priv)
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 01fde94fe2a9..dd847b574457 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -186,6 +186,7 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
>
> return ERR_PTR(ret);
> }
> +EXPORT_SYMBOL(drm_file_alloc);
>
> static void drm_events_release(struct drm_file *file_priv)
> {
> @@ -261,6 +262,7 @@ void drm_file_free(struct drm_file *file)
> put_pid(rcu_access_pointer(file->pid));
> kfree(file);
> }
> +EXPORT_SYMBOL(drm_file_free);
>
> static void drm_close_helper(struct file *filp)
> {
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 47e6e8577b62..761262529416 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -349,6 +349,7 @@ int drm_mode_addfb2(struct drm_device *dev,
>
> return 0;
> }
> +EXPORT_SYMBOL(drm_mode_addfb2);
>
> int drm_mode_addfb2_ioctl(struct drm_device *dev,
> void *data, struct drm_file *file_priv)
> @@ -473,6 +474,7 @@ int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
>
> return 0;
> }
> +EXPORT_SYMBOL(drm_mode_rmfb);
>
> int drm_mode_rmfb_ioctl(struct drm_device *dev,
> void *data, struct drm_file *file_priv)
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index ee811764c3df..07ae82e35517 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -1191,12 +1191,14 @@ int drm_gem_pin_locked(struct drm_gem_object *obj)
>
> return 0;
> }
> +EXPORT_SYMBOL(drm_gem_pin_locked);
>
> void drm_gem_unpin_locked(struct drm_gem_object *obj)
> {
> if (obj->funcs->unpin)
> obj->funcs->unpin(obj);
> }
> +EXPORT_SYMBOL(drm_gem_unpin_locked);
>
> int drm_gem_pin(struct drm_gem_object *obj)
> {
next prev parent reply other threads:[~2024-09-30 11:55 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 14:37 [PATCH 0/5] drm: Introduce DRM client library Thomas Zimmermann
2024-09-27 14:37 ` [PATCH 1/5] drm/i915: Select DRM_CLIENT_SELECTION Thomas Zimmermann
2024-09-27 14:37 ` [PATCH 2/5] drm/xe: " Thomas Zimmermann
2024-09-27 14:37 ` [PATCH 3/5] drm: Move client-device functions in to drm_client_dev.c Thomas Zimmermann
2024-09-30 11:49 ` Jocelyn Falempe
2024-09-27 14:37 ` [PATCH 4/5] drm: Select fbdev helpers for modules that require them Thomas Zimmermann
2024-09-30 11:49 ` Jocelyn Falempe
2024-09-27 14:37 ` [PATCH 5/5] drm: Add client-lib module Thomas Zimmermann
2024-09-30 11:55 ` Jocelyn Falempe [this message]
2024-09-30 11:56 ` Jocelyn Falempe
2024-09-27 16:19 ` ✓ CI.Patch_applied: success for drm: Introduce DRM client library Patchwork
2024-09-27 16:19 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-27 16:20 ` ✓ CI.KUnit: success " Patchwork
2024-09-27 16:26 ` ✗ CI.Build: failure " Patchwork
2024-09-27 19:27 ` [PATCH 0/5] " Felix Kuehling
2024-09-30 6:19 ` Thomas Zimmermann
2024-09-30 11:46 ` Jocelyn Falempe
2024-09-30 12:27 ` Thomas Zimmermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d4da8265-5bbc-44fc-95cc-385b6216b47b@redhat.com \
--to=jfalempe@redhat.com \
--cc=airlied@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox