dec05eba / gpu-screen-recorder-issues

GPU Screen Recorder issue tracker
20 stars 0 forks source link

[BUG] `gsr error: failed to load opengl` #12

Closed wanjohiryan closed 7 months ago

wanjohiryan commented 7 months ago

Describe the bug A clear and concise description of what the bug is.

I am trying to run gpu-screen-recorder inside a docker container.

So, here is how i build it

# This builds and updates the screen recorder we use on Netris
# From https://git.dec05eba.com/gpu-screen-recorder
FROM ubuntu:23.10

ENV DEBIAN_FRONTEND=noninteractive

# To run /usr/bin/gpu-screen-recorder.
# Add this to your runtime
# docker run --rm --cap-add SYS_ADMIN --cap-add SYS_NICE netris/gpu-screen-recorder

#Build and install gpu-screen-recorder
RUN apt-get update -y \
    && apt-get install -y \
    curl \
    unzip \
    git \
    build-essential \
    ninja-build \
    gcc \
    meson \
    cmake \
    ccache \
    bison \
    software-properties-common \
    ca-certificates \
    equivs \
    ca-certificates\
    libcap2-bin \
    libllvm15 \
    libavcodec-dev \
    libavformat-dev \
    libavutil-dev \
    libavfilter-dev \
    libavdevice-dev \
    libswresample-dev \
    libswscale-dev \
    libx11-dev \
    libxcomposite-dev \
    libkpipewire-dev \
    libxrandr-dev \
    libxfixes-dev \
    libpulse-dev \
    libswresample-dev \
    libva-dev \
    libcap-dev \
    libdrm-dev \
    libgl-dev \
    libegl-dev \
    libwayland-dev \
    libnvidia-egl-wayland-dev \
    libwayland-egl-backend-dev \
    wayland-protocols \
    && rm -rf /var/lib/apt/lists/* \
    #Install Cuda
    && cd /tmp && curl -fsSL -o nvidia_cuda_nvrtc_linux_x86_64.whl "https://developer.download.nvidia.com/compute/redist/nvidia-cuda-nvrtc/nvidia_cuda_nvrtc-11.0.221-cp36-cp36m-linux_x86_64.whl" \
    && unzip -joq -d ./nvrtc nvidia_cuda_nvrtc_linux_x86_64.whl && cd nvrtc && chmod 755 libnvrtc* \
    && find . -maxdepth 1 -type f -name "*libnvrtc.so.*" -exec sh -c 'ln -snf $(basename {}) libnvrtc.so' \; \
    && mkdir -p /usr/local/nvidia/lib && mv -f libnvrtc* /usr/local/nvidia/lib \
    && echo "/usr/local/nvidia/lib" >> /etc/ld.so.conf.d/nvidia.conf && echo "/usr/local/nvidia/lib64" >> /etc/ld.so.conf.d/nvidia.conf \
    && git clone https://repo.dec05eba.com/gpu-screen-recorder && cd gpu-screen-recorder \
    && chmod +x ./build.sh ./install.sh \
    && ./install.sh 

...other code

And then the final image is here, where i install EGL and the like.

The problem comes in when i try to run it inside the container on a remote AWS machine with a TESLA T4 nvidia gpu

2024-04-15 12_59_18-13 246 10 238 - Remote Desktop Connection

However, i keep getting this error

2024-04-15 13_04_45-13 246 10 238 - Remote Desktop Connection

To Reproduce

  1. Run docker run --gpus all --entrypoint /bin/bash --rm -it -v $(pwd):/games -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY --cap-add=SYS_NICE --cap-add=SYS_ADMIN ghcr.io/wanjohiryan/netris/server:nightly
  2. Try running the gpu-screen-recorder like gpu-screen-recorder -w screen -f 60 -o "$HOME/Videos/video.mp4"

Edit: Something to note, it appears that the host GPU uses EGL with llvmpipe,(this is software rendering i believe), how can I change this ?

Expected behavior A clear and concise description of what you expected to happen.

  1. the gpu-screen-recorder should run without any EGL errors.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here, such as terminal output of running GPU Screen Recorder and if there was an issue in the video then run the command sudo drm_info > log.log and attach that log.log file in this bug report. drm_info can be installed from your package manager or from https://gitlab.freedesktop.org/emersion/drm_info. Attach a video that shows the issue (if applicable), in raw form as output by GPU Screen Recorder or a losslessly cut version of it. Which game did you run while recording (if any) and does the issue also happen if you only record your desktop? Does the issue also happen if you use obs studio instead? If you have an issue with audio make sure you are not using pulseaudio/pipewire audio processing software such as EasyEffects.

dec05eba commented 7 months ago

This is not a bug in gpu screen recorder so it shouldn't be reported here. It should be a question you ask in a linux/docker forum.

You might need to make sure that X11 is launched with the nvidia gpu by configuring the xorg.conf file on your system with nvidia config inside (nvidia-settings can generate this file). You can get more info about the egl setup if you run eglinfo. GPU Screen Recorder will use the first egl device under "X11 platform" in that eglinfo. glx also needs to be setup properly and you can run glxinfo | grep vendor to check that it uses the nvidia device. You can run that glxinfo command to see if glxinfo works but not egl, to see if it's an issue specifically with egl or if X is not configured properly to use your nvidia gpu.

wanjohiryan commented 7 months ago

Yeah, sorry!

I figured it out... apparently the Xserver was using software rendering, i did some xconfig magic and now it works...

Thank you for this utility @dec05eba

You are the best :)

nkrok commented 5 months ago

Yeah, sorry!

I figured it out... apparently the Xserver was using software rendering, i did some xconfig magic and now it works...

Thank you for this utility @dec05eba

You are the best :)

What exactly did you change to get it to use the gpu? I'm encountering this issue as well but eglinfo and glxinfo both report that the nvidia gpu is being used. I'm not running it in a docker container like you are but I'm still curious how you got it to work.

dec05eba commented 5 months ago

@nkrok I assume you are using the flatpak version since you didn't mention it. That issue can happen in flatpak if the nvidia driver version in flatpak doesn't match the systems nvidia driver version. You can try running flatpak update to see if that fixes it. You can use this https://flathub.org/apps/io.github.arunsivaramanneo.GPUViewer and in the opengl tab to check which gpu is used inside flatpak. Also when checking eglinfo output, make sure you are checking which gpu is used under the display server section. So on x11 you need to search for X11 platform and look at the first OpenGL core profile renderer mentioned under that. Or if you use wayland search for Wayland platform.

nkrok commented 5 months ago

Thanks! It's working now after running flatpak update.