On Wed, Apr 27, 2022 at 12:53:37PM +1000, Jonathan Gray wrote:
> On Tue, Apr 26, 2022 at 12:51:10PM +0100, james palmer wrote:
> > That fixes things, thanks :)
> > 
> > Maybe the default should be to not use glamour if hardware cannot be 
> > scanned. Then again, not many people will be using hardware this old so it 
> > might not be worth it.
> > 
> > - James
> 
> When pci can not be scanned the wscons display type is used to
> decide if modesetting is used.
> 
> Using startx on x40 (i855 with gen 2 graphics) modesetting does not use
> glamor due to the advertised opengl version.
> 
> [   340.854] (II) modeset(0): glamor: Ignoring GL < 2.1, falling back to GLES.
> [   340.855] (EE) modeset(0): glamor: Failed to create GL or GLES2 contexts
> [   340.985] (II) modeset(0): glamor initialization failed
> 
> This check in xenocara/xserver/glamor/glamor_egl.c glamor_egl_init()
> could be changed to include intel gen 3 hardware.
> 
> intel should be the preferred driver for this hardware.  I'll see if I
> can come up with a patch to get the pci vid/pid out of a drm device.

The diff below does that but startx will still result in the modesetting
driver being used.  I suspect that is due to libpciaccess use in
xf86-video-intel.

[ 13988.707] (==) xf86PciFromDRM returning vid 0x8086 pid 0x3582
[ 13988.707] (==) Matched intel as autoconfigured driver 0
[ 13988.707] (==) Matched modesetting as autoconfigured driver 1

[ 13988.608] 
X.Org X Server 1.21.1.3
X Protocol Version 11, Revision 0
[ 13988.622] Current Operating System: OpenBSD x40.jsg.id.au 7.1 GENERIC#166 
i386
[ 13988.629]  
[ 13988.636] Current version of pixman: 0.40.0
[ 13988.643]    Before reporting problems, check http://wiki.x.org
        to make sure that you have the latest version.
[ 13988.644] Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 13988.652] (==) Log file: "/home/jsg/.local/share/xorg/Xorg.0.log", Time: Wed 
Apr 27 14:48:57 2022
[ 13988.653] (==) Using system config directory 
"/usr/X11R6/share/X11/xorg.conf.d"
[ 13988.654] (==) No Layout section.  Using the first Screen section.
[ 13988.654] (==) No screen section available. Using defaults.
[ 13988.654] (**) |-->Screen "Default Screen Section" (0)
[ 13988.654] (**) |   |-->Monitor "<default monitor>"
[ 13988.656] (==) No monitor specified for screen "Default Screen Section".
        Using a default monitor configuration.
[ 13988.656] (==) Automatically adding devices
[ 13988.656] (==) Automatically enabling devices
[ 13988.656] (==) Not automatically adding GPU devices
[ 13988.656] (==) Automatically binding GPU devices
[ 13988.656] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 13988.656] (==) FontPath set to:
        /usr/X11R6/lib/X11/fonts/misc/,
        /usr/X11R6/lib/X11/fonts/TTF/,
        /usr/X11R6/lib/X11/fonts/OTF/,
        /usr/X11R6/lib/X11/fonts/Type1/,
        /usr/X11R6/lib/X11/fonts/100dpi/,
        /usr/X11R6/lib/X11/fonts/75dpi/
[ 13988.656] (==) ModulePath set to "/usr/X11R6/lib/modules"
[ 13988.656] (II) The server relies on wscons to provide the list of input 
devices.
        If no devices become available, reconfigure wscons or disable 
AutoAddDevices.
[ 13988.656] (II) Loader magic: 0x39e0c7d8
[ 13988.656] (II) Module ABI versions:
[ 13988.657]    X.Org ANSI C Emulation: 0.4
[ 13988.657]    X.Org Video Driver: 25.2
[ 13988.657]    X.Org XInput driver : 24.4
[ 13988.657]    X.Org Server Extension : 10.0
[ 13988.657] (--) Using wscons driver on /dev/ttyC4
[ 13988.687] (WW) checkDevMem: failed to open /dev/xf86 and /dev/mem
        (Permission denied)
        Check that you have set 'machdep.allowaperture=1'
        in /etc/sysctl.conf and reboot your machine
        refer to xf86(4) for details
