diff mbox series

[28/86] drm/mi0283qt: Run DRM default client setup

Message ID 20240816125408.310253-29-tzimmermann@suse.de (mailing list archive)
State New, archived
Headers show
Series drm: Provide client setup helper and convert drivers | expand

Commit Message

Thomas Zimmermann Aug. 16, 2024, 12:22 p.m. UTC
Call drm_client_setup() to run the kernel's default client setup
for DRM. Set fbdev_probe in struct drm_driver, so that the client
setup can start the common fbdev client.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Cc: "Noralf Trønnes" <noralf@tronnes.org>
---
 drivers/gpu/drm/tiny/mi0283qt.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Noralf Trønnes Aug. 16, 2024, 4:01 p.m. UTC | #1
On 8/16/24 14:22, Thomas Zimmermann wrote:
> Call drm_client_setup() to run the kernel's default client setup
> for DRM. Set fbdev_probe in struct drm_driver, so that the client
> setup can start the common fbdev client.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---
>  drivers/gpu/drm/tiny/mi0283qt.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
> index cdc5423990ca..f1461c55dba6 100644
> --- a/drivers/gpu/drm/tiny/mi0283qt.c
> +++ b/drivers/gpu/drm/tiny/mi0283qt.c

<snip>

> @@ -226,7 +228,7 @@ static int mi0283qt_probe(struct spi_device *spi)
>  
>  	spi_set_drvdata(spi, drm);
>  
> -	drm_fbdev_dma_setup(drm, 0);
> +	drm_client_setup(drm, NULL);

Would it be possible for drm_dev_register() to handle the client setup
so drivers won't have to? struct drm_driver could have a field for
drivers that want a different color format.

Noralf.

>  
>  	return 0;
>  }
Thomas Zimmermann Aug. 20, 2024, 7:30 a.m. UTC | #2
Hi

Am 16.08.24 um 18:01 schrieb Noralf Trønnes:
>
> On 8/16/24 14:22, Thomas Zimmermann wrote:
>> Call drm_client_setup() to run the kernel's default client setup
>> for DRM. Set fbdev_probe in struct drm_driver, so that the client
>> setup can start the common fbdev client.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> Cc: "Noralf Trønnes" <noralf@tronnes.org>
>> ---
>>   drivers/gpu/drm/tiny/mi0283qt.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
>> index cdc5423990ca..f1461c55dba6 100644
>> --- a/drivers/gpu/drm/tiny/mi0283qt.c
>> +++ b/drivers/gpu/drm/tiny/mi0283qt.c
> <snip>
>
>> @@ -226,7 +228,7 @@ static int mi0283qt_probe(struct spi_device *spi)
>>   
>>   	spi_set_drvdata(spi, drm);
>>   
>> -	drm_fbdev_dma_setup(drm, 0);
>> +	drm_client_setup(drm, NULL);
> Would it be possible for drm_dev_register() to handle the client setup
> so drivers won't have to? struct drm_driver could have a field for
> drivers that want a different color format.

There's drm_mode_config.preferred_depth, which at least serves this 
purpose to some extend.

I briefly considered using drm_dev_register() while making the patches, 
but then decided against it. In terms of design, functions should only 
do one thing. In practical terms, there is at least one driver author 
that explicitly decided against instantiating clients in the driver 
(sprd IIRC). And there is at least one driver where client format and 
preferred_depth are different (vc4).

But hopefully this series is the final major interface rework of this 
kind and later changes can be done within drm_client_setup() or 
incrementally.

Best regards
Thomas

>
> Noralf.
>
>>   
>>   	return 0;
>>   }
Noralf Trønnes Aug. 20, 2024, 8:25 a.m. UTC | #3
On 8/16/24 14:22, Thomas Zimmermann wrote:
> Call drm_client_setup() to run the kernel's default client setup
> for DRM. Set fbdev_probe in struct drm_driver, so that the client
> setup can start the common fbdev client.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> ---

Acked-by: Noralf Trønnes <noralf@tronnes.org>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index cdc5423990ca..f1461c55dba6 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -14,6 +14,7 @@ 
 #include <linux/spi/spi.h>
 
 #include <drm/drm_atomic_helper.h>
+#include <drm/drm_client_setup.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fbdev_dma.h>
 #include <drm/drm_gem_atomic_helper.h>
@@ -154,6 +155,7 @@  static const struct drm_driver mi0283qt_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &mi0283qt_fops,
 	DRM_GEM_DMA_DRIVER_OPS_VMAP,
+	DRM_FBDEV_DMA_DRIVER_OPS,
 	.debugfs_init		= mipi_dbi_debugfs_init,
 	.name			= "mi0283qt",
 	.desc			= "Multi-Inno MI0283QT",
@@ -226,7 +228,7 @@  static int mi0283qt_probe(struct spi_device *spi)
 
 	spi_set_drvdata(spi, drm);
 
-	drm_fbdev_dma_setup(drm, 0);
+	drm_client_setup(drm, NULL);
 
 	return 0;
 }