Make the eglfs and eglfs-viv detection and build work for INTEGRITY.

The majority of these changes is about #ifdef-ing the Linux-specific use
of /dev/fb0.
The display handle is also acquired using fbGetDisplay(), which is
equivalent to fbGetDisplayByIndex(0) but is also portable.

Change-Id: I6f460edc9c06ae7461a6aab2a816ac6f645208c4
Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
This commit is contained in:
Rolland Dudemaine 2016-03-11 15:05:56 +01:00
parent 2687eb5a8c
commit 9b35b0e8dc
6 changed files with 35 additions and 5 deletions

View File

@ -43,6 +43,6 @@
int main(int, char **) int main(int, char **)
{ {
fbGetDisplayByIndex(0); fbGetDisplay();
return 0; return 0;
} }

View File

@ -1,6 +1,16 @@
SOURCES = eglfs-viv.cpp SOURCES = eglfs-viv.cpp
integrity {
DEFINES += EGL_API_FB=1
} else {
DEFINES += LINUX=1 EGL_API_FB=1 DEFINES += LINUX=1 EGL_API_FB=1
}
CONFIG -= qt CONFIG -= qt
LIBS += -lEGL -lGLESv2 -lGAL LIBS += -lEGL -lGLESv2 -lGAL
for(p, QMAKE_LIBDIR_OPENGL_ES2) {
exists($$p):LIBS += -L$$p
}
!isEmpty(QMAKE_INCDIR_EGL): INCLUDEPATH += $$QMAKE_INCDIR_EGL
!isEmpty(QMAKE_LIBS_EGL): LIBS += $$QMAKE_LIBS_EGL

View File

@ -47,6 +47,10 @@
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
#include <QtCore/qloggingcategory.h> #include <QtCore/qloggingcategory.h>
#ifdef Q_OS_INTEGRITY
#include <EGL/egl.h>
#endif
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE_EXT #ifndef GL_FRAMEBUFFER_SRGB_CAPABLE_EXT
#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA #define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
#endif #endif

View File

@ -41,6 +41,10 @@
#include <EGL/eglvivante.h> #include <EGL/eglvivante.h>
#include <QDebug> #include <QDebug>
#ifdef Q_OS_INTEGRITY
extern "C" void VivanteInit(void);
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
void QEglFSVivIntegration::platformInit() void QEglFSVivIntegration::platformInit()
@ -57,6 +61,10 @@ void QEglFSVivIntegration::platformInit()
qputenv("FB_MULTI_BUFFER", "2"); qputenv("FB_MULTI_BUFFER", "2");
} }
#ifdef Q_OS_INTEGRITY
VivanteInit();
#endif
mNativeDisplay = fbGetDisplayByIndex(framebufferIndex()); mNativeDisplay = fbGetDisplayByIndex(framebufferIndex());
fbGetDisplayGeometry(mNativeDisplay, &width, &height); fbGetDisplayGeometry(mNativeDisplay, &width, &height);
mScreenSize.setHeight(height); mScreenSize.setHeight(height);

View File

@ -120,11 +120,15 @@ static int framebuffer = -1;
QByteArray QEGLDeviceIntegration::fbDeviceName() const QByteArray QEGLDeviceIntegration::fbDeviceName() const
{ {
#ifdef Q_OS_LINUX
QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB"); QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");
if (fbDev.isEmpty()) if (fbDev.isEmpty())
fbDev = QByteArrayLiteral("/dev/fb0"); fbDev = QByteArrayLiteral("/dev/fb0");
return fbDev; return fbDev;
#else
return QByteArray();
#endif
} }
int QEGLDeviceIntegration::framebufferIndex() const int QEGLDeviceIntegration::framebufferIndex() const
@ -141,6 +145,7 @@ int QEGLDeviceIntegration::framebufferIndex() const
void QEGLDeviceIntegration::platformInit() void QEGLDeviceIntegration::platformInit()
{ {
#ifdef Q_OS_LINUX
QByteArray fbDev = fbDeviceName(); QByteArray fbDev = fbDeviceName();
framebuffer = qt_safe_open(fbDev, O_RDONLY); framebuffer = qt_safe_open(fbDev, O_RDONLY);
@ -153,12 +158,15 @@ void QEGLDeviceIntegration::platformInit()
#ifdef FBIOBLANK #ifdef FBIOBLANK
ioctl(framebuffer, FBIOBLANK, VESA_NO_BLANKING); ioctl(framebuffer, FBIOBLANK, VESA_NO_BLANKING);
#endif #endif
#endif
} }
void QEGLDeviceIntegration::platformDestroy() void QEGLDeviceIntegration::platformDestroy()
{ {
#ifdef Q_OS_LINUX
if (framebuffer != -1) if (framebuffer != -1)
close(framebuffer); close(framebuffer);
#endif
} }
EGLNativeDisplayType QEGLDeviceIntegration::platformDisplay() const EGLNativeDisplayType QEGLDeviceIntegration::platformDisplay() const
@ -307,7 +315,7 @@ void QEGLDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
{ {
Q_UNUSED(surface); Q_UNUSED(surface);
#if defined(FBIO_WAITFORVSYNC) #if defined(Q_OS_LINUX) && defined(FBIO_WAITFORVSYNC)
static const bool forceSync = qEnvironmentVariableIntValue("QT_QPA_EGLFS_FORCEVSYNC"); static const bool forceSync = qEnvironmentVariableIntValue("QT_QPA_EGLFS_FORCEVSYNC");
if (forceSync && framebuffer != -1) { if (forceSync && framebuffer != -1) {
int arg = 0; int arg = 0;

View File

@ -66,7 +66,7 @@ private:
Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration) Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration)
DeviceIntegration::DeviceIntegration() DeviceIntegration::DeviceIntegration() : m_integration(0)
{ {
QStringList pluginKeys = QEGLDeviceIntegrationFactory::keys(); QStringList pluginKeys = QEGLDeviceIntegrationFactory::keys();
if (!pluginKeys.isEmpty()) { if (!pluginKeys.isEmpty()) {