[ 13988.687]    linear framebuffer access unavailable
[ 13988.687] (II) LoadModule: "glx"
[ 13988.691] (II) Loading /usr/X11R6/lib/modules/extensions/libglx.so
[ 13988.696] (II) Module glx: vendor="X.Org Foundation"
[ 13988.696]    compiled for 1.21.1.3, module version = 1.0.0
[ 13988.696]    ABI class: X.Org Server Extension, version 10.0
[ 13988.707] (==) xf86PciFromDRM returning vid 0x8086 pid 0x3582
[ 13988.707] (==) Matched intel as autoconfigured driver 0
[ 13988.707] (==) Matched modesetting as autoconfigured driver 1
[ 13988.707] (==) Assigned the driver to the xf86ConfigLayout
[ 13988.707] (II) LoadModule: "intel"
[ 13988.709] (II) Loading /usr/X11R6/lib/modules/drivers/intel_drv.so
[ 13988.709] (II) Module intel: vendor="X.Org Foundation"
[ 13988.710]    compiled for 1.21.1.3, module version = 2.99.916
[ 13988.710]    Module class: X.Org Video Driver
[ 13988.710]    ABI class: X.Org Video Driver, version 25.2
[ 13988.710] (II) LoadModule: "modesetting"
[ 13988.712] (II) Loading /usr/X11R6/lib/modules/drivers/modesetting_drv.so
[ 13988.713] (II) Module modesetting: vendor="X.Org Foundation"
[ 13988.713]    compiled for 1.21.1.3, module version = 1.21.1
[ 13988.713]    Module class: X.Org Video Driver
[ 13988.713]    ABI class: X.Org Video Driver, version 25.2
[ 13988.713] (II) intel: Driver for Intel(R) Integrated Graphics Chipsets:
        i810, i810-dc100, i810e, i815, i830M, 845G, 854, 852GM/855GM, 865G,
        915G, E7221 (i915), 915GM, 945G, 945GM, 945GME, Pineview GM,
        Pineview G, 965G, G35, 965Q, 946GZ, 965GM, 965GME/GLE, G33, Q35, Q33,
        GM45, 4 Series, G45/G43, Q45/Q43, G41, B43
[ 13988.714] (II) intel: Driver for Intel(R) HD Graphics: 2000-6000
[ 13988.714] (II) intel: Driver for Intel(R) Iris(TM) Graphics: 5100, 6100
[ 13988.714] (II) intel: Driver for Intel(R) Iris(TM) Pro Graphics: 5200, 6200, 
P6300
[ 13988.714] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[ 13988.714] (WW) Falling back to old probe method for modesetting
[ 13988.727] (II) modeset(0): using default device
[ 13988.728] (II) modeset(0): Creating default Display subsection in Screen 
section
        "Default Screen Section" for depth/fbbpp 24/32
