From 79b18384be24ea700b4904303e76514ba4797117 Mon Sep 17 00:00:00 2001 From: David Barbion Date: Sat, 25 Feb 2023 22:35:27 +0100 Subject: [PATCH] fix(xorg): load modesetting then intel Intel Xorg driver is still usefull for older intel GPU adapters. Modesetting is the new, replacement of that older driver for newer GPUs. The EmulationStation startup script finds if the PC is running an older GPU and then force the usage of intel driver. If a gen4 or newer is present in the PC, then the modesetting driver is used instead. The script checks for PCI id of the Intel device and tests it against a list of old PCI ids. The list was obtained with the help of: * https://github.com/freedesktop/xorg-xf86-video-intel/blob/master/src/i915_pciids.h * https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_units --- RELEASE-NOTES.md | 6 +++++ .../recalbox/scripts/recalbox-utils.sh | 16 +++++++++++++ .../fsoverlay/etc/init.d/S31emulationstation | 24 +++++++++++++++++++ configs/recalbox-x86_64_defconfig | 1 + 4 files changed, 47 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 894bdd3476..2fb9639bcc 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -4,6 +4,12 @@ This file will be processed and will be distributed with Recalbox Releases. The text, located between the first `## Version XXX` and the second one, will appear as release notes for end user on a Recalbox upgrade. +## Version 9.0.1-Pulstar + +### Fixes + +- Fix black screen on older PC with Intel graphic card + ## Version 9-Pulstar ### News diff --git a/board/recalbox/fsoverlay/recalbox/scripts/recalbox-utils.sh b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-utils.sh index a527b21ebd..05b460e4bd 100644 --- a/board/recalbox/fsoverlay/recalbox/scripts/recalbox-utils.sh +++ b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-utils.sh @@ -165,3 +165,19 @@ getStepNumber() { sed -E '/^\s*case=/!d;s/\s*case=[^:]+:(.*)/\1/' /boot/recalbox-boot.conf } +# isOldIntelChipset +# chipset number is 4 hexa digit (without the 8086) +# return 0 if the given device id mathces a Gen3 and older GPU +isOldIntelChipset() { + local OLD_CHIPSETS=(7800 1240 7121 7123 7125 1132 \ + 2562 3577 2572 3582 358e 3582 \ + 2582 258a 2592 2772 27a2 27ae 29d2 29b2 29c2 a001 a011 \ + ) + local chipset=$(echo "$1" | tr "[:upper:]" "[:lower:]") + for old_chipset in "${OLD_CHIPSETS[@]}"; do + if [ "$chipset" = "$old_chipset" ]; then + return 0 + fi + done + return 1 +} diff --git a/board/recalbox/x86/fsoverlay/etc/init.d/S31emulationstation b/board/recalbox/x86/fsoverlay/etc/init.d/S31emulationstation index 01b8f3f219..86ca1a98a3 100755 --- a/board/recalbox/x86/fsoverlay/etc/init.d/S31emulationstation +++ b/board/recalbox/x86/fsoverlay/etc/init.d/S31emulationstation @@ -8,6 +8,30 @@ INIT_SCRIPT=$(basename "$0") case "$1" in start) + intel_chip_id=$(lspci -d 8086::0300 -mm -n | sed -E 's/^.*8086"\s*"([^"]+)".*/\1/') + if [ -n "$intel_chip_id" -a ! -f /etc/X11/xorg.conf ]; then + # we should reach this part if we have an intel GPU and no hybrid laptop + # nor prime configuration (which configures /etc/X11/xorg.conf) + source /recalbox/scripts/recalbox-utils.sh + mount -o remount,rw / + if isOldIntelChipset "$intel_chip_id"; then + recallog -s "${INIT_SCRIPT}" -t "ES" "Older intel chipset detected (${intel_chip_id}), using intel Xorg driver" + cat >/etc/X11/xorg.conf <<" EOF" + Section "Device" + Identifier "intel" + Driver "intel" + EndSection + EOF + else + recallog -s "${INIT_SCRIPT}" -t "ES" "Newer intel chipset detected (${intel_chip_id}), using modesetting Xorg driver" + cat >/etc/X11/xorg.conf <<" EOF" + Section "Module" + Load "modesetting" + EndSection + EOF + fi + mount -o remount,ro / + fi enabled="`$systemsetting -command load -key system.es.atstartup`" if [ "$enabled" != "0" ];then settings_lang="`$systemsetting -command load -key system.language`" diff --git a/configs/recalbox-x86_64_defconfig b/configs/recalbox-x86_64_defconfig index 1e64f05903..48a2219c15 100644 --- a/configs/recalbox-x86_64_defconfig +++ b/configs/recalbox-x86_64_defconfig @@ -139,6 +139,7 @@ BR2_PACKAGE_XDRIVER_XF86_INPUT_LIBINPUT=y BR2_PACKAGE_XDRIVER_XF86_VIDEO_AMDGPU=y BR2_PACKAGE_XDRIVER_XF86_VIDEO_ATI=y BR2_PACKAGE_XDRIVER_XF86_VIDEO_FBDEV=y +BR2_PACKAGE_XDRIVER_XF86_VIDEO_INTEL=y BR2_PACKAGE_XDRIVER_XF86_VIDEO_NOUVEAU=y BR2_PACKAGE_XDRIVER_XF86_VIDEO_NV=y BR2_PACKAGE_XTERM=y -- GitLab