summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2014-01-17 20:45:57 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-28 19:32:53 +0100
commitb8103a4e8174446584caf80c0bf1a006b25d9905 (patch)
tree465a99e8d15a6037e48dccbb7a7aba5530b332ea /src/plugins/platforms/qnx/qqnxrasterwindow.cpp
parenta4ff400e25c76a32ec8252285dda043f07b19c15 (diff)
[QNX] Introduce proper screen error handling
This patch adds a new function which does the error handling for libscreen calls. The patch introduces following changes: - Libscreen errors will not crash (qFatal)the application any more but rather post a warning message. -With the "flush-screen-context" option the screen_context is always flushed when a screen function is called. This enables better correlation between the time an error happens and the time it is logged. Change-Id: Ie2456e5b746dcf917d786f3b832847d2ebbe5f1e Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Roger Maclean <rmaclean@qnx.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins/platforms/qnx/qqnxrasterwindow.cpp')
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.cpp42
1 files changed, 17 insertions, 25 deletions
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
index 1f974b268d..795b122319 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include "qqnxglobal.h"
+
#include "qqnxrasterwindow.h"
#include "qqnxscreen.h"
@@ -102,10 +104,9 @@ void QQnxRasterWindow::post(const QRegion &dirty)
int dirtyRect[4] = { rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height() };
// Update the display with contents of render buffer
- errno = 0;
- int result = screen_post_window(nativeHandle(), currentBuffer.nativeBuffer(), 1, dirtyRect, 0);
- if (result != 0)
- qFatal("QQnxWindow: failed to post window buffer, errno=%d", errno);
+ Q_SCREEN_CHECKERROR(
+ screen_post_window(nativeHandle(), currentBuffer.nativeBuffer(), 1, dirtyRect, 0),
+ "Failed to post window");
// Advance to next nender buffer
m_previousBufferIndex = m_currentBufferIndex++;
@@ -135,28 +136,23 @@ QQnxBuffer &QQnxRasterWindow::renderBuffer()
// Check if render buffer is invalid
if (m_currentBufferIndex == -1) {
// Get all buffers available for rendering
- errno = 0;
screen_buffer_t buffers[MAX_BUFFER_COUNT];
- int result = screen_get_window_property_pv(nativeHandle(), SCREEN_PROPERTY_RENDER_BUFFERS, (void **)buffers);
- if (result != 0)
- qFatal("QQnxRasterWindow: failed to query window buffers, errno=%d", errno);
+ const int result = screen_get_window_property_pv(nativeHandle(), SCREEN_PROPERTY_RENDER_BUFFERS,
+ (void **)buffers);
+ Q_SCREEN_CRITICALERROR(result, "Failed to query window buffers");
// Wrap each buffer and clear
for (int i = 0; i < MAX_BUFFER_COUNT; ++i) {
m_buffers[i] = QQnxBuffer(buffers[i]);
// Clear Buffer
- errno = 0;
int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, SCREEN_BLIT_END };
- result = screen_fill(screen()->nativeContext(), buffers[i], bg);
- if (result != 0)
- qFatal("QQnxWindow: failed to clear window buffer, errno=%d", errno);
+ Q_SCREEN_CHECKERROR(screen_fill(screen()->nativeContext(), buffers[i], bg),
+ "Failed to clear window buffer");
}
- errno = 0;
- result = screen_flush_blits(screen()->nativeContext(), 0);
- if (result != 0)
- qFatal("QQnxWindow: failed to flush blits, errno=%d", errno);
+ Q_SCREEN_CHECKERROR(screen_flush_blits(screen()->nativeContext(), 0),
+ "Failed to flush blits");
// Use the first available render buffer
m_currentBufferIndex = 0;
@@ -220,20 +216,16 @@ void QQnxRasterWindow::blitPreviousToCurrent(const QRegion &region, int dx, int
SCREEN_BLIT_END };
// Queue blit operation
- errno = 0;
- const int result = screen_blit(m_screenContext, currentBuffer.nativeBuffer(),
- previousBuffer.nativeBuffer(), attribs);
- if (result != 0)
- qFatal("QQnxWindow: failed to blit buffers, errno=%d", errno);
+ Q_SCREEN_CHECKERROR(screen_blit(m_screenContext, currentBuffer.nativeBuffer(),
+ previousBuffer.nativeBuffer(), attribs),
+ "Failed to blit buffers");
}
// Check if flush requested
if (flush) {
// Wait for all blits to complete
- errno = 0;
- const int result = screen_flush_blits(m_screenContext, SCREEN_WAIT_IDLE);
- if (result != 0)
- qFatal("QQnxWindow: failed to flush blits, errno=%d", errno);
+ Q_SCREEN_CHECKERROR(screen_flush_blits(m_screenContext, SCREEN_WAIT_IDLE),
+ "Failed to flush blits");
// Buffer was modified outside the CPU
currentBuffer.invalidateInCache();