diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 83c8416ff..c512ceb84 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -52,6 +52,14 @@ RUN --mount=type=tmpfs,target=/tmp --mount=type=tmpfs,target=/var/cache/apt \ --mount=type=cache,target=/root/.ccache \ /deps/build_sqlite_vec.sh +# Build intel-media-driver from source against bookworm's system libva so it +# works with Debian 12's glibc/libstdc++ (pre-built noble/trixie packages +# require glibc 2.38 which is not available on bookworm). +FROM base AS intel-media-driver +ARG DEBIAN_FRONTEND +RUN --mount=type=bind,source=docker/main/build_intel_media_driver.sh,target=/deps/build_intel_media_driver.sh \ + /deps/build_intel_media_driver.sh + FROM scratch AS go2rtc ARG TARGETARCH WORKDIR /rootfs/usr/local/go2rtc/bin @@ -200,6 +208,7 @@ RUN --mount=type=bind,source=docker/main/install_hailort.sh,target=/deps/install FROM scratch AS deps-rootfs COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/ COPY --from=sqlite-vec /usr/local/lib/ /usr/local/lib/ +COPY --from=intel-media-driver /rootfs/ / COPY --from=go2rtc /rootfs/ / COPY --from=libusb-build /usr/local/lib /usr/local/lib COPY --from=tempio /rootfs/ / diff --git a/docker/main/build_intel_media_driver.sh b/docker/main/build_intel_media_driver.sh new file mode 100755 index 000000000..acc9caf09 --- /dev/null +++ b/docker/main/build_intel_media_driver.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +set -euxo pipefail + +# Intel media driver is x86_64-only. Create empty rootfs on other arches so +# the downstream COPY --from has a valid source. +if [ "$(uname -m)" != "x86_64" ]; then + mkdir -p /rootfs + exit 0 +fi + +MEDIA_DRIVER_VERSION="intel-media-25.2.6" +GMMLIB_VERSION="intel-gmmlib-22.7.2" + +apt-get -qq update +apt-get -qq install -y wget gnupg ca-certificates cmake g++ make pkg-config + +# Use Intel's jammy repo for newer libva-dev (2.22) which provides the +# VVC/VVC-decode headers required by media-driver 25.x +wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg +echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" > /etc/apt/sources.list.d/intel-gpu-jammy.list +apt-get -qq update +apt-get -qq install -y libva-dev + +# Build gmmlib (required by media-driver) +wget -qO gmmlib.tar.gz "https://github.com/intel/gmmlib/archive/refs/tags/${GMMLIB_VERSION}.tar.gz" +mkdir /tmp/gmmlib +tar -xf gmmlib.tar.gz -C /tmp/gmmlib --strip-components 1 +cmake -S /tmp/gmmlib -B /tmp/gmmlib/build -DCMAKE_BUILD_TYPE=Release +make -C /tmp/gmmlib/build -j"$(nproc)" +make -C /tmp/gmmlib/build install + +# Build intel-media-driver +wget -qO media-driver.tar.gz "https://github.com/intel/media-driver/archive/refs/tags/${MEDIA_DRIVER_VERSION}.tar.gz" +mkdir /tmp/media-driver +tar -xf media-driver.tar.gz -C /tmp/media-driver --strip-components 1 +cmake -S /tmp/media-driver -B /tmp/media-driver/build \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_KERNELS=ON \ + -DENABLE_NONFREE_KERNELS=ON \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=/usr/lib/x86_64-linux-gnu \ + -DCMAKE_C_FLAGS="-Wno-error" \ + -DCMAKE_CXX_FLAGS="-Wno-error" +make -C /tmp/media-driver/build -j"$(nproc)" + +# Install driver to rootfs for COPY --from +make -C /tmp/media-driver/build install DESTDIR=/rootfs diff --git a/docker/main/install_deps.sh b/docker/main/install_deps.sh index 2dfe07d35..d54a64c52 100755 --- a/docker/main/install_deps.sh +++ b/docker/main/install_deps.sh @@ -91,8 +91,10 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | tee /etc/apt/sources.list.d/intel-gpu-jammy.list apt-get -qq update + # intel-media-va-driver-non-free is built from source in the + # intel-media-driver Dockerfile stage for Battlemage (Xe2) support apt-get -qq install --no-install-recommends --no-install-suggests -y \ - intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 + libmfx1 libmfxgen1 libvpl2 apt-get -qq install -y ocl-icd-libopencl1 diff --git a/docs/docs/configuration/hardware_acceleration_video.md b/docs/docs/configuration/hardware_acceleration_video.md index 918c23e67..7aeecfda9 100644 --- a/docs/docs/configuration/hardware_acceleration_video.md +++ b/docs/docs/configuration/hardware_acceleration_video.md @@ -59,13 +59,14 @@ Frigate can utilize most Intel integrated GPUs and Arc GPUs to accelerate video **Recommended hwaccel Preset** -| CPU Generation | Intel Driver | Recommended Preset | Notes | -| -------------- | ------------ | ------------------- | ------------------------------------------- | -| gen1 - gen5 | i965 | preset-vaapi | qsv is not supported, may not support H.265 | -| gen6 - gen7 | iHD | preset-vaapi | qsv is not supported | -| gen8 - gen12 | iHD | preset-vaapi | preset-intel-qsv-\* can also be used | -| gen13+ | iHD / Xe | preset-intel-qsv-\* | | -| Intel Arc GPU | iHD / Xe | preset-intel-qsv-\* | | +| CPU Generation | Intel Driver | Recommended Preset | Notes | +| ------------------ | ------------ | ------------------- | ------------------------------------------- | +| gen1 - gen5 | i965 | preset-vaapi | qsv is not supported, may not support H.265 | +| gen6 - gen7 | iHD | preset-vaapi | qsv is not supported | +| gen8 - gen12 | iHD | preset-vaapi | preset-intel-qsv-\* can also be used | +| gen13+ | iHD / Xe | preset-intel-qsv-\* | | +| Intel Arc A-series | iHD / Xe | preset-intel-qsv-\* | | +| Intel Arc B-series | iHD / Xe | preset-intel-qsv-\* | Requires host kernel 6.12+ | ::: diff --git a/docs/docs/frigate/hardware.md b/docs/docs/frigate/hardware.md index afbd95aaf..7df2ae0bb 100644 --- a/docs/docs/frigate/hardware.md +++ b/docs/docs/frigate/hardware.md @@ -146,17 +146,11 @@ A single Coral can handle many cameras using the default model and will be suffi The OpenVINO detector type is able to run on: - 6th Gen Intel Platforms and newer that have an iGPU -- x86 hosts with an Intel Arc GPU +- x86 hosts with an Intel Arc GPU (including Arc A-series and B-series Battlemage) - Intel NPUs - Most modern AMD CPUs (though this is officially not supported by Intel) - x86 & Arm64 hosts via CPU (generally not recommended) -:::note - -Intel B-series (Battlemage) GPUs are not officially supported with Frigate 0.17, though a user has [provided steps to rebuild the Frigate container](https://github.com/blakeblackshear/frigate/discussions/21257) with support for them. - -::: - More information is available [in the detector docs](/configuration/object_detectors#openvino-detector) Inference speeds vary greatly depending on the CPU or GPU used, some known examples of GPU inference times are below: