diff mbox series

drm/stm: remove conflicting framebuffers

Message ID 20211203085512.11127-1-yannick.fertre@foss.st.com (mailing list archive)
State New, archived
Headers show
Series drm/stm: remove conflicting framebuffers | expand

Commit Message

Yannick Fertre Dec. 3, 2021, 8:55 a.m. UTC
In case of using simplefb or another conflicting framebuffer,
call drm_aperture_remove_framebuffers() to remove memory allocated.

Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
---
 drivers/gpu/drm/stm/drv.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas Zimmermann Dec. 3, 2021, 9:35 a.m. UTC | #1
Hi

Am 03.12.21 um 09:55 schrieb Yannick Fertre:
> In case of using simplefb or another conflicting framebuffer,
> call drm_aperture_remove_framebuffers() to remove memory allocated.
> 
> Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
> ---
>   drivers/gpu/drm/stm/drv.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 222869b232ae..5ba46f70f081 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -14,6 +14,7 @@
>   #include <linux/of_platform.h>
>   #include <linux/pm_runtime.h>
>   
> +#include <drm/drm_aperture.h>
>   #include <drm/drm_atomic.h>
>   #include <drm/drm_atomic_helper.h>
>   #include <drm/drm_drv.h>
> @@ -193,6 +194,10 @@ static int stm_drm_platform_probe(struct platform_device *pdev)
>   	if (ret)
>   		goto err_put;
>   
> +	ret = drm_aperture_remove_framebuffers(false, &drv_driver);
> +	if (ret)
> +		goto err_put;
> +

This has to be done at the very top of the probe function, before 
anything that touches the device. Otherwise both drivers interfere with 
each other while probing and setup's going on.

Best regards
Thomas

>   	ret = drm_dev_register(ddev, 0);
>   	if (ret)
>   		goto err_put;
>
Yannick Fertre Dec. 6, 2021, 1:42 p.m. UTC | #2
Hi Thomas,


On 12/3/21 10:35 AM, Thomas Zimmermann wrote:
> Hi
> 
> Am 03.12.21 um 09:55 schrieb Yannick Fertre:
>> In case of using simplefb or another conflicting framebuffer,
>> call drm_aperture_remove_framebuffers() to remove memory allocated.
>>
>> Signed-off-by: Yannick Fertre <yannick.fertre@foss.st.com>
>> ---
>>   drivers/gpu/drm/stm/drv.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
>> index 222869b232ae..5ba46f70f081 100644
>> --- a/drivers/gpu/drm/stm/drv.c
>> +++ b/drivers/gpu/drm/stm/drv.c
>> @@ -14,6 +14,7 @@
>>   #include <linux/of_platform.h>
>>   #include <linux/pm_runtime.h>
>> +#include <drm/drm_aperture.h>
>>   #include <drm/drm_atomic.h>
>>   #include <drm/drm_atomic_helper.h>
>>   #include <drm/drm_drv.h>
>> @@ -193,6 +194,10 @@ static int stm_drm_platform_probe(struct 
>> platform_device *pdev)
>>       if (ret)
>>           goto err_put;
>> +    ret = drm_aperture_remove_framebuffers(false, &drv_driver);
>> +    if (ret)
>> +        goto err_put;
>> +
> 
> This has to be done at the very top of the probe function, before 
> anything that touches the device. Otherwise both drivers interfere with 
> each other while probing and setup's going on.
> 
> Best regards
> Thomas
> 
>>       ret = drm_dev_register(ddev, 0);
>>       if (ret)
>>           goto err_put;
>>
> 
Thanks for reviewing the patch.
I will follow your advice and push a new patch.

Yannick
diff mbox series

Patch

diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 222869b232ae..5ba46f70f081 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -14,6 +14,7 @@ 
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
 
+#include <drm/drm_aperture.h>
 #include <drm/drm_atomic.h>
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_drv.h>
@@ -193,6 +194,10 @@  static int stm_drm_platform_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_put;
 
+	ret = drm_aperture_remove_framebuffers(false, &drv_driver);
+	if (ret)
+		goto err_put;
+
 	ret = drm_dev_register(ddev, 0);
 	if (ret)
 		goto err_put;