-
Notifications
You must be signed in to change notification settings - Fork 9
Support vulkan backend #110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support vulkan backend #110
Conversation
|
@JSUYA Do you konw how to fix unittests build error? |
I will look into it. |
|
+) #113 |
@xiaowei-guan |
1.Fix spelling issues. 2.Do not need to destroy swapchain image when destory the renderer. 3.Replace memset with zero-init. 4.Free command buffer when begin command buffer or end command buffer failed. 5.Fix return wrong api version issue.
The problem was solved with the help of @swift-kim. |
@JSUYA Yes, if we want to run vulkan app on RPI4, we need to install vulkan related rpm files. @swift-kim @JSUYA Thank you, the issue has been fixed. |
|
@JSUYA Can you review the code? |
|
@xiaowei-guan On TV, it failed to create a vk instance. And since libvulkan is not included in the binary by default, merging vulkan PRs for the embedder and engine will prevent Flutter apps from running in the basic Common Headed Profile. |
|
|
||
| std::unique_ptr<ExternalTexture> TizenRendererVulkan::CreateExternalTexture( | ||
| const FlutterDesktopTextureInfo* texture_info) { | ||
| return nullptr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question
External texture is not supported?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have finished code of External texture:
- Engine PR : [Tizen] Support render texture for vulkan + impeller flutter#17
- Embedder code : xiaowei-guan@6a94746
After vulkan backend PR released, I will create a new PR for texture.
0d078ae to
6f7c767
Compare
In tizen repo, the vulkan so files are uploaded, but they are not actually included in the image binary. Therefore, unless user install the RPI binary and separately install libvulkan, user cannot run a Flutter app even if they do not use the EVulkan renderer. How about additionally releasing libflutter_tizen.so that supports the Vulkan renderer? For example... The flutter-tizen tool can download experimental artifacts to the cache and load experimental SO files using predefined settings or separate flags. (Ex flutter-tizen run --dart-define=USE_FLUTTER_TIZEN_EXPERIMENTAL ?) please suggest better approaches if you have them. |
result is VK_SUBOPTIMAL_KHR or VK_ERROR_OUT_OF_DATE_KHR.
As I konw, all tizen device profile has included vulkan, but the
Ok |
Add new struct FlutterVulkanTexture for embedder :
```
typedef struct {
/// Handle to the VkImage that is owned by the embedder. The engine will
/// bind this image for writing the frame.
FlutterVulkanImageHandle image;
/// The VkDeviceMemory that backs the iamge.
FlutterVulkanDeviceMemoryHandle image_memory;
/// The VkFormat of the image (for example: VK_FORMAT_R8G8B8A8_UNORM).
uint32_t format;
/// User data to be returned on the invocation of the destruction callback.
void* user_data;
/// Callback invoked (on an engine managed thread) that asks the embedder to
/// collect the texture.
VoidCallback destruction_callback;
/// Optional parameters for texture height/width, default is 0, non-zero means
/// the texture has the specified width/height.
/// Width of the texture.
size_t width;
/// Height of the texture.
size_t height;
} FlutterVulkanTexture;
```
The implement of [texture
source](https://github.com/flutter-tizen/flutter/pull/17/files#diff-7955a8522a753162869f2e8ca0017a83f4854b60800c844202e70c3aa00ff0c9R5-R204)
refer to the solution of android
platform(https://github.com/flutter-tizen/flutter/blob/flutter-3.35.3/engine/src/flutter/impeller/renderer/backend/vulkan/android/ahb_texture_source_vk.cc)
and I have submitted the code [Support render texture for
embedder](xiaowei-guan/embedder@6a94746),
I will create a new PR after[ support vulkan
backend](flutter-tizen/embedder#110) PR
released.
| embedder("flutter_tizen_common_experimental") { | ||
| target_type = "shared_library" | ||
|
|
||
| defines = [ "COMMON_PROFILE" ] | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to test libflutter_tizen_common_experimental.so on an RPi4 with the Vulkan library installed.
I renamed libflutter_tizen_common_experimental.so to libflutter_tizen_common.so in the path flutter/bin/cache/artifacts/engine/tizen-arm/6.5.
c# hostapp ran the Vulkan renderer app normally.
However, c++ hostapp displayed the error message below. Do you know the cause?
E/STDERR_pkgmgr-server( 8385): [EXEC_CHECKER_PLUGIN_PARSER][ERROR] Not found library ( libflutter_tizen_common_experimental.so)
E/STDERR ( 8112): /opt/usr/globalapps/com.example.test_cpp_6/bin/runner: error while loading shared libraries: libflutter_tizen_common_experimental.so: cannot open shared object file: No such file or directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I can't reproduce this issue:
below are my steps:
2025 cp ../embedder/src/out/tizen_arm_6.5/libflutter_tizen_common_experimental.so ../flutter-tizen/flutter/bin/cache/artifacts/engine/tizen-arm/6.5/libflutter_tizen_common.so
2026 sync
2027 ../flutter-tizen/bin/flutter-tizen clean
2028 ../flutter-tizen/bin/flutter-tizen run --enable-impeller
and logs:
guanxw@samsung10022:~/flutter-tizen-3.35.3/sample$ ../flutter-tizen/bin/flutter-tizen run --enable-impeller
Launching tizen/flutter/generated_main.dart on Tizen rpi4 in debug mode...
The partner profile is used for signing.
Building a Tizen application in debug mode... 24.3s
✓ Built build/tizen/tpk/com.example.sample-1.0.0.tpk (30.1MB)
Installing build/tizen/tpk/com.example.sample-1.0.0.tpk... 19.4s
[E] [WARNING:flutter/impeller/renderer/backend/vulkan/driver_info_vk.cc(263)] Unknown GPU Driver Vendor: 5348. This is not an error.
[IMPORTANT:flutter/shell/platform/embedder/embedder_surface_vulkan_impeller.cc(80)] Using the Impeller rendering backend (Vulkan).
Syncing files to device Tizen rpi4... 57ms
Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
A Dart VM Service on Tizen rpi4 is available at: http://127.0.0.1:43323/LoQ0Sh-iQZs=/
The Flutter DevTools debugger and profiler on Tizen rpi4 is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:43323/LoQ0Sh-iQZs=/
Because vulkan libs are not included in the binary by default. we need to install vulkan libs before run vulkan app on device.
How to set vulkan for Tizen device:
RPI4 hreaded image already has vulkan driver, no need to install to the target.
For TV image, you need to install vulkan driver manually to the target.
vulkan-loader
vulkan-tools
vulkan-wsi-layer
rpm -Uvh --force --nodeps *.rpm
vulkaninfo or vkcube
I can run vulkan backend app on RPI4.
Because the vulkan driver on TV is not stable, I can only run vulkan backend app on Tizen 8.0 with old version dirver.