Skip to content

use egl platform display #437

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

wang-bin
Copy link

@wang-bin wang-bin commented May 17, 2025

not required by mesa driver because platform type can be detected in eglGetDisplay() via native display.
required by arm mali driver if mutiple platforms are available, otherwise egl may call into x11 and crash even if gbm is desired. tested on rk3588

[WARNING][elinux_window_drm.h(158)] FLUTTER_DRM_DEVICE is not set, use /dev/dri/card0
Process 20346 stopped
* thread #1, name = 'esample', stop reason = signal SIGSEGV: invalid address (fault address: 0x30)
    frame #0: 0x0000007feb8d7fa8 libX11.so.6`XNoOp + 24
libX11.so.6`XNoOp:
->  0x7feb8d7fa8 <+24>: ldr    x1, [x1]
    0x7feb8d7fac <+28>: blr    x1
    0x7feb8d7fb0 <+32>: mov    x0, x19
    0x7feb8d7fb4 <+36>: mov    x2, #0x4
(lldb) bt
* thread #1, name = 'esample', stop reason = signal SIGSEGV: invalid address (fault address: 0x30)
  * frame #0: 0x0000007feb8d7fa8 libX11.so.6`XNoOp + 24
    frame #1: 0x0000007fec0da834 libmali.so.1
    frame #2: 0x0000007ff31727a8 libflutter_elinux_gbm.so`std::_MakeUniq<flutter::EnvironmentEgl>::__single_object std::make_unique<flutter::EnvironmentEgl, gbm_device*&>(__args=0x00000000004e0480) at unique_ptr.h:962:34
    frame #3: 0x0000007ff3171f94 libflutter_elinux_gbm.so`flutter::NativeWindowDrmGbm::CreateRenderSurface(this=0x00000000004e03c0, enable_impeller=false) at native_window_drm_gbm.cc:137:7
    frame #4: 0x0000007ff30cd2cc libflutter_elinux_gbm.so`flutter::ELinuxWindowDrm<flutter::NativeWindowDrmGbm>::CreateRenderSurface(this=0x00000000004ae6d0, width=1280, height=720, enable_impeller=false) at elinux_window_drm.h:190:39
    frame #5: 0x0000007ff30e548c libflutter_elinux_gbm.so`flutter::FlutterELinuxView::CreateRenderSurface(this=0x00000000004cec30) at flutter_elinux_view.cc:494:28
    frame #6: 0x0000007ff30c8648 libflutter_elinux_gbm.so`::FlutterDesktopViewControllerCreate(view_properties=0x0000007fffffef18, engine=0x00000000004ade40) at flutter_elinux.cc:98:16
    frame #7: 0x00000000004170c8 esample`flutter::FlutterViewController::FlutterViewController(this=0x00000000004adb80, view_properties=0x0000007ffffff1f0, project=0x0000007ffffff278) at flutter_view_controller.cc:49:17
    frame #8: 0x00000000004067d4 esample`std::_MakeUniq<flutter::FlutterViewController>::__single_object std::make_unique<flutter::FlutterViewController, flutter::FlutterViewController::ViewProperties&, flutter::DartProject&>(__args=0x0000007ffffff1f0, __args=0x0000007ffffff278) at unique_ptr.h:962:34
    frame #9: 0x0000000000406320 esample`FlutterWindow::OnCreate(this=0x0000007ffffff1f0) at flutter_window.cc:20:30
    frame #10: 0x0000000000408c8c esample`main(argc=3, argv=0x0000007ffffff7a8) at main.cc:46:15
    frame #11: 0x0000007ff2a86dd8 libc.so.6`__libc_start_main + 232
    frame #12: 0x00000000004061b4 esample`_start + 52

@wang-bin wang-bin force-pushed the eglplatform branch 3 times, most recently from 00f6aab to cd33f62 Compare May 18, 2025 10:25
@HidenoriMatsubayashi
Copy link
Contributor

@taka-okayama could you watch the repos?

required if mutiple platforms are available, otherwise egl may call into
x11 and crash even if gbm is desired. tested on rk3588
@wang-bin
Copy link
Author

wang-bin commented Jun 4, 2025

can anyone review this pr?

I've read mesa source code and know why eglGetDisplay() does not crash on x86 desktop. mesa can check native display's first pointer and detect platform type with this hack, see https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.0.7/src/egl/main/eglapi.c?ref_type=tags#L423 and https://gitlab.freedesktop.org/mesa/mesa/-/blob/mesa-25.0.7/src/egl/main/egldisplay.c#L125

proprietary drivers may not support this, for example arm mali drivers I tested on some rockchip boards, that's why egl paltform extension exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants