diff mbox series

[v2,01/10] drm/client: Test for connectors before sending hotplug event

Message ID 20230124134010.30263-2-tzimmermann@suse.de (mailing list archive)
State Accepted
Commit c2bb3be64eb7182285846123219230375af61abd
Headers show
Series drm/fb-helper: Various cleanups | expand

Commit Message

Thomas Zimmermann Jan. 24, 2023, 1:40 p.m. UTC
Test for connectors in the client code and remove a similar test
from the generic fbdev emulation. Do nothing if the test fails.
Not having connectors indicates a driver bug.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
---
 drivers/gpu/drm/drm_client.c        | 5 +++++
 drivers/gpu/drm/drm_fbdev_generic.c | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Javier Martinez Canillas Jan. 25, 2023, 8:30 a.m. UTC | #1
Hello Thomas,

On 1/24/23 14:40, Thomas Zimmermann wrote:
> Test for connectors in the client code and remove a similar test
> from the generic fbdev emulation. Do nothing if the test fails.
> Not having connectors indicates a driver bug.
> 
> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

but I've a question below.

>  drivers/gpu/drm/drm_client.c        | 5 +++++
>  drivers/gpu/drm/drm_fbdev_generic.c | 5 -----
>  2 files changed, 5 insertions(+), 5 deletions(-)

[...]

> --- a/drivers/gpu/drm/drm_fbdev_generic.c
> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
> @@ -389,11 +389,6 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client)
>  	if (dev->fb_helper)
>  		return drm_fb_helper_hotplug_event(dev->fb_helper);
>  
> -	if (!dev->mode_config.num_connector) {
> -		drm_dbg_kms(dev, "No connectors found, will not create framebuffer!\n");
> -		return 0;
> -	}
> -

What about the following code snippet:

	if (!drm_drv_uses_atomic_modeset(dev))
		drm_helper_disable_unused_functions(dev);

that seems to be something that should be in the core client dev hotplug
as well, since it isn't specific to the fbdev emulation client ?
Thomas Zimmermann Jan. 25, 2023, 2:04 p.m. UTC | #2
Hi

Am 25.01.23 um 09:30 schrieb Javier Martinez Canillas:
> Hello Thomas,
> 
> On 1/24/23 14:40, Thomas Zimmermann wrote:
>> Test for connectors in the client code and remove a similar test
>> from the generic fbdev emulation. Do nothing if the test fails.
>> Not having connectors indicates a driver bug.
>>
>> Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
>> ---
> 
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> 
> but I've a question below.
> 
>>   drivers/gpu/drm/drm_client.c        | 5 +++++
>>   drivers/gpu/drm/drm_fbdev_generic.c | 5 -----
>>   2 files changed, 5 insertions(+), 5 deletions(-)
> 
> [...]
> 
>> --- a/drivers/gpu/drm/drm_fbdev_generic.c
>> +++ b/drivers/gpu/drm/drm_fbdev_generic.c
>> @@ -389,11 +389,6 @@ static int drm_fbdev_client_hotplug(struct drm_client_dev *client)
>>   	if (dev->fb_helper)
>>   		return drm_fb_helper_hotplug_event(dev->fb_helper);
>>   
>> -	if (!dev->mode_config.num_connector) {
>> -		drm_dbg_kms(dev, "No connectors found, will not create framebuffer!\n");
>> -		return 0;
>> -	}
>> -
> 
> What about the following code snippet:
> 
> 	if (!drm_drv_uses_atomic_modeset(dev))
> 		drm_helper_disable_unused_functions(dev);
> 
> that seems to be something that should be in the core client dev hotplug
> as well, since it isn't specific to the fbdev emulation client ?

That's in the middle of the initial probing code and disables pipeline 
elements in non-atomic modesetting. TBH I don't dare to move it around. 
If we ever have other clients, we can attempt the put it into the client.

Best regards
Thomas


>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c
index 262ec64d4397..09ac191c202d 100644
--- a/drivers/gpu/drm/drm_client.c
+++ b/drivers/gpu/drm/drm_client.c
@@ -198,6 +198,11 @@  void drm_client_dev_hotplug(struct drm_device *dev)
 	if (!drm_core_check_feature(dev, DRIVER_MODESET))
 		return;
 
+	if (!dev->mode_config.num_connector) {
+		drm_dbg_kms(dev, "No connectors found, will not send hotplug events!\n");
+		return;
+	}
+
 	mutex_lock(&dev->clientlist_mutex);
 	list_for_each_entry(client, &dev->clientlist, list) {
 		if (!client->funcs || !client->funcs->hotplug)
diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c
index 0a4c160e0e58..3d455a2e3fb5 100644
--- a/drivers/gpu/drm/drm_fbdev_generic.c
+++ b/drivers/gpu/drm/drm_fbdev_generic.c
@@ -389,11 +389,6 @@  static int drm_fbdev_client_hotplug(struct drm_client_dev *client)
 	if (dev->fb_helper)
 		return drm_fb_helper_hotplug_event(dev->fb_helper);
 
-	if (!dev->mode_config.num_connector) {
-		drm_dbg_kms(dev, "No connectors found, will not create framebuffer!\n");
-		return 0;
-	}
-
 	drm_fb_helper_prepare(dev, fb_helper, &drm_fb_helper_generic_funcs);
 
 	ret = drm_fb_helper_init(dev, fb_helper);