eglfs: ifdef linux specific functionality from convenience functions

Because change a093204f07
qeglfshooks_stub.cpp don't compile anymore on any other *nix
platform than linux as those functions have been set linux
specific only.

Change-Id: I339672b1bf2745511076030cc1fe13dc7f2356ff
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Pasi Petäjäjärvi 2014-10-08 15:11:57 +03:00 committed by Jani Heikkinen
parent be64d905a0
commit 4b717026d3

View File

@ -37,8 +37,8 @@
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/fb.h> #include <linux/fb.h>
#include <private/qmath_p.h>
#endif #endif
#include <private/qmath_p.h>
#include "qeglconvenience_p.h" #include "qeglconvenience_p.h"
@ -448,10 +448,13 @@ void q_printEglConfig(EGLDisplay display, EGLConfig config)
} }
} }
#ifdef Q_OS_LINUX #ifdef Q_OS_UNIX
QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize) QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize)
{ {
#ifndef Q_OS_LINUX
Q_UNUSED(framebufferDevice)
#endif
const int defaultPhysicalDpi = 100; const int defaultPhysicalDpi = 100;
static QSizeF size; static QSizeF size;
@ -466,10 +469,11 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize
return size; return size;
} }
struct fb_var_screeninfo vinfo;
int w = -1; int w = -1;
int h = -1; int h = -1;
QSize screenResolution; QSize screenResolution;
#ifdef Q_OS_LINUX
struct fb_var_screeninfo vinfo;
if (framebufferDevice != -1) { if (framebufferDevice != -1) {
if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) { if (ioctl(framebufferDevice, FBIOGET_VSCREENINFO, &vinfo) == -1) {
@ -479,7 +483,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize
h = vinfo.height; h = vinfo.height;
screenResolution = QSize(vinfo.xres, vinfo.yres); screenResolution = QSize(vinfo.xres, vinfo.yres);
} }
} else { } else
#endif
{
// Use the provided screen size, when available, since some platforms may have their own // Use the provided screen size, when available, since some platforms may have their own
// specific way to query it. Otherwise try querying it from the framebuffer. // specific way to query it. Otherwise try querying it from the framebuffer.
screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize; screenResolution = screenSize.isEmpty() ? q_screenSizeFromFb(framebufferDevice) : screenSize;
@ -499,6 +505,9 @@ QSizeF q_physicalScreenSizeFromFb(int framebufferDevice, const QSize &screenSize
QSize q_screenSizeFromFb(int framebufferDevice) QSize q_screenSizeFromFb(int framebufferDevice)
{ {
#ifndef Q_OS_LINUX
Q_UNUSED(framebufferDevice)
#endif
const int defaultWidth = 800; const int defaultWidth = 800;
const int defaultHeight = 600; const int defaultHeight = 600;
static QSize size; static QSize size;
@ -513,6 +522,7 @@ QSize q_screenSizeFromFb(int framebufferDevice)
return size; return size;
} }
#ifdef Q_OS_LINUX
struct fb_var_screeninfo vinfo; struct fb_var_screeninfo vinfo;
int xres = -1; int xres = -1;
int yres = -1; int yres = -1;
@ -528,6 +538,10 @@ QSize q_screenSizeFromFb(int framebufferDevice)
size.setWidth(xres <= 0 ? defaultWidth : xres); size.setWidth(xres <= 0 ? defaultWidth : xres);
size.setHeight(yres <= 0 ? defaultHeight : yres); size.setHeight(yres <= 0 ? defaultHeight : yres);
#else
size.setWidth(defaultWidth);
size.setHeight(defaultHeight);
#endif
} }
return size; return size;
@ -535,10 +549,14 @@ QSize q_screenSizeFromFb(int framebufferDevice)
int q_screenDepthFromFb(int framebufferDevice) int q_screenDepthFromFb(int framebufferDevice)
{ {
#ifndef Q_OS_LINUX
Q_UNUSED(framebufferDevice)
#endif
const int defaultDepth = 32; const int defaultDepth = 32;
static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt();
if (depth == 0) { if (depth == 0) {
#ifdef Q_OS_LINUX
struct fb_var_screeninfo vinfo; struct fb_var_screeninfo vinfo;
if (framebufferDevice != -1) { if (framebufferDevice != -1) {
@ -550,11 +568,14 @@ int q_screenDepthFromFb(int framebufferDevice)
if (depth <= 0) if (depth <= 0)
depth = defaultDepth; depth = defaultDepth;
#else
depth = defaultDepth;
#endif
} }
return depth; return depth;
} }
#endif // Q_OS_LINUX #endif // Q_OS_UNIX
QT_END_NAMESPACE QT_END_NAMESPACE