diff mbox series

[v3,2/3] drm/vc4: Remove conflicting framebuffers before callind bind_all

Message ID 20211213092503.57379-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, 9:25 a.m. UTC
The bind hooks will modify their controller registers, so simplefb is
going to be unusable anyway. Let's avoid any transient state where it
could still be in the system but no longer functionnal.

Acked-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_drv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Thomas Zimmermann Dec. 13, 2021, 9:47 a.m. UTC | #1
Hi Maxime

Am 13.12.21 um 10:25 schrieb Maxime Ripard:
> The bind hooks will modify their controller registers, so simplefb is
> going to be unusable anyway. Let's avoid any transient state where it
> could still be in the system but no longer functionnal.
> 
> Acked-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---
>   drivers/gpu/drm/vc4/vc4_drv.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
> index 16abc3a3d601..8ab89f805826 100644
> --- a/drivers/gpu/drm/vc4/vc4_drv.c
> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
> @@ -251,6 +251,10 @@ static int vc4_drm_bind(struct device *dev)

Since you work on this, I'd like to suggest to call 
drm_firmware_drivers_only() at the very top of this function. It's our 
new interface for the kernel's nomodeset argument. If it returns false, 
the user has disabled native drivers for this boot. The generic DRM 
driver will continue to run the device.

>   	if (ret)
>   		return ret;
>   
> +	ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
> +	if (ret)
> +		return ret;
> +

There's quite a bit of work being done before calling this function. 
None of it is allowed to touch HW.

Is that reliable? If so, the code is fine, otherwise the call should go 
to the top of the function.

Best regards
Thomas

>   	ret = component_bind_all(dev, drm);
>   	if (ret)
>   		return ret;
> @@ -259,10 +263,6 @@ static int vc4_drm_bind(struct device *dev)
>   	if (ret)
>   		goto unbind_all;
>   
> -	ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
> -	if (ret)
> -		goto unbind_all;
> -
>   	ret = vc4_kms_load(drm);
>   	if (ret < 0)
>   		goto unbind_all;
>
Thomas Zimmermann Dec. 13, 2021, 9:51 a.m. UTC | #2
Am 13.12.21 um 10:47 schrieb Thomas Zimmermann:
> Hi Maxime
> 
> Am 13.12.21 um 10:25 schrieb Maxime Ripard:
>> The bind hooks will modify their controller registers, so simplefb is
>> going to be unusable anyway. Let's avoid any transient state where it
>> could still be in the system but no longer functionnal.
>>
>> Acked-by: Nicolas Saenz Julienne <nsaenz@kernel.org>
>> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
>> ---
>>   drivers/gpu/drm/vc4/vc4_drv.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vc4/vc4_drv.c 
>> b/drivers/gpu/drm/vc4/vc4_drv.c
>> index 16abc3a3d601..8ab89f805826 100644
>> --- a/drivers/gpu/drm/vc4/vc4_drv.c
>> +++ b/drivers/gpu/drm/vc4/vc4_drv.c
>> @@ -251,6 +251,10 @@ static int vc4_drm_bind(struct device *dev)
> 
> Since you work on this, I'd like to suggest to call 
> drm_firmware_drivers_only() at the very top of this function. It's our 
> new interface for the kernel's nomodeset argument. If it returns false, 

s/false/true

> the user has disabled native drivers for this boot. The generic DRM 
> driver will continue to run the device.
> 
>>       if (ret)
>>           return ret;
>> +    ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
>> +    if (ret)
>> +        return ret;
>> +
> 
> There's quite a bit of work being done before calling this function. 
> None of it is allowed to touch HW.
> 
> Is that reliable? If so, the code is fine, otherwise the call should go 
> to the top of the function.
> 
> Best regards
> Thomas
> 
>>       ret = component_bind_all(dev, drm);
>>       if (ret)
>>           return ret;
>> @@ -259,10 +263,6 @@ static int vc4_drm_bind(struct device *dev)
>>       if (ret)
>>           goto unbind_all;
>> -    ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
>> -    if (ret)
>> -        goto unbind_all;
>> -
>>       ret = vc4_kms_load(drm);
>>       if (ret < 0)
>>           goto unbind_all;
>>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c
index 16abc3a3d601..8ab89f805826 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.c
+++ b/drivers/gpu/drm/vc4/vc4_drv.c
@@ -251,6 +251,10 @@  static int vc4_drm_bind(struct device *dev)
 	if (ret)
 		return ret;
 
+	ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
+	if (ret)
+		return ret;
+
 	ret = component_bind_all(dev, drm);
 	if (ret)
 		return ret;
@@ -259,10 +263,6 @@  static int vc4_drm_bind(struct device *dev)
 	if (ret)
 		goto unbind_all;
 
-	ret = drm_aperture_remove_framebuffers(false, &vc4_drm_driver);
-	if (ret)
-		goto unbind_all;
-
 	ret = vc4_kms_load(drm);
 	if (ret < 0)
 		goto unbind_all;