hax11 icon indicating copy to clipboard operation
hax11 copied to clipboard

Can this be used to fake displays?

Open vans163 opened this issue 8 years ago • 21 comments

Im having a huge pain dealing with games that require a display. They simply fail to start and crash in most cases with errors ranging from failed xrandr ccrtinfos (no crts) to unable to initialize opengl contexts. When the opengl context is obviously fully functional and there, glxgears works, glxinfo is very prudent.

i am not sure if this library goes deep enough as to fix all these issues. I looked at making fakerandr work, but I am concerned it wont address all these errors. Note that as soon as a hook up a real display and xrandr -q shows a CRT or DFP or HDMI, etc the game works and runs fine. As soon as xrandr -q just shows a screen[n] of size 1920x1080 for example without any CRT/DFP, games that query the monitor at startup crash, other games coded differently work.

The reason why I want the game running on the virtual screen/display is so I can VNC to the screen. Which will support full glx if done this way. The only problem is the apps themselves start refusing to start when theres no real outputs.

vans163 avatar Oct 11 '17 22:10 vans163

I'm not sure. The problem might be at the driver level, especially when it comes to OpenGL contexts.

Can you provide instructions on how to set up an X server in this way (without disconnecting my physical monitors), and an example program that you'd like to get working (preferably open-source)?

On a more practical note, perhaps a display emulator plug would work for you?

CyberShadow avatar Oct 12 '17 05:10 CyberShadow

@CyberShadow The plug would work great, if only I had that many output ports on the video card :).

Quite easy.

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Section "InputDevice"
    # generated from default
   Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection


Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Unknown"
    HorizSync       28.0 - 33.0
    VertRefresh     43.0 - 72.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "YourCardName"
    BusID          "PCI:111:0:0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "UseDisplayDevice" "none"
    SubSection     "Display"
        Virtual     1920 1080
        Depth       24
    EndSubSection
EndSection
/usr/bin/X :0 &
DISPLAY=:0 xrandr -q
// Notice its just a screen
DISPLAY=:0 glxgears  
// Full FPS

DISPLAY=:0 WarThunder
//Works full FPS

DISPLAY=:0 Xonotic
//Works full FPS

DISPLAY=:0 https://www.demetriosgame.com/en/demo/
//Xrandr problems, we dont have a display

DISPLAY=:0 wine Path of Exile.exe
//crashing trying to initialize a openGL context (dxd11 wine->opengl)

Same exact config when xrandr -q gives display options works.

I wonder if there maybe a way to call the functions Xorg does when it inits itself to fake the displays that way.

X86VidMode, XrandR, openGL? I think 3 places need to be patched if not more. So thats why I was thinking if theres a way to patch it deeper down in Xorg.

As you can see some games work great, others that query device information tend to crash.

vans163 avatar Oct 12 '17 07:10 vans163

Quite easy.

It doesn't look like I can start a second X server with that config along my main one (so I can work on the same machine), right?

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

@CyberShadow You need /usr/bin/X :0 vt17 -nolisten tcp -novtswitch -sharevts &

vt17 can be any spare tty. from 1-63~.

This will allow you to start the second.

vans163 avatar Oct 12 '17 07:10 vans163

I don't see how that could work.

  • Surely :0 should be something else, like :1, because my main X server is running on :0.
  • That command line is missing a path to the configuration file you pasted above.
  • Running X or Xorg with any command gives me "/usr/lib/xorg-server/Xorg.wrap: Only console users are allowed to run the X server".

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

@CyberShadow

Yea change the :0 to a free display.

Add --config my_custom.conf

Run as sudo/root, Xorg requires root.

sudo /usr/bin/X :9 vt17 -nolisten tcp -novtswitch -sharevts --config custom.conf &

vans163 avatar Oct 12 '17 07:10 vans163

Gets further but doesn't start:

