* [PATCH v2] drm/mediatek: Remove all conflicting aperture devices during probe
@ 2026-02-12 19:22 Luca Leonardo Scorcia
2026-02-25 3:13 ` CK Hu (胡俊光)
2026-03-22 13:06 ` Chun-Kuang Hu
0 siblings, 2 replies; 3+ messages in thread
From: Luca Leonardo Scorcia @ 2026-02-12 19:22 UTC (permalink / raw)
To: linux-mediatek
Cc: Luca Leonardo Scorcia, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Simona Vetter, Matthias Brugger, AngeloGioacchino Del Regno,
dri-devel, linux-kernel, linux-arm-kernel
If a device has a framebuffer available it might be already used as
display by simple-framebuffer or simpledrm when mediatek-drm is probed.
This is actually helpful when porting to a new device as
framebuffers are simple to setup in device trees and fbcon can be
used to monitor the kernel boot process.
When drm-mediatek loads a new fb device is initialized, however
fbcon remains attached to the initial framebuffer which is no longer
connected to the actual display - the early fb is never removed.
We can gracefully transition from framebuffer handling to drm-managed
display by calling aperture_remove_all_conflicting_devices before
registering mediatek-drm. This takes care of unloading other fb
devices/drivers and disconnects fbcon which then automatically
reconnects to mediatekdrmfb as soon as it's available.
The function is invoked just before drm_dev_register() to kick out
the existing framebuffer as late as possible to reduce the time the
screen is unresponsive.
Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
---
v2: Moved the call to aperture_remove_all_conflicting_devices to
right before drm_dev_register()
drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index a94c51a83261..02effd9fc698 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -4,6 +4,7 @@
* Author: YT SHEN <yt.shen@mediatek.com>
*/
+#include <linux/aperture.h>
#include <linux/component.h>
#include <linux/module.h>
#include <linux/of.h>
@@ -670,6 +671,10 @@ static int mtk_drm_bind(struct device *dev)
if (ret < 0)
goto err_free;
+ ret = aperture_remove_all_conflicting_devices(DRIVER_NAME);
+ if (ret < 0)
+ dev_err(dev, "Error %d while removing conflicting aperture devices", ret);
+
ret = drm_dev_register(drm, 0);
if (ret < 0)
goto err_deinit;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] drm/mediatek: Remove all conflicting aperture devices during probe
2026-02-12 19:22 [PATCH v2] drm/mediatek: Remove all conflicting aperture devices during probe Luca Leonardo Scorcia
@ 2026-02-25 3:13 ` CK Hu (胡俊光)
2026-03-22 13:06 ` Chun-Kuang Hu
1 sibling, 0 replies; 3+ messages in thread
From: CK Hu (胡俊光) @ 2026-02-25 3:13 UTC (permalink / raw)
To: linux-mediatek@lists.infradead.org, l.scorcia@gmail.com
Cc: chunkuang.hu@kernel.org, simona@ffwll.ch,
dri-devel@lists.freedesktop.org, AngeloGioacchino Del Regno,
airlied@gmail.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, p.zabel@pengutronix.de,
matthias.bgg@gmail.com
On Thu, 2026-02-12 at 19:22 +0000, Luca Leonardo Scorcia wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> If a device has a framebuffer available it might be already used as
> display by simple-framebuffer or simpledrm when mediatek-drm is probed.
> This is actually helpful when porting to a new device as
> framebuffers are simple to setup in device trees and fbcon can be
> used to monitor the kernel boot process.
>
> When drm-mediatek loads a new fb device is initialized, however
> fbcon remains attached to the initial framebuffer which is no longer
> connected to the actual display - the early fb is never removed.
>
> We can gracefully transition from framebuffer handling to drm-managed
> display by calling aperture_remove_all_conflicting_devices before
> registering mediatek-drm. This takes care of unloading other fb
> devices/drivers and disconnects fbcon which then automatically
> reconnects to mediatekdrmfb as soon as it's available.
>
> The function is invoked just before drm_dev_register() to kick out
> the existing framebuffer as late as possible to reduce the time the
> screen is unresponsive.
Reviewed-by: CK Hu <ck.hu@mediatek.com>
>
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
> ---
> v2: Moved the call to aperture_remove_all_conflicting_devices to
> right before drm_dev_register()
>
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index a94c51a83261..02effd9fc698 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -4,6 +4,7 @@
> * Author: YT SHEN <yt.shen@mediatek.com>
> */
>
> +#include <linux/aperture.h>
> #include <linux/component.h>
> #include <linux/module.h>
> #include <linux/of.h>
> @@ -670,6 +671,10 @@ static int mtk_drm_bind(struct device *dev)
> if (ret < 0)
> goto err_free;
>
> + ret = aperture_remove_all_conflicting_devices(DRIVER_NAME);
> + if (ret < 0)
> + dev_err(dev, "Error %d while removing conflicting aperture devices", ret);
> +
> ret = drm_dev_register(drm, 0);
> if (ret < 0)
> goto err_deinit;
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] drm/mediatek: Remove all conflicting aperture devices during probe
2026-02-12 19:22 [PATCH v2] drm/mediatek: Remove all conflicting aperture devices during probe Luca Leonardo Scorcia
2026-02-25 3:13 ` CK Hu (胡俊光)
@ 2026-03-22 13:06 ` Chun-Kuang Hu
1 sibling, 0 replies; 3+ messages in thread
From: Chun-Kuang Hu @ 2026-03-22 13:06 UTC (permalink / raw)
To: Luca Leonardo Scorcia
Cc: linux-mediatek, Chun-Kuang Hu, Philipp Zabel, David Airlie,
Simona Vetter, Matthias Brugger, AngeloGioacchino Del Regno,
dri-devel, linux-kernel, linux-arm-kernel
Hi, Luca:
Luca Leonardo Scorcia <l.scorcia@gmail.com> 於 2026年2月12日週四 下午7:26寫道:
>
> If a device has a framebuffer available it might be already used as
> display by simple-framebuffer or simpledrm when mediatek-drm is probed.
> This is actually helpful when porting to a new device as
> framebuffers are simple to setup in device trees and fbcon can be
> used to monitor the kernel boot process.
>
> When drm-mediatek loads a new fb device is initialized, however
> fbcon remains attached to the initial framebuffer which is no longer
> connected to the actual display - the early fb is never removed.
>
> We can gracefully transition from framebuffer handling to drm-managed
> display by calling aperture_remove_all_conflicting_devices before
> registering mediatek-drm. This takes care of unloading other fb
> devices/drivers and disconnects fbcon which then automatically
> reconnects to mediatekdrmfb as soon as it's available.
>
> The function is invoked just before drm_dev_register() to kick out
> the existing framebuffer as late as possible to reduce the time the
> screen is unresponsive.
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
>
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@gmail.com>
> ---
> v2: Moved the call to aperture_remove_all_conflicting_devices to
> right before drm_dev_register()
>
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index a94c51a83261..02effd9fc698 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -4,6 +4,7 @@
> * Author: YT SHEN <yt.shen@mediatek.com>
> */
>
> +#include <linux/aperture.h>
> #include <linux/component.h>
> #include <linux/module.h>
> #include <linux/of.h>
> @@ -670,6 +671,10 @@ static int mtk_drm_bind(struct device *dev)
> if (ret < 0)
> goto err_free;
>
> + ret = aperture_remove_all_conflicting_devices(DRIVER_NAME);
> + if (ret < 0)
> + dev_err(dev, "Error %d while removing conflicting aperture devices", ret);
> +
> ret = drm_dev_register(drm, 0);
> if (ret < 0)
> goto err_deinit;
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-22 13:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-12 19:22 [PATCH v2] drm/mediatek: Remove all conflicting aperture devices during probe Luca Leonardo Scorcia
2026-02-25 3:13 ` CK Hu (胡俊光)
2026-03-22 13:06 ` Chun-Kuang Hu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox