toradex / vscode-torizon-templates

VS Code Torizon Integrated Development Environment Templates
MIT License
15 stars 21 forks source link

Limited Support for graphical acceleration on downstream-based modules #51

Closed brunoaamello closed 11 months ago

brunoaamello commented 1 year ago

There are templates that use the container wayland-base as a base for their application containers, regardless of SoC/SoM. This results in limited hardware acceleration support for downstream-based modules (i.MX 8/i.MX 8M/i.MX 8X).

The downstream-based modules should use the container wayland-base-vivante instead, to allow hardware acceleration within the container. As it is right now, the templates have hardware accelerated compositing, in the separate weston-vivante container, but the OpenGL provider in the application container itself is LLVMpipe, a software implementation.

The affected templates are:

The fix can be as simple as using a build arg for the GPU or may require further changes to these templates.

microhobby commented 1 year ago

This is blocked because we are having some issues with the torizon/wayland-base-vivante:3 packages when trying to install qt6-base-dev:

root@ef1e75ce2d6c:/# apt install qt6-base-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 qt6-base-dev : Depends: libgl-dev
E: Unable to correct problems, you have held broken packages.

From #57

microhobby commented 1 year ago

For the Qt6 we need to wait until we have the packages build with OpenGL ES support. This is under WIP by the Toradex Debian Package team.

microhobby commented 1 year ago

@tronical Slint supports OpenGL ES? We need to toggle something to work? I'm trying to run the Slint CPP with the Vivante GPU libraries and I'm getting:

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Other("Skia OpenGL Renderer: Failed to create OpenGL Window Surface: not found")', internal/core/window.rs:868:31
stack backtrace:
   0:     0xffff7ffec2e8 - std::backtrace_rs::backtrace::libunwind::trace::h133dba2ec81dba86
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0xffff7ffec2e8 - std::backtrace_rs::backtrace::trace_unsynchronized::hb45230733992545f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0xffff7ffec2e8 - std::sys_common::backtrace::_print_fmt::h8a874ebe04d394ce
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:65:5
   3:     0xffff7ffec2e8 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9b87a899c77ef3b5
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:44:22
   4:     0xffff8000cbd0 - core::fmt::write::h061a780c9b6fd754
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/fmt/mod.rs:1232:17
   5:     0xffff7ffe96ac - std::io::Write::write_fmt::h3f1f287b1848cd4f
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/io/mod.rs:1684:15
   6:     0xffff7ffec0f4 - std::sys_common::backtrace::_print::h100b30670f353331
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:47:5
   7:     0xffff7ffec0f4 - std::sys_common::backtrace::print::h29dfb2146a9553c9
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:34:9
   8:     0xffff7ffed5c4 - std::panicking::default_hook::{{closure}}::h45d6c2261e27eed0
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:271:22
   9:     0xffff7ffed308 - std::panicking::default_hook::h75e1432f64a5032c
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:290:9
  10:     0xffff7ffedb34 - std::panicking::rust_panic_with_hook::h5576bdd7c6e0d8fd
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:692:13
  11:     0xffff7ffeda24 - std::panicking::begin_panic_handler::{{closure}}::h4280476b458722ea
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:583:13
  12:     0xffff7ffec734 - std::sys_common::backtrace::__rust_end_short_backtrace::hb9c75d0d66f9b0dd
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/sys_common/backtrace.rs:150:18
  13:     0xffff7ffed770 - rust_begin_unwind
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:579:5
  14:     0xffff7f60609c - core::panicking::panic_fmt::h727e74184e222656
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:64:14
  15:     0xffff7f6063d4 - core::result::unwrap_failed::hdae050f7658acc01
                               at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/result.rs:1750:5
  16:     0xffff7fde46a4 - slint_windowrc_show
  17:     0xaaaad11f5158 - _ZNK5slint11private_api15WindowAdapterRc4showEv
                               at /usr/include/slint/slint.h:112:44
  18:     0xaaaad11f5298 - _ZN5slint6Window4showEv
                               at /usr/include/slint/slint.h:421:29
  19:     0xaaaad11fcbb4 - _ZN9AppWindow4showEv
                               at /app/build/arm64/appwindow.h:4660:18
  20:     0xaaaad11fcc08 - _ZN9AppWindow3runEv
                               at /app/build/arm64/appwindow.h:4672:9
  21:     0xaaaad11f3164 - main
                               at /app/src/main.cpp:15:12
  22:     0xffff7f137780 - <unknown>
  23:     0xffff7f137858 - __libc_start_main
  24:     0xaaaad11f2f70 - _start
  25:                0x0 - <unknown>
Aborted (core dumped)
tronical commented 1 year ago

Yes, it uses EGL and GLESv2. Both libraries are opened dynamically at run-time. The error message suggests that libEGL.so could not be found on the system (at runtime).

I’ve run this code before on the vivante containers before without issues. Were there any changes?

microhobby commented 1 year ago

I’ve run this code before on the vivante containers before without issues. Were there any changes?

Yes, the previous version probably was using software renderer, because we are not passing the -vivante GPU prefix to get the right Docker Image with the proprietary vendor libraries.

The Slint template from here: https://github.com/microhobby/vscode-torizon-templates/commits/gpu-prefix is the repo that we are working to fix this.

microhobby commented 1 year ago

@tronical Yeah, there is an issue on my Dockerfile.debug that was not installing the Vivante libs correctly. Now I'm able to run the app with HW acceleration. Thanks!

tronical commented 1 year ago

I’ve run this code before on the vivante containers before without issues. Were there any changes?

Yes, the previous version probably was using software renderer, because we are not passing the -vivante GPU prefix to get the right Docker Image with the proprietary vendor libraries.

I mean here for example: https://github.com/slint-ui/slint/pkgs/container/slint%2Ftorizon-demos-arm64-vivante

Based on https://github.com/slint-ui/slint/blob/master/docker/Dockerfile.torizon-demos

The Slint template from here: https://github.com/microhobby/vscode-torizon-templates/commits/gpu-prefix is the repo that we are working to fix this.

Thx. I can take a look at that next week.

tronical commented 1 year ago

@tronical Yeah, there is an issue on my Dockerfile.debug that was not installing the Vivante libs correctly. Now I'm able to run the app with HW acceleration. Thanks!

Ah Great :)

microhobby commented 1 year ago

We are moving it to the next development cycle because the Vivante GPU stuff is not ready yet from the Torizon Containers and packaging side.

microhobby commented 11 months ago

with the merge of #125 this can be closed