From c6e77e2bbea04124fdf15e14cb443477be4ea5f0 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Thu, 3 Dec 2026 05:15:54 +0800 Subject: [PATCH 1/3] ARM: configs: orchard_applearmv7: Drive the boot framebuffer with simpledrm Build simpledrm in and drop simplefb, as the 64-bit boards do. FB_SIMPLE depends on !DRM_SIMPLEDRM, so the two cannot both be built. simpledrm binds the same simple-framebuffer node, from its memory-region, and its fbdev emulation (DRM_FBDEV_EMULATION, on by default with FB) still gives fbcon a framebuffer, /dev/fb0, so the boot console keeps showing. With simpledrm the iPad 3's scanout is presented upright by the driver (the framebuffer node's rotation = <90>), and fbcon draws on that upright framebuffer: drop fbcon=rotate:1 from the iPad 3 command line, or the console would be turned twice. earlycon=j1fb still stops drawing once a framebuffer is registered, now simpledrm's. Assisted-by: LLM Signed-off-by: Henrik Klee --- arch/arm/boot/dts/apple/s5l8945x-ipad3.dtsi | 27 ++++++++++++------- arch/arm/configs/orchard_applearmv7_defconfig | 2 +- arch/arm/mach-apple/j1_earlyfb.c | 6 ++--- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/arch/arm/boot/dts/apple/s5l8945x-ipad3.dtsi b/arch/arm/boot/dts/apple/s5l8945x-ipad3.dtsi index 29d05eeb18c045..4a843cf7f0ce18 100644 --- a/arch/arm/boot/dts/apple/s5l8945x-ipad3.dtsi +++ b/arch/arm/boot/dts/apple/s5l8945x-ipad3.dtsi @@ -50,10 +50,16 @@ * tick before the AIC timer (init/main.c, patches/tree/0001). * * console=tty0 also sends the log to fbcon, which takes the - * panel over from j1fb when simplefb registers: the penguins and - * the log, portrait (fbcon=rotate:1, home button at the bottom; - * font:TER16x32 if the kernel has it, else fbcon's default). - * ttyGS0 stays last, so it is still /dev/console. + * panel over from j1fb when simpledrm registers its fbdev: the + * penguins and the log, portrait with the home button at the + * bottom, because simpledrm already presents the scanout upright + * (the framebuffer node's rotation), so fbcon is not turned + * itself (font:TER16x32 if the kernel has it, else fbcon's + * default). ttyGS0 stays last, so it is still /dev/console. + * + * simpledrm.zoom=2 here would present the desktop at 768 x 1024, + * each pixel copied as a 2 x 2 block: a quarter of the pixels to + * draw for a desktop without the GPU. Off by default. * * Both cores start at boot, the mini's way (platsmp.c). lpj is * the 1 GHz A5's; the A5X is 1 GHz too. @@ -61,7 +67,7 @@ * external initrd here would make the kernel look for a second * archive. */ - bootargs = "earlycon=j1fb console=tty0 console=ttyGS0,115200 fbcon=rotate:1,font:TER16x32 lpj=5000000 rdinit=/init panic=10 loglevel=8 ignore_loglevel g_cdc.host_addr=02:10:5a:31:00:01 g_cdc.dev_addr=02:10:5a:31:00:02"; + bootargs = "earlycon=j1fb console=tty0 console=ttyGS0,115200 fbcon=font:TER16x32 lpj=5000000 rdinit=/init panic=10 loglevel=8 ignore_loglevel g_cdc.host_addr=02:10:5a:31:00:01 g_cdc.dev_addr=02:10:5a:31:00:02"; }; /* @@ -103,10 +109,11 @@ /* * The panel is portrait and scans out 2048 x 1536, turned: * simpledrm presents 1536 x 2048 and turns each damaged - * rectangle as it copies it, so that compositors render - * unrotated. This is the turn fbcon=rotate:1 draws the console - * upright with: upright pixel (x, y) at scanout (2047 - y, x). - * The touchscreen's axes are already the upright ones. + * rectangle as it copies it, so that compositors and fbcon + * render unrotated: upright pixel (x, y) at scanout + * (2047 - y, x), the turn fbcon=rotate:1 used to draw on + * simplefb. The touchscreen's axes are already the upright + * ones. */ rotation = <90>; }; @@ -534,7 +541,7 @@ * Display pipeline, recorded and left off. The mini's node * here is MIPI-DSI. This ADT's panel is eDP (edp@9500000, * max 4 lanes) fed by CLCD, with a highland-park block at - * 0xb020000 that the mini does not have. simplefb can reuse + * 0xb020000 that the mini does not have. simpledrm can reuse * iBoot's scanout once its base is known; it cannot be copied * from the mini's 768x1024 region at 0x9f6fc000. */ diff --git a/arch/arm/configs/orchard_applearmv7_defconfig b/arch/arm/configs/orchard_applearmv7_defconfig index 64a896f105c09c..8bb1bdafb0cf49 100644 --- a/arch/arm/configs/orchard_applearmv7_defconfig +++ b/arch/arm/configs/orchard_applearmv7_defconfig @@ -511,12 +511,12 @@ CONFIG_DRM_I2C_ADV7511=m CONFIG_DRM_I2C_ADV7511_AUDIO=y CONFIG_DRM_ETNAVIV=m CONFIG_DRM_PL111=m +CONFIG_DRM_SIMPLEDRM=y CONFIG_DRM_LIMA=m CONFIG_DRM_APPLE_SGX=y CONFIG_DRM_PANFROST=m CONFIG_FB=y CONFIG_FB_EFI=y -CONFIG_FB_SIMPLE=y CONFIG_FB_MODE_HELPERS=y CONFIG_BACKLIGHT_CLASS_DEVICE=y CONFIG_BACKLIGHT_PWM=y diff --git a/arch/arm/mach-apple/j1_earlyfb.c b/arch/arm/mach-apple/j1_earlyfb.c index 75c59df45052ca..0f64380febe1b6 100644 --- a/arch/arm/mach-apple/j1_earlyfb.c +++ b/arch/arm/mach-apple/j1_earlyfb.c @@ -9,8 +9,8 @@ * fbcon=rotate:1 does). The 8x8 font at scale 2 gives 96 columns by 128 * rows; it wraps to the top and clears the line ahead instead of scrolling. * - * Once a framebuffer is registered (simplefb, a device_initcall) fbcon owns - * the panel -- with console=tty0 it redraws the log under the penguins -- + * Once a framebuffer is registered (simpledrm's fbdev, from its probe at + * device_initcall) fbcon owns the panel -- with console=tty0 it redraws the log under the penguins -- * so this stops drawing there rather than at late_initcall. * * This runs before the kernel has any mapping for the panel, and while @@ -22,7 +22,7 @@ * * Everything here is __init on purpose. printk_late_init unregisters any * boot console whose code is in init memory, so this hands the panel back - * (to simplefb/fbcon and userspace) at late_initcall time. + * (to simpledrm/fbcon and userspace) at late_initcall time. * * It used to be required: without it the J1 hung early in boot. That was * the missing tick before the AIC timer (irq-apple-aic1.c, From fef38523d6628cfe28bb089164e48bd0a479a536 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Thu, 3 Dec 2026 05:15:54 +0800 Subject: [PATCH 2/3] ARM: dts: apple: s5l8955x: Turn the iPad 4's scanout upright The iPad 4 has the iPad 3's 2048 x 1536 panel behind the same eDP block (its ADT's edp node is "edp,s5l8955x", "edp,s5l8945x"). The iPad 3's iBoot scans it out landscape and simpledrm presents it portrait with rotation = <90>; set the same on the A6X's framebuffer node, so the iPad 4 comes up upright as well. Assisted-by: LLM Signed-off-by: Henrik Klee --- arch/arm/boot/dts/apple/s5l8955x.dtsi | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/arch/arm/boot/dts/apple/s5l8955x.dtsi b/arch/arm/boot/dts/apple/s5l8955x.dtsi index a32fdfb7908554..a47d1ac867e65f 100644 --- a/arch/arm/boot/dts/apple/s5l8955x.dtsi +++ b/arch/arm/boot/dts/apple/s5l8955x.dtsi @@ -70,12 +70,27 @@ * iBoot's scanout, kept running. m1n1 fills reg, width, height and * stride from iBoot's boot arguments and enables it (dt_set_fb). The * pixel order is not in the boot arguments; x8r8g8b8 is the A5X's. + * + * The panel is the iPad 3's: the same 2048 x 1536 Retina panel in the + * same housing, behind the same eDP block (the ADT's edp node is + * "edp,s5l8955x", "edp,s5l8945x"). On the iPad 3 iBoot scans it out + * landscape, 2048 x 1536, and simpledrm turns it upright (portrait, + * home button at the bottom) with rotation 90; the same is set here. + * If iBoot's boot arguments give a portrait size on this board (the + * kernel log's "scanout ... turned 90 degrees: presenting ..." line), + * this rotation is the one value to drop. The ADT's /chosen + * display-rotation is zero in the IPSW, filled by iBoot at boot. + * + * simpledrm.zoom=2 on the command line would present the desktop at + * half size (768 x 1024), each pixel copied as a 2 x 2 block, for a + * desktop without the GPU. Off by default. */ framebuffer0: framebuffer@0 { compatible = "simple-framebuffer"; reg = <0x0 0x0>; memory-region = <&fb_region>; format = "x8r8g8b8"; + rotation = <90>; status = "disabled"; }; From 599b480bd1654ea659f387eecd7b9bc5bc45aab5 Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Thu, 3 Dec 2026 05:15:54 +0800 Subject: [PATCH 3/3] ARM: apple: Name simpledrm as the boot framebuffer's driver Comments that named simplefb now name simpledrm. The K93's framebuffer node says why it has no rotation: its desktop is the landscape screen, and its touch and motion sensors are described in that screen's axes. apple-sgx's fbcon acceleration (debugfs "fbcon", fbcon_gpu, off by default) drew fbcon's fills and copies straight into the boot framebuffer, which simplefb's fbdev was. simpledrm's fbdev draws into a shadow in system memory instead; the hook already refused it (smem_start differs), and now says so in the log. Assisted-by: LLM Signed-off-by: Henrik Klee --- arch/arm/boot/dts/apple/s5l8940x-k93.dts | 7 ++++++- arch/arm/boot/dts/apple/s5l8942x-p105.dts | 2 +- arch/arm/boot/dts/apple/s5l8955x-p101.dts | 2 +- arch/arm/boot/dts/apple/s5l8955x-p102.dts | 2 +- arch/arm/boot/dts/apple/s5l8955x-p103.dts | 2 +- drivers/gpu/drm/apple-sgx/apple_sgx_hw.c | 17 +++++++++++++---- drivers/gpu/drm/apple-sgx/apple_sgx_kms.c | 2 +- 7 files changed, 24 insertions(+), 10 deletions(-) diff --git a/arch/arm/boot/dts/apple/s5l8940x-k93.dts b/arch/arm/boot/dts/apple/s5l8940x-k93.dts index e40eb246bb52c6..97eea9ad4f7ac0 100644 --- a/arch/arm/boot/dts/apple/s5l8940x-k93.dts +++ b/arch/arm/boot/dts/apple/s5l8940x-k93.dts @@ -91,7 +91,12 @@ }; /* iBoot's scanout, as it leaves it: landscape 1024x768 (the K93's - * panel is scanned out that way), read and verified on this board. */ + * panel is scanned out that way), read and verified on this board. + * No "rotation" for simpledrm: this board's desktop is the landscape + * screen as it stands, upright with the Home button on the left, and + * the touchscreen (touchscreen-swapped-x-y) and the motion sensors' + * mount matrices below are in that screen's axes. A portrait desktop + * would be a rotation here together with those turned back. */ framebuffer0: framebuffer@9f6fc000 { compatible = "simple-framebuffer"; reg = <0x9f6fc000 0x300000>; diff --git a/arch/arm/boot/dts/apple/s5l8942x-p105.dts b/arch/arm/boot/dts/apple/s5l8942x-p105.dts index 34b65623955dda..e9770e716a3e44 100644 --- a/arch/arm/boot/dts/apple/s5l8942x-p105.dts +++ b/arch/arm/boot/dts/apple/s5l8942x-p105.dts @@ -573,7 +573,7 @@ }; /* - * Display pipeline. simplefb above reuses the output of these + * Display pipeline. simpledrm above reuses the output of these * blocks rather than reprogramming them; a real CLCD + MIPI-DSI * driver for S5L8940X does not exist and is not needed to get a * desktop on screen. diff --git a/arch/arm/boot/dts/apple/s5l8955x-p101.dts b/arch/arm/boot/dts/apple/s5l8955x-p101.dts index 46454dcf0b4801..67ac3a29adb9f8 100644 --- a/arch/arm/boot/dts/apple/s5l8955x-p101.dts +++ b/arch/arm/boot/dts/apple/s5l8955x-p101.dts @@ -7,7 +7,7 @@ * * The console is the USB gadget's ACM port (ttyGS0), as on the iPad 3: * the Lightning connector carries no UART. console=tty0 also puts the log - * on iBoot's framebuffer once simplefb takes it. rdinit=/init is the + * on iBoot's framebuffer once simpledrm takes it. rdinit=/init is the * initramfs that comes with the kernel. */ diff --git a/arch/arm/boot/dts/apple/s5l8955x-p102.dts b/arch/arm/boot/dts/apple/s5l8955x-p102.dts index f11181697494a6..91faba6ec9c408 100644 --- a/arch/arm/boot/dts/apple/s5l8955x-p102.dts +++ b/arch/arm/boot/dts/apple/s5l8955x-p102.dts @@ -7,7 +7,7 @@ * * The console is the USB gadget's ACM port (ttyGS0), as on the iPad 3: * the Lightning connector carries no UART. console=tty0 also puts the log - * on iBoot's framebuffer once simplefb takes it. rdinit=/init is the + * on iBoot's framebuffer once simpledrm takes it. rdinit=/init is the * initramfs that comes with the kernel. */ diff --git a/arch/arm/boot/dts/apple/s5l8955x-p103.dts b/arch/arm/boot/dts/apple/s5l8955x-p103.dts index 0071d2c33760bf..177a95380615b7 100644 --- a/arch/arm/boot/dts/apple/s5l8955x-p103.dts +++ b/arch/arm/boot/dts/apple/s5l8955x-p103.dts @@ -7,7 +7,7 @@ * * The console is the USB gadget's ACM port (ttyGS0), as on the iPad 3: * the Lightning connector carries no UART. console=tty0 also puts the log - * on iBoot's framebuffer once simplefb takes it. rdinit=/init is the + * on iBoot's framebuffer once simpledrm takes it. rdinit=/init is the * initramfs that comes with the kernel. */ diff --git a/drivers/gpu/drm/apple-sgx/apple_sgx_hw.c b/drivers/gpu/drm/apple-sgx/apple_sgx_hw.c index 7f356bf3226d65..ce22b65d1e7640 100644 --- a/drivers/gpu/drm/apple-sgx/apple_sgx_hw.c +++ b/drivers/gpu/drm/apple-sgx/apple_sgx_hw.c @@ -1615,7 +1615,7 @@ static void blt_put_prog(struct apple_sgx *sgx, u32 va, const u64 *p, int n) memcpy(sgx->blt_code + (va - SGX_BLT_CODE_VA) / 8, p, n * sizeof(*p)); } -/* The framebuffer simplefb drives, from the device tree. */ +/* The framebuffer simpledrm drives, from the device tree. */ int apple_sgx_fb_find(struct apple_sgx *sgx, struct resource *res) { struct device_node *np, *mem; @@ -2035,8 +2035,12 @@ static int sgx_fb_copy_safe(struct apple_sgx *sgx, u32 sx, u32 sy, u32 dx, u32 d return ret; } -/* fbcon on the GPU: simplefb's operations, with fills and copies replaced; - * whatever the engine cannot do goes back to simplefb's (CPU) versions. */ +/* fbcon on the GPU: the framebuffer driver's operations, with fills and + * copies replaced; whatever the engine cannot do goes back to its (CPU) + * versions. Only a driver that draws straight into the boot framebuffer + * qualifies (simplefb did). simpledrm's fbdev draws into a shadow in system + * memory (smem_start 0) that it copies out itself, so with it fbcon stays on + * the CPU and this hook is not set. */ extern struct fb_info *registered_fb[FB_MAX]; /* fbmem.c; both built in */ static struct apple_sgx *sgx_fbcon; static struct fb_ops sgx_fbcon_ops; @@ -2065,8 +2069,13 @@ static void sgx_fbcon_hook(struct apple_sgx *sgx) { struct fb_info *info = registered_fb[0]; - if (sgx->fb_hooked || !sgx->fb_w || !info || info->fix.smem_start != sgx->fb_pa) + if (sgx->fb_hooked || !sgx->fb_w || !info) return; + if (info->fix.smem_start != sgx->fb_pa) { + dev_info(sgx->dev, "fbcon: %s does not draw into the boot framebuffer; fills and copies stay on the CPU\n", + info->fix.id); + return; + } sgx_fbcon_cpu = info->fbops; sgx_fbcon_ops = *info->fbops; sgx_fbcon_ops.fb_fillrect = sgx_fbcon_fillrect; diff --git a/drivers/gpu/drm/apple-sgx/apple_sgx_kms.c b/drivers/gpu/drm/apple-sgx/apple_sgx_kms.c index 4ff58861d41975..62796f168f3e6e 100644 --- a/drivers/gpu/drm/apple-sgx/apple_sgx_kms.c +++ b/drivers/gpu/drm/apple-sgx/apple_sgx_kms.c @@ -3,7 +3,7 @@ * Apple S5L8940X (A5) PowerVR SGX543MP2 -- the screen, through KMS. * * The display pipe is iBoot's: it scans out a framebuffer at a fixed - * physical address (the device tree's simple-framebuffer, which simplefb + * physical address (the device tree's simple-framebuffer, which simpledrm * keeps for fbcon), and nothing here programs it. What is here is KMS on * that memory, so that GBM, EGL and compositors have a screen: one plane, * CRTC, encoder and connector, the framebuffer's one mode. A KMS