Closed ludolpif closed 6 months ago
Hi
There are no hardware requirements. In particular, the compositor supports software-based rendering on the CPU only.
The missing features are likely software side, and unfortunately, we don't have that documented on most platforms. Every platform and even most Linux distributions differ in how you install vulkan/mesa/gpu drivers.
Currently, the only maintained configuration we are verifying is our Docker image https://github.com/membraneframework/video_compositor/blob/master/build_tools/docker/slim.Dockerfile. It, of course, works on other systems, we use macOS, Arch, NixOS and PopOS for development, it just documenting those configurations is problematic.
Also, CPU-based rendering has some additional requirements that GPU rendering does not (e.g. requires newer mesa).
For example, If you use ubuntu:
23.10
with packages libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev mesa-vulkan-drivers
. It's possible that 22.04
is also fine. It was updated recently, but I'm not sure)I'm not sure what exactly is needed on Debian, but I would check the following stuff first:
At the beginning, you should have log like this
2024-04-22T08:26:21.138420Z INFO compositor_render::wgpu::ctx: Available adapters:
- AdapterInfo { name: "AMD Radeon RX 570 Series (RADV POLARIS10)", vendor: 4098, device: 26591, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 23.3.5", backend: Vulkan }
- AdapterInfo { name: "llvmpipe (LLVM 16.0.6, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "llvmpipe", driver_info: "Mesa 23.3.5 (LLVM 16.0.6)", backend: Vulkan }
- AdapterInfo { name: "AMD Radeon RX 570 Series (radeonsi, polaris10, LLVM 16.0.6, DRM 3.57, 6.8.7-arch1-1)", vendor: 4098, device: 0, device_type: Other, driver: "", driver_info: "", backend: Gl }
2024-04-22T08:26:21.141532Z INFO compositor_render::wgpu::ctx: Using AMD Radeon RX 570 Series (RADV POLARIS10) adapter with Vulkan backend
Make sure that the adapter that is selected is Vulkan and not Gl. If you don't have Vulkan adapter on the list then most likely some mesa drivers are missing.
If you have a Vulkan adapter, but still get errors about missing features then the issue is too old mesa.
Thanks for the extensive reply !
About mesa-vulkan-drivers
on debian 12 setup :
ludolpif@lud-5490:~$ LANG=C apt policy mesa-vulkan-drivers
mesa-vulkan-drivers:
Installed: 22.3.6-1+deb12u1
Candidate: 22.3.6-1+deb12u1
Version table:
*** 22.3.6-1+deb12u1 990
990 http://ftp.fr.debian.org/debian bookworm/main amd64 Packages
100 /var/lib/dpkg/status
About packages needed for CPU render, I didn't have installed 2 of them when initially tried and when captured the above log :
ludolpif@lud-5490:~$ dpkg -l | egrep 'libegl1-mesa-dev|libgl1-mesa-dri|libxcb-xfixes0-dev|mesa-vulkan-drivers'
ii libgl1-mesa-dri:amd64 22.3.6-1+deb12u1 amd64 free implementation of the OpenGL API -- DRI modules
ii mesa-vulkan-drivers:amd64 22.3.6-1+deb12u1 amd64 Mesa Vulkan graphics drivers
ludolpif@lud-5490:~$
I am unsure about how to clean run the shipped video_compositor out of membrane and/or getting the log for humans. My first guess is this way :
ludolpif@lud-5490:~$ ./git/membrane_video_compositor_plugin/examples/_build/dev/lib/membrane_video_compositor_plugin/priv/v0.2.0-rc.4/linux_x86_64/video_compositor/video_compositor
A got a unformatted JSON, and if I pipe it to "jq" it seems get lines you refer with some metadata. I see some LoggerConfig.format: json in the way, I didn't learnt how to configure it yet. It seems to use vulkan backend and the Intel GPU right before the wgpu init failure messages show in the original message of ths issue.
{
"timestamp": "2024-04-22T09:33:08.699290Z",
"level": "INFO",
"fields": {
"message": "Starting LiveCompositor with config:\nConfig {\n instance_id: \"live_compositor_604953949\",\n api_port: 8081,\n logger: LoggerConfig {\n ffmpeg_logger_level: Warn,\n format: Json,\n level: \"info,wgpu_hal=warn,wgpu_core=warn\",\n },\n stream_fallback_timeout: 500ms,\n web_renderer: WebRendererInitOptions {\n enable: false,\n enable_gpu: true,\n },\n force_gpu: false,\n download_root: \"/tmp\",\n queue_options: QueueOptions {\n ahead_of_time_processing: false,\n output_framerate: Framerate {\n num: 30,\n den: 1,\n },\n run_late_scheduled_events: false,\n never_drop_output_frames: false,\n },\n output_sample_rate: 48000,\n}",
"log.target": "video_compositor::server",
"log.module_path": "video_compositor::server",
"log.file": "src/server.rs",
"log.line": 23
},
"target": "video_compositor::server"
}
{
"timestamp": "2024-04-22T09:33:08.857136Z",
"level": "WARN",
"fields": {
"message": "Unable to find extension: VK_EXT_swapchain_colorspace",
"log.target": "wgpu_hal::vulkan::instance",
"log.module_path": "wgpu_hal::vulkan::instance",
"log.file": "/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.19.1/src/vulkan/instance.rs",
"log.line": 291
},
"target": "wgpu_hal::vulkan::instance"
}
{
"timestamp": "2024-04-22T09:33:08.891347Z",
"level": "WARN",
"fields": {
"message": "Detected skylake derivative running on mesa i915. Clears to srgb textures will use manual shader clears.",
"log.target": "wgpu_hal::gles::adapter",
"log.module_path": "wgpu_hal::gles::adapter",
"log.file": "/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.19.1/src/gles/adapter.rs",
"log.line": 774
},
"target": "wgpu_hal::gles::adapter"
}
{
"timestamp": "2024-04-22T09:33:08.894883Z",
"level": "INFO",
"fields": {
"message": "Available adapters: \n - AdapterInfo { name: \"Intel(R) UHD Graphics 620 (KBL GT2)\", vendor: 32902, device: 22807, device_type: IntegratedGpu, driver: \"Intel open-source Mesa driver\", driver_info: \"Mesa 22.3.6\", backend: Vulkan }\n - AdapterInfo { name: \"llvmpipe (LLVM 15.0.6, 256 bits)\", vendor: 65541, device: 0, device_type: Cpu, driver: \"llvmpipe\", driver_info: \"Mesa 22.3.6 (LLVM 15.0.6)\", backend: Vulkan }\n - AdapterInfo { name: \"Mesa Intel(R) UHD Graphics 620 (KBL GT2)\", vendor: 32902, device: 0, device_type: IntegratedGpu, driver: \"\", driver_info: \"\", backend: Gl }",
"log.target": "compositor_render::wgpu::ctx",
"log.module_path": "compositor_render::wgpu::ctx",
"log.file": "compositor_render/src/wgpu/ctx.rs",
"log.line": 144
},
"target": "compositor_render::wgpu::ctx"
}
{
"timestamp": "2024-04-22T09:33:08.897989Z",
"level": "WARN",
"fields": {
"message": "Detected skylake derivative running on mesa i915. Clears to srgb textures will use manual shader clears.",
"log.target": "wgpu_hal::gles::adapter",
"log.module_path": "wgpu_hal::gles::adapter",
"log.file": "/home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.19.1/src/gles/adapter.rs",
"log.line": 774
},
"target": "wgpu_hal::gles::adapter"
}
{
"timestamp": "2024-04-22T09:33:08.899573Z",
"level": "INFO",
"fields": {
"message": "Using Intel(R) UHD Graphics 620 (KBL GT2) adapter with Vulkan backend",
"log.target": "compositor_render::wgpu::ctx",
"log.module_path": "compositor_render::wgpu::ctx",
"log.file": "compositor_render/src/wgpu/ctx.rs",
"log.line": 64
},
"target": "compositor_render::wgpu::ctx"
}
I have doubts about going in the docker environment because I hope using physical devices (cams, mics) , network NDI or SRT streams in a not-so-static fashion (and the GPU accel). Am I getting it wrong thinking "this will be pain with docker" ? I am considering include membrane and video_compositor in a Live Streaming setup to got less shaders things in OBS or not using OBS at all. I know that is early and geeky but explorative.
Mesa 22.3.6 is to old for CPU based rendering, but I'm not sure if it is too old for GPU based. It's possible that mesa version is ok but GPU driver does not support it. I'll try to look into that more latter this week.
As for the log formatting, if you want to have human-readable logs from compositor you can set LIVE_COMPOSITOR_LOGGER_FORMAT=compact
env (https://compositor.live/docs/deployment/configuration#live_compositor_logger_format)
Am I getting it wrong thinking "this will be pain with docker"
For your use case probably better to avoid it. Passing dedicated GPU to docker is not that hard, but I'm not sure how it would work with other devices or integrated GPU. This approach is more intended for cloud deployments.
On #wgpu-users:matrix.org chan were I've asked before understanding there is feature requested by the live compositor, there were a reply for my particular GPU and UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING feature : cwfitzgerald (wgpu, rend3) said : That gpu doesn't support that particular feature flag, unfortunately.
As a hacky try : I managed to compile and run video_compositor on the aforementioned graphics card by commenting out the requested feature. simple.rs example with shader works, some others too, some didn't display any window nor errors. I am unsure where this requested feature is used in the compositor right now.
As reasonable try : I tried to run the compositor on a desktop computer with a dedicated Nvidia GTX 1060 and Ubuntu 23.10, I got frame drops (avg FPS below 25 it seems) with shipped examples, even tweaking a few to stick with "ultrafast" profile on output (instead of fast). Is there some tips to know to try to figure out where the bottleneck(s) is/are ?
I am unsure where this requested feature is used in the compositor right now.
Currently, it is not used in our shaders, but it can be used in user-defined shaders.
I tried to run the compositor on a desktop computer with a dedicated Nvidia GTX 1060 and Ubuntu 23.10. I got frame drops (avg FPS below 25 it seems)
Sounds like a missing driver issue, find the log like
"Using Intel(R) UHD Graphics 620 (KBL GT2) adapter with Vulkan backend"
And make sure that is using Vulkan and that nvidia card. If you see llvmpipe there that means CPU rendering.
Is there some tips to know to try to figure out where the bottleneck(s) is/are ?
If switching to ultrafast did not help then most likely rendering is a bottleneck. Any graphics card should be enough to handle rendering, so I suspect you are rendering on CPU.
After trying again on the desktop computer, I see NVIDIA / Vulkan and frame drops are gone if I switch simple.rs from fast to ultrafast today. I must messed up something or got a ressource-eating process left in background when I first tried. Sorry for the noise.
About minimum features and the abort I got : I will suggest two PR to (1) don't panic (but errror!() and exit) on missing feature by asking wgpu adapter supported features, (2) let start in a non-nominal mode for some not-so-critical Features instead of aborting. (2) is for my poor's man/hw use case and may not be the current goals of the project.
May we add a note in a README or so about targeted GPU / known non working for now situations and close this issue ? If it can help : say me where it best fit from your point of view and I may try write some concise lines for future newcomers.
May we add a note in a README or so about targeted GPU / known non working for now situations and close this issue ?
I'm not sure what you would like to write there. For now, the only non-working situation is if you have to old drivers. Identifying a minimal version of drivers for each GPU vendor would require a ton of research and testing. Even if did that just the version of the driver is not really helpful to the user.
We plan to improve the documentation about what the compositor requires, but it will still be up to the user to translate those requirements to their specific operating system, hardware, and driver versions.
Hi, I hit a wall trying to run video_compositor examples from membrane.
I tried this on a Dell 5490 Laptop with Debian 12 tweaked a bit to get ffmpeg 6, vulkaninfo says :
It seems because there is :
in https://github.com/membraneframework/video_compositor/blob/04f1e0576e10977ecb7cfa83e42fab90d86098b5/compositor_render/src/wgpu/ctx.rs#L83
I can't find any info about what the project aim in term of GPUs, did I missed it somewere ? May can help to write some "hardware requirements" closer to where newcomers put their eyes ?