[ 13988.728] (==) modeset(0): Depth 24, (==) framebuffer bpp 32
[ 13988.728] (==) modeset(0): RGB weight 888
[ 13988.728] (==) modeset(0): Default visual is TrueColor
[ 13988.728] (II) Loading sub module "glamoregl"
[ 13988.728] (II) LoadModule: "glamoregl"
[ 13988.734] (II) Loading /usr/X11R6/lib/modules/libglamoregl.so
[ 13988.744] (II) Module glamoregl: vendor="X.Org Foundation"
[ 13988.744]    compiled for 1.21.1.3, module version = 1.0.1
[ 13988.744]    ABI class: X.Org ANSI C Emulation, version 0.4
[ 13988.782] (II) modeset(0): glamor: Ignoring GL < 2.1, falling back to GLES.
[ 13988.782] (EE) modeset(0): glamor: Failed to create GL or GLES2 contexts
[ 13988.794] (II) modeset(0): glamor initialization failed
[ 13988.794] (II) modeset(0): ShadowFB: preferred YES, enabled YES
[ 13988.794] (II) modeset(0): Double-buffered shadow updates: off
[ 13988.795] (II) modeset(0): Output LVDS-1 has no monitor section
[ 13988.876] (II) modeset(0): Output VGA-1 has no monitor section
[ 13988.877] (II) modeset(0): EDID for output LVDS-1
[ 13988.878] (II) modeset(0): Printing probed modes for output LVDS-1
[ 13988.878] (II) modeset(0): Modeline "1024x768"x50.0   54.17  1024 1048 1184 
1344  768 771 777 806 -hsync -vsync (40.3 kHz P)
[ 13988.878] (II) modeset(0): Modeline "960x720"x120.0  117.00  960 1024 1128 
1300  720 720 722 750 doublescan -hsync +vsync (90.0 kHz d)
[ 13988.878] (II) modeset(0): Modeline "928x696"x120.1  109.15  928 976 1088 
1264  696 696 698 719 doublescan -hsync +vsync (86.4 kHz d)
[ 13988.878] (II) modeset(0): Modeline "896x672"x120.0  102.40  896 960 1060 
1224  672 672 674 697 doublescan -hsync +vsync (83.7 kHz d)
[ 13988.878] (II) modeset(0): Modeline "1024x576"x119.9   98.50  1024 1092 1200 
1376  576 577 580 597 doublescan -hsync +vsync (71.6 kHz d)
[ 13988.878] (II) modeset(0): Modeline "1024x576"x119.9   78.38  1024 1048 1064 
1104  576 577 580 592 doublescan +hsync -vsync (71.0 kHz d)
[ 13988.878] (II) modeset(0): Modeline "1024x576"x59.9   46.50  1024 1064 1160 
1296  576 579 584 599 -hsync +vsync (35.9 kHz d)
[ 13988.878] (II) modeset(0): Modeline "1024x576"x59.8   42.00  1024 1072 1104 
1184  576 579 584 593 +hsync -vsync (35.5 kHz d)
[ 13988.878] (II) modeset(0): Modeline "960x600"x119.9   96.62  960 1028 1128 
1296  600 601 604 622 doublescan -hsync +vsync (74.6 kHz d)
[ 13988.878] (II) modeset(0): Modeline "960x600"x120.0   77.00  960 984 1000 
1040  600 601 604 617 doublescan +hsync -vsync (74.0 kHz d)
[ 13988.879] (II) modeset(0): Modeline "960x540"x119.9   86.50  960 1024 1124 
1288  540 541 544 560 doublescan -hsync +vsync (67.2 kHz d)
[ 13988.879] (II) modeset(0): Modeline "960x540"x120.0   69.25  960 984 1000 
1040  540 541 544 555 doublescan +hsync -vsync (66.6 kHz d)
[ 13988.879] (II) modeset(0): Modeline "960x540"x59.6   40.75  960 992 1088 
1216  540 543 548 562 -hsync +vsync (33.5 kHz d)
[ 13988.879] (II) modeset(0): Modeline "960x540"x59.8   37.25  960 1008 1040 
1120  540 543 548 556 +hsync -vsync (33.3 kHz d)
[ 13988.879] (II) modeset(0): Modeline "800x600"x120.0   81.00  800 832 928 
1080  600 600 602 625 doublescan +hsync +vsync (75.0 kHz d)
[ 13988.879] (II) modeset(0): Modeline "800x600"x60.3   40.00  800 840 968 1056 
 600 601 605 628 +hsync +vsync (37.9 kHz d)
[ 13988.879] (II) modeset(0): Modeline "800x600"x56.2   36.00  800 824 896 1024 
 600 601 603 625 +hsync +vsync (35.2 kHz d)
