qtwebkit / qtwebkit

Code in this repository is obsolete. Use this fork: https://github.com/movableink/webkit
479 stars 132 forks source link

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

Open SylvainGarrigues opened 7 years ago

SylvainGarrigues commented 7 years ago

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 commented 7 years ago

Same issues #525 probably

annulen commented 7 years ago

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

SylvainGarrigues commented 7 years ago

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

He does manage to get it with old WebKit.

annulen commented 7 years ago

"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 commented 7 years ago

What is your hardware platform?

SylvainGarrigues commented 7 years ago

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

SylvainGarrigues commented 7 years ago

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 commented 7 years ago

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 commented 7 years ago

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:

SylvainGarrigues commented 7 years ago

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

annulen commented 7 years ago

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.