Skip to content

Commit

Permalink
feat: Apply workarounds for other programs included with Resolve (#104)
Browse files Browse the repository at this point in the history
- Replaces `run-davinci` with `/etc/profile.d/davinci.sh`
- Repurposse `run-davinci` for just opting in to ROCm on AMD, or rusticl
on Intel/Nouveau
- Restores old `add-davinci-launcher` behavior of modifying every
.desktop file included with Resolve, not just the one for DaVinci
Resolve itself

Closes #100
  • Loading branch information
zelikos authored Jul 25, 2024
1 parent b84fa22 commit 945ffe8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 35 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@ Davincibox has had limited testing with DaVinci Resolve Studio. Use at your own

DaVinci Resolve on Linux, especially the free version, has [limited codec support](https://documents.blackmagicdesign.com/SupportNotes/DaVinci_Resolve_18_Supported_Codec_List.pdf?_v=1705996810000). Unless you can show that certain codecs are available when using DaVinci Resolve outside of davincibox, but not when using davincibox, **do not** report issues about missing codecs here.

### Running from the CLI

If you need to run davincibox from the CLI instead of using a desktop shortcut, you'll need to use the `run-davinci` script in davincibox, as it contains necessary workarounds for DaVinci Resolve to work in the container's Fedora Linux environment.

- Distrobox: `distrobox enter -n davincibox -- /usr/bin/run-davinci`
- Toolbox: `toolbox run -c davincibox /usr/bin/run-davinci`

## Requirements & GPU Information

You will need [Podman](https://podman.io/), as well as [`distrobox`](https://github.com/89luca89/distrobox) or [`toolbox`](https://github.com/containers/toolbox).
Expand All @@ -31,6 +24,8 @@ You will also need the latest release of DaVinci Resolve from [Blackmagic's webs

If you're less comfortable in the CLI, I recommend using the `setup.sh` script from this repository to help simplify the setup process, but ultimately use of the CLI is a requirement.

Optional: Ensure `lshw` is installed on your system, as `setup.sh` uses it to detect whether you are using an Nvidia GPU or not.

### AMD

AMD uses Mesa's `rusticl` for OpenCL support in DaVinci Resolve, due [various](https://github.com/ROCm/ROCm/issues/768) [issues](https://github.com/zelikos/davincibox/issues/65) with AMD's official option, ROCm. These issues largely stem from the fact that [GPU support in ROCm is very limited](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html#supported-gpus).
Expand Down
3 changes: 2 additions & 1 deletion extra-packages
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ libxkbcommon-x11
libXrandr
libXtst
libXxf86vm
lshw
mesa-libGLU
mesa-libOpenCL
mtdev
Expand All @@ -30,4 +31,4 @@ xcb-util-image
xcb-util-keysyms
xcb-util-renderutil
xcb-util-wm
xorg-x11-drv-nvidia-cuda
xorg-x11-drv-nvidia-cuda
2 changes: 1 addition & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ get_gpu_type () {
nvidia_gpu=true
fi
else
echo "WARNING: glxinfo not found. Could not determine GPU vendor."
echo "WARNING: lshw not found. Could not determine GPU vendor."
nvidia_gpu=false
fi
}
Expand Down
30 changes: 30 additions & 0 deletions system_files/etc/profile.d/davinci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Info for this line comes from here: https://www.reddit.com/r/voidlinux/comments/12g71x0/comment/l2cwo27/
# Slightly modified, as the original wasn't pointed to the correct lib file names
export LD_PRELOAD=/usr/lib64/libglib-2.0.so.0:/usr/lib64/libgdk_pixbuf-2.0.so.0:/usr/lib64/libgio-2.0.so.0:/usr/lib64/libgmodule-2.0.so.0
export QT_QPA_PLATFORM=xcb

gpu_type=""

get_gpu_type () {
if lshw -c video 2>/dev/null | grep -qi nvidia; then
gpu_type="nvidia"
elif lshw -c video 2>/dev/null | grep -qi amd; then
gpu_type="amd"
elif lshw -c video 2>/dev/null | grep -qi intel; then
gpu_type="intel"
fi
}

use_rusticl () {
export RUSTICL_ENABLE=radeonsi,iris,nouveau
export OCL_ICD_VENDORS=rusticl.icd
}

get_gpu_type

# Default to rusticl on AMD GPUs
if [[ $gpu_type == "amd" ]]; then
use_rusticl
fi
2 changes: 1 addition & 1 deletion system_files/usr/bin/add-davinci-launcher
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ then
container_run_command="distrobox-enter -n davincibox --"
fi

sed -i "s,Exec=/opt/resolve/bin/resolve,Exec=$container_run_command /usr/bin/run-davinci," ~/.local/share/applications/{blackmagicraw*,DaVinci*}.desktop
sed -i "s,Exec=,Exec=$container_run_command ," ~/.local/share/applications/{blackmagicraw*,DaVinci*}.desktop

# Overwrite shortcut created by upstream DaVinci Resolve installer
desktop_shortcut=$HOME/Desktop/com.blackmagicdesign.resolve.desktop
Expand Down
32 changes: 7 additions & 25 deletions system_files/usr/bin/run-davinci
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
#!/bin/bash

# Info for this line comes from here: https://www.reddit.com/r/voidlinux/comments/12g71x0/comment/l2cwo27/
# Slightly modified, as the original wasn't pointed to the correct lib file names
export LD_PRELOAD=/usr/lib64/libglib-2.0.so.0:/usr/lib64/libgdk_pixbuf-2.0.so.0:/usr/lib64/libgio-2.0.so.0:/usr/lib64/libgmodule-2.0.so.0
export QT_QPA_PLATFORM=xcb
source /etc/profile.d/davinci.sh

gpu_type=""

get_gpu_type () {
if [[ -n $(glxinfo -B | grep -i nvidia) ]]; then
gpu_type="nvidia"
elif [[ -n $(glxinfo -B | grep -i AMD) ]]; then
gpu_type="amd"
elif [[ -n $(glxinfo -B | grep -i Intel) ]]; then
gpu_type="intel"
fi
}

use_rusticl () {
export RUSTICL_ENABLE=radeonsi,iris,nouveau
export OCL_ICD_VENDORS=rusticl.icd
disable_rusticl () {
export RUSTICL_ENABLE=""
export OCL_ICD_VENDORS=""
}

get_gpu_type

# Default to rusticl on AMD GPUs
# Don't use rusticl if arg rocm is passed
# Allow use of arg rusticl to opt in for Intel and Nvidia nouveau users
if [[ $gpu_type == "amd" && $1 != "rocm" || $1 == "rusticl" ]]; then
if [[ $1 == "rusticl" ]]; then
use_rusticl
elif [[ $1 == "rocm" ]]; then
disable_rusticl
fi

/opt/resolve/bin/resolve

0 comments on commit 945ffe8

Please sign in to comment.