[ 13988.879] (II) modeset(0): Modeline "840x525"x120.0   73.12  840 892 980 
1120  525 526 529 544 doublescan -hsync +vsync (65.3 kHz d)
[ 13988.879] (II) modeset(0): Modeline "840x525"x119.8   59.50  840 864 880 920 
 525 526 529 540 doublescan +hsync -vsync (64.7 kHz d)
[ 13988.879] (II) modeset(0): Modeline "864x486"x59.9   32.50  864 888 968 1072 
 486 489 494 506 -hsync +vsync (30.3 kHz d)
[ 13988.879] (II) modeset(0): Modeline "864x486"x59.6   30.50  864 912 944 1024 
 486 489 494 500 +hsync -vsync (29.8 kHz d)
[ 13988.879] (II) modeset(0): Modeline "700x525"x120.0   61.00  700 744 820 940 
 525 526 532 541 doublescan +hsync +vsync (64.9 kHz d)
[ 13988.879] (II) modeset(0): Modeline "800x450"x119.9   59.12  800 848 928 
1056  450 451 454 467 doublescan -hsync +vsync (56.0 kHz d)
[ 13988.879] (II) modeset(0): Modeline "800x450"x119.6   48.75  800 824 840 880 
 450 451 454 463 doublescan +hsync -vsync (55.4 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x512"x120.0   54.00  640 664 720 844 
 512 512 514 533 doublescan +hsync +vsync (64.0 kHz d)
[ 13988.879] (II) modeset(0): Modeline "700x450"x119.9   51.75  700 740 812 924 
 450 451 456 467 doublescan -hsync +vsync (56.0 kHz d)
[ 13988.879] (II) modeset(0): Modeline "700x450"x119.8   43.25  700 724 740 780 
 450 451 456 463 doublescan +hsync -vsync (55.4 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x480"x120.0   54.00  640 688 744 900 
 480 480 482 500 doublescan +hsync +vsync (60.0 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x480"x59.9   25.18  640 656 752 800  
480 490 492 525 -hsync -vsync (31.5 kHz d)
[ 13988.879] (II) modeset(0): Modeline "720x405"x59.5   22.50  720 744 808 896  
405 408 413 422 -hsync +vsync (25.1 kHz d)
[ 13988.879] (II) modeset(0): Modeline "720x405"x59.0   21.75  720 768 800 880  
405 408 413 419 +hsync -vsync (24.7 kHz d)
[ 13988.879] (II) modeset(0): Modeline "684x384"x119.8   42.62  684 720 788 892 
 384 385 390 399 doublescan -hsync +vsync (47.8 kHz d)
[ 13988.879] (II) modeset(0): Modeline "684x384"x119.7   36.12  684 708 724 764 
 384 385 390 395 doublescan +hsync -vsync (47.3 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x400"x119.8   41.75  640 676 740 840 
 400 401 404 415 doublescan -hsync +vsync (49.7 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x400"x120.0   35.50  640 664 680 720 
 400 401 404 411 doublescan +hsync -vsync (49.3 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x360"x119.7   37.25  640 672 736 832 
 360 361 364 374 doublescan -hsync +vsync (44.8 kHz d)
[ 13988.879] (II) modeset(0): Modeline "640x360"x119.7   31.88  640 664 680 720 
 360 361 364 370 doublescan +hsync -vsync (44.3 kHz d)
[ 13988.880] (II) modeset(0): Modeline "640x360"x59.8   18.00  640 664 720 800  
360 363 368 376 -hsync +vsync (22.5 kHz d)
[ 13988.880] (II) modeset(0): Modeline "640x360"x59.3   17.75  640 688 720 800  
360 363 368 374 +hsync -vsync (22.2 kHz d)
[ 13988.880] (II) modeset(0): Modeline "512x384"x120.0   32.50  512 524 592 672 
 384 385 388 403 doublescan -hsync -vsync (48.4 kHz d)
[ 13988.880] (II) modeset(0): Modeline "512x288"x120.0   23.25  512 532 580 648 
 288 289 292 299 doublescan -hsync +vsync (35.9 kHz d)
[ 13988.880] (II) modeset(0): Modeline "512x288"x119.8   21.00  512 536 552 592 
 288 289 292 296 doublescan +hsync -vsync (35.5 kHz d)
[ 13988.880] (II) modeset(0): Modeline "480x270"x119.3   20.38  480 496 544 608 
 270 271 274 281 doublescan -hsync +vsync (33.5 kHz d)
[ 13988.880] (II) modeset(0): Modeline "480x270"x119.6   18.62  480 504 520 560 
 270 271 274 278 doublescan +hsync -vsync (33.3 kHz d)
[ 13988.880] (II) modeset(0): Modeline "400x300"x120.6   20.00  400 420 484 528 
 300 300 302 314 doublescan +hsync +vsync (37.9 kHz d)
[ 13988.880] (II) modeset(0): Modeline "400x300"x112.7   18.00  400 412 448 512 
 300 300 301 312 doublescan +hsync +vsync (35.2 kHz d)
[ 13988.880] (II) modeset(0): Modeline "432x243"x119.8   16.25  432 444 484 536 
 243 244 247 253 doublescan -hsync +vsync (30.3 kHz d)
[ 13988.880] (II) modeset(0): Modeline "432x243"x119.1   15.25  432 456 472 512 
 243 244 247 250 doublescan +hsync -vsync (29.8 kHz d)
[ 13988.880] (II) modeset(0): Modeline "320x240"x120.1   12.59  320 328 376 400 
 240 245 246 262 doublescan -hsync -vsync (31.5 kHz d)
[ 13988.880] (II) modeset(0): Modeline "360x202"x119.0   11.25  360 372 404 448 
 202 204 206 211 doublescan -hsync +vsync (25.1 kHz d)
[ 13988.880] (II) modeset(0): Modeline "360x202"x118.3   10.88  360 384 400 440 
 202 204 206 209 doublescan +hsync -vsync (24.7 kHz d)
[ 13988.880] (II) modeset(0): Modeline "320x180"x119.7    9.00  320 332 360 400 
 180 181 184 188 doublescan -hsync +vsync (22.5 kHz d)
[ 13988.880] (II) modeset(0): Modeline "320x180"x118.6    8.88  320 344 360 400 
 180 181 184 187 doublescan +hsync -vsync (22.2 kHz d)
[ 13988.961] (II) modeset(0): EDID for output VGA-1
[ 13988.961] (II) modeset(0): Output LVDS-1 connected
[ 13988.961] (II) modeset(0): Output VGA-1 disconnected
[ 13988.961] (II) modeset(0): Using exact sizes for initial modes
[ 13988.961] (II) modeset(0): Output LVDS-1 using initial mode 1024x768 +0+0
[ 13988.961] (==) modeset(0): Using gamma correction (1.0, 1.0, 1.0)
[ 13988.961] (==) modeset(0): DPI set to (96, 96)
[ 13988.962] (II) Loading sub module "fb"
[ 13988.962] (II) LoadModule: "fb"
[ 13988.962] (II) Module "fb" already built-in
[ 13988.962] (II) Loading sub module "shadow"
[ 13988.962] (II) LoadModule: "shadow"
[ 13988.966] (II) Loading /usr/X11R6/lib/modules/libshadow.so
[ 13988.967] (II) Module shadow: vendor="X.Org Foundation"
[ 13988.967]    compiled for 1.21.1.3, module version = 1.1.0
[ 13988.967]    ABI class: X.Org ANSI C Emulation, version 0.4
[ 13988.967] (II) UnloadModule: "intel"
[ 13988.967] (II) Unloading intel
[ 13988.968] (==) modeset(0): Backing store enabled
[ 13988.968] (==) modeset(0): Silken mouse enabled
[ 13989.008] (II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
[ 13989.009] (==) modeset(0): DPMS enabled
[ 13989.009] (II) Initializing extension Generic Event Extension
[ 13989.010] (II) Initializing extension SHAPE
[ 13989.012] (II) Initializing extension MIT-SHM
[ 13989.013] (II) Initializing extension XInputExtension
[ 13989.014] (II) Initializing extension XTEST
[ 13989.016] (II) Initializing extension BIG-REQUESTS
[ 13989.017] (II) Initializing extension SYNC
[ 13989.018] (II) Initializing extension XKEYBOARD
[ 13989.019] (II) Initializing extension XC-MISC
[ 13989.021] (II) Initializing extension SECURITY
[ 13989.022] (II) Initializing extension XFIXES
[ 13989.023] (II) Initializing extension RENDER
[ 13989.024] (II) Initializing extension RANDR
[ 13989.027] (II) Initializing extension COMPOSITE
[ 13989.028] (II) Initializing extension DAMAGE
[ 13989.030] (II) Initializing extension MIT-SCREEN-SAVER
[ 13989.031] (II) Initializing extension DOUBLE-BUFFER
[ 13989.032] (II) Initializing extension RECORD
[ 13989.033] (II) Initializing extension DPMS
[ 13989.035] (II) Initializing extension Present
[ 13989.036] (II) Initializing extension DRI3
[ 13989.036] (II) Initializing extension X-Resource
[ 13989.037] (II) Initializing extension XVideo
[ 13989.038] (II) Initializing extension XVideo-MotionCompensation
[ 13989.038] (II) Initializing extension GLX
[ 13989.040] (II) AIGLX: Screen 0 is not DRI2 capable
[ 13989.156] (II) IGLX: Loaded and initialized swrast
[ 13989.156] (II) GLX: Initialized DRISWRAST GL provider for screen 0
[ 13989.156] (II) Initializing extension XFree86-VidModeExtension
[ 13989.158] (II) Initializing extension XFree86-DGA
[ 13989.159] (II) Initializing extension XFree86-DRI
[ 13989.159] (II) Initializing extension DRI2
[ 13989.161] (II) modeset(0): Damage tracking initialized
[ 13989.161] (II) modeset(0): Setting screen physical size to 270 x 203
[ 13989.424] (II) config/wscons: checking input device /dev/wskbd
[ 13989.424] (II) wskbd: using layout us
[ 13989.424] (II) LoadModule: "kbd"
[ 13989.428] (II) Loading /usr/X11R6/lib/modules/input/kbd_drv.so
[ 13989.429] (II) Module kbd: vendor="X.Org Foundation"
[ 13989.429]    compiled for 1.21.1.3, module version = 1.9.0
[ 13989.429]    Module class: X.Org XInput Driver
[ 13989.429]    ABI class: X.Org XInput driver, version 24.4
[ 13989.429] (II) Using input driver 'kbd' for '/dev/wskbd'
[ 13989.429] (**) /dev/wskbd: always reports core events
[ 13989.429] (**) /dev/wskbd: always reports core events
[ 13989.429] (**) Option "Protocol" "standard"
[ 13989.429] (**) Option "XkbRules" "base"
[ 13989.429] (**) Option "XkbModel" "pc105"
[ 13989.429] (**) Option "XkbLayout" "us"
[ 13989.429] (II) XINPUT: Adding extended input device "/dev/wskbd" (type: 
KEYBOARD, id 6)
[ 13989.504] (II) config/wscons: checking input device /dev/wsmouse
[ 13989.504] (II) LoadModule: "ws"
[ 13989.508] (II) Loading /usr/X11R6/lib/modules/input/ws_drv.so
[ 13989.508] (II) Module ws: vendor="X.Org Foundation"
[ 13989.508]    compiled for 1.21.1.3, module version = 1.3.0
[ 13989.508]    Module class: X.Org XInput Driver
[ 13989.508]    ABI class: X.Org XInput driver, version 24.4
[ 13989.508] (II) Using input driver 'ws' for '/dev/wsmouse'
[ 13989.508] (**) /dev/wsmouse: always reports core events
[ 13989.508] (II) ws: /dev/wsmouse: debuglevel 0
[ 13989.508] (**) Option "Device" "/dev/wsmouse"
[ 13989.509] (**) ws: /dev/wsmouse: ZAxisMapping: buttons 4 and 5
[ 13989.509] (**) ws: /dev/wsmouse: WAxisMapping: buttons 6 and 7
[ 13989.509] (**) ws: /dev/wsmouse: associated screen: 0
[ 13989.575] (II) ws: /dev/wsmouse: minimum x position: 0
[ 13989.575] (II) ws: /dev/wsmouse: maximum x position: 1023
[ 13989.575] (II) ws: /dev/wsmouse: minimum y position: 0
[ 13989.575] (II) ws: /dev/wsmouse: maximum y position: 767
[ 13989.575] (==) ws: /dev/wsmouse: Buttons: 7
[ 13989.580] (**) ws: /dev/wsmouse: YAxisMapping: buttons 4 and 5
[ 13989.580] (II) XINPUT: Adding extended input device "/dev/wsmouse" (type: 
MOUSE, id 7)
[ 13989.646] (**) /dev/wsmouse: (accel) keeping acceleration scheme 1
[ 13989.646] (**) /dev/wsmouse: (accel) acceleration profile 0
[ 13989.647] (**) /dev/wsmouse: (accel) acceleration factor: 2.000
[ 13989.647] (**) /dev/wsmouse: (accel) acceleration threshold: 4

Index: xserver/hw/xfree86/common/xf86pciBus.c
===================================================================
RCS file: /cvs/xenocara/xserver/hw/xfree86/common/xf86pciBus.c,v
retrieving revision 1.18
diff -u -p -r1.18 xf86pciBus.c
--- xserver/hw/xfree86/common/xf86pciBus.c      3 Feb 2022 23:48:52 -0000       
1.18
+++ xserver/hw/xfree86/common/xf86pciBus.c      27 Apr 2022 04:50:13 -0000
@@ -35,6 +35,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <fcntl.h>
 #include <X11/X.h>
 #include <pciaccess.h>
 #include "os.h"
@@ -51,6 +52,10 @@
 
 #define PCI_VENDOR_GENERIC             0x00FF
 
+#ifdef WITH_LIBDRM
+#include <xf86drm.h>
+#endif
+
 /* Bus-specific globals */
 int pciSlotClaimed = 0;
 
@@ -1422,6 +1427,48 @@ xf86MatchDriverFromFiles(uint16_t match_
 }
 #endif                          /* __linux__ */
 
+#ifdef X_PRIVSEP
+extern int priv_open_device(const char *);
+#else
+#define priv_open_device(n)    open((n),O_RDWR)
+#endif
+
+struct pci_device *xf86PciFromDRM(void);
+
+struct pci_device *
+xf86PciFromDRM(void)
+{
+#ifdef WITH_LIBDRM
+    struct pci_device *info;
+    drmDevicePtr device;
+    int fd;
+
+    fd = priv_open_device("/dev/dri/card0");
+    if (fd == -1)
+        return NULL;
+
+    if (drmGetDevice2(fd, 0, &device) != 0) {
+        close(fd);
+        return NULL;
+    }
+    close(fd);
+
+    if (device->bustype != DRM_BUS_PCI)
+        return NULL;
+
+    info = calloc(1, sizeof *info);
+    if (info == NULL)
+        return NULL;
+    info->vendor_id = device->deviceinfo.pci->vendor_id;
+    info->device_id = device->deviceinfo.pci->device_id;
+    xf86Msg(X_DEFAULT, "%s returning vid 0x%x pid 0x%x\n", __func__,
+        info->vendor_id, info->device_id);
+    return info;
+#else
+    return NULL;
+#endif
+}
+
 void
 xf86PciMatchDriver(XF86MatchedDrivers *md)
 {
@@ -1441,6 +1488,9 @@ xf86PciMatchDriver(XF86MatchedDrivers *m
     if (info)
         xf86MatchDriverFromFiles(info->vendor_id, info->device_id, md);
 #endif
+
+    if (info == NULL)
+       info = xf86PciFromDRM();
 
     if (info != NULL) {
         xf86VideoPtrToDriverList(info, md);

Reply via email to