diff mbox series

[48/86] drm/xlnx: Run DRM default client setup

Message ID 20240816125408.310253-49-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:23 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Cc: Michal Simek <michal.simek@amd.com>
---
 drivers/gpu/drm/xlnx/zynqmp_kms.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart Aug. 18, 2024, 8:19 p.m. UTC | #1
Hi Thomas,

Thank you for the patch.

On Fri, Aug 16, 2024 at 02:23:14PM +0200, 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Cc: Michal Simek <michal.simek@amd.com>
> ---
>  drivers/gpu/drm/xlnx/zynqmp_kms.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
> index bd1368df7870..f26b119322d5 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
> @@ -14,6 +14,7 @@
>  #include <drm/drm_blend.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_bridge_connector.h>
> +#include <drm/drm_client_setup.h>
>  #include <drm/drm_connector.h>
>  #include <drm/drm_crtc.h>
>  #include <drm/drm_device.h>
> @@ -402,6 +403,7 @@ static const struct drm_driver zynqmp_dpsub_drm_driver = {
>  					  DRIVER_ATOMIC,
>  
>  	DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(zynqmp_dpsub_dumb_create),
> +	DRM_FBDEV_DMA_DRIVER_OPS,
>  
>  	.fops				= &zynqmp_dpsub_drm_fops,
>  
> @@ -523,7 +525,7 @@ int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
>  		goto err_poll_fini;
>  
>  	/* Initialize fbdev generic emulation. */
> -	drm_fbdev_dma_setup(drm, 24);
> +	drm_client_setup(drm, drm_format_info(DRM_FORMAT_RGB888));

I know this would be a hassle to change, but do the majority of the
callers of drm_client_setup() have a drm_format_info * already, or do
they need to call drm_format_info() on a 4CC ? In the latter case, would
it be better to pass the 4CC to drm_client_setup() ?

As far as this patch goes,

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

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

Am 18.08.24 um 22:19 schrieb Laurent Pinchart:
> Hi Thomas,
>
> Thank you for the patch.
>
> On Fri, Aug 16, 2024 at 02:23:14PM +0200, 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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>> Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
>> Cc: Michal Simek <michal.simek@amd.com>
>> ---
>>   drivers/gpu/drm/xlnx/zynqmp_kms.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> index bd1368df7870..f26b119322d5 100644
>> --- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> +++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
>> @@ -14,6 +14,7 @@
>>   #include <drm/drm_blend.h>
>>   #include <drm/drm_bridge.h>
>>   #include <drm/drm_bridge_connector.h>
>> +#include <drm/drm_client_setup.h>
>>   #include <drm/drm_connector.h>
>>   #include <drm/drm_crtc.h>
>>   #include <drm/drm_device.h>
>> @@ -402,6 +403,7 @@ static const struct drm_driver zynqmp_dpsub_drm_driver = {
>>   					  DRIVER_ATOMIC,
>>   
>>   	DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(zynqmp_dpsub_dumb_create),
>> +	DRM_FBDEV_DMA_DRIVER_OPS,
>>   
>>   	.fops				= &zynqmp_dpsub_drm_fops,
>>   
>> @@ -523,7 +525,7 @@ int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
>>   		goto err_poll_fini;
>>   
>>   	/* Initialize fbdev generic emulation. */
>> -	drm_fbdev_dma_setup(drm, 24);
>> +	drm_client_setup(drm, drm_format_info(DRM_FORMAT_RGB888));
> I know this would be a hassle to change, but do the majority of the
> callers of drm_client_setup() have a drm_format_info * already, or do
> they need to call drm_format_info() on a 4CC ? In the latter case, would
> it be better to pass the 4CC to drm_client_setup() ?

Good idea. Most of the drivers have a 4cc code, but no format-info 
pointer. I think there are enough instances that it makes sense to add a 
little helper, drm_client_setup_with_fourcc(), for these drivers.

There's also preferred_depth from drm_mode_config. It's already used in 
the client mode-setting code. That means that in some drivers, the 
format parameter to drm_client_setup() could likely be dropped.

Best regards
Thomas

>
> As far as this patch goes,
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
>
>>   
>>   	return 0;
>>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/xlnx/zynqmp_kms.c b/drivers/gpu/drm/xlnx/zynqmp_kms.c
index bd1368df7870..f26b119322d5 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_kms.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_kms.c
@@ -14,6 +14,7 @@ 
 #include <drm/drm_blend.h>
 #include <drm/drm_bridge.h>
 #include <drm/drm_bridge_connector.h>
+#include <drm/drm_client_setup.h>
 #include <drm/drm_connector.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_device.h>
@@ -402,6 +403,7 @@  static const struct drm_driver zynqmp_dpsub_drm_driver = {
 					  DRIVER_ATOMIC,
 
 	DRM_GEM_DMA_DRIVER_OPS_WITH_DUMB_CREATE(zynqmp_dpsub_dumb_create),
+	DRM_FBDEV_DMA_DRIVER_OPS,
 
 	.fops				= &zynqmp_dpsub_drm_fops,
 
@@ -523,7 +525,7 @@  int zynqmp_dpsub_drm_init(struct zynqmp_dpsub *dpsub)
 		goto err_poll_fini;
 
 	/* Initialize fbdev generic emulation. */
-	drm_fbdev_dma_setup(drm, 24);
+	drm_client_setup(drm, drm_format_info(DRM_FORMAT_RGB888));
 
 	return 0;