diff options
author | Alexander Irhin <alexander.irhin@lge.com> | 2013-05-24 11:37:02 -0700 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2013-06-07 11:43:33 +0200 |
commit | ac8a20d754f122b8238c145ccc346cdbae1158d0 (patch) | |
tree | b2e93d85efad6aa6d7d630ca8bf8632514490d4d | |
parent | 6f4e86b62121c94b36e89b8bd7de50099733547f (diff) | |
download | meta-qt5-ac8a20d754f122b8238c145ccc346cdbae1158d0.tar.gz |
qtbase: patches for WebKit hardware accelerated rendering support
0018 - Offset support for QOpenGLPaintDevice is required for
speedup WebKit hardware rendering.
0019 - Fix FBO restoring in QOpenGLTextureGlyphCache
Jira task
0020 - Uses right texture format to exclude extra convertion.
Signed-off-by: Alexander Irhin <alexander.irhin@lge.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
7 files changed, 474 insertions, 1 deletions
diff --git a/recipes-qt/qt5/qtbase-5.0.2/0018-QOpenGLPaintDevice-sub-area-support.patch b/recipes-qt/qt5/qtbase-5.0.2/0018-QOpenGLPaintDevice-sub-area-support.patch new file mode 100644 index 00000000..9d581f82 --- /dev/null +++ b/recipes-qt/qt5/qtbase-5.0.2/0018-QOpenGLPaintDevice-sub-area-support.patch | |||
@@ -0,0 +1,152 @@ | |||
1 | From 2efd051d3093ee4e4091a8947f28d9bd528f2e9e Mon Sep 17 00:00:00 2001 | ||
2 | From: Jani Hautakangas <jani.hautakangas@ixonos.com> | ||
3 | Date: Thu, 16 May 2013 09:52:07 +0300 | ||
4 | Subject: [PATCH] QOpenGLPaintDevice sub-area support | ||
5 | |||
6 | Allows creating QOpenGLPaintDevice targetting sub-area | ||
7 | of binded framebuffer. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Change-Id: Ida2f079aa1ac0b87d36b54129e226399dbcdda80 | ||
12 | --- | ||
13 | src/gui/opengl/qopenglpaintdevice.cpp | 12 ++++++++++++ | ||
14 | src/gui/opengl/qopenglpaintdevice.h | 2 ++ | ||
15 | src/gui/opengl/qopenglpaintengine.cpp | 10 +++++++--- | ||
16 | src/gui/opengl/qopenglpaintengine_p.h | 1 + | ||
17 | src/gui/opengl/qopengltextureglyphcache.cpp | 2 +- | ||
18 | 5 files changed, 23 insertions(+), 4 deletions(-) | ||
19 | |||
20 | diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp | ||
21 | index f0e7e49..fe9a30c 100644 | ||
22 | --- a/src/gui/opengl/qopenglpaintdevice.cpp | ||
23 | +++ b/src/gui/opengl/qopenglpaintdevice.cpp | ||
24 | @@ -111,6 +111,7 @@ class QOpenGLPaintDevicePrivate | ||
25 | public: | ||
26 | QOpenGLPaintDevicePrivate(const QSize &size); | ||
27 | |||
28 | + QPoint offset; | ||
29 | QSize size; | ||
30 | QOpenGLContext *ctx; | ||
31 | |||
32 | @@ -159,6 +160,12 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height) | ||
33 | { | ||
34 | } | ||
35 | |||
36 | +QOpenGLPaintDevice::QOpenGLPaintDevice(int x, int y, int width, int height) | ||
37 | + : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height))) | ||
38 | +{ | ||
39 | + d_ptr->offset = QPoint(x,y); | ||
40 | +} | ||
41 | + | ||
42 | /*! | ||
43 | Destroys the QOpenGLPaintDevice. | ||
44 | */ | ||
45 | @@ -228,6 +235,11 @@ QOpenGLContext *QOpenGLPaintDevice::context() const | ||
46 | return d_ptr->ctx; | ||
47 | } | ||
48 | |||
49 | +QPoint QOpenGLPaintDevice::offset() const | ||
50 | +{ | ||
51 | + return d_ptr->offset; | ||
52 | +} | ||
53 | + | ||
54 | /*! | ||
55 | Returns the pixel size of the paint device. | ||
56 | |||
57 | diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h | ||
58 | index c05571c..01eb1bc 100644 | ||
59 | --- a/src/gui/opengl/qopenglpaintdevice.h | ||
60 | +++ b/src/gui/opengl/qopenglpaintdevice.h | ||
61 | @@ -62,12 +62,14 @@ public: | ||
62 | QOpenGLPaintDevice(); | ||
63 | explicit QOpenGLPaintDevice(const QSize &size); | ||
64 | QOpenGLPaintDevice(int width, int height); | ||
65 | + QOpenGLPaintDevice(int x, int y, int width, int height); | ||
66 | virtual ~QOpenGLPaintDevice(); | ||
67 | |||
68 | int devType() const { return QInternal::OpenGL; } | ||
69 | QPaintEngine *paintEngine() const; | ||
70 | |||
71 | QOpenGLContext *context() const; | ||
72 | + QPoint offset() const; | ||
73 | QSize size() const; | ||
74 | void setSize(const QSize &size); | ||
75 | void setDevicePixelRatio(qreal devicePixelRatio); | ||
76 | diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp | ||
77 | index 0782e42..52afc60 100644 | ||
78 | --- a/src/gui/opengl/qopenglpaintengine.cpp | ||
79 | +++ b/src/gui/opengl/qopenglpaintengine.cpp | ||
80 | @@ -1978,7 +1978,10 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) | ||
81 | for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) | ||
82 | d->vertexAttributeArraysEnabledState[i] = false; | ||
83 | |||
84 | + const QPoint offset = d->device->offset(); | ||
85 | const QSize sz = d->device->size(); | ||
86 | + d->x = offset.x(); | ||
87 | + d->y = offset.y(); | ||
88 | d->width = sz.width(); | ||
89 | d->height = sz.height(); | ||
90 | d->mode = BrushDrawingMode; | ||
91 | @@ -2066,7 +2069,7 @@ void QOpenGL2PaintEngineEx::ensureActive() | ||
92 | d->device->ensureActiveTarget(); | ||
93 | |||
94 | d->transferMode(BrushDrawingMode); | ||
95 | - glViewport(0, 0, d->width, d->height); | ||
96 | + glViewport(d->x, d->y, d->width, d->height); | ||
97 | d->needsSync = false; | ||
98 | d->lastMaskTextureUsed = 0; | ||
99 | d->shaderManager->setDirty(); | ||
100 | @@ -2109,6 +2112,7 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() | ||
101 | if (bounds == QRect(0, 0, width, height)) { | ||
102 | glDisable(GL_SCISSOR_TEST); | ||
103 | } else { | ||
104 | + bounds = QRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()); | ||
105 | glEnable(GL_SCISSOR_TEST); | ||
106 | setScissor(bounds); | ||
107 | } | ||
108 | @@ -2117,14 +2121,14 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() | ||
109 | |||
110 | void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect) | ||
111 | { | ||
112 | - const int left = rect.left(); | ||
113 | + const int left = rect.left() + x; | ||
114 | const int width = rect.width(); | ||
115 | int bottom = height - (rect.top() + rect.height()); | ||
116 | if (device->paintFlipped()) { | ||
117 | bottom = rect.top(); | ||
118 | } | ||
119 | + bottom += y; | ||
120 | const int height = rect.height(); | ||
121 | - | ||
122 | glScissor(left, bottom, width, height); | ||
123 | } | ||
124 | |||
125 | diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h | ||
126 | index d51f0e5..0d4b38d 100644 | ||
127 | --- a/src/gui/opengl/qopenglpaintengine_p.h | ||
128 | +++ b/src/gui/opengl/qopenglpaintengine_p.h | ||
129 | @@ -264,6 +264,7 @@ public: | ||
130 | QOpenGL2PaintEngineEx* q; | ||
131 | QOpenGLEngineShaderManager* shaderManager; | ||
132 | QOpenGLPaintDevice* device; | ||
133 | + int x, y; | ||
134 | int width, height; | ||
135 | QOpenGLContext *ctx; | ||
136 | EngineMode mode; | ||
137 | diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
138 | index 83f4075..ec29900 100644 | ||
139 | --- a/src/gui/opengl/qopengltextureglyphcache.cpp | ||
140 | +++ b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
141 | @@ -268,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
142 | funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); | ||
143 | |||
144 | if (pex != 0) { | ||
145 | - glViewport(0, 0, pex->width, pex->height); | ||
146 | + glViewport(pex->x, pex->y, pex->width, pex->height); | ||
147 | pex->updateClipScissorTest(); | ||
148 | } else { | ||
149 | m_blitProgram->disableAttributeArray(int(QT_VERTEX_COORDS_ATTR)); | ||
150 | -- | ||
151 | 1.7.9.5 | ||
152 | |||
diff --git a/recipes-qt/qt5/qtbase-5.0.2/0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch b/recipes-qt/qt5/qtbase-5.0.2/0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch new file mode 100644 index 00000000..96b0a71a --- /dev/null +++ b/recipes-qt/qt5/qtbase-5.0.2/0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From dd2a427857612798071d3f8c23286322654669d6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Valery Volgutov <valery.volgutov@lge.com> | ||
3 | Date: Tue, 21 May 2013 12:02:19 -0700 | ||
4 | Subject: [PATCH] Fix FBO restoring in QOpenGLTextureGlyphCache | ||
5 | |||
6 | QOpenGLTextureGlyphCache::restoreTextureData restores FBO which | ||
7 | was binded before restoreTextureData call. More specifically, | ||
8 | it restores QOpenGLContextPrivate's current_fbo member. This works | ||
9 | if FBO was binded by QOpenGLFramebufferObject but not if FBO was | ||
10 | binded using glBindFramebufferObject and rendering done via | ||
11 | QOpenGLPaintDevice. | ||
12 | |||
13 | This patch fixes it by querying current FBO using | ||
14 | GL_FRAMEBUFFER_BINDING query and restoring it. | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | https://codereview.qt-project.org/#change,56608 | ||
18 | |||
19 | --- | ||
20 | src/gui/opengl/qopengltextureglyphcache.cpp | 5 ++++- | ||
21 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
24 | index 4e20f6a..3e66bad 100644 | ||
25 | --- a/src/gui/opengl/qopengltextureglyphcache.cpp | ||
26 | +++ b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
27 | @@ -147,6 +147,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
28 | return; | ||
29 | } | ||
30 | |||
31 | + GLuint saveFbo; | ||
32 | + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &saveFbo); | ||
33 | + | ||
34 | int oldWidth = m_textureResource->m_width; | ||
35 | int oldHeight = m_textureResource->m_height; | ||
36 | |||
37 | @@ -265,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
38 | glDeleteTextures(1, &tmp_texture); | ||
39 | glDeleteTextures(1, &oldTexture); | ||
40 | |||
41 | - funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); | ||
42 | + funcs.glBindFramebuffer(GL_FRAMEBUFFER, saveFbo); | ||
43 | |||
44 | if (pex != 0) { | ||
45 | glViewport(0, 0, pex->width, pex->height); | ||
46 | -- | ||
47 | 1.7.9.5 | ||
48 | |||
diff --git a/recipes-qt/qt5/qtbase-5.0.2/0020-Use-BGRA-extension-in-bindTexture.patch b/recipes-qt/qt5/qtbase-5.0.2/0020-Use-BGRA-extension-in-bindTexture.patch new file mode 100644 index 00000000..6e881837 --- /dev/null +++ b/recipes-qt/qt5/qtbase-5.0.2/0020-Use-BGRA-extension-in-bindTexture.patch | |||
@@ -0,0 +1,39 @@ | |||
1 | From 9108a53309ae584d6622881b418742a9213cb9f1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jani Hautakangas <jani.hautakangas@ixonos.com> | ||
3 | Date: Mon, 27 May 2013 15:25:25 -0700 | ||
4 | Subject: [PATCH] Use BGRA extension in bindTexture | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Change-Id: I18aecc87c5c7d4483cabe5555da33ca6bb8580f1 | ||
9 | --- | ||
10 | src/gui/opengl/qopengltexturecache.cpp | 6 ++---- | ||
11 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
12 | |||
13 | diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp | ||
14 | index 05e9bd4..a268f23 100644 | ||
15 | --- a/src/gui/opengl/qopengltexturecache.cpp | ||
16 | +++ b/src/gui/opengl/qopengltexturecache.cpp | ||
17 | @@ -171,7 +171,7 @@ static inline void qgl_byteSwapImage(QImage &img) | ||
18 | } | ||
19 | } | ||
20 | } | ||
21 | - | ||
22 | +#include <QDebug> | ||
23 | GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, const QImage &image) | ||
24 | { | ||
25 | GLuint id; | ||
26 | @@ -180,9 +180,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, con | ||
27 | |||
28 | QImage tx = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); | ||
29 | |||
30 | - qgl_byteSwapImage(tx); | ||
31 | - | ||
32 | - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits()); | ||
33 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, tx.width(), tx.height(), 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits()); | ||
34 | |||
35 | int cost = tx.width() * tx.height() * 4 / 1024; | ||
36 | m_cache.insert(key, new QOpenGLCachedTexture(id, context), cost); | ||
37 | -- | ||
38 | 1.7.9.5 | ||
39 | |||
diff --git a/recipes-qt/qt5/qtbase-git/0018-QOpenGLPaintDevice-sub-area-support.patch b/recipes-qt/qt5/qtbase-git/0018-QOpenGLPaintDevice-sub-area-support.patch new file mode 100644 index 00000000..9d581f82 --- /dev/null +++ b/recipes-qt/qt5/qtbase-git/0018-QOpenGLPaintDevice-sub-area-support.patch | |||
@@ -0,0 +1,152 @@ | |||
1 | From 2efd051d3093ee4e4091a8947f28d9bd528f2e9e Mon Sep 17 00:00:00 2001 | ||
2 | From: Jani Hautakangas <jani.hautakangas@ixonos.com> | ||
3 | Date: Thu, 16 May 2013 09:52:07 +0300 | ||
4 | Subject: [PATCH] QOpenGLPaintDevice sub-area support | ||
5 | |||
6 | Allows creating QOpenGLPaintDevice targetting sub-area | ||
7 | of binded framebuffer. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Change-Id: Ida2f079aa1ac0b87d36b54129e226399dbcdda80 | ||
12 | --- | ||
13 | src/gui/opengl/qopenglpaintdevice.cpp | 12 ++++++++++++ | ||
14 | src/gui/opengl/qopenglpaintdevice.h | 2 ++ | ||
15 | src/gui/opengl/qopenglpaintengine.cpp | 10 +++++++--- | ||
16 | src/gui/opengl/qopenglpaintengine_p.h | 1 + | ||
17 | src/gui/opengl/qopengltextureglyphcache.cpp | 2 +- | ||
18 | 5 files changed, 23 insertions(+), 4 deletions(-) | ||
19 | |||
20 | diff --git a/src/gui/opengl/qopenglpaintdevice.cpp b/src/gui/opengl/qopenglpaintdevice.cpp | ||
21 | index f0e7e49..fe9a30c 100644 | ||
22 | --- a/src/gui/opengl/qopenglpaintdevice.cpp | ||
23 | +++ b/src/gui/opengl/qopenglpaintdevice.cpp | ||
24 | @@ -111,6 +111,7 @@ class QOpenGLPaintDevicePrivate | ||
25 | public: | ||
26 | QOpenGLPaintDevicePrivate(const QSize &size); | ||
27 | |||
28 | + QPoint offset; | ||
29 | QSize size; | ||
30 | QOpenGLContext *ctx; | ||
31 | |||
32 | @@ -159,6 +160,12 @@ QOpenGLPaintDevice::QOpenGLPaintDevice(int width, int height) | ||
33 | { | ||
34 | } | ||
35 | |||
36 | +QOpenGLPaintDevice::QOpenGLPaintDevice(int x, int y, int width, int height) | ||
37 | + : d_ptr(new QOpenGLPaintDevicePrivate(QSize(width, height))) | ||
38 | +{ | ||
39 | + d_ptr->offset = QPoint(x,y); | ||
40 | +} | ||
41 | + | ||
42 | /*! | ||
43 | Destroys the QOpenGLPaintDevice. | ||
44 | */ | ||
45 | @@ -228,6 +235,11 @@ QOpenGLContext *QOpenGLPaintDevice::context() const | ||
46 | return d_ptr->ctx; | ||
47 | } | ||
48 | |||
49 | +QPoint QOpenGLPaintDevice::offset() const | ||
50 | +{ | ||
51 | + return d_ptr->offset; | ||
52 | +} | ||
53 | + | ||
54 | /*! | ||
55 | Returns the pixel size of the paint device. | ||
56 | |||
57 | diff --git a/src/gui/opengl/qopenglpaintdevice.h b/src/gui/opengl/qopenglpaintdevice.h | ||
58 | index c05571c..01eb1bc 100644 | ||
59 | --- a/src/gui/opengl/qopenglpaintdevice.h | ||
60 | +++ b/src/gui/opengl/qopenglpaintdevice.h | ||
61 | @@ -62,12 +62,14 @@ public: | ||
62 | QOpenGLPaintDevice(); | ||
63 | explicit QOpenGLPaintDevice(const QSize &size); | ||
64 | QOpenGLPaintDevice(int width, int height); | ||
65 | + QOpenGLPaintDevice(int x, int y, int width, int height); | ||
66 | virtual ~QOpenGLPaintDevice(); | ||
67 | |||
68 | int devType() const { return QInternal::OpenGL; } | ||
69 | QPaintEngine *paintEngine() const; | ||
70 | |||
71 | QOpenGLContext *context() const; | ||
72 | + QPoint offset() const; | ||
73 | QSize size() const; | ||
74 | void setSize(const QSize &size); | ||
75 | void setDevicePixelRatio(qreal devicePixelRatio); | ||
76 | diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp | ||
77 | index 0782e42..52afc60 100644 | ||
78 | --- a/src/gui/opengl/qopenglpaintengine.cpp | ||
79 | +++ b/src/gui/opengl/qopenglpaintengine.cpp | ||
80 | @@ -1978,7 +1978,10 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) | ||
81 | for (int i = 0; i < QT_GL_VERTEX_ARRAY_TRACKED_COUNT; ++i) | ||
82 | d->vertexAttributeArraysEnabledState[i] = false; | ||
83 | |||
84 | + const QPoint offset = d->device->offset(); | ||
85 | const QSize sz = d->device->size(); | ||
86 | + d->x = offset.x(); | ||
87 | + d->y = offset.y(); | ||
88 | d->width = sz.width(); | ||
89 | d->height = sz.height(); | ||
90 | d->mode = BrushDrawingMode; | ||
91 | @@ -2066,7 +2069,7 @@ void QOpenGL2PaintEngineEx::ensureActive() | ||
92 | d->device->ensureActiveTarget(); | ||
93 | |||
94 | d->transferMode(BrushDrawingMode); | ||
95 | - glViewport(0, 0, d->width, d->height); | ||
96 | + glViewport(d->x, d->y, d->width, d->height); | ||
97 | d->needsSync = false; | ||
98 | d->lastMaskTextureUsed = 0; | ||
99 | d->shaderManager->setDirty(); | ||
100 | @@ -2109,6 +2112,7 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() | ||
101 | if (bounds == QRect(0, 0, width, height)) { | ||
102 | glDisable(GL_SCISSOR_TEST); | ||
103 | } else { | ||
104 | + bounds = QRect(bounds.x(), bounds.y(), bounds.width(), bounds.height()); | ||
105 | glEnable(GL_SCISSOR_TEST); | ||
106 | setScissor(bounds); | ||
107 | } | ||
108 | @@ -2117,14 +2121,14 @@ void QOpenGL2PaintEngineExPrivate::updateClipScissorTest() | ||
109 | |||
110 | void QOpenGL2PaintEngineExPrivate::setScissor(const QRect &rect) | ||
111 | { | ||
112 | - const int left = rect.left(); | ||
113 | + const int left = rect.left() + x; | ||
114 | const int width = rect.width(); | ||
115 | int bottom = height - (rect.top() + rect.height()); | ||
116 | if (device->paintFlipped()) { | ||
117 | bottom = rect.top(); | ||
118 | } | ||
119 | + bottom += y; | ||
120 | const int height = rect.height(); | ||
121 | - | ||
122 | glScissor(left, bottom, width, height); | ||
123 | } | ||
124 | |||
125 | diff --git a/src/gui/opengl/qopenglpaintengine_p.h b/src/gui/opengl/qopenglpaintengine_p.h | ||
126 | index d51f0e5..0d4b38d 100644 | ||
127 | --- a/src/gui/opengl/qopenglpaintengine_p.h | ||
128 | +++ b/src/gui/opengl/qopenglpaintengine_p.h | ||
129 | @@ -264,6 +264,7 @@ public: | ||
130 | QOpenGL2PaintEngineEx* q; | ||
131 | QOpenGLEngineShaderManager* shaderManager; | ||
132 | QOpenGLPaintDevice* device; | ||
133 | + int x, y; | ||
134 | int width, height; | ||
135 | QOpenGLContext *ctx; | ||
136 | EngineMode mode; | ||
137 | diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
138 | index 83f4075..ec29900 100644 | ||
139 | --- a/src/gui/opengl/qopengltextureglyphcache.cpp | ||
140 | +++ b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
141 | @@ -268,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
142 | funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); | ||
143 | |||
144 | if (pex != 0) { | ||
145 | - glViewport(0, 0, pex->width, pex->height); | ||
146 | + glViewport(pex->x, pex->y, pex->width, pex->height); | ||
147 | pex->updateClipScissorTest(); | ||
148 | } else { | ||
149 | m_blitProgram->disableAttributeArray(int(QT_VERTEX_COORDS_ATTR)); | ||
150 | -- | ||
151 | 1.7.9.5 | ||
152 | |||
diff --git a/recipes-qt/qt5/qtbase-git/0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch b/recipes-qt/qt5/qtbase-git/0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch new file mode 100644 index 00000000..96b0a71a --- /dev/null +++ b/recipes-qt/qt5/qtbase-git/0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch | |||
@@ -0,0 +1,48 @@ | |||
1 | From dd2a427857612798071d3f8c23286322654669d6 Mon Sep 17 00:00:00 2001 | ||
2 | From: Valery Volgutov <valery.volgutov@lge.com> | ||
3 | Date: Tue, 21 May 2013 12:02:19 -0700 | ||
4 | Subject: [PATCH] Fix FBO restoring in QOpenGLTextureGlyphCache | ||
5 | |||
6 | QOpenGLTextureGlyphCache::restoreTextureData restores FBO which | ||
7 | was binded before restoreTextureData call. More specifically, | ||
8 | it restores QOpenGLContextPrivate's current_fbo member. This works | ||
9 | if FBO was binded by QOpenGLFramebufferObject but not if FBO was | ||
10 | binded using glBindFramebufferObject and rendering done via | ||
11 | QOpenGLPaintDevice. | ||
12 | |||
13 | This patch fixes it by querying current FBO using | ||
14 | GL_FRAMEBUFFER_BINDING query and restoring it. | ||
15 | |||
16 | Upstream-Status: Backport | ||
17 | https://codereview.qt-project.org/#change,56608 | ||
18 | |||
19 | --- | ||
20 | src/gui/opengl/qopengltextureglyphcache.cpp | 5 ++++- | ||
21 | 1 file changed, 4 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
24 | index 4e20f6a..3e66bad 100644 | ||
25 | --- a/src/gui/opengl/qopengltextureglyphcache.cpp | ||
26 | +++ b/src/gui/opengl/qopengltextureglyphcache.cpp | ||
27 | @@ -147,6 +147,9 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
28 | return; | ||
29 | } | ||
30 | |||
31 | + GLuint saveFbo; | ||
32 | + glGetIntegerv(GL_FRAMEBUFFER_BINDING, &saveFbo); | ||
33 | + | ||
34 | int oldWidth = m_textureResource->m_width; | ||
35 | int oldHeight = m_textureResource->m_height; | ||
36 | |||
37 | @@ -265,7 +268,7 @@ void QOpenGLTextureGlyphCache::resizeTextureData(int width, int height) | ||
38 | glDeleteTextures(1, &tmp_texture); | ||
39 | glDeleteTextures(1, &oldTexture); | ||
40 | |||
41 | - funcs.glBindFramebuffer(GL_FRAMEBUFFER, ctx->d_func()->current_fbo); | ||
42 | + funcs.glBindFramebuffer(GL_FRAMEBUFFER, saveFbo); | ||
43 | |||
44 | if (pex != 0) { | ||
45 | glViewport(0, 0, pex->width, pex->height); | ||
46 | -- | ||
47 | 1.7.9.5 | ||
48 | |||
diff --git a/recipes-qt/qt5/qtbase-git/0020-Use-BGRA-extension-in-bindTexture.patch b/recipes-qt/qt5/qtbase-git/0020-Use-BGRA-extension-in-bindTexture.patch new file mode 100644 index 00000000..a3543077 --- /dev/null +++ b/recipes-qt/qt5/qtbase-git/0020-Use-BGRA-extension-in-bindTexture.patch | |||
@@ -0,0 +1,31 @@ | |||
1 | From 9108a53309ae584d6622881b418742a9213cb9f1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Jani Hautakangas <jani.hautakangas@ixonos.com> | ||
3 | Date: Mon, 27 May 2013 15:25:25 -0700 | ||
4 | Subject: [PATCH] Use BGRA extension in bindTexture | ||
5 | |||
6 | Upstream-Status: Pending | ||
7 | |||
8 | Change-Id: I18aecc87c5c7d4483cabe5555da33ca6bb8580f1 | ||
9 | --- | ||
10 | src/gui/opengl/qopengltexturecache.cpp | 6 ++---- | ||
11 | 1 file changed, 2 insertions(+), 4 deletions(-) | ||
12 | |||
13 | diff --git a/src/gui/opengl/qopengltexturecache.cpp b/src/gui/opengl/qopengltexturecache.cpp | ||
14 | index 94b8288..45aad1f 100644 | ||
15 | --- a/src/gui/opengl/qopengltexturecache.cpp | ||
16 | +++ b/src/gui/opengl/qopengltexturecache.cpp | ||
17 | @@ -181,11 +181,7 @@ GLuint QOpenGLTextureCache::bindTexture(QOpenGLContext *context, qint64 key, con | ||
18 | |||
19 | QImage tx = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); | ||
20 | |||
21 | - // Performance could be improved by skipping qgl_byteSwapImage(). | ||
22 | - if (m_useByteSwapImage) | ||
23 | - qgl_byteSwapImage(tx); | ||
24 | - | ||
25 | - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tx.width(), tx.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits()); | ||
26 | + glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, tx.width(), tx.height(), 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, const_cast<const QImage &>(tx).bits()); | ||
27 | |||
28 | int cost = tx.width() * tx.height() * 4 / 1024; | ||
29 | m_cache.insert(key, new QOpenGLCachedTexture(id, context), cost); | ||
30 | -- | ||
31 | 1.7.9.5 | ||
diff --git a/recipes-qt/qt5/qtbase.inc b/recipes-qt/qt5/qtbase.inc index 2a5e3bc3..569332e9 100644 --- a/recipes-qt/qt5/qtbase.inc +++ b/recipes-qt/qt5/qtbase.inc | |||
@@ -16,6 +16,9 @@ SRC_URI += " \ | |||
16 | file://0013-Disable-mkv8snapshot.patch \ | 16 | file://0013-Disable-mkv8snapshot.patch \ |
17 | file://0014-enables-tslib-device-to-be-read-from-env-variable.patch \ | 17 | file://0014-enables-tslib-device-to-be-read-from-env-variable.patch \ |
18 | file://0015-qtbase-allow-build-of-examples.patch \ | 18 | file://0015-qtbase-allow-build-of-examples.patch \ |
19 | file://0018-QOpenGLPaintDevice-sub-area-support.patch \ | ||
20 | file://0019-Fix-FBO-restoring-in-QOpenGLTextureGlyphCache.patch \ | ||
21 | file://0020-Use-BGRA-extension-in-bindTexture.patch \ | ||
19 | " | 22 | " |
20 | 23 | ||
21 | DEPENDS += "qtbase-native freetype jpeg libpng zlib openssl glib-2.0 ${ICU} udev ${XCB_DEPENDS} ${GL_DEPENDS} ${TSLIB_DEPENDS}" | 24 | DEPENDS += "qtbase-native freetype jpeg libpng zlib openssl glib-2.0 ${ICU} udev ${XCB_DEPENDS} ${GL_DEPENDS} ${TSLIB_DEPENDS}" |
@@ -86,7 +89,7 @@ QT_CONFIG_FLAGS += " \ | |||
86 | ${QT_TSLIB} \ | 89 | ${QT_TSLIB} \ |
87 | " | 90 | " |
88 | 91 | ||
89 | INC_PR = "r1" | 92 | INC_PR = "r2" |
90 | 93 | ||
91 | # Qt uses atomic instructions not supported in thumb mode | 94 | # Qt uses atomic instructions not supported in thumb mode |
92 | ARM_INSTRUCTION_SET = "arm" | 95 | ARM_INSTRUCTION_SET = "arm" |