Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switchres: init at 2.2.1 #340709

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Bot-wxt1221
Copy link
Member

@Bot-wxt1221 Bot-wxt1221 commented Sep 9, 2024

Description of changes

fix #340668

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-ready-for-review/3032/4547

@DataHearth
Copy link
Contributor

Result of nixpkgs-review pr 340709 run on x86_64-linux 1

1 package built:
  • switchres

@damiankorcz
Copy link

Tried to run this on my system and it's not working to actually set the generated modelines to an output:

[nix-shell:~]$ sudo switchres 320 240 60 -i /home/damian/Emulation/test/switchres.ini
[sudo] password for damian: 
Switchres(v2.2.1) add display[0]
Switchres: display[0] options: monitor[generic_15] generation[on]
Switchres: Monitor range 15625.00-15750.00,49.50-65.00,2.000,4.700,8.000,0.064,0.192,1.024,0,0,192,288,448,576
Switchres: Calculating best video mode for [email protected] orientation: normal
Switchres: could not find a video mode that meets your specs

Things I tried:

  • Adding video to users.users.${userSettings.username}.extraGroups. Didn't work.
  • Tried changing the display option in switchres.ini to any of the listed formats and all options I could think of. Didn't work.
  • I have a kernel patched with the 15Khz patches (https://github.com/D0023R/linux_kernel_15khz). As indicated by the readme there, I have added video=VGA-1:640x480ieS to boot.kernelParams. This does make the display work correctly with that resolution set on boot. (I am running in X11 btw).
  • Running the command with and without sudo. Didn't work.

Manually adding the generated modeline from this:

[nix-shell:~]$ switchres 320 240 60 -i /home/damian/Emulation/test/switchres.ini -c
Switchres(v2.2.1) add display[0]
Switchres: display[0] options: monitor[generic_15] generation[on]
Switchres: Monitor range 15625.00-15750.00,49.50-65.00,2.000,4.700,8.000,0.064,0.192,1.024,0,0,192,288,448,576
Switchres: Calculating best video mode for [email protected] orientation: normal

Switchres: (   0)x(   0)_(0=0.000000Hz)
   rng(0):  320 x 240_60.000000p 15.660000 [integ] scale(1.000, 1.000, 1.000) diff(0.000, 0.000, 0.000)

Switchres: normal ([email protected])->([email protected])
   rng(0):  320 x 240_60.000000p 15.660000 [integ] scale(1.000, 1.000, 1.000) diff(0.000, 0.000, 0.000)
Switchres: Modeline "320x240_60 15.660000KHz 60.000000Hz" 6.514560 320 333 364 416 240 242 245 261   -hsync -vsync
Switchres: success adding mode dummy timing "320x240_60 15.660000KHz 60.000000Hz" 6.514560 320 333 364 416 240 242 245 261   -hsync -vsync
Switchres: success deleting mode dummy timing "320x240_60 15.660000KHz 60.000000Hz" 6.514560 320 333 364 416 240 242 245 261   -hsync -vsync

...with xrandr and setting the screen to it does work so I don't necessarily think it's a hardware fault or the kernel patch fault.

When switchres is building these lines come up which might be the reason:

Switchres needs xrandr. X support is disabled
Switchres needs libdrm >= 2.4.98. KMS support is disabled
Switchres needs SDL2 >= 2.0.16. SDL2 support is disabled

@Bot-wxt1221
Copy link
Member Author

@damiankorcz Try again with this.

@damiankorcz
Copy link

@Bot-wxt1221
Xrandr, libdrm and SDL2 warnings are now gone and it says they are enabled when building. But still not working. I get this now:

[nix-shell:~]$ switchres 320 240 60 -i /home/damian/Emulation/test/switchres.ini
Switchres/SDL2: (sdl2_display): SDL2 video wasn't initialized
Switchres(v2.2.1) add display[0]
Switchres: display[0] options: monitor[generic_15] generation[on]
Switchres: Monitor range 15625.00-15750.00,49.50-65.00,2.000,4.700,8.000,0.064,0.192,1.024,0,0,192,288,448,576
XRANDR: <1> (xrandr_timing) creation (auto)
XRANDR: <1> (xrandr_timing) checking X availability (early stub)
XRANDR: <1> (xrandr_timing) [ERROR] missing X11_LIBRARY library
DRM/KMS: <1> (drmkms_timing) creation (auto)
DRM/KMS: <1> (init) loading DRM/KMS library
DRM/KMS: <1> (init) version 0.0.0 type nvidia-drm
DRM/KMS: <1> (init) card 0 connector 0 id 89 name DisplayPort-2 status 2 - modes 0
DRM/KMS: <1> (init) card 0 connector 1 id 93 name HDMI-A-1 status 1 - modes 26
DRM/KMS: <1> (init) card 0 connector 1 id 93 name HDMI-A-1 selected as primary output
DRM/KMS: <1> (init) [ERROR] no crtc found
DRM/KMS: <1> (init) card 0 connector 2 id 96 name DisplayPort-3 status 1 - modes 26
DRM/KMS: <1> (init) card 0 connector 2 id 96 name DisplayPort-3 selected as primary output
DRM/KMS: <1> (init) [ERROR] no crtc found
DRM/KMS: <1> (init) card 0 connector 3 id 100 name DisplayPort-4 status 1 - modes 16
DRM/KMS: <1> (init) card 0 connector 3 id 100 name DisplayPort-4 selected as primary output
DRM/KMS: <1> (init) [ERROR] no crtc found
DRM/KMS: <1> (init) card 0 connector 4 id 104 name Unknown2 status 2 - modes 0
DRM/KMS: <1> (init) version 3.57.0 type amdgpu
DRM/KMS: <1> (init) card 1 connector 0 id 45 name DisplayPort-1 status 2 - modes 0
DRM/KMS: <1> (init) card 1 connector 1 id 48 name DVI-I-1 status 1 - modes 1
DRM/KMS: <1> (init) card 1 connector 1 id 48 name DVI-I-1 selected as primary output
DRM/KMS: <1> (init) desktop mode name  crtc 41 fb 53 valid 1
DRM/KMS: <1> (init) looking for the DRM master
DRM/KMS: <1> (get_master_fd) Couldn't find a master FD, opening default /dev/dri/card1
DRM/KMS: <1> (get_master_fd) No way to get master rights!
DRM/KMS: <1> (init) [ERROR] limited DRM rights on this screen
DRM/KMS: <1> (init) [ERROR] no screen detected
Switchres: Calculating best video mode for [email protected] orientation: normal
Switchres: could not find a video mode that meets your specs
DRM/KMS: <1> (set_timing) [ERROR] no screen detected

It erroring out on the ports from the Nvidia card makes sense since they aren't supposed to work with this but the DVI-I-1 is the connector I'm targeting. Also, I think this is supposed to set it with xrandr not DRM/KMS or SDL2.

@Bot-wxt1221
Copy link
Member Author

Bot-wxt1221 commented Sep 10, 2024

@damiankorcz [ERROR] missing X11_LIBRARY library

So the prebuilt work? https://github.com/antonioginer/switchres/releases/tag/v2.2.1

@damiankorcz
Copy link

@Bot-wxt1221 Not sure why it's complaining about X11. I'm booted up into KDE 6 with X11.

image

But to does seem to building ok now. Here is the full build log:

[damian@nixos-desktop:~]$ nix-shell -p switchres -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/754161a10fc566e5f0c949b51c72b74beb386afd.zip
these 2 derivations will be built:
  /nix/store/4p2221ygz16n85m48kwkmjf8j62b79vj-source.drv
  /nix/store/2vpvj79fkrnrx5xcyvfs8dbghfcndfnd-switchres-2.2.1.drv
these 16 paths will be fetched (4.32 MiB download, 16.08 MiB unpacked):
  /nix/store/99paw0fafwm8qk4rwndyl7cvmsy77bp6-curl-8.9.1
  /nix/store/gg33ilcxhn7pfafk0nq69qqapj5l63nq-curl-8.9.1-bin
  /nix/store/187fk8nan75f417bsglb2qw22kgfa69x-curl-8.9.1-dev
  /nix/store/mmqdbx40m784rhf112wr26jxv6rp0d0f-curl-8.9.1-man
  /nix/store/kyjgw7mmwv553nq7gjgrdpjkc2sbbazb-krb5-1.21.3
  /nix/store/2n3j7i0k45h7w6r1k7x7qh330q6kwcqv-krb5-1.21.3-dev
  /nix/store/31alln8xhjq0nzawswnzmrh0w32bkcwr-krb5-1.21.3-lib
  /nix/store/lpz7x09f8cqzqwsgfg8sday6jvp0dcrp-libssh2-1.11.0
  /nix/store/3nfp6v7b39ahd9sjwjd349rj727068xx-libssh2-1.11.0-dev
  /nix/store/sblww37ig036rvrib2j5z9p2mydvw6ha-mirrors-list
  /nix/store/vlzdqwzxhc951ygla7l97674737gd7bg-nghttp2-1.62.1
  /nix/store/n22ib0szv7ckmgc7sv6341cpk08g73rj-nghttp2-1.62.1-dev
  /nix/store/ww0n18vi957ilwgj867x99dsjpqy9f5a-nghttp2-1.62.1-lib
  /nix/store/nsrxmqmlcppv9wkkxfaj841bjf5pnr1s-openssl-3.0.14
  /nix/store/ykd2a6gzbdx8a9awyj9n42kvcrqmyy79-openssl-3.0.14-bin
  /nix/store/ffi4lgb1q372dbxiir8ahci4p1vjibzy-openssl-3.0.14-dev
copying path '/nix/store/sblww37ig036rvrib2j5z9p2mydvw6ha-mirrors-list' from 'https://cache.nixos.org'...
copying path '/nix/store/mmqdbx40m784rhf112wr26jxv6rp0d0f-curl-8.9.1-man' from 'https://cache.nixos.org'...
copying path '/nix/store/vlzdqwzxhc951ygla7l97674737gd7bg-nghttp2-1.62.1' from 'https://cache.nixos.org'...
copying path '/nix/store/ww0n18vi957ilwgj867x99dsjpqy9f5a-nghttp2-1.62.1-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/nsrxmqmlcppv9wkkxfaj841bjf5pnr1s-openssl-3.0.14' from 'https://cache.nixos.org'...
copying path '/nix/store/n22ib0szv7ckmgc7sv6341cpk08g73rj-nghttp2-1.62.1-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/31alln8xhjq0nzawswnzmrh0w32bkcwr-krb5-1.21.3-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/lpz7x09f8cqzqwsgfg8sday6jvp0dcrp-libssh2-1.11.0' from 'https://cache.nixos.org'...
copying path '/nix/store/ykd2a6gzbdx8a9awyj9n42kvcrqmyy79-openssl-3.0.14-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/ffi4lgb1q372dbxiir8ahci4p1vjibzy-openssl-3.0.14-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/99paw0fafwm8qk4rwndyl7cvmsy77bp6-curl-8.9.1' from 'https://cache.nixos.org'...
copying path '/nix/store/kyjgw7mmwv553nq7gjgrdpjkc2sbbazb-krb5-1.21.3' from 'https://cache.nixos.org'...
copying path '/nix/store/3nfp6v7b39ahd9sjwjd349rj727068xx-libssh2-1.11.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/gg33ilcxhn7pfafk0nq69qqapj5l63nq-curl-8.9.1-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/2n3j7i0k45h7w6r1k7x7qh330q6kwcqv-krb5-1.21.3-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/187fk8nan75f417bsglb2qw22kgfa69x-curl-8.9.1-dev' from 'https://cache.nixos.org'...
building '/nix/store/4p2221ygz16n85m48kwkmjf8j62b79vj-source.drv'...

trying https://github.com/antonioginer/switchres/archive/refs/tags/v2.2.1.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  126k    0  126k    0     0   221k      0 --:--:-- --:--:-- --:--:--  221k
unpacking source archive /build/v2.2.1.tar.gz
building '/nix/store/2vpvj79fkrnrx5xcyvfs8dbghfcndfnd-switchres-2.2.1.drv'...
Running phase: unpackPhase
unpacking source archive /nix/store/a6lla2p39p579d0j62nn8q6s6hffkacg-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
no configure script, doing nothing
Running phase: buildPhase
build flags: SHELL=/nix/store/vpvy79k1qq02p1vyqjk6nb89gwhxqvyb-bash-5.2p32/bin/bash
grep: warning: stray \ before #
Switchres 2.2.1
X support enabled
KMS support enabled
SDL2 support enabled
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC monitor.cpp -o monitor.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC modeline.cpp -o modeline.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC switchres.cpp -o switchres.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC display.cpp -o display.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC custom_video.cpp -o custom_video.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC log.cpp -o log.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC switchres_wrapper.cpp -o switchres_wrapper.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC edid.cpp -o edid.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC display_linux.cpp -o display_linux.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC custom_video_xrandr.cpp -o custom_video_xrandr.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC custom_video_drmkms.cpp -o custom_video_drmkms.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC display_sdl2.cpp -o display_sdl2.o
g++ -shared -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC -Wl,-soname,libswitchres.so.2 -o libswitchres.so.2.2.1 monitor.o modeline.o switchres.o display.o custom_video.o log.o switchres_wrapper.o edid.o display_linux.o custom_video_xrandr.o custom_video_drmkms.o display_sdl2.o
g++ -c -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC -DSR_WIN32_STATIC switchres_wrapper.cpp -o switchres_wrapper.o
ar rcs libswitchres.a monitor.o modeline.o switchres.o display.o custom_video.o log.o switchres_wrapper.o edid.o display_linux.o custom_video_xrandr.o custom_video_drmkms.o display_sdl2.o

g++ -O3 -Wall -Wextra -DSR_WITH_XRANDR -DSR_WITH_KMSDRM -DSR_WITH_SDL2  -D_REENTRANT -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include -I/nix/store/kxqcbxk6ha8smyyhp3a0k7xgyi4365s4-libdrm-2.4.122-dev/include/libdrm -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include -I/nix/store/v3mykjwcyg50kgdr0f5gpa0hzhk1k687-SDL2-2.30.6-dev/include/SDL2 -fPIC  monitor.o modeline.o switchres.o display.o custom_video.o log.o switchres_wrapper.o edid.o display_linux.o custom_video_xrandr.o custom_video_drmkms.o display_sdl2.o switchres_main.cpp -L/nix/store/n2aif1mg86whm5ls99w33558whkyh4za-libdrm-2.4.122/lib -L/nix/store/m1d9yhb7wbanfgyzfbd1i3n3fvk3l8z7-SDL2-2.30.6/lib -ldrm -Wl,-rpath,/nix/store/m1d9yhb7wbanfgyzfbd1i3n3fvk3l8z7-SDL2-2.30.6/lib -Wl,--enable-new-dtags -lSDL2 -ldl -o switchres
Running phase: installPhase
install flags: SHELL=/nix/store/vpvy79k1qq02p1vyqjk6nb89gwhxqvyb-bash-5.2p32/bin/bash install
grep: warning: stray \ before #
Switchres 2.2.1
X support enabled
KMS support enabled
SDL2 support enabled
install -Dm644 libswitchres.so.2.2.1 /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/lib/libswitchres.so.2.2.1
install -Dm644 switchres_defines.h /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/include/switchres/switchres_defines.h
install -Dm644 switchres_wrapper.h /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/include/switchres/switchres_wrapper.h
install -Dm644 switchres.h /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/include/switchres/switchres.h
install -Dm644 switchres.pc /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/lib/pkgconfig/switchres.pc
ln -s -f libswitchres.so.2.2.1 /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/lib/libswitchres.so.2
ln -s -f libswitchres.so.2 /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/lib/libswitchres.so
Running phase: fixupPhase
shrinking RPATHs of ELF executables and libraries in /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1
shrinking /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/bin/switchres
shrinking /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/lib/libswitchres.so.2.2.1
checking for references to /build/ in /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1...
patching script interpreter paths in /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1
stripping (with command strip and flags -S -p) in  /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/lib /nix/store/m59ym7qqcsvzb088dzyx2q4385g8wfpi-switchres-2.2.1/bin

Could it be with how I'm running it? Sorry I'm fairly new to NixOS so still figuring some of these things out 😅

@damiankorcz
Copy link

damiankorcz commented Sep 10, 2024

I've found mentions of the following packages:

  • libx11-dev
  • libxrandr-dev

Potentially those missing are causing the X11 issue.

Sources (both from the same individual on different platforms):

More context as to why it might be required to have the development packages included:

@Bot-wxt1221
Copy link
Member Author

@damiankorcz It is caused by the runtime library dependencies. I will patch the path later.

@damiankorcz
Copy link

Jackpot 🥳

18ae1036-053d-4120-a123-3d0616cc02bb.mp4

All seems to be working as intended now. Awesome job! Thank you @Bot-wxt1221

[nix-shell:~]$ switchres 320 240 60 -i /home/damian/Emulation/test/switchres.ini -s
Switchres/SDL2: (sdl2_display): SDL2 video wasn't initialized
Switchres(v2.2.1) add display[0]
Switchres: display[0] options: monitor[generic_15] generation[on]
Switchres: Monitor range 15625.00-15750.00,49.50-65.00,2.000,4.700,8.000,0.064,0.192,1.024,0,0,192,288,448,576
XRANDR: <1> (xrandr_timing) creation (DVI-I-1-0)
XRANDR: <1> (xrandr_timing) checking X availability (early stub)
XRANDR: <1> (init) loading Xrandr library
XRANDR: <1> (init) loading X11 library
XRANDR: <1> (init) version 1.6
XRANDR: <1> (init) check screen number 0
XRANDR: <1> (init) check output connector 'DP-0' active 0 crtc 0 
XRANDR: <1> (init) check output connector 'DP-1' active 0 crtc 0 
XRANDR: <1> (init) check output connector 'HDMI-0' active 1 crtc 1 
XRANDR: <1> (init) check output connector 'DP-2' active 1 crtc 1 
XRANDR: <1> (init) check output connector 'DP-3' active 0 crtc 0 
XRANDR: <1> (init) check output connector 'DP-4' active 1 crtc 1 
XRANDR: <1> (init) check output connector 'DP-5' active 0 crtc 0 
XRANDR: <1> (init) check output connector 'USB-C-0' active 0 crtc 0 
XRANDR: <1> (init) check output connector 'DisplayPort-1-0' active 0 crtc 0 
XRANDR: <1> (init) check output connector 'DVI-I-1-0' active 1 crtc 1 [SELECTED]
XRANDR: <1> (get_timing) mode 0207 640x480 refresh 59.996176 added
Switchres: [  1]  640x 480 @ 59i* : XRANDR timing "640x480_59i 15.689000KHz 59.996176Hz" 13.038000 640 666 727 831 480 483 489 523 interlace  -hsync -vsync
Switchres: Calculating best video mode for [email protected] orientation: normal

Switchres: [ 640]x[ 480]_[59=59.996176Hz]
   rng(0):  640 x 480_59.996176i 15.689000 [integ] scale(2.000, 2.000, 1.000) diff(0.000, 0.000, -0.004)

Switchres: (   0)x(   0)_(0=0.000000Hz)
   rng(0):  320 x 240_60.000000p 15.660000 [integ] scale(1.000, 1.000, 1.000) diff(0.000, 0.000, 0.000)

Switchres: normal ([email protected])->([email protected])
   rng(0):  320 x 240_60.000000p 15.660000 [integ] scale(1.000, 1.000, 1.000) diff(0.000, 0.000, 0.000)
Switchres: Modeline "320x240_60 15.660000KHz 60.000000Hz" 6.514560 320 333 364 416 240 242 245 261   -hsync -vsync
XRANDR: <1> (add_mode) create mode [email protected]
XRANDR: <1> (add_mode) mode 05c7 320x240 refresh 60.000000 added
Switchres: success adding mode XRANDR timing "320x240_60 15.660000KHz 60.000000Hz" 6.514560 320 333 364 416 240 242 245 261   -hsync -vsync
XRANDR: <1> (set_timing) crtc 0  [01dc] 2560x1440+1440+1440
XRANDR: <1> (set_timing) crtc 1  [01bf] 2560x1440+1440+0
XRANDR: <1> (set_timing) crtc 2  [01bf] 1440x2560+0+320
XRANDR: <1> (set_timing) crtc 4* [0207] 640x480+4000+2400 --> [05c7] 320x240+4000+2400 flags [11]
XRANDR: <1> (set_timing) setting screen size to 4320 x 2880
Press ENTER to exit...

XRANDR: <1> (set_timing) crtc 0  [01dc] 2560x1440+1440+1440
XRANDR: <1> (set_timing) crtc 1  [01bf] 2560x1440+1440+0
XRANDR: <1> (set_timing) crtc 2  [01bf] 1440x2560+0+320
XRANDR: <1> (set_timing) crtc 4* [05c7] 320x240+4000+2400 --> [0207] 640x480+4000+2400 flags [11]
XRANDR: <1> (set_timing) setting screen size to 4640 x 2880
XRANDR: <1> (delete_mode) remove mode [email protected]
Switchres: success deleting mode XRANDR timing "320x240_60 15.660000KHz 60.000000Hz" 6.514560 320 333 364 416 240 242 245 261   -hsync -vsync

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/prs-already-reviewed/2617/1946

@Bot-wxt1221
Copy link
Member Author

@damiankorcz Could you approval this PR?

@damiankorcz
Copy link

Result of nixpkgs-review pr 340709 run on x86_64-linux 1

1 package built:
  • switchres

@damiankorcz
Copy link

LGTM. Works as intended.

@Bot-wxt1221
Copy link
Member Author

We should wait for an nixpkgs committer anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: switchres
5 participants