From ec14ecf75111dc8723579644a73b60860fc13a19 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 20 Aug 2025 12:26:01 -0700 Subject: [PATCH] modesetting: Fix builds with pciaccess or udev_kms disabled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI meson-disable-options builds were failing with: ../hw/xfree86/drivers/modesetting/driver.c:127:5: error: ‘ms_device_match’ undeclared here (not in a function) 127 | ms_device_match, | ^~~~~~~~~~~~~~~ ../hw/xfree86/drivers/modesetting/driver.c: In function ‘ms_get_drm_master_fd’: ../hw/xfree86/drivers/modesetting/driver.c:1179:19: error: variable ‘pEnt’ set but not used [-Werror=unused-but-set-variable] 1179 | EntityInfoPtr pEnt; | ^~~~ ../hw/xfree86/drivers/modesetting/driver.c: At top level: ../hw/xfree86/drivers/modesetting/driver.c:84:13: error: ‘ms_pci_probe’ used but never defined [-Werror] 84 | static Bool ms_pci_probe(DriverPtr driver, | ^~~~~~~~~~~~ ../hw/xfree86/drivers/modesetting/driver.c:313:1: error: ‘probe_hw_pci’ defined but not used [-Werror=unused-function] 313 | probe_hw_pci(const char *dev, struct pci_device *pdev) | ^~~~~~~~~~~~ Fixes: a72bdf170 ("modesetting: rewrite probing based on fbdev.") Signed-off-by: Alan Coopersmith Part-of: --- hw/xfree86/drivers/modesetting/driver.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c index fe78111e8..d7958806b 100644 --- a/hw/xfree86/drivers/modesetting/driver.c +++ b/hw/xfree86/drivers/modesetting/driver.c @@ -81,9 +81,11 @@ static Bool ScreenInit(ScreenPtr pScreen, int argc, char **argv); static Bool PreInit(ScrnInfoPtr pScrn, int flags); static Bool Probe(DriverPtr drv, int flags); +#ifdef XSERVER_LIBPCIACCESS static Bool ms_pci_probe(DriverPtr driver, int entity_num, struct pci_device *device, intptr_t match_data); +#endif static Bool ms_driver_func(ScrnInfoPtr scrn, xorgDriverFuncOp op, void *data); /* window wrapper functions used to get the notification when @@ -124,8 +126,13 @@ _X_EXPORT DriverRec modesetting = { NULL, 0, ms_driver_func, +#ifdef XSERVER_LIBPCIACCESS ms_device_match, ms_pci_probe, +#else + NULL, + NULL, +#endif #ifdef XSERVER_PLATFORM_BUS ms_platform_probe, #endif @@ -297,6 +304,7 @@ probe_hw(const char *dev, struct xf86_platform_device *platform_dev) return FALSE; } +#ifdef XSERVER_LIBPCIACCESS static char * ms_DRICreatePCIBusID(const struct pci_device *dev) { @@ -339,6 +347,7 @@ probe_hw_pci(const char *dev, struct pci_device *pdev) free(devid); return ret; } +#endif static const OptionInfoRec * AvailableOptions(int chipid, int busid) @@ -1176,14 +1185,11 @@ msShouldDoubleShadow(ScrnInfoPtr pScrn, modesettingPtr ms) static Bool ms_get_drm_master_fd(ScrnInfoPtr pScrn) { - EntityInfoPtr pEnt; - modesettingPtr ms; - modesettingEntPtr ms_ent; - - ms = modesettingPTR(pScrn); - ms_ent = ms_ent_priv(pScrn); - - pEnt = ms->pEnt; + modesettingPtr ms = modesettingPTR(pScrn); + modesettingEntPtr ms_ent = ms_ent_priv(pScrn); +#if defined(XSERVER_PLATFORM_BUS) || defined(XSERVER_LIBPCIACCESS) + EntityInfoPtr pEnt = ms->pEnt; +#endif if (ms_ent->fd) { xf86DrvMsg(pScrn->scrnIndex, X_INFO,