mbox series

[0/5] drm: Introduce DRM client library

Message ID 20240927144252.31813-1-tzimmermann@suse.de (mailing list archive)
Headers show
Series drm: Introduce DRM client library | expand

Message

Thomas Zimmermann Sept. 27, 2024, 2:37 p.m. UTC
With the next DRM client coming soon (drm_log) and most of DRM's
fbdev emulation consolidated in a few places, it's time to provide
a single place for the clients.

The new module drm_client_lib.ko stores most of the common client
code. It's designed such that drivers can opt into client support,
but the presence of the client module depends on the user's kernel
configuration. Without selected clients, no client module will be
build.

Thomas Zimmermann (5):
  drm/i915: Select DRM_CLIENT_SELECTION
  drm/xe: Select DRM_CLIENT_SELECTION
  drm: Move client-device functions in to drm_client_dev.c
  drm: Select fbdev helpers for modules that require them
  drm: Add client-lib module

 Documentation/gpu/drm-client.rst   |   3 +
 drivers/gpu/drm/Kconfig            |  34 +++++--
 drivers/gpu/drm/Makefile           |  20 +++--
 drivers/gpu/drm/amd/amdgpu/Kconfig |   1 +
 drivers/gpu/drm/drm_client.c       | 122 +------------------------
 drivers/gpu/drm/drm_client_dev.c   | 138 +++++++++++++++++++++++++++++
 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 +
 drivers/gpu/drm/i915/Kconfig       |   1 +
 drivers/gpu/drm/xe/Kconfig         |   1 +
 12 files changed, 196 insertions(+), 132 deletions(-)
 create mode 100644 drivers/gpu/drm/drm_client_dev.c

Comments

Felix Kuehling Sept. 27, 2024, 7:27 p.m. UTC | #1
On 2024-09-27 10:37, Thomas Zimmermann wrote:
> With the next DRM client coming soon (drm_log) and most of DRM's
> fbdev emulation consolidated in a few places, it's time to provide
> a single place for the clients.
>
> The new module drm_client_lib.ko stores most of the common client
> code. It's designed such that drivers can opt into client support,
> but the presence of the client module depends on the user's kernel
> configuration. Without selected clients, no client module will be
> build.
>
> Thomas Zimmermann (5):
>    drm/i915: Select DRM_CLIENT_SELECTION
>    drm/xe: Select DRM_CLIENT_SELECTION

BTW, we are using drm_client in amdgpu, as well: 
https://elixir.bootlin.com/linux/v6.11/source/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c#L155

Regards,
   Felix


>    drm: Move client-device functions in to drm_client_dev.c
>    drm: Select fbdev helpers for modules that require them
>    drm: Add client-lib module
>
>   Documentation/gpu/drm-client.rst   |   3 +
>   drivers/gpu/drm/Kconfig            |  34 +++++--
>   drivers/gpu/drm/Makefile           |  20 +++--
>   drivers/gpu/drm/amd/amdgpu/Kconfig |   1 +
>   drivers/gpu/drm/drm_client.c       | 122 +------------------------
>   drivers/gpu/drm/drm_client_dev.c   | 138 +++++++++++++++++++++++++++++
>   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 +
>   drivers/gpu/drm/i915/Kconfig       |   1 +
>   drivers/gpu/drm/xe/Kconfig         |   1 +
>   12 files changed, 196 insertions(+), 132 deletions(-)
>   create mode 100644 drivers/gpu/drm/drm_client_dev.c
>
Thomas Zimmermann Sept. 30, 2024, 6:19 a.m. UTC | #2
Hi

