From 6c35eb5f0ff17d02166ca144eef8792acf2acd63 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 10 Oct 2014 14:45:42 +0200 Subject: eglconvenience/eglfs: Clean up warning messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove the last occurrence of ifdefed debug prints and replace it with categorized logging. Also clean up the warning texts for some of the serious errors, the old ones from Qt 4 times were somewhat messy. Change-Id: I2a3e48c393d56be2511d25c3003b1f2b74ac3c8c Reviewed-by: Louai Al-Khanji Reviewed-by: Jørgen Lind --- .../eglconvenience/qeglconvenience.cpp | 2 +- .../eglconvenience/qeglplatformcontext.cpp | 8 ++--- .../eglconvenience/qeglplatformwindow.cpp | 2 +- .../eglconvenience/qxlibeglintegration.cpp | 34 ++++++++++------------ src/plugins/platforms/eglfs/qeglfshooks_x11.cpp | 2 +- 5 files changed, 22 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index d7b5527a9f..b7f4c55d3d 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -303,7 +303,7 @@ EGLConfig QEglConfigChooser::chooseConfig() } while (q_reduceConfigAttributes(&configureAttributes)); if (!cfg) - qWarning("Cant find EGLConfig, returning null config"); + qWarning("Cannot find EGLConfig, returning null config"); return cfg; } diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp index 07ef202195..d7c4fd6764 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformcontext.cpp @@ -177,7 +177,7 @@ void QEGLPlatformContext::init(const QSurfaceFormat &format, QPlatformOpenGLCont } if (m_eglContext == EGL_NO_CONTEXT) { - qWarning("QEGLPlatformContext::init: eglError: %x, this: %p \n", eglGetError(), this); + qWarning("QEGLPlatformContext: Failed to create context: %x", eglGetError()); return; } @@ -357,7 +357,7 @@ bool QEGLPlatformContext::makeCurrent(QPlatformSurface *surface) eglSwapInterval(eglDisplay(), m_swapInterval); } } else { - qWarning("QEGLPlatformContext::makeCurrent: eglError: %x, this: %p \n", eglGetError(), this); + qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); } return ok; @@ -376,7 +376,7 @@ void QEGLPlatformContext::doneCurrent() eglBindAPI(m_api); bool ok = eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (!ok) - qWarning("QEGLPlatformContext::doneCurrent(): eglError: %d, this: %p \n", eglGetError(), this); + qWarning("QEGLPlatformContext: eglMakeCurrent failed: %x", eglGetError()); } void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) @@ -385,7 +385,7 @@ void QEGLPlatformContext::swapBuffers(QPlatformSurface *surface) EGLSurface eglSurface = eglSurfaceForPlatformSurface(surface); bool ok = eglSwapBuffers(m_eglDisplay, eglSurface); if (!ok) - qWarning("QEGLPlatformContext::swapBuffers(): eglError: %d, this: %p \n", eglGetError(), this); + qWarning("QEGLPlatformContext: eglSwapBuffers failed: %x", eglGetError()); } void (*QEGLPlatformContext::getProcAddress(const QByteArray &procName)) () diff --git a/src/platformsupport/eglconvenience/qeglplatformwindow.cpp b/src/platformsupport/eglconvenience/qeglplatformwindow.cpp index 39edec4811..af4c907e85 100644 --- a/src/platformsupport/eglconvenience/qeglplatformwindow.cpp +++ b/src/platformsupport/eglconvenience/qeglplatformwindow.cpp @@ -122,7 +122,7 @@ WId QEGLPlatformWindow::winId() const void QEGLPlatformWindow::setOpacity(qreal) { if (!isRaster()) - qWarning("eglfs: Cannot set opacity for non-raster windows"); + qWarning("QEGLPlatformWindow: Cannot set opacity for non-raster windows"); // Nothing to do here. The opacity is stored in the QWindow. } diff --git a/src/platformsupport/eglconvenience/qxlibeglintegration.cpp b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp index ff7e6ce271..439189d1b4 100644 --- a/src/platformsupport/eglconvenience/qxlibeglintegration.cpp +++ b/src/platformsupport/eglconvenience/qxlibeglintegration.cpp @@ -31,8 +31,11 @@ ** ****************************************************************************/ +#include #include "qxlibeglintegration_p.h" +Q_LOGGING_CATEGORY(lcXlibEglDebug, "qt.egl.xlib.debug") + VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLDisplay eglDisplay, EGLConfig config) { VisualID visualId = 0; @@ -87,31 +90,26 @@ VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLDisplay // configs. In such a case we have to fall back to XGetVisualInfo. if (!visualMatchesConfig) { visualId = 0; -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qWarning("Warning: EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d (%d %d %d %d), but this is incompatible", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, - configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize); -#endif + qCWarning(lcXlibEglDebug, + "EGL suggested using X Visual ID %d (%d %d %d depth %d) for EGL config %d" + "(%d %d %d %d), but this is incompatible", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, chosenVisualInfo->depth, + configId, configRedSize, configGreenSize, configBlueSize, configAlphaSize); } } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); + qCWarning(lcXlibEglDebug, "EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); visualId = 0; } XFree(chosenVisualInfo); } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif + qCDebug(lcXlibEglDebug, "EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif + qCDebug(lcXlibEglDebug, configAlphaSize > 0 + ? "Using ARGB Visual ID %d provided by EGL for config %d" + : "Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); return visualId; } @@ -143,9 +141,7 @@ VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLDisplay } if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif + qCDebug(lcXlibEglDebug, "Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); return visualId; } diff --git a/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp index 8880a2a8a9..c026546ced 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_x11.cpp @@ -265,7 +265,7 @@ QSize QEglFSX11Hooks::screenSize() const m_screenSize = QSize(env.at(0).toInt(), env.at(1).toInt()); } else { m_screenSize = QSize(640, 480); - qDebug("EGLFS_X11_SIZE not set, falling back to 640x480"); + qWarning("EGLFS_X11_SIZE not set, falling back to 640x480"); } } return m_screenSize; -- cgit v1.2.3