feat(server): Add Intel/AMD GPU support (#84)

## Description

### This is a DRAFT - Changes will be discussed and made upon requests!

In nutshell, this adds support for running Nestri with Intel and AMD
GPU's. Both integrated and dedicated.

It took a few days to find a trick for having output without dummy plugs
or connected displays, but I think I got it.

`gpu-screen-recorder` requires a custom patch to skip the check for
connected displays (as we're using a xrandr workaround which makes them
stay "unconnected")

Most likely fixes #68

### Changes

The NVIDIA sections have been split in their own code branches since
there's some NVIDIA specific things I didn't feel approriate to poke
more than necessary for the goal of this PR.

Added a script with helper functions related to GPU discovery and
gathering some basic info off from them (note: it might be better to
declare the helper script arrays outside it's initially run function).
The helper scripts rely on `lshw`.

NVIDIA code was slightly adjusted to use the bus-id's provided by the
helper functions to have some code re-use.

Cleaned up few things on the side.

---------

Co-authored-by: Kristian Ollikainen <DatCaptainHorse@users.noreply.github.com>
Co-authored-by: Wanjohi <71614375+wanjohiryan@users.noreply.github.com>
This commit is contained in:
Kristian Ollikainen
2024-07-07 11:06:48 +03:00
committed by GitHub
parent b12b26223c
commit cf69f6c93a
5 changed files with 441 additions and 60 deletions

View File

@@ -203,6 +203,8 @@ ENV \
# Disable VSYNC for NVIDIA GPUs
__GL_SYNC_TO_VBLANK=0
COPY .patches /etc/
#Build and install gpu-screen-recorder
RUN apt-get update -y \
&& apt-get install -y \
@@ -236,6 +238,8 @@ RUN apt-get update -y \
libxi-dev \
libxdamage-dev \
libxfixes-dev \
libxi-dev \
libxdamage-dev \
libpulse-dev \
libswresample-dev \
libva-dev \
@@ -255,6 +259,7 @@ RUN apt-get update -y \
&& 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 \
&& git clone https://repo.dec05eba.com/gpu-screen-recorder && cd gpu-screen-recorder \
&& git apply /etc/connectcheckskip.patch \
&& meson setup build \
&& meson configure --prefix=/usr --buildtype=release -Dsystemd=true -Dstrip=true build \
&& ninja -C build install