X.Org X Server 1.19.4
Release Date: 2017-10-04
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.12.12-1-ARCH x86_64 
Current Operating System: Linux home.thecybershadow.net 4.13.4-1-ARCH #1 SMP PREEMPT Thu Sep 28 08:39:52 CEST 2017 x86_64
Kernel command line: root=UUID=2b738eaf-519c-47bc-9981-e76fd644423f rw rootflags=subvol=@arch  intel_iommu=on iommu=pt log_buf_len=1048576 fbcon=rotate:3 initrd= initrd=/intel-ucode.img initrd=/initramfs-linux.img
Build Date: 05 October 2017  03:52:55AM
 
Current version of pixman: 0.34.0
	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.9.log", Time: Thu Oct 12 07:42:16 2017
(++) Using config file: "xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
Data incomplete in file xorg.conf
	Undefined InputDevice "EvDev0" referenced by ServerLayout "Layout0".
(EE) 
Fatal server error:
(EE) no screens found(EE) 
(EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
(EE) Please also check the log file at "/var/log/Xorg.9.log" for additional information.
(EE) 
(EE) Server terminated with error (1). Closing log file.

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

I made an error in the ServerLayout

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
EndSection

Change it to thise. Note the InputDevice.

Also can you paste /var/log/Xorg.0.log? It seems it cannot find a screen. Usually this means the PCI-BUS id does not match the video card? Did you change the BUS ID? BusID "PCI:111:0:0"

vans163 avatar Oct 12 '17 07:10 vans163

Same. I don't think the input configuration is the problem, considering the fatal error is (EE) no screens found(EE) .

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

Yes the BUSID? Is it matching what lspci shows? Remember lspci is in hex and xorg wants decimal. The BUSID should be == to the pci id of the card you want to use.

vans163 avatar Oct 12 '17 07:10 vans163

Oh, I hadn't noticed that. But how could an X server start while using the same GPU as another running X server?

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

@CyberShadow If you dont use the same output port on both, it should work.

vans163 avatar Oct 12 '17 07:10 vans163

I changed the BusID and get the same error.

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

@CyberShadow Can you get the logs from /var/log/Xorg.0.conf ? For sanity would it be possible to use a secondary GPU for this config? Maybe its indeed conflicting as your first X server claimed the GPU.

vans163 avatar Oct 12 '17 07:10 vans163

@CyberShadow Can you get the logs from /var/log/Xorg.0.conf ?

/var/log/Xorg.9.log
[ 81424.109] 
X.Org X Server 1.19.4
Release Date: 2017-10-04
[ 81424.109] X Protocol Version 11, Revision 0
[ 81424.109] Build Operating System: Linux 4.12.12-1-ARCH x86_64 
[ 81424.109] Current Operating System: Linux home.thecybershadow.net 4.13.4-1-ARCH #1 SMP PREEMPT Thu Sep 28 08:39:52 CEST 2017 x86_64
[ 81424.109] Kernel command line: root=UUID=2b738eaf-519c-47bc-9981-e76fd644423f rw rootflags=subvol=@arch  intel_iommu=on iommu=pt log_buf_len=1048576 fbcon=rotate:3 initrd= initrd=/intel-ucode.img initrd=/initramfs-linux.img
[ 81424.109] Build Date: 05 October 2017  03:52:55AM
[ 81424.109]  
[ 81424.109] Current version of pixman: 0.34.0
[ 81424.109] 	Before reporting problems, check http://wiki.x.org
	to make sure that you have the latest version.
[ 81424.109] Markers: (--) probed, (**) from config file, (==) default setting,
	(++) from command line, (!!) notice, (II) informational,
	(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 81424.109] (==) Log file: "/var/log/Xorg.9.log", Time: Thu Oct 12 07:51:12 2017
[ 81424.109] (++) Using config file: "xorg.conf"
[ 81424.109] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[ 81424.110] (==) ServerLayout "Layout0"
[ 81424.110] (**) |-->Screen "Screen0" (0)
[ 81424.110] (**) |   |-->Monitor "Monitor0"
[ 81424.110] (**) |   |-->Device "Device0"
[ 81424.110] (**) |-->Input Device "Keyboard0"
[ 81424.110] (**) |-->Input Device "Mouse0"
[ 81424.110] (==) Automatically adding devices
[ 81424.110] (==) Automatically enabling devices
[ 81424.110] (==) Automatically adding GPU devices
[ 81424.110] (==) Automatically binding GPU devices
[ 81424.110] (==) Max clients allowed: 256, resource mask: 0x1fffff
[ 81424.110] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/100dpi/".
[ 81424.110] 	Entry deleted from font path.
[ 81424.110] 	(Run 'mkfontdir' on "/usr/share/fonts/100dpi/").
[ 81424.110] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/75dpi/".
[ 81424.110] 	Entry deleted from font path.
[ 81424.110] 	(Run 'mkfontdir' on "/usr/share/fonts/75dpi/").
[ 81424.110] (==) FontPath set to:
	/usr/share/fonts/misc/,
	/usr/share/fonts/TTF/,
	/usr/share/fonts/OTF/,
	/usr/share/fonts/Type1/
[ 81424.110] (==) ModulePath set to "/usr/lib/xorg/modules"
[ 81424.110] (WW) Hotplugging is on, devices using drivers 'kbd', 'mouse' or 'vmmouse' will be disabled.
[ 81424.110] (WW) Disabling Keyboard0
[ 81424.110] (WW) Disabling Mouse0
[ 81424.110] (II) Loader magic: 0x55861b23ad60
[ 81424.110] (II) Module ABI versions:
[ 81424.110] 	X.Org ANSI C Emulation: 0.4
[ 81424.110] 	X.Org Video Driver: 23.0
[ 81424.110] 	X.Org XInput driver : 24.1
[ 81424.110] 	X.Org Server Extension : 10.0
[ 81424.110] (++) using VT number 17

[ 81424.110] (II) systemd-logind: logind integration requires -keeptty and -keeptty was not provided, disabling logind integration
[ 81424.110] (II) xfree86: Adding drm device (/dev/dri/card0)
[ 81424.113] (**) OutputClass "nvidia" ModulePath extended to "/usr/lib/nvidia/xorg,/usr/lib/xorg/modules"
[ 81424.113] (**) OutputClass "nvidia" setting /dev/dri/card0 as PrimaryGPU
[ 81424.115] (--) PCI:*(0:5:0:0) 10de:1005:1043:8451 rev 161, Mem @ 0xfa000000/16777216, 0xe8000000/134217728, 0xf0000000/33554432, I/O @ 0x0000d000/128, BIOS @ 0x????????/131072
[ 81424.115] (WW) Open ACPI failed (/var/run/acpid.socket) (No such file or directory)
[ 81424.115] (II) LoadModule: "glx"
[ 81424.115] (II) Loading /usr/lib/nvidia/xorg/libglx.so
[ 81424.118] (II) Module glx: vendor="NVIDIA Corporation"
[ 81424.118] 	compiled for 4.0.2, module version = 1.0.0
[ 81424.118] 	Module class: X.Org Server Extension
[ 81424.118] (II) NVIDIA GLX Module  387.12  Thu Sep 28 19:24:49 PDT 2017
[ 81424.118] (II) LoadModule: "nvidia"
[ 81424.118] (II) Loading /usr/lib/xorg/modules/drivers/nvidia_drv.so
[ 81424.118] (II) Module nvidia: vendor="NVIDIA Corporation"
[ 81424.118] 	compiled for 4.0.2, module version = 1.0.0
[ 81424.118] 	Module class: X.Org Video Driver
[ 81424.118] (II) NVIDIA dlloader X Driver  387.12  Thu Sep 28 18:57:27 PDT 2017
[ 81424.118] (II) NVIDIA Unified Driver for all Supported NVIDIA GPUs
[ 81424.118] (EE) No devices detected.
[ 81424.118] (EE) 
Fatal server error:
[ 81424.118] (EE) no screens found(EE) 
[ 81424.118] (EE) 
Please consult the The X.Org Foundation support 
	 at http://wiki.x.org
 for help. 
[ 81424.118] (EE) Please also check the log file at "/var/log/Xorg.9.log" for additional information.
[ 81424.118] (EE) 
[ 81424.118] (EE) Server terminated with error (1). Closing log file.

For sanity would it be possible to use a secondary GPU for this config?

Don't have one.

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

Maybe we can flip the roles here to progress.

Can you configure hax11 with Debug=2 with a program you want to get running and post the log (/tmp/hax11.log)?

CyberShadow avatar Oct 12 '17 07:10 CyberShadow

@CyberShadow Will do, tomorrow. Late now. Will hax11 work if I have 0 monitors/outputs plugged in tho? because I had this problem with fakerandr, it does not work if you have 0 outputs, but a screen.

vans163 avatar Oct 12 '17 08:10 vans163

hax11 is completely agnostic to the X11 server configuration.

CyberShadow avatar Oct 12 '17 08:10 CyberShadow

Actually did it now, quite fast.

DISPLAY=:0 ./runner 

***************************************
*     YoYo Games Linux Runner V1.3    *
***************************************	 
CommandLine: -game game.unx
ExeName= /home/user/games/DemetriosDemo/runner
MemoryManager allocated: 18470

***************************************
*     YoYo Games Runner v1.0(999)[r32908]    *
***************************************	 
RunnerLoadGame: game.unx
RunnerLoadGame() - assets/game.unx
Checking if INIFile assets/options.ini Exists
assets/options.ini file contents: [Linux]
DisplayName="Demetrios - The BIG Cynical Adventure"
NewDebugger=0

INI DisplayName=Demetrios - The BIG Cynical Adventure
Reading File assets/game.unx
Loaded File assets/game.unx(86660754)
IFF wad found
Get Resolution
Get Header Information
InitGMLFunctions
HighScore..SavePrePend /home/user/.config/Demetrios/ 
Game..Math..Graphic..Action..File..Resource..Interaction..3D..Particle..Misc..DS..Sound..Physics..Gamepad..GAMEPAD: Initialising Ubuntu support
GAMEPAD: 4 axis values (last) at 0x95d07a8
GAMEPAD: Enumerating 3
GAMEPAD: buttons - 3, axes - 2
GAMEPAD: 4 axis values (last) at 0x95d8d28
GAMEPAD: 4 axis values (last) at 0x95d9058
GAMEPAD: 4 axis values (last) at 0x95d9388
Buffers..Networking..Shaders..InitPushFunctions...YoYo..Fini
Code_Load()
VARI_Load()
got 893 global variables
got 708 instance variables
got 132 local variables
ID_STRG
Create Window
hax11: connect(/tmp/.X11-unix/X0,20)
hax11: Found X connection!
Display Size(Pixels): 1920,1080
GameDisplayName=Demetrios - The BIG Cynical Adventure
Win #1
XF86VidModeExtension-Version 2.2
Got Doublebuffered Visual!
glX-Version 1.4
hax11: connect(nvidia8092b7c3,66)
Icon: w=512 h=512
X Error of failed request:  BadRRCrtc (invalid Crtc parameter)
  Major opcode of failed request:  140 (RANDR)
  Minor opcode of failed request:  20 (RRGetCrtcInfo)
  Crtc id in failed request: 0x38
  Serial number of failed request:  60
  Current serial number in output stream:  60

The error is obvious, RandR is trying to get Crtc info. We have 0 outputs thus 0 crtcs.

[3042] connect(/tmp/.X11-unix/X0,20)
[3042] Found X connection!
[3042] connect(nvidia8092b7c3,66)
[3125] connect(/tmp/.X11-unix/X0,20)
[3125] Found X connection!
[3125] Intercepting X connection!
[3125] Server connection setup reply: 1
[3125] [0][1] Request 98 (QueryExtension) with data 0, length 20
[3125]  XQueryExtension(BIG-REQUESTS)
[3125]  [0]Response: 1 (Reply) sequenceNumber=1 length=32
[3125]   X_QueryExtension: present=1 major_opcode=133 first_event=0 first_error=0
[3125] [0][2] Request 133 ((null)) with data 0, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=2 length=32
[3125] [0][3] Request 55 (CreateGC) with data 0, length 20
[3125] [0][4] Request 20 (GetProperty) with data 0, length 24
[3125]  [0]Response: 1 (Reply) sequenceNumber=4 length=32
[3125] [0][5] Request 98 (QueryExtension) with data 0, length 20
[3125]  XQueryExtension(XKEYBOARD)
[3125]  [0]Response: 1 (Reply) sequenceNumber=5 length=32
[3125]   X_QueryExtension: present=1 major_opcode=135 first_event=85 first_error=137
[3125] [0][6] Request 135 ((null)) with data 0, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=6 length=32
[3125] [0][7] Request 98 (QueryExtension) with data 0, length 32
[3125]  XQueryExtension(XFree86-VidModeExtension)
[3125]  [0]Response: 1 (Reply) sequenceNumber=7 length=32
[3125]   X_QueryExtension (XFree86-VidModeExtension): present=1 major_opcode=151 first_event=0 first_error=157
[3125] [0][8] Request 98 (QueryExtension) with data 0, length 32
[3125]  XQueryExtension(Generic Event Extension)
[3125]  [0]Response: 1 (Reply) sequenceNumber=8 length=32
[3125]   X_QueryExtension: present=1 major_opcode=128 first_event=0 first_error=0
[3125] [0][9] Request 128 ((null)) with data 0, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=9 length=32
[3125] [0][10] Request 151 ((null)) with data 0, length 4
[3125]  XFree86_VidModeExtension - 0
[3125]  [0]Response: 1 (Reply) sequenceNumber=10 length=32
[3125] [0][11] Request 151 ((null)) with data 14, length 8
[3125]  XFree86_VidModeExtension - 14
[3125] [0][12] Request 151 ((null)) with data 0, length 4
[3125]  XFree86_VidModeExtension - 0
[3125]  [0]Response: 1 (Reply) sequenceNumber=12 length=32
[3125] [0][13] Request 151 ((null)) with data 14, length 8
[3125]  XFree86_VidModeExtension - 14
[3125] [0][14] Request 151 ((null)) with data 6, length 8
[3125]  XFree86_VidModeExtension - 6
[3125]  [0]Response: 1 (Reply) sequenceNumber=14 length=80
[3125]   X_XF86VidModeGetAllModeLines[0] = 1920 x 1080
[3125]   ->                                1920 x 1080
[3125] [0][15] Request 98 (QueryExtension) with data 14, length 12
[3125]  XQueryExtension(GLX)
[3125]  [0]Response: 1 (Reply) sequenceNumber=15 length=32
[3125]   X_QueryExtension: present=1 major_opcode=154 first_event=104 first_error=169
[3125] [0][16] Request 154 ((null)) with data 19, length 12
[3125]  [0]Response: 1 (Reply) sequenceNumber=16 length=720
[3125] [0][17] Request 154 ((null)) with data 19, length 12
[3125]  [0]Response: 1 (Reply) sequenceNumber=17 length=40
[3125] [0][18] Request 98 (QueryExtension) with data 19, length 12
[3125]  XQueryExtension(GLX)
[3125]  [0]Response: 1 (Reply) sequenceNumber=18 length=32
[3125]   X_QueryExtension: present=1 major_opcode=154 first_event=104 first_error=169
[3125] [0][19] Request 154 ((null)) with data 7, length 12
[3125]  [0]Response: 1 (Reply) sequenceNumber=19 length=32
[3125] [0][20] Request 98 (QueryExtension) with data 7, length 12
[3125]  XQueryExtension(GLX)
[3125]  [0]Response: 1 (Reply) sequenceNumber=20 length=32
[3125]   X_QueryExtension: present=1 major_opcode=154 first_event=104 first_error=169
[3125] [0][21] Request 154 ((null)) with data 14, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=21 length=28832
[3125] [0][22] Request 154 ((null)) with data 21, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=22 length=86296
[3125] [0][23] Request 154 ((null)) with data 19, length 12
[3125]  [0]Response: 1 (Reply) sequenceNumber=23 length=720
[3125] [0][24] Request 154 ((null)) with data 35, length 9632
[3125] [0][25] Request 98 (QueryExtension) with data 0, length 16
[3125]  XQueryExtension(NV-GLX)
[3125]  [0]Response: 1 (Reply) sequenceNumber=25 length=32
[3125]   X_QueryExtension (NV-GLX): present=1 major_opcode=155 first_event=0 first_error=0
[3125] [0][26] Request 155 ((null)) with data 0, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=26 length=32
[3125] [0][27] Request 154 ((null)) with data 7, length 12
[3125]  [0]Response: 1 (Reply) sequenceNumber=27 length=32
[3125] [0][28] Request 155 ((null)) with data 1, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=28 length=32
[3125] [0][29] Request 155 ((null)) with data 39, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=29 length=32
[3125] [0][30] Request 155 ((null)) with data 2, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=30 length=32
[3125] [0][31] Request 155 ((null)) with data 14, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=31 length=303104
[3125] [0][32] Request 155 ((null)) with data 23, length 12
[3125]  [0]Response: 1 (Reply) sequenceNumber=32 length=364
[3125] [0][33] Request 155 ((null)) with data 1, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=33 length=32
[3125] [0][34] Request 155 ((null)) with data 14, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=34 length=303104
[3125] [0][35] Request 155 ((null)) with data 6, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=35 length=284
[3125] [0][36] Request 155 ((null)) with data 14, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=36 length=303104
[3125] [0][37] Request 155 ((null)) with data 49, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=37 length=96
[3125] connect(nvidiac3cc6cfe,66)
[3125] [0][38] Request 155 ((null)) with data 14, length 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=38 length=303104
[3125] [0][39] Request 154 ((null)) with data 3, length 24
[3125] [0][40] Request 43 (GetInputFocus) with data 0, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=40 length=32
[3125] [0][41] Request 78 (CreateColormap) with data 0, length 16
[3125] [0][42] Request 43 (GetInputFocus) with data 0, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=42 length=32
[3125] [0][43] Request 1 (CreateWindow) with data 24, length 44
[3125]  XCreateWindow(1920x1080 @ 0x0)
[3125]  ->           (1920x1080 @ 0x0)
[3125] [0][44] Request 43 (GetInputFocus) with data 0, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=44 length=32
[3125] [0][45] Request 16 (InternAtom) with data 0, length 24
[3125]  XInternAtom: WM_DELETE_WINDOW
[3125]  [0]Response: 1 (Reply) sequenceNumber=45 length=32
[3125]   X_InternAtom: atom=297
[3125] [0][46] Request 16 (InternAtom) with data 0, length 20
[3125]  XInternAtom: WM_PROTOCOLS
[3125]  [0]Response: 1 (Reply) sequenceNumber=46 length=32
[3125]   X_InternAtom: atom=298
[3125] [0][47] Request 18 (ChangeProperty) with data 0, length 28
[3125]  XChangeProperty: property=298 type=4 format=32)
[3125] [0][48] Request 43 (GetInputFocus) with data 40, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=48 length=32
[3125] [0][49] Request 18 (ChangeProperty) with data 0, length 64
[3125]  XChangeProperty: property=39 type=31 format=8)
[3125] [0][50] Request 18 (ChangeProperty) with data 0, length 64
[3125]  XChangeProperty: property=37 type=31 format=8)
[3125] [0][51] Request 43 (GetInputFocus) with data 0, length 4
[3125]  [0]Response: 1 (Reply) sequenceNumber=51 length=32
[3125] [0][52] Request 16 (InternAtom) with data 0, length 20
[3125]  XInternAtom: _NET_WM_ICON
[3125]  [0]Response: 1 (Reply) sequenceNumber=52 length=32
[3125]   X_InternAtom: atom=299
[3125] [0][53] Request 16 (InternAtom) with data 0, length 16
[3125]  XInternAtom: CARDINAL
[3125]  [0]Response: 1 (Reply) sequenceNumber=53 length=32
[3125]   X_InternAtom: atom=6
[3125] [0][54] Request 18 (ChangeProperty) with data 0, length 1048612
[3125]  XChangeProperty: property=2097155 type=299 format=6)
[3125] [0][55] Request 12 (ConfigureWindow) with data 0, length 16
[3125]  XConfigureWindow(3840x2160 @ 0x0)
[3125]  ->              (3840x2160 @ 0x0)
[3125] [0][56] Request 8 (MapWindow) with data 0, length 8
[3125] [0][57] Request 98 (QueryExtension) with data 0, length 16
[3125]  XQueryExtension(RANDR)
[3125]  [0]Response: 19 (MapNotify) sequenceNumber=56 length=32
[3125]  [0]Response: 12 (Expose) sequenceNumber=56 length=32
[3125]  [0]Response: 1 (Reply) sequenceNumber=57 length=32
[3125]   X_QueryExtension (RANDR): present=1 major_opcode=140 first_event=89 first_error=147
[3125] [0][58] Request 140 ((null)) with data 0, length 12
[3125]  RANDR - 0
[3125] [0][59] Request 140 ((null)) with data 8, length 8
[3125]  RANDR - 8
[3125]  [0]Response: 1 (Reply) sequenceNumber=58 length=32
[3125]  [0]Response: 1 (Reply) sequenceNumber=59 length=32
[3125] [0][60] Request 140 ((null)) with data 20, length 12
[3125]  RANDR - 20
[3125]  [0]Response: 0 (Error) sequenceNumber=60 length=32
[3125]  [0] Error - code=148 resourceID=0x38 minorCode=20 majorCode=140 ((null))

