summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/unix/separate_debug_info.prf13
-rw-r--r--mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp120
-rw-r--r--mkspecs/unsupported/android-g++/qmake.conf9
3 files changed, 80 insertions, 62 deletions
diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf
index 0e0f60e16e..3ddeffbf44 100644
--- a/mkspecs/features/unix/separate_debug_info.prf
+++ b/mkspecs/features/unix/separate_debug_info.prf
@@ -1,8 +1,15 @@
!separate_debug_info_nocopy:have_target:!staticlib:!static:!isEmpty(QMAKE_OBJCOPY) {
- qnx:debug_info_suffix=sym
- else:debug_info_suffix=debug
- QMAKE_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.$$debug_info_suffix\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.$$debug_info_suffix\" \"\$\$targ\" && chmod -x \"\$\$targ.$$debug_info_suffix\"
+ qnx {
+ debug_info_suffix = sym
+ debug_info_keep = --keep-file-symbols
+ debug_info_strip = --strip-debug -R.ident
+ } else {
+ debug_info_suffix = debug
+ debug_info_keep = --only-keep-debug
+ debug_info_strip = --strip-debug
+ }
+ QMAKE_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY $$debug_info_keep \"\$\$targ\" \"\$\$targ.$$debug_info_suffix\" && $$QMAKE_OBJCOPY $$debug_info_strip \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.$$debug_info_suffix\" \"\$\$targ\" && chmod -x \"\$\$targ.$$debug_info_suffix\"
QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.$$debug_info_suffix $(INSTALL_ROOT)/\$\$target_path/
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
diff --git a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp
index 2329bf1eb0..78a1eb183e 100644
--- a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp
+++ b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp
@@ -43,12 +43,17 @@
#include <ui/DisplayInfo.h>
#include <ui/FramebufferNativeWindow.h>
-#include <gui/SurfaceComposerClient.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/fb.h>
#include <sys/ioctl.h>
+#if Q_ANDROID_VERSION_MAJOR > 4 || (Q_ANDROID_VERSION_MAJOR == 4 && Q_ANDROID_VERSION_MINOR >= 1)
+#include <gui/SurfaceComposerClient.h>
+#else
+#include <surfaceflinger/SurfaceComposerClient.h>
+#endif
+
using namespace android;
QT_BEGIN_NAMESPACE
@@ -56,17 +61,61 @@ QT_BEGIN_NAMESPACE
class QEglFSPandaHooks : public QEglFSHooks
{
public:
+ QEglFSPandaHooks();
virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format);
- virtual QSize screenSize() const;
- virtual int screenDepth() const;
+ virtual bool filterConfig(EGLDisplay display, EGLConfig config) const;
+ virtual const char *fbDeviceName() const { return "/dev/graphics/fb0"; }
+
private:
+ EGLNativeWindowType createNativeWindowSurfaceFlinger(const QSize &size, const QSurfaceFormat &format);
+ EGLNativeWindowType createNativeWindowFramebuffer(const QSize &size, const QSurfaceFormat &format);
+
+ void ensureFramebufferNativeWindowCreated();
+
// androidy things
sp<android::SurfaceComposerClient> mSession;
sp<android::SurfaceControl> mControl;
sp<android::Surface> mAndroidSurface;
+
+ sp<android::FramebufferNativeWindow> mFramebufferNativeWindow;
+ EGLint mFramebufferVisualId;
+
+ bool mUseFramebuffer;
};
-EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &)
+QEglFSPandaHooks::QEglFSPandaHooks()
+ : mFramebufferVisualId(EGL_DONT_CARE)
+{
+ mUseFramebuffer = qgetenv("QT_QPA_EGLFS_NO_SURFACEFLINGER").toInt();
+}
+
+void QEglFSPandaHooks::ensureFramebufferNativeWindowCreated()
+{
+ if (mFramebufferNativeWindow.get())
+ return;
+ mFramebufferNativeWindow = new FramebufferNativeWindow();
+ framebuffer_device_t const *fbDev = mFramebufferNativeWindow->getDevice();
+ if (!fbDev)
+ qFatal("Failed to get valid FramebufferNativeWindow, no way to create EGL surfaces");
+
+ ANativeWindow *window = mFramebufferNativeWindow.get();
+
+ window->query(window, NATIVE_WINDOW_FORMAT, &mFramebufferVisualId);
+}
+
+EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(const QSize &size, const QSurfaceFormat &format)
+{
+ return mUseFramebuffer ? createNativeWindowFramebuffer(size, format) : createNativeWindowSurfaceFlinger(size, format);
+}
+
+EGLNativeWindowType QEglFSPandaHooks::createNativeWindowFramebuffer(const QSize &size, const QSurfaceFormat &)
+{
+ Q_UNUSED(size);
+ ensureFramebufferNativeWindowCreated();
+ return mFramebufferNativeWindow.get();
+}
+
+EGLNativeWindowType QEglFSPandaHooks::createNativeWindowSurfaceFlinger(const QSize &size, const QSurfaceFormat &)
{
Q_UNUSED(size);
@@ -85,66 +134,21 @@ EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(const QSize &size, cons
EGLNativeWindowType eglWindow = mAndroidSurface.get();
return eglWindow;
}
-QSize QEglFSPandaHooks::screenSize() const
-{
- static QSize size;
-
- if (size.isEmpty()) {
- int width = qgetenv("QT_QPA_EGLFS_WIDTH").toInt();
- int height = qgetenv("QT_QPA_EGLFS_HEIGHT").toInt();
-
- if (width && height) {
- // no need to read fb0
- size.setWidth(width);
- size.setHeight(height);
- return size;
- }
-
- struct fb_var_screeninfo vinfo;
- int fd = open("/dev/graphics/fb0", O_RDONLY);
-
- if (fd != -1) {
- if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1)
- qWarning("Could not query variable screen info.");
- else
- size = QSize(vinfo.xres, vinfo.yres);
-
- close(fd);
- } else {
- qWarning("Failed to open /dev/graphics/fb0 to detect screen resolution.");
- }
-
- // override fb0 from environment var setting
- if (width)
- size.setWidth(width);
- if (height)
- size.setHeight(height);
- }
-
- return size;
-}
-int QEglFSPandaHooks::screenDepth() const
+bool QEglFSPandaHooks::filterConfig(EGLDisplay display, EGLConfig config) const
{
- static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt();
+ if (!mUseFramebuffer)
+ return true;
- if (depth == 0) {
- struct fb_var_screeninfo vinfo;
- int fd = open("/dev/graphics/fb0", O_RDONLY);
+ const_cast<QEglFSPandaHooks *>(this)->ensureFramebufferNativeWindowCreated();
- if (fd != -1) {
- if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1)
- qWarning("Could not query variable screen info.");
- else
- depth = vinfo.bits_per_pixel;
+ if (mFramebufferVisualId == EGL_DONT_CARE)
+ return true;
- close(fd);
- } else {
- qWarning("Failed to open /dev/graphics/fb0 to detect screen depth.");
- }
- }
+ EGLint nativeVisualId = 0;
+ eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &nativeVisualId);
- return depth == 0 ? 32 : depth;
+ return nativeVisualId == mFramebufferVisualId;
}
static QEglFSPandaHooks eglFSPandaHooks;
diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf
index 8e0af9268d..29cc709cb9 100644
--- a/mkspecs/unsupported/android-g++/qmake.conf
+++ b/mkspecs/unsupported/android-g++/qmake.conf
@@ -18,11 +18,13 @@ defineReplace(getAndroidBuildVar) {
store_ANDROID_TARGET_CFLAGS = "ANDROID_TARGET_CFLAGS=$$getAndroidBuildVar(TARGET_GLOBAL_CFLAGS)"
store_ANDROID_TARGET_LDFLAGS = "ANDROID_TARGET_LDFLAGS=$$getAndroidBuildVar(TARGET_GLOBAL_LDFLAGS)"
store_ANDROID_TARGET_ARCH = "ANDROID_TARGET_ARCH=$$getAndroidBuildVar(TARGET_ARCH)"
+ store_ANDROID_VERSION = "ANDROID_VERSION=$$getAndroidBuildVar(PLATFORM_VERSION)"
write_file(android_build_vars, store_ANDROID_TOOLCHAIN_PREFIX)
write_file(android_build_vars, store_ANDROID_TARGET_CFLAGS, append)
write_file(android_build_vars, store_ANDROID_TARGET_LDFLAGS, append)
write_file(android_build_vars, store_ANDROID_TARGET_ARCH, append)
+ write_file(android_build_vars, store_ANDROID_VERSION, append)
}
info(using android build env from cache in $$PWD/android_build_vars . delete this file if you changed your build env )
@@ -30,6 +32,9 @@ exists($$PWD/android_build_vars) {
include($$PWD/android_build_vars)
}
+ANDROID_VERSION_SPLIT = $$split(ANDROID_VERSION, ".")
+ANDROID_VERSION_MAJOR = $$member(ANDROID_VERSION_SPLIT, 0)
+ANDROID_VERSION_MINOR = $$member(ANDROID_VERSION_SPLIT, 1)
MAKEFILE_GENERATOR = UNIX
QMAKE_COMPILER = gcc
@@ -43,6 +48,8 @@ include(../../common/gcc-base-unix.conf)
CONFIG = qt warn_on release link_prl
QT = core gui
DEFINES += Q_OS_LINUX_ANDROID HAVE_ANDROID_OS
+DEFINES += Q_ANDROID_VERSION_MAJOR=$$ANDROID_VERSION_MAJOR
+DEFINES += Q_ANDROID_VERSION_MINOR=$$ANDROID_VERSION_MINOR
DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG QT_NO_EXCEPTIONS
#note: -DANDROID results in weird behaviour of math.h
@@ -50,7 +57,7 @@ DEFINES += ANDROID
QT_QPA_DEFAULT_PLATFORM = eglfs
EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_surfaceflinger.cpp
-EGLFS_PLATFORM_HOOKS_LIBS += -lgui -lutils
+EGLFS_PLATFORM_HOOKS_LIBS += -lui -lgui -lutils -lcutils
QMAKE_CC = $${ANDROID_TOOLCHAIN_PREFIX}gcc