Skip to content
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

WebGL support in WK2 [QT5.9 / EGLFS QPA] #536

Open
SylvainGarrigues opened this issue May 7, 2017 · 11 comments
Open

WebGL support in WK2 [QT5.9 / EGLFS QPA] #536

SylvainGarrigues opened this issue May 7, 2017 · 11 comments

Comments

@SylvainGarrigues
Copy link

SylvainGarrigues commented May 7, 2017

Hello Konstantin,

First, excellent work for this project.

While WebGL works in WK1 (see example at the end), it doesn't work on WK2 (see example below). Here is my test URL:
http://www.equasys.de/solarsystem.html

My QML file:

import QtWebKit 3.0
import QtQuick 2.6
import QtQuick.Controls 1.5
import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3

ApplicationWindow {
    width: 500
    visible: true
    title: "Annulen"
	ScrollView {
         anchors.fill: parent

	WebView {
         anchors.fill: parent
         url: "http://www.equasys.de/solarsystem.html"
        }
    }
}

My C++ file:

#include <QApplication>
#include <QQmlApplicationEngine>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

    return app.exec();
}

However this works (WK1 right?):

#include <QApplication>
#include <QWebView>
#include <QWebInspector>

int main(int argc, char** argv) {
    QApplication app(argc, argv);
    QWebView view;

    view.setUrl(QUrl("http://www.equasys.de/solarsystem.html"));
    view.show();
    return app.exec();
}
@annulen
Copy link
Member

annulen commented May 7, 2017

Same issues #525 probably

@annulen
Copy link
Member

annulen commented May 7, 2017

BTW, AFAIK WebGL never worked on EGLFS because there is no standard way to share OpenGL textures between processes without GLX

@SylvainGarrigues
Copy link
Author

http://thebugfreeblog.blogspot.fr/2015/12/hardware-acceleration-on-webkit-1.html

He does manage to get it with old WebKit.

@annulen
Copy link
Member

annulen commented May 7, 2017

"I'm not talking about WebGL here"

It may be a good idea to talk to luc4 on our IRC channel, maybe he can provide further info

@annulen
Copy link
Member

annulen commented May 7, 2017

What is your hardware platform?

@SylvainGarrigues
Copy link
Author

SylvainGarrigues commented May 7, 2017

RPI2, FreeBSD, QT5.9 backend on EGLFS, everything compiled for cortex-a7. Everything working perfectly except WebGL on WK2 :-)

@SylvainGarrigues
Copy link
Author

I've seen this: https://bugreports.qt.io/browse/QTBUG-33413 where one claimed he had patches for WebGL functionality to WebKit2.

I also read other Carl's blog posts where a commenter mentioned Qt::AA_ShareOpenGLContexts flag had to be used on QGuiApplication.

@SylvainGarrigues
Copy link
Author

BTW, AFAIK WebGL never worked on EGLFS because there is no standard way to share OpenGL textures between processes without GLX

You mean on WK2 right? Because I can show you a video of WebGL working on EGLFS with your webkit fork and WK1 :-)

@annulen
Copy link
Member

annulen commented May 7, 2017

You mean on WK2 right?

Right. In WK1 page and GUI is in one process, so no sharing needed.

AFAIU, Qt::AA_ShareOpenGLContexts is used to share context between different top-level windows in the same processes, but cannot help with anything for cross-process sharing.

To get cross-process sharing working there are 3 ways:

  • Use GLX (X11). It's not yet possible in my fork before WK2: WebGL demo causes high CPU usage, no rendering #525 is fixed, however works in legacy QtWebKit
  • Use Wayland. There is (quite new) implementation for GTK port at https://bugs.webkit.org/show_bug.cgi?id=115803, which AFAIU implements nested compositor inside UI process for which WebProcess conects. May require substantial adaptations, and probably better left for "webkit upgrade" milestone where we at least don't need to merge that patch anymore
  • Use platform-specific API. For example, Broadcom provides their own compositor API as a part of their Nexus kernel module, however I'm pretty sure it's not available for FreeBSD

@SylvainGarrigues
Copy link
Author

SylvainGarrigues commented May 7, 2017

Thanks. Is it worth trying USE_COORDINATED_GRAPHICS_THREADED (instead of the default USE_COORDINATED_GRAPHICS_MULTIPROCESS one ?)

@annulen
Copy link
Member

annulen commented May 7, 2017

It won't work with our current implementation of WK2. It maybe worth switching to it instead of the current model (esp. given that it was purged from trunk when EFL port left it recently), but it's a research topic.

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

No branches or pull requests

2 participants