Implement nativeResourceFunctionForContext for kms
Change-Id: I4e0486744f4c3eb711a9252c90b0d06c5bb3c670 Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
parent
0a8b67b3bb
commit
6c0d267a73
@ -44,6 +44,8 @@
|
||||
#include "qkmsdevice.h"
|
||||
|
||||
#include "qscreen.h"
|
||||
#include "qkmscontext.h"
|
||||
#include <QOpenGLContext>
|
||||
|
||||
class QKmsResourceMap : public QMap<QByteArray, QKmsNativeInterface::ResourceType>
|
||||
{
|
||||
@ -76,6 +78,17 @@ void *QKmsNativeInterface::nativeResourceForWindow(const QByteArray &resourceStr
|
||||
return result;
|
||||
}
|
||||
|
||||
QPlatformNativeInterface::NativeResourceForContextFunction QKmsNativeInterface::nativeResourceFunctionForContext(const QByteArray &resource)
|
||||
{
|
||||
QByteArray lowerCaseResource = resource.toLower();
|
||||
if (lowerCaseResource == "get_egl_context") {
|
||||
return eglContextForContext;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *QKmsNativeInterface::eglDisplayForWindow(QWindow *window)
|
||||
{
|
||||
QKmsScreen *screen = qPlatformScreenForWindow(window);
|
||||
@ -97,3 +110,12 @@ QKmsScreen *QKmsNativeInterface::qPlatformScreenForWindow(QWindow *window)
|
||||
QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
|
||||
return static_cast<QKmsScreen *>(screen->handle());
|
||||
}
|
||||
|
||||
void *QKmsNativeInterface::eglContextForContext(QOpenGLContext *context)
|
||||
{
|
||||
Q_ASSERT(context);
|
||||
|
||||
QKmsContext *eglPlatformContext = static_cast<QKmsContext *>(context->handle());
|
||||
|
||||
return eglPlatformContext->eglContext();
|
||||
}
|
||||
|
@ -56,8 +56,11 @@ public:
|
||||
|
||||
void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window);
|
||||
|
||||
NativeResourceForContextFunction nativeResourceFunctionForContext(const QByteArray &resource);
|
||||
|
||||
void *eglDisplayForWindow(QWindow *window);
|
||||
void *eglContextForWindow(QWindow *window);
|
||||
static void *eglContextForContext(QOpenGLContext *context);
|
||||
|
||||
private:
|
||||
static QKmsScreen *qPlatformScreenForWindow(QWindow *window);
|
||||
|
Loading…
Reference in New Issue
Block a user