QNX: avoid composition when possible
Window buffers are currently always created with an alpha channel when the underlying display supports them. This is the correct thing to to in order to support translucency. However, the cost is that the composition manager unconditionally performs blending even when the use-case in the GUI doesn't make use of it. That is rather expensive, particularly on hardware which doesn't have extremely efficient dedicated 2D blitting hardware. This patch adds inspection of the user's requested window format and--if no blending is desired--sets an additional Screen window property which permits Screen to skip blending on the window surface. Change-Id: I83c100a351a00ef0e8bea1b1d1fec10b7218d1de Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Andreas Holzammer <andreas.holzammer@kdab.com> Reviewed-by: Frank Osterfeld <frank.osterfeld@kdab.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
This commit is contained in:
parent
ec07cdc91e
commit
e40cefff94
@ -323,6 +323,26 @@ void QQnxWindow::setBufferSize(const QSize &size)
|
||||
}
|
||||
}
|
||||
|
||||
// Set the transparency. According to QNX technical support, setting the window
|
||||
// transparency property should always be done *after* creating the window
|
||||
// buffers in order to guarantee the property is paid attention to.
|
||||
if (window()->requestedFormat().alphaBufferSize() == 0) {
|
||||
// To avoid overhead in the composition manager, disable blending
|
||||
// when the underlying window buffer doesn't have an alpha channel.
|
||||
val[0] = SCREEN_TRANSPARENCY_NONE;
|
||||
} else {
|
||||
// Normal alpha blending. This doesn't commit us to translucency; the
|
||||
// normal backfill during the painting will contain a fully opaque
|
||||
// alpha channel unless the user explicitly intervenes to make something
|
||||
// transparent.
|
||||
val[0] = SCREEN_TRANSPARENCY_SOURCE_OVER;
|
||||
}
|
||||
|
||||
errno = 0;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, val);
|
||||
if (result != 0)
|
||||
qFatal("QQnxWindow: failed to set window transparency, errno=%d", errno);
|
||||
|
||||
// Cache new buffer size
|
||||
m_bufferSize = nonEmptySize;
|
||||
resetBuffers();
|
||||
@ -564,17 +584,6 @@ void QQnxWindow::initWindow()
|
||||
if (result != 0)
|
||||
qFatal("QQnxWindow: failed to set window alpha mode, errno=%d", errno);
|
||||
|
||||
// Blend the window with Source Over Porter-Duff behavior onto whatever's
|
||||
// behind it.
|
||||
//
|
||||
// If the desired use-case is opaque, the Widget painting framework will
|
||||
// already fill in the alpha channel with full opacity.
|
||||
errno = 0;
|
||||
val = SCREEN_TRANSPARENCY_SOURCE_OVER;
|
||||
result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_TRANSPARENCY, &val);
|
||||
if (result != 0)
|
||||
qFatal("QQnxWindow: failed to set window transparency, errno=%d", errno);
|
||||
|
||||
// Set the window swap interval
|
||||
errno = 0;
|
||||
val = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user