summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-17 20:53:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-17 20:53:55 (GMT)
commitd484656fcf0ba5422489628c9e2e89aade81e869 (patch)
treefd11fbc963430b7972f8b1d41070c78d4ffb821f /src
parentfd36b47e8758562fc9ff350f292fc9ae9ed91d4e (diff)
parent8ebcd4db8d57b7e90ec86c9290682ee9c2e576b7 (diff)
downloadQt-d484656fcf0ba5422489628c9e2e89aade81e869.zip
Qt-d484656fcf0ba5422489628c9e2e89aade81e869.tar.gz
Qt-d484656fcf0ba5422489628c9e2e89aade81e869.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Some QWindowSurface implementations might implement flush as a buffer Set EGL_SWAP_BEHAVIOR to EGL_BUFFER_PRESERVED for regular QWidgets Cleanup & remove unused function overloads from QEgl* APIs QScrollArea: Excessive scrolling in focusNextPrevChild()
Diffstat (limited to 'src')
-rw-r--r--src/gui/egl/qegl.cpp58
-rw-r--r--src/gui/egl/qegl_p.h5
-rw-r--r--src/gui/egl/qeglcontext_p.h6
-rw-r--r--src/gui/egl/qeglproperties.cpp17
-rw-r--r--src/gui/egl/qeglproperties_p.h2
-rw-r--r--src/gui/painting/qbackingstore.cpp70
-rw-r--r--src/gui/painting/qbackingstore_p.h4
-rw-r--r--src/gui/painting/qwindowsurface.cpp28
-rw-r--r--src/gui/painting/qwindowsurface_p.h2
-rw-r--r--src/gui/widgets/qscrollarea.cpp4
-rw-r--r--src/opengl/qgl_egl.cpp2
-rw-r--r--src/opengl/qgl_x11egl.cpp4
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp4
-rw-r--r--src/openvg/qwindowsurface_vgegl.cpp21
14 files changed, 99 insertions, 128 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 0fe5cbe..bf9f530 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -484,42 +484,6 @@ bool QEglContext::swapBuffers(EGLSurface surface)
return ok;
}
-// Wait for native rendering operations to complete before starting
-// to use OpenGL/OpenVG operations.
-void QEglContext::waitNative()
-{
-#ifdef EGL_CORE_NATIVE_ENGINE
- eglWaitNative(EGL_CORE_NATIVE_ENGINE);
-#endif
-}
-
-// Wait for client OpenGL/OpenVG operations to complete before
-// using native rendering operations.
-void QEglContext::waitClient()
-{
-#ifdef EGL_OPENGL_ES_API
- if (apiType == QEgl::OpenGL) {
- eglBindAPI(EGL_OPENGL_ES_API);
- eglWaitClient();
- }
-#else
- if (apiType == QEgl::OpenGL)
- eglWaitGL();
-#endif
-#ifdef EGL_OPENVG_API
- if (apiType == QEgl::OpenVG) {
- eglBindAPI(EGL_OPENVG_API);
- eglWaitClient();
- }
-#endif
-}
-
-// Query the value of a configuration attribute.
-bool QEglContext::configAttrib(int name, EGLint *value) const
-{
- return eglGetConfigAttrib(QEgl::display(), cfg, name, value);
-}
-
int QEglContext::configAttrib(int name) const
{
EGLint value;
@@ -530,12 +494,6 @@ int QEglContext::configAttrib(int name) const
return EGL_DONT_CARE;
}
-QEglProperties QEglContext::configProperties() const
-{
- return QEglProperties(config());
-}
-
-
typedef EGLImageKHR (EGLAPIENTRY *_eglCreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint*);
typedef EGLBoolean (EGLAPIENTRY *_eglDestroyImageKHR)(EGLDisplay, EGLImageKHR);
@@ -673,22 +631,6 @@ QString QEgl::errorString(EGLint code)
}
}
-QString QEgl::errorString()
-{
- return errorString(error());
-}
-
-void QEgl::clearError()
-{
- eglGetError();
-}
-
-EGLint QEgl::error()
-{
- return eglGetError();
-}
-
-
// Dump all of the EGL configurations supported by the system.
void QEgl::dumpAllConfigs()
{
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 6345d5d..83bdb5e 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -182,10 +182,7 @@ namespace QEgl {
Q_GUI_EXPORT void dumpAllConfigs();
- Q_GUI_EXPORT void clearError();
- Q_GUI_EXPORT EGLint error();
- Q_GUI_EXPORT QString errorString(EGLint code);
- Q_GUI_EXPORT QString errorString();
+ Q_GUI_EXPORT QString errorString(EGLint code = eglGetError());
Q_GUI_EXPORT QString extensions();
Q_GUI_EXPORT bool hasExtension(const char* extensionName);
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index 7eec7eb..ccde00d 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -85,10 +85,6 @@ public:
bool lazyDoneCurrent();
bool swapBuffers(EGLSurface surface);
- void waitNative();
- void waitClient();
-
- bool configAttrib(int name, EGLint *value) const;
int configAttrib(int name) const;
EGLContext context() const { return ctx; }
@@ -99,8 +95,6 @@ public:
EGLConfig config() const { return cfg; }
void setConfig(EGLConfig config) { cfg = config; }
- QEglProperties configProperties() const;
-
private:
QEgl::API apiType;
EGLContext ctx;
diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp
index b34d2c3..3638de5 100644
--- a/src/gui/egl/qeglproperties.cpp
+++ b/src/gui/egl/qeglproperties.cpp
@@ -241,6 +241,9 @@ void QEglProperties::setRenderableType(QEgl::API api)
// reductions in complexity are possible.
bool QEglProperties::reduceConfiguration()
{
+ if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE)
+ removeValue(EGL_SWAP_BEHAVIOR);
+
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
// For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't
// find a config which supports pre-multiplied formats, remove the flag on the surface type:
@@ -292,20 +295,6 @@ static void addTag(QString& str, const QString& tag)
str += tag;
}
-void QEglProperties::dumpAllConfigs()
-{
- EGLint count = 0;
- eglGetConfigs(QEgl::display(), 0, 0, &count);
- if (count < 1)
- return;
-
- EGLConfig *configs = new EGLConfig [count];
- eglGetConfigs(QEgl::display(), configs, count, &count);
- for (EGLint index = 0; index < count; ++index)
- qWarning() << QEglProperties(configs[index]).toString();
- delete [] configs;
-}
-
// Convert a property list to a string suitable for debug output.
QString QEglProperties::toString() const
{
diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h
index eebcf72..b1f9642 100644
--- a/src/gui/egl/qeglproperties_p.h
+++ b/src/gui/egl/qeglproperties_p.h
@@ -90,8 +90,6 @@ public:
QString toString() const;
- static void dumpAllConfigs();
-
private:
QVarLengthArray<int> props;
};
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8de9eaa..f9cd59b 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -263,7 +263,7 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi
{
const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
const QRect tlwRect(QRect(pos, rect.size()));
- if (dirty.intersects(tlwRect))
+ if (fullUpdatePending || dirty.intersects(tlwRect))
return false; // We don't want to scroll junk.
return windowSurface->scroll(tlwRect, dx, dy);
}
@@ -402,7 +402,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const
const bool widgetDirty = widget && widget != tlw;
const QRect tlwRect(topLevelRect());
const QRect surfaceGeometry(windowSurface->geometry());
- if (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size()) {
+ if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) {
if (widgetDirty) {
const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size());
const QPoint offset(widget->mapTo(tlw, QPoint()));
@@ -555,6 +555,18 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up
return;
}
+ if (fullUpdatePending) {
+ if (updateImmediately)
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
+ if (!windowSurface->hasPartialUpdateSupport()) {
+ fullUpdatePending = true;
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
const QPoint offset = widget->mapTo(tlw, QPoint());
const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect());
if (qt_region_strictContains(dirty, widgetRect.translated(offset))) {
@@ -638,6 +650,18 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd
return;
}
+ if (fullUpdatePending) {
+ if (updateImmediately)
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
+ if (!windowSurface->hasPartialUpdateSupport()) {
+ fullUpdatePending = true;
+ sendUpdateRequest(tlw, updateImmediately);
+ return;
+ }
+
const QRect widgetRect = widget->d_func()->effectiveRectFor(rect);
const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint())));
if (qt_region_strictContains(dirty, translatedRect)) {
@@ -833,6 +857,7 @@ void QWidgetBackingStore::updateLists(QWidget *cur)
QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel)
: tlw(topLevel), dirtyOnScreenWidgets(0), hasDirtyFromPreviousSync(false)
+ , fullUpdatePending(0)
{
windowSurface = tlw->windowSurface();
if (!windowSurface)
@@ -1122,6 +1147,7 @@ void QWidgetBackingStore::sync()
for (int i = 0; i < dirtyWidgets.size(); ++i)
resetWidget(dirtyWidgets.at(i));
dirtyWidgets.clear();
+ fullUpdatePending = false;
}
return;
}
@@ -1132,28 +1158,28 @@ void QWidgetBackingStore::sync()
const QRect surfaceGeometry(windowSurface->geometry());
bool repaintAllWidgets = false;
- if (inTopLevelResize || surfaceGeometry != tlwRect) {
- if ((inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
- if (hasStaticContents()) {
- // Repaint existing dirty area and newly visible area.
- const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
- const QRegion staticRegion(staticContents(0, clipRect));
- QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
- newVisible -= staticRegion;
- dirty += newVisible;
- windowSurface->setStaticContents(staticRegion);
- } else {
- // Repaint everything.
- dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height());
- for (int i = 0; i < dirtyWidgets.size(); ++i)
- resetWidget(dirtyWidgets.at(i));
- dirtyWidgets.clear();
- repaintAllWidgets = true;
- }
+ if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
+ if (hasStaticContents()) {
+ // Repaint existing dirty area and newly visible area.
+ const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
+ const QRegion staticRegion(staticContents(0, clipRect));
+ QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
+ newVisible -= staticRegion;
+ dirty += newVisible;
+ windowSurface->setStaticContents(staticRegion);
+ } else {
+ // Repaint everything.
+ dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height());
+ for (int i = 0; i < dirtyWidgets.size(); ++i)
+ resetWidget(dirtyWidgets.at(i));
+ dirtyWidgets.clear();
+ repaintAllWidgets = true;
}
- windowSurface->setGeometry(tlwRect);
}
+ if (inTopLevelResize || surfaceGeometry != tlwRect)
+ windowSurface->setGeometry(tlwRect);
+
if (updatesDisabled)
return;
@@ -1212,6 +1238,8 @@ void QWidgetBackingStore::sync()
}
dirtyWidgets.clear();
+ fullUpdatePending = false;
+
if (toClean.isEmpty()) {
// Nothing to repaint. However, we might have newly exposed areas on the
// screen if this function was called from sync(QWidget *, QRegion)), so
diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h
index 02c0f7c..6510b57 100644
--- a/src/gui/painting/qbackingstore_p.h
+++ b/src/gui/painting/qbackingstore_p.h
@@ -91,6 +91,7 @@ public:
inline bool isDirty() const
{
return !(dirtyWidgets.isEmpty() && dirty.isEmpty() && !hasDirtyFromPreviousSync
+ && !fullUpdatePending
#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_MANAGER)
&& !hasDirtyWindowDecoration()
#endif
@@ -115,7 +116,8 @@ private:
#ifdef Q_BACKINGSTORE_SUBSURFACES
QList<QWindowSurface*> subSurfaces;
#endif
- bool hasDirtyFromPreviousSync;
+ uint hasDirtyFromPreviousSync : 1;
+ uint fullUpdatePending : 1;
QPoint tlwOffset;
diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp
index 8bd6344..e18ea3f 100644
--- a/src/gui/painting/qwindowsurface.cpp
+++ b/src/gui/painting/qwindowsurface.cpp
@@ -49,13 +49,19 @@ QT_BEGIN_NAMESPACE
class QWindowSurfacePrivate
{
public:
- QWindowSurfacePrivate(QWidget *w) : window(w), staticContentsSupport(false) {}
+ QWindowSurfacePrivate(QWidget *w)
+ : window(w)
+ , staticContentsSupport(0)
+ , partialUpdateSupport(1)
+ {
+ }
QWidget *window;
QRect geometry;
QRegion staticContents;
QList<QImage*> bufferImages;
- bool staticContentsSupport;
+ uint staticContentsSupport : 1;
+ uint partialUpdateSupport : 1;
};
/*!
@@ -284,6 +290,10 @@ bool QWindowSurface::hasStaticContentsSupport() const
void QWindowSurface::setStaticContentsSupport(bool enable)
{
+ if (enable && !d_ptr->partialUpdateSupport) {
+ qWarning("QWindowSurface::setStaticContentsSupport: static contents support requires partial update support");
+ return;
+ }
d_ptr->staticContentsSupport = enable;
}
@@ -302,6 +312,20 @@ bool QWindowSurface::hasStaticContents() const
return d_ptr->staticContentsSupport && !d_ptr->staticContents.isEmpty();
}
+bool QWindowSurface::hasPartialUpdateSupport() const
+{
+ return d_ptr->partialUpdateSupport;
+}
+
+void QWindowSurface::setPartialUpdateSupport(bool enable)
+{
+ if (!enable && d_ptr->staticContentsSupport) {
+ qWarning("QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support");
+ return;
+ }
+ d_ptr->partialUpdateSupport = enable;
+}
+
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
{
// make sure we don't detach
diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h
index 0a453af..e6ee5f6 100644
--- a/src/gui/painting/qwindowsurface_p.h
+++ b/src/gui/painting/qwindowsurface_p.h
@@ -90,6 +90,7 @@ public:
inline QRect rect(const QWidget *widget) const;
bool hasStaticContentsSupport() const;
+ bool hasPartialUpdateSupport() const;
void setStaticContents(const QRegion &region);
QRegion staticContents() const;
@@ -97,6 +98,7 @@ public:
protected:
bool hasStaticContents() const;
void setStaticContentsSupport(bool enable);
+ void setPartialUpdateSupport(bool enable);
private:
QWindowSurfacePrivate *d_ptr;
diff --git a/src/gui/widgets/qscrollarea.cpp b/src/gui/widgets/qscrollarea.cpp
index 6b81d9f..38e799e 100644
--- a/src/gui/widgets/qscrollarea.cpp
+++ b/src/gui/widgets/qscrollarea.cpp
@@ -482,14 +482,14 @@ void QScrollArea::ensureWidgetVisible(QWidget *childWidget, int xmargin, int yma
d->hbar->setValue(focusRect.center().x() - d->viewport->width() / 2);
else if (focusRect.right() > visibleRect.right())
d->hbar->setValue(focusRect.right() - d->viewport->width());
- else
+ else if (focusRect.left() < visibleRect.left())
d->hbar->setValue(focusRect.left());
if (focusRect.height() > visibleRect.height())
d->vbar->setValue(focusRect.center().y() - d->viewport->height() / 2);
else if (focusRect.bottom() > visibleRect.bottom())
d->vbar->setValue(focusRect.bottom() - d->viewport->height());
- else
+ else if (focusRect.top() < visibleRect.top())
d->vbar->setValue(focusRect.top());
}
diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp
index 822c9f6..0fbbbf9 100644
--- a/src/opengl/qgl_egl.cpp
+++ b/src/opengl/qgl_egl.cpp
@@ -147,7 +147,7 @@ void qt_glformat_from_eglconfig(QGLFormat& format, const EGLConfig config)
// Clear the EGL error state because some of the above may
// have errored out because the attribute is not applicable
// to the surface type. Such errors don't matter.
- QEgl::clearError();
+ eglGetError();
}
bool QGLFormat::hasOpenGL()
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 6f210ce..d67a3ea 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -199,6 +199,10 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
configProps.setRenderableType(QEgl::OpenGL);
qt_eglproperties_set_glformat(configProps, d->glFormat);
+ // Set buffer preserved for regular QWidgets, QGLWidgets are ok with either preserved or destroyed:
+ if ((devType == QInternal::Widget) && qobject_cast<QGLWidget*>(static_cast<QWidget*>(device())) == 0)
+ configProps.setValue(EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED);
+
if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) {
delete d->eglContext;
d->eglContext = 0;
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index db9e754..0b94f5a 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -75,9 +75,9 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
ctx->setConfig(shareContext->config());
#if QGL_RENDER_TEXTURE
EGLint value = EGL_FALSE;
- if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA, &value) && value)
+ if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA) == EGL_TRUE)
textureFormat = EGL_TEXTURE_RGBA;
- else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB, &value) && value)
+ else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB) == EGL_TRUE)
textureFormat = EGL_TEXTURE_RGB;
#endif
} else {
diff --git a/src/openvg/qwindowsurface_vgegl.cpp b/src/openvg/qwindowsurface_vgegl.cpp
index 92c4371..e3f52f4e 100644
--- a/src/openvg/qwindowsurface_vgegl.cpp
+++ b/src/openvg/qwindowsurface_vgegl.cpp
@@ -71,18 +71,13 @@ VGImageFormat qt_vg_config_to_vg_format(QEglContext *context)
QImage::Format qt_vg_config_to_image_format(QEglContext *context)
{
- EGLint red = 0;
- EGLint green = 0;
- EGLint blue = 0;
- EGLint alpha = 0;
- context->configAttrib(EGL_RED_SIZE, &red);
- context->configAttrib(EGL_GREEN_SIZE, &green);
- context->configAttrib(EGL_BLUE_SIZE, &blue);
- context->configAttrib(EGL_ALPHA_SIZE, &alpha);
+ EGLint red = context->configAttrib(EGL_RED_SIZE);
+ EGLint green = context->configAttrib(EGL_GREEN_SIZE);
+ EGLint blue = context->configAttrib(EGL_BLUE_SIZE);
+ EGLint alpha = context->configAttrib(EGL_ALPHA_SIZE);
QImage::Format argbFormat;
#ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT
- EGLint type = 0;
- context->configAttrib(EGL_SURFACE_TYPE, &type);
+ EGLint type = context->configAttrib(EGL_SURFACE_TYPE);
if ((type & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0)
argbFormat = QImage::Format_ARGB32_Premultiplied;
else
@@ -210,11 +205,7 @@ void qt_vg_unregister_pixmap(QVGPixmapData *pd)
static bool isPremultipliedContext(const QEglContext *context)
{
- EGLint value = 0;
- if (context->configAttrib(EGL_SURFACE_TYPE, &value))
- return (value & EGL_VG_ALPHA_FORMAT_PRE_BIT) != 0;
- else
- return false;
+ return context->configAttrib(EGL_SURFACE_TYPE) & EGL_VG_ALPHA_FORMAT_PRE_BIT;
}
#endif