-
Notifications
You must be signed in to change notification settings - Fork 2
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
RZ/G1E: WebGLの有効化 #21
Comments
PC用のWebGLのデモはどれも重すぎるかシンプル過ぎるかで、なかなか良いものが見当たらない。 |
落ちるのはGPUドライバの問題である可能性も考えられるが、どちらかと言えば現状のFirefoxへのパッチの方が怪しい。同一 |
例えば、以下のコンテンツはレンダリングはちゃんとできているが3fps程度? |
これは1280x720の場合。 |
WebGL コンテンツ例ちょっと探してきて追加しておきます (現時点では程よい軽いのはまだ無いかもですがもう少し軽いのあるのが何処だったか思い出します): |
ありがとうございます! |
45.6.0のリリースノートにWebGLに関する記載があったので一応試してみたが、特に状況変わらず。 |
ESR52のEGLを有効化したブランチ |
gdbで見てみたところ、実機の場合、 SharedSurface_EGLImage::~SharedSurface_EGLImage()
{
mEGL->fDestroyImage(Display(), mImage);
.... |
Gecko側の問題かドライバ側の問題かはっきりとは分かっていないが、該当箇所をコメントアウトすると
もう少し状況が改善されて、数フレーム程度は描画されるが、最終的にはやはりクラッシュする。 |
今のコードだとSharedSurface_EGLの再利用がされないようになっているが SharedSurface_EGLImage::SharedSurface_EGLImage(GLContext* gl,
GLLibraryEGL* egl,
const gfx::IntSize& size,
bool hasAlpha,
const GLFormats& formats,
GLuint prodTex,
EGLImage image)
: SharedSurface(SharedSurfaceType::EGLImageShare,
AttachmentType::GLTexture,
gl,
size,
hasAlpha,
false) // Can't recycle, as mSync changes never update TextureHost. これを再利用されるように変更すると、大きく改善した。 |
|
CompositorOGLを有効化せずにWebGLを有効化すると、オフスクリーンバッファからメインメモリへのコピーが発生するので性能が低下する。 |
ただし、http://webglsamples.org/ のデモは今のところ全滅。 |
eglDestroyImageKHR()でクラッシュする原因はFirefox側かドライバ側か分かっていないので、単純なサンプルコードを書いて確認した方が良いだろう。 |
|
根本解決には |
現在のレシピでの上記の再現手順:
diff --git a/recipes-mozilla/firefox/firefox_52.2.0esr.bb b/recipes-mozilla/firefox/firefox_52.2.0esr.bb
index 9ed4694..fc0d619 100644
--- a/recipes-mozilla/firefox/firefox_52.2.0esr.bb
+++ b/recipes-mozilla/firefox/firefox_52.2.0esr.bb
@@ -113,8 +113,6 @@ SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'wayland', \
file://wayland-patches/0001-Fix-setting-up-shellHasCSD-flag-position.patch \
file://wayland-patches/0001-Fixed-fullscreen-on-Weston.patch \
file://wayland-patches/0001-Fixed-clipboard-crashes-after-browser-start-rhbz-145.patch \
- file://wayland-patches/0001-Enable-sharing-SharedSurface_EGLImage.patch \
- file://wayland-patches/0002-Add-workaround-for-eglDestroyImageKHR-SEGV.patch \
file://wayland-patches/0001-Fixed-error-handling-for-posix_fallocate-ftruncate-b.patch \
file://wayland-patches/0002-Fixed-error-handling-for-posix_fallocate-and-formatt.patch \
file://wayland-patches/0003-Fixed-rhbz-1464017-Wayland-Hamburger-menu-popup-and-.patch \
最初の1フレーム目はレンダリングできるが、すぐにクラッシュする。 |
クラッシュ時のスタックトレース #0 raise (sig=11) at ../sysdeps/unix/sysv/linux/pt-raise.c:38
#1 0xb4fc8024 in nsProfileLock::FatalSignalHandler(int, siginfo_t*, void*) () from /usr/lib/firefox-52.2.0/libxul.so
#2 <signal handler called>
#3 0x00000000 in ?? ()
#4 0xb3c276f0 in mozilla::gl::SharedSurface_EGLImage::~SharedSurface_EGLImage() () from /usr/lib/firefox-52.2.0/libxul.so
#5 0xb3c27790 in mozilla::gl::SharedSurface_EGLImage::~SharedSurface_EGLImage() () from /usr/lib/firefox-52.2.0/libxul.so
#6 0xb3c787f0 in mozilla::layers::SharedSurfaceTextureData::~SharedSurfaceTextureData() () from /usr/lib/firefox-52.2.0/libxul.so
#7 0xb3c7881c in mozilla::layers::SharedSurfaceTextureData::~SharedSurfaceTextureData() () from /usr/lib/firefox-52.2.0/libxul.so
#8 0xb3c8132c in mozilla::layers::SharedSurfaceTextureClient::~SharedSurfaceTextureClient() () from /usr/lib/firefox-52.2.0/libxul.so
#9 0xb3c8134c in mozilla::layers::SharedSurfaceTextureClient::~SharedSurfaceTextureClient() () from /usr/lib/firefox-52.2.0/libxul.so
#10 0xb3c24798 in mozilla::AtomicRefCountedWithFinalize<mozilla::layers::TextureClient>::Release() () from /usr/lib/firefox-52.2.0/libxul.so
#11 0xb3c247f4 in RefPtr<mozilla::layers::SharedSurfaceTextureClient>::~RefPtr() () from /usr/lib/firefox-52.2.0/libxul.so
#12 0xb3c28094 in mozilla::gl::SurfaceFactory::RecycleCallback(mozilla::layers::TextureClient*, void*) () from /usr/lib/firefox-52.2.0/libxul.so
#13 0xb3c247c4 in mozilla::AtomicRefCountedWithFinalize<mozilla::layers::TextureClient>::Release() () from /usr/lib/firefox-52.2.0/libxul.so
#14 0xb3c38bf0 in RefPtr<mozilla::layers::TextureClient>::~RefPtr() () from /usr/lib/firefox-52.2.0/libxul.so
#15 0xb3ca67f8 in mozilla::layers::CompositorBridgeChild::NotifyNotUsed(unsigned long long, unsigned long long) () from /usr/lib/firefox-52.2.0/libxul.so
#16 0xb3ca6868 in mozilla::layers::CompositorBridgeChild::RecvParentAsyncMessages(nsTArray<mozilla::layers::AsyncParentMessageData>&&) ()
from /usr/lib/firefox-52.2.0/libxul.so
#17 0xb39858a0 in mozilla::layers::PCompositorBridgeChild::OnMessageReceived(IPC::Message const&) () from /usr/lib/firefox-52.2.0/libxul.so
#18 0xb37832c0 in mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) () from /usr/lib/firefox-52.2.0/libxul.so
#19 0xb3789f04 in mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) () from /usr/lib/firefox-52.2.0/libxul.so
#20 0xb378b498 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::MessageChannel::MessageTask&) () from /usr/lib/firefox-52.2.0/libxul.so
#21 0xb378b638 in mozilla::ipc::MessageChannel::MessageTask::Run() () from /usr/lib/firefox-52.2.0/libxul.so
#22 0xb33fa8d4 in nsThread::ProcessNextEvent(bool, bool*) () from /usr/lib/firefox-52.2.0/libxul.so
#23 0xb3418ab8 in NS_ProcessNextEvent(nsIThread*, bool) () from /usr/lib/firefox-52.2.0/libxul.so
#24 0xb3780468 in mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) () from /usr/lib/firefox-52.2.0/libxul.so
#25 0xb3769240 in MessageLoop::Run() () from /usr/lib/firefox-52.2.0/libxul.so
#26 0xb48e92fc in nsBaseAppShell::Run() () from /usr/lib/firefox-52.2.0/libxul.so
#27 0xb4f7ab74 in nsAppStartup::Run() () from /usr/lib/firefox-52.2.0/libxul.so
#28 0xb4fcf4f0 in XREMain::XRE_mainRun() () from /usr/lib/firefox-52.2.0/libxul.so
#29 0xb4fcf7d4 in XREMain::XRE_main(int, char**, nsXREAppData const*) () from /usr/lib/firefox-52.2.0/libxul.so
#30 0xb4fcfa14 in XRE_main () from /usr/lib/firefox-52.2.0/libxul.so
#31 0x00014a98 in do_main(int, char**, char**, nsIFile*) [clone .constprop.4] ()
#32 0x0001410c in main () 以下の箇所(eglDestroyImageKHR)でクラッシュしている: https://dxr.mozilla.org/mozilla-esr52/source/gfx/gl/SharedSurfaceEGL.cpp#88 |
その後の調査で、Canvasのサイズに依存していることが分かった。 もう少し見ていくと、128 x 4095 = 524,160 pix あたりがギリギリで、32bitとすると2048KBとマジックナンバーっぽい値になる。 |
eglDestroyImageKHR()のシンボル解決の方法に問題があるようだ。クラッシュする問題のコードは gfx/gl/GLLibraryEGL.cpp: 305bool
306GLLibraryEGL::EnsureInitialized(bool forceAccel, nsACString* const out_failureId)
307{
...
442 const auto lookupFunction =
443 (GLLibraryLoader::PlatformLookupFunction)mSymbols.fGetProcAddress;
...
610 if (IsExtensionSupported(KHR_image) || IsExtensionSupported(KHR_image_base)) {
611 GLLibraryLoader::SymLoadStruct imageSymbols[] = {
612 { (PRFuncPtr*) &mSymbols.fCreateImage, { "eglCreateImageKHR", nullptr } },
613 { (PRFuncPtr*) &mSymbols.fDestroyImage, { "eglDestroyImageKHR", nullptr } },
614 { nullptr, { nullptr } }
615 };
616
617 bool success = GLLibraryLoader::LoadSymbols(mEGLLibrary,
618 &imageSymbols[0],
619 lookupFunction); gfx/gl/GLLibraryLoader.cpp: PRFuncPtr
GLLibraryLoader::LookupSymbol(PRLibrary* lib,
const char* sym,
PlatformLookupFunction lookupFunction)
{
PRFuncPtr res = 0;
// try finding it in the library directly, if we have one
if (lib) {
res = PR_FindFunctionSymbol(lib, sym);
}
// then try looking it up via the lookup symbol
if (!res && lookupFunction) {
res = lookupFunction(sym);
} |
今のところYocto 2.0・firefox-52.3esrブランチ限定だが、以下の設定でWebGLを有効化できるようにした。
ビルド手順も更新した: https://github.com/webdino/meta-browser/wiki/Build-RZ-G1E-Yocto2.0 この内容なら45esrブランチにもバックポートできるが、現行ブランチは52esrなので、ひとまず本issueはこれで完了として、残りの問題に対応する場合は別issueを立てる。 |
補足
|
ちがう、
|
RZ/G1EでWebGLを有効化できるようにする。
現状のコードでは、prefs.jsで以下の様にするとWebGLを有効化することができた。
layers.acceleration.force-enabled
をtrue
にすると、WebGLコンテンツを表示したときに一瞬レンダリングされた後にクラッシュする。両方とも有効化できるようにしたい。どうもWebGLに限らず複数モジュールでGPUを有効化すると落ちるように見える。Skiaも以下のようにすると落ちるが、SkiaだけでGPUを使うようにすると落ちない(今のところアクセラレーション効果はあまり見られないが)
The text was updated successfully, but these errors were encountered: