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:
parent
2687eb5a8c
commit
9b35b0e8dc
@ -43,6 +43,6 @@
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
fbGetDisplayByIndex(0);
|
||||
fbGetDisplay();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,6 +1,16 @@
|
||||
SOURCES = eglfs-viv.cpp
|
||||
DEFINES += LINUX=1 EGL_API_FB=1
|
||||
|
||||
integrity {
|
||||
DEFINES += EGL_API_FB=1
|
||||
} else {
|
||||
DEFINES += LINUX=1 EGL_API_FB=1
|
||||
}
|
||||
CONFIG -= qt
|
||||
|
||||
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
|
||||
|
@ -47,6 +47,10 @@
|
||||
#include <qpa/qplatformintegration.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
#ifdef Q_OS_INTEGRITY
|
||||
#include <EGL/egl.h>
|
||||
#endif
|
||||
|
||||
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE_EXT
|
||||
#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
|
||||
#endif
|
||||
|
@ -41,6 +41,10 @@
|
||||
#include <EGL/eglvivante.h>
|
||||
#include <QDebug>
|
||||
|
||||
#ifdef Q_OS_INTEGRITY
|
||||
extern "C" void VivanteInit(void);
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
void QEglFSVivIntegration::platformInit()
|
||||
@ -57,6 +61,10 @@ void QEglFSVivIntegration::platformInit()
|
||||
qputenv("FB_MULTI_BUFFER", "2");
|
||||
}
|
||||
|
||||
#ifdef Q_OS_INTEGRITY
|
||||
VivanteInit();
|
||||
#endif
|
||||
|
||||
mNativeDisplay = fbGetDisplayByIndex(framebufferIndex());
|
||||
fbGetDisplayGeometry(mNativeDisplay, &width, &height);
|
||||
mScreenSize.setHeight(height);
|
||||
|
@ -120,11 +120,15 @@ static int framebuffer = -1;
|
||||
|
||||
QByteArray QEGLDeviceIntegration::fbDeviceName() const
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");
|
||||
if (fbDev.isEmpty())
|
||||
fbDev = QByteArrayLiteral("/dev/fb0");
|
||||
|
||||
return fbDev;
|
||||
#else
|
||||
return QByteArray();
|
||||
#endif
|
||||
}
|
||||
|
||||
int QEGLDeviceIntegration::framebufferIndex() const
|
||||
@ -141,6 +145,7 @@ int QEGLDeviceIntegration::framebufferIndex() const
|
||||
|
||||
void QEGLDeviceIntegration::platformInit()
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
QByteArray fbDev = fbDeviceName();
|
||||
|
||||
framebuffer = qt_safe_open(fbDev, O_RDONLY);
|
||||
@ -153,12 +158,15 @@ void QEGLDeviceIntegration::platformInit()
|
||||
#ifdef FBIOBLANK
|
||||
ioctl(framebuffer, FBIOBLANK, VESA_NO_BLANKING);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void QEGLDeviceIntegration::platformDestroy()
|
||||
{
|
||||
#ifdef Q_OS_LINUX
|
||||
if (framebuffer != -1)
|
||||
close(framebuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
EGLNativeDisplayType QEGLDeviceIntegration::platformDisplay() const
|
||||
@ -307,7 +315,7 @@ void QEGLDeviceIntegration::waitForVSync(QPlatformSurface *surface) const
|
||||
{
|
||||
Q_UNUSED(surface);
|
||||
|
||||
#if defined(FBIO_WAITFORVSYNC)
|
||||
#if defined(Q_OS_LINUX) && defined(FBIO_WAITFORVSYNC)
|
||||
static const bool forceSync = qEnvironmentVariableIntValue("QT_QPA_EGLFS_FORCEVSYNC");
|
||||
if (forceSync && framebuffer != -1) {
|
||||
int arg = 0;
|
||||
|
@ -66,7 +66,7 @@ private:
|
||||
|
||||
Q_GLOBAL_STATIC(DeviceIntegration, deviceIntegration)
|
||||
|
||||
DeviceIntegration::DeviceIntegration()
|
||||
DeviceIntegration::DeviceIntegration() : m_integration(0)
|
||||
{
|
||||
QStringList pluginKeys = QEGLDeviceIntegrationFactory::keys();
|
||||
if (!pluginKeys.isEmpty()) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user