Hi all,
I’ve noticed quite a few questions and troubleshooting threads about the official Raspberry Pi 7" touchscreen, so I wanted to share a fix for an issue I was encountering namely, incorrect resolution scaling after a cold boot.
Step 1: Basic Fix with xrandr
First, credit to RandyR for pointing out a simple and effective fix that works in most cases by fixing xrandr:
Edit your autostart file:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
And add this line:
@xrandr --output DSI-1 --primary --scale-from 1024x600
This forces the correct scaling on the DSI-1 display. It works well for most reboots, but I found that on cold boots the scaling would sometimes fail.
Step 2: Diagnosing the Cold Boot Issue
After some digging, I found the issue: if the power supply isn't completely stable at boot, the screen may not be recognized as a DSI display. As a result, it defaults to a generic framebuffer and skips the DSI-1 output entirely.
This is usually a power-on timing issue, especially common if you're powering the Pi from a battery or using lower-quality power supplies. The DSI display requires a stable 3.3V and a successful I²C handshake early in the boot sequence.
Step 3: Automatically Recovering with a Script
# Wait for system to fully boot
sleep 10
# Check if the DSI display is attached
if ! grep -q "^DSI" /sys/class/drm/*/status 2>/dev/null; then
echo "DSI screen not detected — restarting display stack..."
# Try restarting common display managers
sudo systemctl restart display-manager 2>/dev/null || \
sudo systemctl restart lightdm 2>/dev/null || \
sudo systemctl restart gdm 2>/dev/null || \
sudo systemctl restart sddm 2>/dev/null
fi
Make it executable:
sudo chmod +x /usr/local/bin/dsi-screen-check.sh
Add a systemd service to run the script:
sudo nano /etc/systemd/system/dsi-screen-check.service
Insert:
[Unit]
Description=Check and reset DSI screen if not detected
After=multi-user.target
[Service]
ExecStart=/usr/local/bin/dsi-screen-check.sh
Type=oneshot
[Install]
WantedBy=multi-user.target
Enable the service:
sudo systemctl daemon-reexec
sudo systemctl enable dsi-screen-check.service
This service now runs at boot and will only restart the display manager if the DSI screen is not detected. When used together with the original xrandr fix, it ensures the display scales correctly even on setups that boot from battery or experience power irregularities.
Hope this helps someone avoid the same headaches! Let me know if you run into issues or have tweaks to improve it.
Kind regards,
Danny
--
You received this message because you are subscribed to the Google Groups "PicoChess" group.
To unsubscribe from this group and stop receiving emails from it, send an email to picochess+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/picochess/808c4f95-83bf-45a7-87ee-ad08f9d4f731n%40googlegroups.com.