diff mbox series

[RESEND,v4,v4,2/4] drm/vc4: Support nomodeset

Message ID 20211213162635.252582-3-maxime@cerno.tech (mailing list archive)
State New, archived
Headers show
Series drm/vc4: Use the firmware to stop the display pipeline | expand

Commit Message

Maxime Ripard Dec. 13, 2021, 4:26 p.m. UTC
If we have nomodeset on the kernel command line we should have the
firmware framebuffer driver kept as is and not try to load the
full-blown KMS driver.

In this case, let's just register the v3d driver.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

Comments

Javier Martinez Canillas Dec. 14, 2021, 8:30 a.m. UTC | #1
Hello Maxime

On Mon, Dec 13, 2021 at 5:26 PM Maxime Ripard <maxime@cerno.tech> wrote:
>
> If we have nomodeset on the kernel command line we should have the
> firmware framebuffer driver kept as is and not try to load the
> full-blown KMS driver.
>

Patch looks good to me. I just have a question, but I'm OK with either way.

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

> In this case, let's just register the v3d driver.
>

I wonder if the v3d driver should be registered if nomodeset is
present. Most (if not all?) drivers that currently check for this
parameter disable both KMS and DRM. So even when it seems to imply
that's about kernel mode settings, it is also used to disable DRM.

This semantic was never documented and I attempted to do that in
commit b22a15a5aca3 ("Documentation/admin-guide: Document nomodeset
kernel parameter"). After feedback from folks in the list, the text
ended as follows:

```
Disable kernel modesetting. DRM drivers will not perform
display-mode changes or accelerated rendering. Only the
system framebuffer will be available for use if this was
set-up by the firmware or boot loader.

Useful as fallback, or for testing and debugging.
```

So maybe vc4_drm_register() should just return -EINVAL if
(drm_firmware_drivers_only()) like the other drivers do?

Best regards,
Javier
Thomas Zimmermann Dec. 14, 2021, 8:57 a.m. UTC | #2
Hi

Am 14.12.21 um 09:30 schrieb Javier Martinez Canillas:
> Hello Maxime
> 
> On Mon, Dec 13, 2021 at 5:26 PM Maxime Ripard <maxime@cerno.tech> wrote:
>>
>> If we have nomodeset on the kernel command line we should have the
>> firmware framebuffer driver kept as is and not try to load the
>> full-blown KMS driver.
>>
> 
> Patch looks good to me. I just have a question, but I'm OK with either way.
> 
> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
> 
>> In this case, let's just register the v3d driver.
>>
> 
> I wonder if the v3d driver should be registered if nomodeset is
> present. Most (if not all?) drivers that currently check for this
> parameter disable both KMS and DRM. So even when it seems to imply
> that's about kernel mode settings, it is also used to disable DRM.
> 
> This semantic was never documented and I attempted to do that in
> commit b22a15a5aca3 ("Documentation/admin-guide: Document nomodeset
> kernel parameter"). After feedback from folks in the list, the text
> ended as follows:
> 
> ```
> Disable kernel modesetting. DRM drivers will not perform
> display-mode changes or accelerated rendering. Only the
> system framebuffer will be available for use if this was
> set-up by the firmware or boot loader.
> 
> Useful as fallback, or for testing and debugging.
> ```
> 
> So maybe vc4_drm_register() should just return -EINVAL if
> (drm_firmware_drivers_only()) like the other drivers do?

I second this comment. The intention of this test is to disable 
HW-native drivers if something goes wrong with the display.

The function's name drm_firmware_drivers_only() reflects that. The 
parameter is called nomodeset for historical reasons and it's probably a 
terrible name.

So I think the code should call drm_firmware_drivers_only() at the top 
and return an error is it's true. That's what we will do for other 
drivers as well. Maybe rather return -ENODEV; EINVAL mean 'invalid 
argument'.

Best regards
Thomas


> 
> Best regards,
> Javier
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 16abc3a3d601..12694e2201e7 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -357,12 +357,22 @@  static int __init vc4_drm_register(void)
 {
 	int ret;
 
-	ret = platform_register_drivers(component_drivers,
-					ARRAY_SIZE(component_drivers));
-	if (ret)
-		return ret;
+	if (!drm_firmware_drivers_only()) {
+		ret = platform_register_drivers(component_drivers,
+						ARRAY_SIZE(component_drivers));
+		if (ret)
+			return ret;
 
-	return platform_driver_register(&vc4_platform_driver);
+		ret = platform_driver_register(&vc4_platform_driver);
+		if (ret)
+			return ret;
+	} else {
+		ret = platform_driver_register(&vc4_v3d_driver);
+		if (ret)
+			return ret;
+	}
+
+	return 0;
 }
 
 static void __exit vc4_drm_unregister(void)