From: Luca Leonardo Scorcia Date: Thu, 12 Feb 2026 19:22:47 +0000 (+0000) Subject: drm/mediatek: Remove all conflicting aperture devices during probe X-Git-Tag: v7.1-rc1~167^2~17^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86d5f60dea00a56ed3da9612028f930d78336adf;p=thirdparty%2Fkernel%2Fstable.git drm/mediatek: Remove all conflicting aperture devices during probe 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 Reviewed-by: CK Hu Link: https://patchwork.kernel.org/project/dri-devel/patch/20260212192605.263160-1-l.scorcia@gmail.com/ Signed-off-by: Chun-Kuang Hu --- diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index a94c51a832616..02effd9fc6985 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 */ +#include #include #include #include @@ -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;