dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
@ 2021-05-16  7:48 Javier Martinez Canillas
  2021-05-16 10:30 ` Thomas Zimmermann
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Javier Martinez Canillas @ 2021-05-16  7:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: David Airlie, Thomas Zimmermann, Javier Martinez Canillas,
	dri-devel, Sandy Huang, linux-rockchip, Peter Robinson,
	linux-arm-kernel

There are drivers that register framebuffer devices very early in the boot
process and make use of the existing framebuffer as setup by the firmware.

If one of those drivers has registered a fbdev, then the fallback fbdev of
the DRM driver won't be bound to the framebuffer console. To avoid that,
remove any existing generic driver and take over the graphics device.

By doing that, the fb mapped to the console is switched correctly from the
early fbdev to the one registered by the rockchip DRM driver:

    [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA

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

Changes in v2:
- Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann).
- Adapt subject line, commit message, etc accordingly.

 drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index 212bd87c0c4..b730b8d5d94 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -16,6 +16,7 @@
 #include <linux/console.h>
 #include <linux/iommu.h>
 
+#include <drm/drm_aperture.h>
 #include <drm/drm_drv.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem_cma_helper.h>
@@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev)
 	struct rockchip_drm_private *private;
 	int ret;
 
+	/* Remove existing drivers that may own the framebuffer memory. */
+	ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb");
+	if (ret) {
+		DRM_DEV_ERROR(dev,
+			      "Failed to remove existing framebuffers - %d.\n",
+			      ret);
+		return ret;
+	}
+
 	drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev);
 	if (IS_ERR(drm_dev))
 		return PTR_ERR(drm_dev);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
  2021-05-16  7:48 [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device Javier Martinez Canillas
@ 2021-05-16 10:30 ` Thomas Zimmermann
  2021-05-16 15:25   ` Javier Martinez Canillas
  2021-05-27  7:38   ` Javier Martinez Canillas
  2021-05-16 12:31 ` Peter Robinson
  2021-05-27  9:15 ` Heiko Stübner
  2 siblings, 2 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2021-05-16 10:30 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: David Airlie, Sandy Huang, dri-devel, linux-rockchip,
	Peter Robinson, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 2380 bytes --]



Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
> There are drivers that register framebuffer devices very early in the boot
> process and make use of the existing framebuffer as setup by the firmware.
> 
> If one of those drivers has registered a fbdev, then the fallback fbdev 
of
> the DRM driver won't be bound to the framebuffer console. To avoid that,
> remove any existing generic driver and take over the graphics device.
> 
> By doing that, the fb mapped to the console is switched correctly from the
> early fbdev to the one registered by the rockchip DRM driver:
> 
>      [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
> 
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

Ping me if no one else merges the patch.

Best regards
Thomas

> ---
> 
> Changes in v2:
> - Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann).
> - Adapt subject line, commit message, etc accordingly.
> 
>   drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++++++++++
>   1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 212bd87c0c4..b730b8d5d94 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -16,6 +16,7 @@
>   #include <linux/console.h>
>   #include <linux/iommu.h>
>   
> +#include <drm/drm_aperture.h>
>   #include <drm/drm_drv.h>
>   #include <drm/drm_fb_helper.h>
>   #include <drm/drm_gem_cma_helper.h>
> @@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev)
>   	struct rockchip_drm_private *private;
>   	int ret;
>   
> +	/* Remove existing drivers that may own the framebuffer memory. */
> +	ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb");
> +	if (ret) {
> +		DRM_DEV_ERROR(dev,
> +			      "Failed to remove existing framebuffers - %d.\n",
> +			      ret);
> +		return ret;
> +	}
> +
>   	drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev);
>   	if (IS_ERR(drm_dev))
>   		return PTR_ERR(drm_dev);
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
  2021-05-16  7:48 [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device Javier Martinez Canillas
  2021-05-16 10:30 ` Thomas Zimmermann
@ 2021-05-16 12:31 ` Peter Robinson
  2021-05-27  9:15 ` Heiko Stübner
  2 siblings, 0 replies; 7+ messages in thread
From: Peter Robinson @ 2021-05-16 12:31 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Thomas Zimmermann, David Airlie, Sandy Huang, dri-devel,
	linux-kernel, linux-rockchip, linux-arm-kernel

On Sun, May 16, 2021 at 8:48 AM Javier Martinez Canillas
<javierm@redhat.com> wrote:
>
> There are drivers that register framebuffer devices very early in the boot
> process and make use of the existing framebuffer as setup by the firmware.
>
> If one of those drivers has registered a fbdev, then the fallback fbdev of
> the DRM driver won't be bound to the framebuffer console. To avoid that,
> remove any existing generic driver and take over the graphics device.
>
> By doing that, the fb mapped to the console is switched correctly from the
> early fbdev to the one registered by the rockchip DRM driver:
>
>     [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
>
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>

Tested on Pinebook Pro (eDP), Rock960 (HDMI) and Firefly3399.

> ---
>
> Changes in v2:
> - Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann).
> - Adapt subject line, commit message, etc accordingly.
>
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 212bd87c0c4..b730b8d5d94 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -16,6 +16,7 @@
>  #include <linux/console.h>
>  #include <linux/iommu.h>
>
> +#include <drm/drm_aperture.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> @@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev)
>         struct rockchip_drm_private *private;
>         int ret;
>
> +       /* Remove existing drivers that may own the framebuffer memory. */
> +       ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb");
> +       if (ret) {
> +               DRM_DEV_ERROR(dev,
> +                             "Failed to remove existing framebuffers - %d.\n",
> +                             ret);
> +               return ret;
> +       }
> +
>         drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev);
>         if (IS_ERR(drm_dev))
>                 return PTR_ERR(drm_dev);
> --
> 2.31.1
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
  2021-05-16 10:30 ` Thomas Zimmermann
@ 2021-05-16 15:25   ` Javier Martinez Canillas
  2021-05-27  7:38   ` Javier Martinez Canillas
  1 sibling, 0 replies; 7+ messages in thread
From: Javier Martinez Canillas @ 2021-05-16 15:25 UTC (permalink / raw)
  To: Thomas Zimmermann, linux-kernel
  Cc: David Airlie, Sandy Huang, dri-devel, linux-rockchip,
	Peter Robinson, linux-arm-kernel

Hello Thomas,

On 5/16/21 12:30 PM, Thomas Zimmermann wrote:
> 
> 
> Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
>> There are drivers that register framebuffer devices very early in the boot
>> process and make use of the existing framebuffer as setup by the firmware.
>>
>> If one of those drivers has registered a fbdev, then the fallback fbdev 
> of
>> the DRM driver won't be bound to the framebuffer console. To avoid that,
>> remove any existing generic driver and take over the graphics device.
>>
>> By doing that, the fb mapped to the console is switched correctly from the
>> early fbdev to the one registered by the rockchip DRM driver:
>>
>>      [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
> 
> Ping me if no one else merges the patch.
>

Sure, I will. And thanks a lot for your review!
 
> Best regards
> Thomas
>

Best regards,
-- 
Javier Martinez Canillas
Software Engineer
New Platform Technologies Enablement team
RHEL Engineering


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
  2021-05-16 10:30 ` Thomas Zimmermann
  2021-05-16 15:25   ` Javier Martinez Canillas
@ 2021-05-27  7:38   ` Javier Martinez Canillas
  2021-05-28 13:59     ` Thomas Zimmermann
  1 sibling, 1 reply; 7+ messages in thread
From: Javier Martinez Canillas @ 2021-05-27  7:38 UTC (permalink / raw)
  To: Thomas Zimmermann, linux-kernel
  Cc: David Airlie, Sandy Huang, dri-devel, linux-rockchip,
	Peter Robinson, linux-arm-kernel

Hello Thomas,

On 5/16/21 12:30 PM, Thomas Zimmermann wrote:
> 
> 
> Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
>> There are drivers that register framebuffer devices very early in the boot
>> process and make use of the existing framebuffer as setup by the firmware.
>>
>> If one of those drivers has registered a fbdev, then the fallback fbdev 
> of
>> the DRM driver won't be bound to the framebuffer console. To avoid that,
>> remove any existing generic driver and take over the graphics device.
>>
>> By doing that, the fb mapped to the console is switched correctly from the
>> early fbdev to the one registered by the rockchip DRM driver:
>>
>>      [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
>>
>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
> 
> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>

Thanks for the ack.
 
> Ping me if no one else merges the patch.
>

I would really appreciate if you merge this patch.
 
> Best regards
> Thomas

Best regards,
-- 
Javier Martinez Canillas
Software Engineer
New Platform Technologies Enablement team
RHEL Engineering


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
  2021-05-16  7:48 [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device Javier Martinez Canillas
  2021-05-16 10:30 ` Thomas Zimmermann
  2021-05-16 12:31 ` Peter Robinson
@ 2021-05-27  9:15 ` Heiko Stübner
  2 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2021-05-27  9:15 UTC (permalink / raw)
  To: linux-kernel, Javier Martinez Canillas
  Cc: Thomas Zimmermann, David Airlie, Sandy Huang, dri-devel,
	Javier Martinez Canillas, linux-rockchip, Peter Robinson,
	linux-arm-kernel

Am Sonntag, 16. Mai 2021, 09:48:33 CEST schrieb Javier Martinez Canillas:
> There are drivers that register framebuffer devices very early in the boot
> process and make use of the existing framebuffer as setup by the firmware.
> 
> If one of those drivers has registered a fbdev, then the fallback fbdev of
> the DRM driver won't be bound to the framebuffer console. To avoid that,
> remove any existing generic driver and take over the graphics device.
> 
> By doing that, the fb mapped to the console is switched correctly from the
> early fbdev to the one registered by the rockchip DRM driver:
> 
>     [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
> 
> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>

fwiw, this looks like the right thing to do. I haven't found time to test
though yet. So anyway

Acked-by: Heiko Stuebner <heiko@sntech.de>


Heiko


> ---
> 
> Changes in v2:
> - Move drm_aperture_remove_framebuffers() call to .bind callback (tzimmermann).
> - Adapt subject line, commit message, etc accordingly.
> 
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index 212bd87c0c4..b730b8d5d94 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -16,6 +16,7 @@
>  #include <linux/console.h>
>  #include <linux/iommu.h>
>  
> +#include <drm/drm_aperture.h>
>  #include <drm/drm_drv.h>
>  #include <drm/drm_fb_helper.h>
>  #include <drm/drm_gem_cma_helper.h>
> @@ -114,6 +115,15 @@ static int rockchip_drm_bind(struct device *dev)
>  	struct rockchip_drm_private *private;
>  	int ret;
>  
> +	/* Remove existing drivers that may own the framebuffer memory. */
> +	ret = drm_aperture_remove_framebuffers(false, "rockchip-drm-fb");
> +	if (ret) {
> +		DRM_DEV_ERROR(dev,
> +			      "Failed to remove existing framebuffers - %d.\n",
> +			      ret);
> +		return ret;
> +	}
> +
>  	drm_dev = drm_dev_alloc(&rockchip_drm_driver, dev);
>  	if (IS_ERR(drm_dev))
>  		return PTR_ERR(drm_dev);
> 





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device
  2021-05-27  7:38   ` Javier Martinez Canillas
@ 2021-05-28 13:59     ` Thomas Zimmermann
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Zimmermann @ 2021-05-28 13:59 UTC (permalink / raw)
  To: Javier Martinez Canillas, linux-kernel
  Cc: David Airlie, Sandy Huang, dri-devel, linux-rockchip,
	Peter Robinson, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1429 bytes --]



Am 27.05.21 um 09:38 schrieb Javier Martinez Canillas:
> Hello Thomas,
> 
> On 5/16/21 12:30 PM, Thomas Zimmermann wrote:
>>
>>
>> Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
>>> There are drivers that register framebuffer devices very early in the boot
>>> process and make use of the existing framebuffer as setup by the firmware.
>>>
>>> If one of those drivers has registered a fbdev, then the fallback fbdev
>> of
>>> the DRM driver won't be bound to the framebuffer console. To avoid that,
>>> remove any existing generic driver and take over the graphics device.
>>>
>>> By doing that, the fb mapped to the console is switched correctly from the
>>> early fbdev to the one registered by the rockchip DRM driver:
>>>
>>>       [   40.752420] fb0: switching to rockchip-drm-fb from EFI VGA
>>>
>>> Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
>>
>> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>>
> 
> Thanks for the ack.
>   
>> Ping me if no one else merges the patch.
>>
> 
> I would really appreciate if you merge this patch.

It's merged now. Thanks for the patch.

Best regards
Thomas

>   
>> Best regards
>> Thomas
> 
> Best regards,
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Felix Imendörffer


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-28 13:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-16  7:48 [PATCH v2] drm/rockchip: remove existing generic drivers to take over the device Javier Martinez Canillas
2021-05-16 10:30 ` Thomas Zimmermann
2021-05-16 15:25   ` Javier Martinez Canillas
2021-05-27  7:38   ` Javier Martinez Canillas
2021-05-28 13:59     ` Thomas Zimmermann
2021-05-16 12:31 ` Peter Robinson
2021-05-27  9:15 ` Heiko Stübner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).