Closed DatCaptainHorse closed 3 months ago
Include the sudo drm_info > log.txt
output as mentioned in the report template..
Also, can you include the output of glxinfo
and eglinfo
?
Knew I had forgotten something :sweat_smile: - here you go! glxlog.txt egllog.txt drminfolog.txt
For some reason your driver is saying that the monitor is disconnected, so the error gpu screen recorder gives is correct that there are no available outputs. But it still says that the display is displaying something. I didn't even know that you could display something on a disconnected monitor. Is the monitor connected (and enabled) or not?
Thats for the first HDMI output, it says that its displaying graphics at 1080p but that its disconnected at the same time.
Yeah.. I found a very odd way to make that work using xrandr, here's the snippet of what's done to make that happen:
# Additional non-NVIDIA configuration required
if [[ ! "${selected_gpu,,}" =~ "nvidia" ]]; then
modeline_xrandr="$(echo $MODELINE | sed 's/Modeline //')"
modeline_mode="$(echo $modeline_xrandr | grep -o '"[^"]*"')"
xrandr --newmode $(echo $modeline_xrandr)
# We need to get a disconnected output for our shenanigans
# priorize "HDMI-n" outputs as "DP-n" ones seem to have trouble with configuring output multiple times
disconnected_output=$(xrandr --query | grep -Eo 'HDMI-[0-9]+ disconnected' | head -1 | awk '{print $1}')
if [ -z "$disconnected_output" ]; then
disconnected_output=$(xrandr --query | grep -Eo 'DP-[0-9]+ disconnected' | head -1 | awk '{print $1}')
fi
echo "Configuring output: '$disconnected_output' to use mode '$modeline_mode'"
xrandr --addmode "$disconnected_output" $(echo $modeline_mode)
xrandr --output "$disconnected_output" --primary --mode $(echo $modeline_mode)
fi
This somehow makes Xorg work with custom resolution under full GPU acceleration, without a connected display or dummy plug on non-NVIDIA GPU's.
I could technically make it work with disconnected output as well but im not sure if that is just a hack. There might be other applications or things that break as well if the output isn't connected. This setup doesn't happen on real systems.
Yeah that's valid reasoning, though now that this hack has been cooked and is on the open, I know bunch of projects that have wanted something like this for ages :sweat_smile: - In that case they can use x11grab or so thru ffmpeg I suppose? Since that worked in my testing without trouble (maybe latency?).
On real system config I'd still be nice to have some kind of way to let gpu-screen-recorder know which device to use primarily, but that's already on your TODO comments :+1:
Feel free to close if there's nothing else to it!
x11grab is bad for performance so its not a good solution, and especially as it blocks the entire X server when its grabbing frames so in some cases and especially at high resolutions it will cause a lot of mouse stutter in games even at high fps.
And I think I know why kmsgrab behaves like that.. if you do graphical things outside monitor areas it will limit fps to 1 to reduce power usage when things are not visible on the screen. So I guess even if i make gpu screen recorder work with that disconnected output it will likely have the same issue. Grabbing a single window is different since I think those become special windows that dont run at 1 fps. Something like that, dunno.
You can try it, go to src/utils.cc in gpu screen recorder and comment out lines 221-224 (where it checks for DRM_MODE_CONNECTED) and check if screen recording works without lag
oh and also on line 74, remove && out_info->connection == RR_Connected
:tada: Well that allows it to capture just like ffmpeg, but also at 1 FPS like ffmpeg :sweat_smile:
I wonder if there's any way to force the limiter off :thinking:
a hack would be to maybe have a compositor running, unless the compositor is optimized to not composite windows that are not visible on the screen :p. Or try more if you can get it to say that the monitor is connected so it appears as a regular working system.
I wonder if there's any way to force the limiter off 🤔
I think there is a driver option for this, but I cant see any right now. But getting the output to work correctly in docker would be better. Im sure there has to be a way to do it properly. The same thing will have to be done for amd as amd also behaves like that with 1 fps for window outside monitor (so it might be a mesa thing instead or even x11 modesetting driver thing, i forgot).
Option "AsyncFlipSecondaries" "yes"
seems to have done it :laughing:
If you don't want to make those code changes into a flag like --allow-totally-broken-usecases
, I'll just use a patch for it :+1:
Yeah you will have to use a patch for it as im sure there is a way to do it properly. If it later turns out that there is no proper way to do it then I can add a flag to allow this use case.
Alright! Thanks for such quick responses and help! I'll finally let you rest :P
Describe the bug gpu-screen-recorder is unable to capture screen when X11 is run on GPU another than
/dev/dri/card0
.To Reproduce
gpu-screen-recorder -w screen -c flv -f 60 -o /game/testout.flv
Run within system with multiple GPU's (iGPU+dGPU for example), where the/dev/dri/card1
is used to run X11.Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Additional context Output given by program:
xrandr -q output:
trying to give X11 DISPLAY by
-w ":0"
doesn't work either:Only working method is to give
-w
a X11 window ID. But yeah that's not that seamless.xwininfo -tree -root output, just in case that's useful:
Note that ffmpeg kmsgrab does almost work,
ffmpeg -hide_banner -v verbose -device /dev/dri/card1 -framerate 60 -f kmsgrab -i - -an -filter:v 'hwmap=derive_device=vaapi,scale_vaapi=format=nv12' -c:v h264_vaapi -b:v 4000k -maxrate 8000k /game/testffmpegout.mkv
output:However the output is odd, it's as if it's doing 1 FPS (see attached video).
https://github.com/dec05eba/gpu-screen-recorder-issues/assets/14197772/c76c7f7f-b43a-4635-8c7e-4e2cd0f6140a
mpv --no-config video.mp4
(if applicable)