drm/rockchip: remove existing generic drivers to take over the device
Subsystems (4)
PATCH v2 1/1 drm/rockchip: remove existing generic drivers to take over the device
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
---
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(+)
drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10 -0
@@ -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);
Signature · 1 line
2.31.1
Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
Quoted 4 lines
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
Quoted 9 lines
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 VGASigned-off-by Javier Martinez Canillas <[email protected]>
Ping me if no one else merges the patch.
Best regards
Thomas
Quoted 38 lines
---
Changes in v2:
- Movedrm_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(+)drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10
-0@@ -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);
Signature · 6 lines
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
Hello Thomas,
Quoted 14 lines · Thomas Zimmermann
Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
Quoted 4 lines
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
Quoted 6 lines
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:
Quoted 8 lines
Quoted 3 lines
[ 40.752420] fb0: switching to rockchip-drm-fb from EFI VGASigned-off-by Javier Martinez Canillas <[email protected]>Ping me if no one else merges the patch.
Sure, I will. And thanks a lot for your review!
Quoted 3 lines
Best regards
Thomas
Best regards,
Signature · 4 lines
Javier Martinez Canillas Software Engineer New Platform Technologies Enablement team RHEL Engineering
Hello Thomas,
Quoted 11 lines · Thomas Zimmermann
Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
Quoted 4 lines
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
Quoted 3 lines
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.
Quoted 9 lines
Quoted 6 lines
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 VGASigned-off-by Javier Martinez Canillas <[email protected]>
Thanks for the ack.
Quoted 2 lines
Ping me if no one else merges the patch.
I would really appreciate if you merge this patch.
Quoted 2 lines
Best regards
Thomas
Best regards,
Signature · 4 lines
Javier Martinez Canillas Software Engineer New Platform Technologies Enablement team RHEL Engineering
Thomas Zimmermann
maintainerAm 27.05.21 um 09:38 schrieb Javier Martinez Canillas:
Quoted 24 lines
Hello Thomas,
Quoted 11 lines · Thomas Zimmermann
Am 16.05.21 um 09:48 schrieb Javier Martinez Canillas:
Quoted 4 lines
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
Quoted 3 lines
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.
Quoted 9 lines
Quoted 6 lines
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 VGASigned-off-by Javier Martinez Canillas <[email protected]>
Quoted 6 lines
Thanks for the ack.
Quoted 2 lines
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
Quoted 6 lines
Quoted 3 lines
Best regards
ThomasBest regards,
Signature · 6 lines
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
Quoted 8 lines · 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.
Quoted 6 lines
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 VGASigned-off-by Javier Martinez Canillas <[email protected]>
Tested on Pinebook Pro (eDP), Rock960 (HDMI) and Firefly3399.
Quoted 40 lines
---
Changes in v2:
- Movedrm_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(+)drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10
-1@@ -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
Am Sonntag, 16. Mai 2021, 09:48:33 CEST schrieb Javier Martinez Canillas:
Quoted 7 lines
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.
Quoted 6 lines
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 VGASigned-off-by Javier Martinez Canillas <[email protected]>
fwiw, this looks like the right thing to do. I haven't found time to test though yet. So anyway
Heiko
Quoted 38 lines
---
Changes in v2:
- Movedrm_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(+)drivers/gpu/drm/rockchip/rockchip_drm_drv.c +10
-0@@ -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);