Am 27.09.24 um 21:27 schrieb Felix Kuehling:
>
> On 2024-09-27 10:37, Thomas Zimmermann wrote:
>> With the next DRM client coming soon (drm_log) and most of DRM's
>> fbdev emulation consolidated in a few places, it's time to provide
>> a single place for the clients.
>>
>> The new module drm_client_lib.ko stores most of the common client
>> code. It's designed such that drivers can opt into client support,
>> but the presence of the client module depends on the user's kernel
>> configuration. Without selected clients, no client module will be
>> build.
>>
>> Thomas Zimmermann (5):
>>    drm/i915: Select DRM_CLIENT_SELECTION
>>    drm/xe: Select DRM_CLIENT_SELECTION
>
> BTW, we are using drm_client in amdgpu, as well: 
> https://elixir.bootlin.com/linux/v6.11/source/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c#L155

Right. Patch 5 selects DRM_CLIENT in the driver's Kconfig item. This 
will prove the plain drm_client code without any of the shared 
implementations (fbdev, log, etc). Unless the user enabled such an 
implementation, of course.

I've tried several combinations of =y and =m settings of these options 
and found this to be working well.

Best regards
Thomas

>
> Regards,
>   Felix
>
>
>>    drm: Move client-device functions in to drm_client_dev.c
>>    drm: Select fbdev helpers for modules that require them
>>    drm: Add client-lib module
>>
>>   Documentation/gpu/drm-client.rst   |   3 +
>>   drivers/gpu/drm/Kconfig            |  34 +++++--
>>   drivers/gpu/drm/Makefile           |  20 +++--
>>   drivers/gpu/drm/amd/amdgpu/Kconfig |   1 +
>>   drivers/gpu/drm/drm_client.c       | 122 +------------------------
>>   drivers/gpu/drm/drm_client_dev.c   | 138 +++++++++++++++++++++++++++++
>>   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 +
>>   drivers/gpu/drm/i915/Kconfig       |   1 +
>>   drivers/gpu/drm/xe/Kconfig         |   1 +
>>   12 files changed, 196 insertions(+), 132 deletions(-)
>>   create mode 100644 drivers/gpu/drm/drm_client_dev.c
>>
Jocelyn Falempe Sept. 30, 2024, 11:46 a.m. UTC | #3
On 27/09/2024 16:37, Thomas Zimmermann wrote:
> With the next DRM client coming soon (drm_log) and most of DRM's
> fbdev emulation consolidated in a few places, it's time to provide
> a single place for the clients.
> 
> The new module drm_client_lib.ko stores most of the common client
> code. It's designed such that drivers can opt into client support,
> but the presence of the client module depends on the user's kernel
> configuration. Without selected clients, no client module will be
> build.

Thanks for this work, I've rebased drm_log on top of this, and it works 
great.

My only nitpick is I would prefer it to be called drm_client.ko, to be a 
little shorter. So that the kernel parameter to change the default 
client can be "drm_client.default=fbdev".

Best regards,
Thomas Zimmermann Sept. 30, 2024, 12:27 p.m. UTC | #4
Hi

Am 30.09.24 um 13:46 schrieb Jocelyn Falempe:
> On 27/09/2024 16:37, Thomas Zimmermann wrote:
>> With the next DRM client coming soon (drm_log) and most of DRM's
>> fbdev emulation consolidated in a few places, it's time to provide
>> a single place for the clients.
>>
>> The new module drm_client_lib.ko stores most of the common client
>> code. It's designed such that drivers can opt into client support,
>> but the presence of the client module depends on the user's kernel
>> configuration. Without selected clients, no client module will be
>> build.
>
> Thanks for this work, I've rebased drm_log on top of this, and it 
> works great.

I got a warning from some CI script about a circular module dependency. 
I need to investigate this before I can merge it, but I'll do soon-ish.

>
> My only nitpick is I would prefer it to be called drm_client.ko, to be 
> a little shorter. So that the kernel parameter to change the default 
> client can be "drm_client.default=fbdev".

Yeah, naming is a bit unfortunate. There's drm_client.o (from 
drm_client.c) already, which would conflict with drm_client.ko. And 
there's no better name for drm_client.c either. Hence drm_client_lib.ko. 
I also thought about drm_client_helper and drm_client_mod. Neither 
seemed better.

Thanks for looking over it.

Best regards
Thomas


>
> Best regards,
>