Log from /tmp/hax11.log

DISPLAY=:0 xrandr -q
Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 16384 x 16384

As soon as xrandr shows things like VGA-0 DVI-0 HDMI-0 etc, this game works fine because XrandR query works. It queries the CRTC correctly and proceeds.

XrandR with hax11

DISPLAY=:0 xrandr -q
hax11: connect(/tmp/.X11-unix/X0,20)
hax11: Found X connection!
hax11: Intercepting X connection!
hax11: hax11: Ack, dlopen failed!
hax11: hax11: Ack, dlsym failed!

vans163 avatar Oct 12 '17 08:10 vans163

Yep, certainly looks like RRGetCrtcInfo is failing. hax11 already has code to rewrite RRGetCrtcInfo replies, but it currently isn't rewriting errors.

If you haven't yet, try fakerandr, since it should already implement this functionality.

CyberShadow avatar Oct 12 '17 09:10 CyberShadow

Il take a look a rewriting RRGetCrtcInfo replies, but from working with fakerandr its a long road (as all the complimentary functions need to be hooked too). The correct approach should be to call/hook the same function that X calls internally when you launch it and it sets up the displays, and send it fake info here. fakerandr does not work because its coded with the intention you have atleast 1 real output plugged in, and it multiplexs the fakes ontop the real. So it passes real outputs to the calls so X does not give error, as the output needs to really exist deeper down in X.

Also the code you linked is not the correct place to patch it, it errors before even hitting that, hence the complexity without a single real output.

vans163 avatar Oct 12 '17 16:10 vans163

Yeah, I'm pretty sure that creating a display out of thin air when there are none is outside the realm of what hax11 can do. There needs to be a Xorg driver backing it. One clue is that the Intel driver allows creating VIRTUAL outputs, but that's not there on e.g. NVIDIA.

CyberShadow avatar Dec 11 '22 14:12 CyberShadow