Date: Tuesday, June 21, 2022 @ 20:24:47 Author: heftig Revision: 449234
2.5.0-3: Prevent interference with simpledrm Added: xf86-video-vesa/trunk/0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch Modified: xf86-video-vesa/trunk/PKGBUILD Deleted: xf86-video-vesa/trunk/revert-kernelcheck.patch -----------------------------------------------------------------+ 0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch | 88 ++++++++++ PKGBUILD | 11 - revert-kernelcheck.patch | 31 --- 3 files changed, 95 insertions(+), 35 deletions(-) Added: 0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch =================================================================== --- 0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch (rev 0) +++ 0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch 2022-06-21 20:24:47 UTC (rev 449234) @@ -0,0 +1,88 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jocelyn Falempe <jfale...@redhat.com> +Date: Thu, 14 Apr 2022 14:39:37 +0200 +Subject: [PATCH] Refuse to run if framebuffer or dri devices are present + +The simpledrm driver, introduced in kernel 5.14, +can replace efifb to provide the efi framebuffer. + +This fixes a bug on Fedora 36 (first version to use simpledrm driver): +https://bugzilla.redhat.com/show_bug.cgi?id=2074789 + +v2: check for framebuffer or dri devices instead of efi framebuffer interface. + +Reviewed-by: Adam Jackson <a...@redhat.com> +Reviewed-by: Javier Martinez Canillas <javi...@redhat.com> +Signed-off-by: Jocelyn Falempe <jfale...@redhat.com> +--- + src/vesa.c | 39 ++++++++++++++++++++++++++++++++++----- + 1 file changed, 34 insertions(+), 5 deletions(-) + +diff --git a/src/vesa.c b/src/vesa.c +index b2a1922c2332..2bf18e9f278c 100644 +--- a/src/vesa.c ++++ b/src/vesa.c +@@ -44,6 +44,7 @@ + + #include <string.h> + #include <unistd.h> ++#include <dirent.h> + #include "vesa.h" + + /* All drivers initialising the SW cursor need this */ +@@ -439,22 +440,50 @@ VESAInitScrn(ScrnInfoPtr pScrn) + pScrn->FreeScreen = VESAFreeScreen; + } + ++#ifdef XSERVER_LIBPCIACCESS ++#ifdef __linux__ ++/* ++ * check if a file exist in directory ++ * should be equivalent to a glob ${directory}/${prefix}* ++ */ ++ ++static Bool ++VESAFileExistsPrefix(const char *directory, const char *prefix) { ++ DIR *dir; ++ struct dirent *entry; ++ Bool found = FALSE; ++ int len = strlen(prefix); ++ ++ dir = opendir(directory); ++ if (!dir) ++ return FALSE; ++ ++ while ((entry = readdir(dir)) != NULL) { ++ if (strlen(entry->d_name) > len && ++ !memcmp(entry->d_name, prefix, len)) { ++ found = TRUE; ++ break; ++ } ++ } ++ closedir(dir); ++ return found; ++} ++#endif ++ + /* + * This function is called once, at the start of the first server generation to + * do a minimal probe for supported hardware. + */ +- +-#ifdef XSERVER_LIBPCIACCESS + static Bool + VESAPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev, + intptr_t match_data) + { + ScrnInfoPtr pScrn; + + #ifdef __linux__ +- if (access("/sys/devices/platform/efi-framebuffer.0", F_OK) == 0 || +- access("/sys/devices/platform/efifb.0", F_OK) == 0) { +- ErrorF("vesa: Refusing to run on UEFI\n"); ++ if (VESAFileExistsPrefix("/dev", "fb") || ++ VESAFileExistsPrefix("/dev/dri", "card")) { ++ ErrorF("vesa: Refusing to run, Framebuffer or dri device present\n"); + return FALSE; + } + #endif Modified: PKGBUILD =================================================================== --- PKGBUILD 2022-06-21 19:44:28 UTC (rev 449233) +++ PKGBUILD 2022-06-21 20:24:47 UTC (rev 449234) @@ -2,7 +2,7 @@ pkgname=xf86-video-vesa pkgver=2.5.0 -pkgrel=2 +pkgrel=3 pkgdesc="X.org vesa video driver" arch=(x86_64) license=('custom') @@ -11,17 +11,20 @@ makedepends=('xorg-server-devel' 'X-ABI-VIDEODRV_VERSION=25.2') conflicts=('xorg-server<21.1.1' 'X-ABI-VIDEODRV_VERSION<25' 'X-ABI-VIDEODRV_VERSION>=26') groups=('xorg-drivers' 'xorg') +options=('debug') source=(${url}/releases/individual/driver/${pkgname}-${pkgver}.tar.bz2{,.sig} - revert-kernelcheck.patch) + 0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch) sha512sums=('36fd921f54f33eb25966b5f9ea1e1b3e9009965c012c8b9c676686b472111719921b80cf62dafc746058878253e21f0ef341a2ff2d650df22ca1e35e81716a8b' 'SKIP' - '2357f9b30732321c774073c3e233d16ebff29aab31bcebf7c6481bd2187554e85ec8b9cd375eaa836b433dfaba4d9e9cea1dcf3659803a388ceb6699ed905923') + '97fe6c8953bc026d53033fb53367208d70affcc2a05d0011fb71d5f95cba2f7c46c65cd64bc74609e97515052952f1d2342b5607e1d0fe2deb9dfcdcb077f200') validpgpkeys=('DD38563A8A8224537D1F90E45B8A2D50A0ECD0D3') # "Adam Jackson <a...@nwnk.net>" validpgpkeys+=('995ED5C8A6138EB0961F18474C09DD83CAAA50B2') # "Adam Jackson <a...@nwnk.net>" prepare() { cd ${pkgname}-${pkgver} - patch -Np1 -R -i "${srcdir}/revert-kernelcheck.patch" + + # https://gitlab.freedesktop.org/xorg/driver/xf86-video-vesa/-/merge_requests/5 + patch -Np1 -i ../0001-Refuse-to-run-if-framebuffer-or-dri-devices-are-pres.patch } build() { Deleted: revert-kernelcheck.patch =================================================================== --- revert-kernelcheck.patch 2022-06-21 19:44:28 UTC (rev 449233) +++ revert-kernelcheck.patch 2022-06-21 20:24:47 UTC (rev 449234) @@ -1,31 +0,0 @@ -From b1f7f190f9d4f2ab63d3e9ade3e7e04bb4b1f89f Mon Sep 17 00:00:00 2001 -From: Adam Jackson <a...@redhat.com> -Date: Wed, 08 Dec 2010 18:45:32 +0000 -Subject: Refuse to load if there's a kernel driver bound to the device - -Ported from the equivalent check in nv. - -Signed-off-by: Adam Jackson <a...@redhat.com> ---- -diff --git a/src/vesa.c b/src/vesa.c -index 168fde1..2523d76 100644 ---- a/src/vesa.c -+++ b/src/vesa.c -@@ -431,8 +431,14 @@ VESAPciProbe(DriverPtr drv, int entity_num, struct pci_device *dev, - pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL, - NULL, NULL, NULL, NULL, NULL); - if (pScrn != NULL) { -- VESAPtr pVesa = VESAGetRec(pScrn); -+ VESAPtr pVesa; - -+ if (pci_device_has_kernel_driver(dev)) { -+ ErrorF("vesa: Ignoring device with a bound kernel driver\n"); -+ return FALSE; -+ } -+ -+ pVesa = VESAGetRec(pScrn); - VESAInitScrn(pScrn); - pVesa->pciInfo = dev; - } --- -cgit v0.9.0.2-2-gbebe