flutter-elinux
flutter-elinux copied to clipboard
Failed to create view controller (DRM backend)
I follow your steps to cross compile with docker.
When I run it on the board, I find that Failed to create view controller FLUTTER_LOG_LEVELS=TRACE FLUTTER_DRM_DEVICE="/dev/dri/card1" /root/bundle/elinux --bundle=/root/bundle
My CPU is rk3568 and my build command flutter-elinux build elinux --target-arch=arm64 --target-sysroot=~/ubuntu18-arm64-sysroot/ --target-backend-type=gbm
You should paste your log.
I have FLUTTER_LOG_LEVELS=TRACE . But it just print Failed to create view controller.
or where is the log?
[root@RK356X:~/bundle]# FLUTTER_LOG_LEVELS=TRACE FLUTTER_DRM_DEVICE="/dev/dri/ca
rd1" /root/bundle/elinux --bundle=/root/bundle
Failed to create view controller.
Please use debug builds.
flutter-elinux build elinux --target-arch=arm64 --target-sysroot=~/ubuntu18-arm64-sysroot/ --target-backend-type=gbm --debug
HA! I see ^_^
[root@RK356X:~/bundle]# FLUTTER_LOG_LEVELS=TRACE FLUTTER_DRM_DEVICE="/dev/dri/ca
rd1" /root/bundle/elinux --bundle=/root/bundle
[ERROR][ConfigureDisplay(53)] Couldn't get resources
[ERROR][CreateRenderSurface(118)] Failed to create the native window
Failed to create view controller.
According to the log message, drmModeGetResources failed. I don't know your device, "/dev/dri/card1" is correct?
I have tried
[root@RK356X:~/bundle]# FLUTTER_LOG_LEVELS=TRACE FLUTTER_DRM_DEVICE="/dev/dri/ca
rd0" /root/bundle/elinux --bundle=/root/bundle
[INFO][ConfigureDisplay(71)] resolution: 1280x800
/root/bundle/elinux: symbol lookup error: /root/bundle/lib/libflutter_elinux_gbm.so: undefined symbol: drmIsMaste
But there is error drmIsMaste
It seem to be right when you said that
"/dev/dri/card1" is correct
Can you please comment-out drmIsMaster in https://github.com/sony/flutter-embedded-linux/blob/master/src/flutter/shell/platform/linux_embedded/window/native_window_drm_gbm.cc#L29 and try again?
Or can you update your kernel version to more newest version?
Or can you update your kernel version to more newest version?
Linux RK356X 4.19.206
Maybe I can't update. Because I don't have all the drivers of this official kernel.
I just want to see the result of elinux flutter. So I don't compile it.
I see it has no the api. Can I update the libdrm to fix it?
I think the first one is easier than building of the libdrm. Can you try it? After modifying the source file, you can build libflutter_elinux_gbm.so by the following steps in arm64 docker, and replace /root/bundle/lib/libflutter_elinux_gbm.so with the new libflutter_elinux_gbm.so.
$ cmake -DBUILD_ELINUX_SO=ON -DBACKEND_TYPE=DRM-GBM -DCMAKE_BUILD_TYPE=Release -DENABLE_ELINUX_EMBEDDER_LOG=ON -DFLUTTER_RELEASE=OFF ..
See also: https://github.com/sony/flutter-embedded-linux/wiki/Building-Embedded-Linux-embedding-for-Flutter#build-shared-library-for-flutter-elinux
flutter-embedded-linux/build$ cmake -DBUILD_ELINUX_SO=ON -DBACKEND_TYPE=DRM-GBM -DCMAKE_BUILD_TYPE=Release -DENABLE_ELINUX_EMBEDDER_LOG=ON -DFLUTTER_RELEASE=OFF ..
-- The CXX compiler identification is Clang 14.0.0
-- The C compiler identification is Clang 14.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Checking for module 'egl'
-- No package 'egl' found
CMake Error at /usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:603 (message):
A required package was not found
Call Stack (most recent call first):
/usr/share/cmake-3.22/Modules/FindPkgConfig.cmake:825 (_pkg_check_modules_internal)
cmake/package.cmake:6 (pkg_check_modules)
CMakeLists.txt:41 (include)
-- Configuring incomplete, errors occurred!
See also "/home/alfred/working/da/flutter-embedded-linux/build/CMakeFiles/CMakeOutput.log".
Do I need to set the sysroot?
See https://github.com/sony/flutter-embedded-linux/wiki/Installing-dependent-libraries
I need to cross compile, it seem to have no sysroot option?
After modifying the source file, you can build libflutter_elinux_gbm.so by the following steps in arm64 docker,
Simply, you can build .so file for arm64 on arm64 docker. No sysroot as it's self build on arm64.
That means I must put the source to the docker, and compile it?
Yes, that's right. Because it's easy to build than cross-buildings.
HA! It's too slow.
[ 94%] Building CXX object CMakeFiles/flutter_elinux_gbm.dir/src/flutter/shell/platform/common/client_wrapper/standard_codec.cc.o
make[2]: *** No rule to make target 'libflutter_engine.so', needed by 'libflutter_elinux_gbm.so'. Stop.
make[2]: *** Waiting for unfinished jobs....
[ 97%] Building CXX object CMakeFiles/flutter_elinux_gbm.dir/src/flutter/shell/platform/common/client_wrapper/plugin_registrar.cc.o
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/flutter_elinux_gbm.dir/all' failed
make[1]: *** [CMakeFiles/flutter_elinux_gbm.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
But it's failed
Please copy libflutter_engine.so (aarch64 version) to current directory in the docker.
[root@RK356X:~/bundle]# FLUTTER_LOG_LEVELS=TRACE FLUTTER_DRM_DEVICE="/dev/dri/ca
rd0" /root/bundle/elinux --bundle=/root/bundle
[INFO][ConfigureDisplay(71)] resolution: 1280x800
[ERROR][EnvironmentEgl(22)] Failed to get the EGL display: eglGetError: EGL_SUCCESS
[ERROR][ContextEgl(33)] Failed to choose EGL surface config: eglGetError: EGL_BAD_DISPLAY
[ERROR][CreateOnscreenSurface(71)] Failed to create EGL window surface: eglGetError: EGL_BAD_DISPLAY
Failed to create view controller.
eglGetDisplay failed on your device, but I'm not sure why it failed. Your device supports OpenGL ES and EGL?
[ERROR][EnvironmentEgl(22)] Failed to get the EGL display: eglGetError: EGL_SUCCESS this one is error?
Yes.
The device has tow cards card0 and card1
Have you set DISPLAY env? Also x11 or wayland is running on your device?
[root@RK356X:~/bundle]# env
USER=root
GST_V4L2_PREFERRED_FOURCC=NV12:YU12:NV16:YUY2
WESTON_DISABLE_ATOMIC=1
WESTON_DRM_DISABLE_MODIFIER=1
SHLVL=3
OLDPWD=/
HOME=/
PIXMAN_USE_RGA=1
PAGER=/bin/more
GST_VIDEO_CONVERT_USE_RGA=1
PS1=[\u@\h:\w]#
QT_GSTREAMER_PLAYBIN=playbin3
QT_GSTREAMER_WIDGET_VIDEOSINK=waylandsink
TERM=vt102
WESTON_DRM_KEEP_RATIO=1
GST_VIDEO_CONVERT_PREFERRED_FORMAT=NV12:NV16:I420:YUY2
PATH=/bin:/sbin:/usr/bin:/usr/sbin
XDG_RUNTIME_DIR=/var/run
GST_DEBUG_NO_COLOR=1
GST_V4L2_USE_LIBV4L2=1
SHELL=/bin/sh
storagemedia=emmc
PWD=/root/bundle
QT_QPA_PLATFORM=wayland
WESTON_DRM_MIRROR=1
PREFERED_VIDEOSINK=waylandsink
QT_GSTREAMER_WINDOW_VIDEOSINK=waylandsink
GST_VIDEO_FLIP_USE_RGA=1
EDITOR=/bin/vi
Is it here? I don't know how to see what you said. The default demo is weston qt.
I find that if I turn on weston and the elinux change to flutter_wayland.so . It works well. That means it has wayland?
And I find that cpu is high performance.
Did you stop Wayland & Weston before running flutter for DRM? see https://github.com/sony/flutter-embedded-linux/wiki/How-to-run-Flutter-apps#2-run-with-drm-backend
And I find that cpu is high performance.
Because you are using debug mode.
if flutter_wayland.so I don't stop the weston.
if flutter_gbm.so I stop the weston, but I don't know how to stop wayland.
see https://github.com/sony/flutter-embedded-linux/wiki/How-to-run-Flutter-apps#2-run-with-drm-backend
see https://github.com/sony/flutter-embedded-linux/wiki/How-to-run-Flutter-apps#2-run-with-drm-backend
I see that $ Ctrl + Alt + F3 # Switching to CUI but I am elinux not ubuntu. I stop weston is ok? Ctrl + Alt + F3 doesn't work for the system.