<feed xmlns='http://www.w3.org/2005/Atom'>
<title>qt/qtdeclarative.git/src/quick/scenegraph/qsgdefaultrendercontext.cpp, branch 6.5</title>
<subtitle>Qt Declarative (Quick 2)
</subtitle>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/'/>
<entry>
<title>Fix memory leak when invalidating NativeRendering fonts</title>
<updated>2023-06-27T16:09:50+00:00</updated>
<author>
<name>Eskil Abrahamsen Blomfeldt</name>
<email>eskil.abrahamsen-blomfeldt@qt.io</email>
</author>
<published>2023-06-14T10:18:18+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=1001b385f2e82a09676146370fcb61fe0e38c2b0'/>
<id>1001b385f2e82a09676146370fcb61fe0e38c2b0</id>
<content type='text'>
When NativeRendering is used, we keep a reference to all the font
engines currently in use to make sure they stay alive, and then
dereference them when the scenegraph is invalidated, typically when
the window closes.

There was always a controlled leak here: If you loaded new font assets
continuously, then we would retain the old ones in memory. Due to
the bug in QTBUG-100697, we would keep them even if they were
application fonts that were removed.

However, when QTBUG-100697 was fixed, a side effect was that the memory
leak became more visible: It no longer only happens when loading new
fonts, but just loading and unloading the same two application fonts
and setting them on a text item in a loop would cause us to
continuously create new font engines, give them a font cache and then add
them to the m_fontEnginesToClean list.

The fix is to match the registerFontEngineToClean() with an unregister
function and then clean up the font engines that no longer have any
references during the synchronization step, similar to how we clean
up distance field caches that are no longer in use.

Note that this removes a bogus qDeleteAll() from the software backend:
This was added blindly by f1b188df132c42da62197055725e5f7eebcc4249.
Since the set will be empty, it doesn't cause a crash, but is not the
correct way to delete font engines, so to avoid future confusion or
cargo-culting, we just replace it with an assert that the set is
empty.

[ChangeLog][Text] Fixed a controlled memory leak with Text.NativeRendering
where loading and unloading the same application fonts could cause memory
usage to increase indefinitely and not be regained until the window was
closed.

Fixes: QTBUG-113714
Change-Id: I34c60e647bf63a0d203f752066f1cbfaeb049bcf
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
Reviewed-by: Mårten Nordheim &lt;marten.nordheim@qt.io&gt;
Reviewed-by: Andy Nichols &lt;andy.nichols@qt.io&gt;
(cherry picked from commit eed2ee69ac291da33c48093bc2c2bc4d359f46a2)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When NativeRendering is used, we keep a reference to all the font
engines currently in use to make sure they stay alive, and then
dereference them when the scenegraph is invalidated, typically when
the window closes.

There was always a controlled leak here: If you loaded new font assets
continuously, then we would retain the old ones in memory. Due to
the bug in QTBUG-100697, we would keep them even if they were
application fonts that were removed.

However, when QTBUG-100697 was fixed, a side effect was that the memory
leak became more visible: It no longer only happens when loading new
fonts, but just loading and unloading the same two application fonts
and setting them on a text item in a loop would cause us to
continuously create new font engines, give them a font cache and then add
them to the m_fontEnginesToClean list.

The fix is to match the registerFontEngineToClean() with an unregister
function and then clean up the font engines that no longer have any
references during the synchronization step, similar to how we clean
up distance field caches that are no longer in use.

Note that this removes a bogus qDeleteAll() from the software backend:
This was added blindly by f1b188df132c42da62197055725e5f7eebcc4249.
Since the set will be empty, it doesn't cause a crash, but is not the
correct way to delete font engines, so to avoid future confusion or
cargo-culting, we just replace it with an assert that the set is
empty.

[ChangeLog][Text] Fixed a controlled memory leak with Text.NativeRendering
where loading and unloading the same application fonts could cause memory
usage to increase indefinitely and not be regained until the window was
closed.

Fixes: QTBUG-113714
Change-Id: I34c60e647bf63a0d203f752066f1cbfaeb049bcf
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
Reviewed-by: Mårten Nordheim &lt;marten.nordheim@qt.io&gt;
Reviewed-by: Andy Nichols &lt;andy.nichols@qt.io&gt;
(cherry picked from commit eed2ee69ac291da33c48093bc2c2bc4d359f46a2)
</pre>
</div>
</content>
</entry>
<entry>
<title>Match fontEngine glyph cache key to lifespan of owner</title>
<updated>2023-06-20T06:50:50+00:00</updated>
<author>
<name>David Edmundson</name>
<email>davidedmundson@kde.org</email>
</author>
<published>2023-06-07T15:59:20+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=935c60a93b3196809587d8168525f49b96ae216b'/>
<id>935c60a93b3196809587d8168525f49b96ae216b</id>
<content type='text'>
The glyph cache key is based on the RHI instance. We clean up the font
cache when the QSGRenderContext is deleted.

For a regular QQuickWindow this is effectively the same. For a
QQuickWidget the RHI instance has a lifespan of the parent widget, but
the render context changes.

Task-number: QTBUG-113426
Task-number: QTBUG-112306
Change-Id: Ifd901ace6caaff9a08352901956865f5f58e06ef
Reviewed-by: Laszlo Agocs &lt;laszlo.agocs@qt.io&gt;
(cherry picked from commit cc4fbbc5ef208ef22c94b1b034173edffacafe19)
Reviewed-by: Qt Cherry-pick Bot &lt;cherrypick_bot@qt-project.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The glyph cache key is based on the RHI instance. We clean up the font
cache when the QSGRenderContext is deleted.

For a regular QQuickWindow this is effectively the same. For a
QQuickWidget the RHI instance has a lifespan of the parent widget, but
the render context changes.

Task-number: QTBUG-113426
Task-number: QTBUG-112306
Change-Id: Ifd901ace6caaff9a08352901956865f5f58e06ef
Reviewed-by: Laszlo Agocs &lt;laszlo.agocs@qt.io&gt;
(cherry picked from commit cc4fbbc5ef208ef22c94b1b034173edffacafe19)
Reviewed-by: Qt Cherry-pick Bot &lt;cherrypick_bot@qt-project.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix destroying glyph cache textures with hidden text items</title>
<updated>2023-03-23T18:33:32+00:00</updated>
<author>
<name>Laszlo Agocs</name>
<email>laszlo.agocs@qt.io</email>
</author>
<published>2023-03-21T19:52:22+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=292ad9322149fafc945daa117087177486830734'/>
<id>292ad9322149fafc945daa117087177486830734</id>
<content type='text'>
Move the management of the to-be-released textures up to the
rendercontext, so that the glyph cache objects do not need to
care about this. Issuing a delete(Later) on the QRhiTexture in
the glyph cache is too early if there is no visible text item
in the scene that's going to commit the resource updates
collected on the rendercontext's QRhiResourceUpdateBatch.
Instead, it is logical to move also the list of pending-release
textures to the rendercontext, since it already has the update
batch object.

Fixes: QTBUG-111995
Change-Id: Ic4309166f265950a7061ae510567ce677c4943df
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
Reviewed-by: Andy Nichols &lt;andy.nichols@qt.io&gt;
(cherry picked from commit e9c0b15060e0b70f70857d02029d6ebed95c0abf)
Reviewed-by: Qt Cherry-pick Bot &lt;cherrypick_bot@qt-project.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move the management of the to-be-released textures up to the
rendercontext, so that the glyph cache objects do not need to
care about this. Issuing a delete(Later) on the QRhiTexture in
the glyph cache is too early if there is no visible text item
in the scene that's going to commit the resource updates
collected on the rendercontext's QRhiResourceUpdateBatch.
Instead, it is logical to move also the list of pending-release
textures to the rendercontext, since it already has the update
batch object.

Fixes: QTBUG-111995
Change-Id: Ic4309166f265950a7061ae510567ce677c4943df
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
Reviewed-by: Andy Nichols &lt;andy.nichols@qt.io&gt;
(cherry picked from commit e9c0b15060e0b70f70857d02029d6ebed95c0abf)
Reviewed-by: Qt Cherry-pick Bot &lt;cherrypick_bot@qt-project.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Use SPDX license identifiers</title>
<updated>2022-06-11T06:05:15+00:00</updated>
<author>
<name>Lucie Gérard</name>
<email>lucie.gerard@qt.io</email>
</author>
<published>2022-05-13T13:12:05+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=0dc4fd240a2897c5c443a0ef6d84c416843e4938'/>
<id>0dc4fd240a2897c5c443a0ef6d84c416843e4938</id>
<content type='text'>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge &lt;shawn.rutledge@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge &lt;shawn.rutledge@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unused static var in rendercontext</title>
<updated>2022-04-21T19:04:01+00:00</updated>
<author>
<name>Laszlo Agocs</name>
<email>laszlo.agocs@qt.io</email>
</author>
<published>2022-04-21T13:41:21+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=9cace9109b951b135b8b551779df041cdd9b5c45'/>
<id>9cace9109b951b135b8b551779df041cdd9b5c45</id>
<content type='text'>
Change-Id: I517d317ea9d1b01ef9366999de71e62256a6230f
Reviewed-by: Laszlo Agocs &lt;laszlo.agocs@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I517d317ea9d1b01ef9366999de71e62256a6230f
Reviewed-by: Laszlo Agocs &lt;laszlo.agocs@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unused member variable in rendercontext</title>
<updated>2022-04-21T19:04:01+00:00</updated>
<author>
<name>Laszlo Agocs</name>
<email>laszlo.agocs@qt.io</email>
</author>
<published>2022-04-20T08:16:30+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=60f99a613828017983b0408ac39ef5aa2da17b40'/>
<id>60f99a613828017983b0408ac39ef5aa2da17b40</id>
<content type='text'>
Change-Id: I1e52743937a4dd7bdebf0b03d3c0ecd1169a9558
Reviewed-by: Christian Strømme &lt;christian.stromme@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I1e52743937a4dd7bdebf0b03d3c0ecd1169a9558
Reviewed-by: Christian Strømme &lt;christian.stromme@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scenegraph: Remove beginNext[Rhi]Frame differentiation</title>
<updated>2022-04-21T19:04:01+00:00</updated>
<author>
<name>Laszlo Agocs</name>
<email>laszlo.agocs@qt.io</email>
</author>
<published>2022-04-19T11:01:42+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=b1bcd39e987e5c3290fed13ded90204ab67e82b2'/>
<id>b1bcd39e987e5c3290fed13ded90204ab67e82b2</id>
<content type='text'>
One set of functions is enough, no need for a separate set of "Rhi"
ones.

Change-Id: I58600c539734d5f8a767926eb9649d9968bab08a
Reviewed-by: Christian Strømme &lt;christian.stromme@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
One set of functions is enough, no need for a separate set of "Rhi"
ones.

Change-Id: I58600c539734d5f8a767926eb9649d9968bab08a
Reviewed-by: Christian Strømme &lt;christian.stromme@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Support to custom the render target on the software renderer</title>
<updated>2022-04-19T15:39:07+00:00</updated>
<author>
<name>JiDe Zhang</name>
<email>zhangjide@uniontech.com</email>
</author>
<published>2021-05-28T08:12:55+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=43f705c3c01a7b78b94ea1db655c715ab2a54939'/>
<id>43f705c3c01a7b78b94ea1db655c715ab2a54939</id>
<content type='text'>
Add QQuickRenderTarget::fromPaintDevice, aollow to get a
QQuickRendererTarget from the QPaintDevice object.

[ChangeLog][QtQuick] Added QQuickRenderTarget::fromPaintDevice,
Allowed to set the render target of QQuickWindow on the software
renderer.

Task-number: QTBUG-94075
Change-Id: I4946c25d2a6315cd8f9c12a7ac7ac4cf71d95361
Reviewed-by: Laszlo Agocs &lt;laszlo.agocs@qt.io&gt;
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add QQuickRenderTarget::fromPaintDevice, aollow to get a
QQuickRendererTarget from the QPaintDevice object.

[ChangeLog][QtQuick] Added QQuickRenderTarget::fromPaintDevice,
Allowed to set the render target of QQuickWindow on the software
renderer.

Task-number: QTBUG-94075
Change-Id: I4946c25d2a6315cd8f9c12a7ac7ac4cf71d95361
Reviewed-by: Laszlo Agocs &lt;laszlo.agocs@qt.io&gt;
Reviewed-by: Qt CI Bot &lt;qt_ci_bot@qt-project.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Invalidate text when application fonts are added or removed</title>
<updated>2022-04-08T05:48:57+00:00</updated>
<author>
<name>Eskil Abrahamsen Blomfeldt</name>
<email>eskil.abrahamsen-blomfeldt@qt.io</email>
</author>
<published>2022-03-18T11:57:01+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=2fb43a35dfa08bb0746913e3363f1fcf21815e72'/>
<id>2fb43a35dfa08bb0746913e3363f1fcf21815e72</id>
<content type='text'>
We had multiple related issues due to application fonts being added
or removed during the application lifetime.

1. If a text had font family "foo" set, and this font did not
exist at the time, then loading "foo" at a later stage would not
update the text to use the correct font, since the result of
the previous request had been cached.

2. A variation of #1 was if the font "foo" was loaded by a FontLoader
in the scene and referred to by name in the text component. In this
case, there was a race condition, where the font lookup would sometimes
yield different results on the main thread and on the render thread,
and text would be garbled.

3. When a font was removed from the font database, then references to
it would remain in the caches (glyph cache + font cache) in the render
thread. With certain backends (DirectWrite, CoreText) this caused errors
or even crashes, as the cached font engines would be referring to data
that had been removed.

The work-around for #1 and #2 was merely to avoid hardcoding names for
fonts, but instead getting them from the FontLoader. This way, you can
avoid requesting the font family before it is available (and thus avoid
caching the wrong result). However, for #3 there is no known work-around.

This patch fixes all three (together with a smaller patch for qtbase) by
invalidating all text and related caches in Qt Quick when fonts are
either added or removed from the font database. This does add some
overhead if font loading happens during runtime, but the alternative is
broken behavior and dangling pointers.

This is done during the synchronization step. Before synchronization,
the font cache is flushed and all text components are marked for update,
so that fonts are re-requested against the new font database.

After synchronization, we delete all distance field glyph caches which
are not currently in use, to avoid having references to stale application
font data in the list.

[ChangeLog][Text] Fix multiple issues with usage of application fonts when
they are added or removed during the lifetime of the application.

Task-number: QTBUG-100697
Task-number: QDS-1142
Change-Id: Ib309e54e0ee97b6be6d2a7211964043fd51c9ec5
Reviewed-by: Tor Arne Vestbø &lt;tor.arne.vestbo@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We had multiple related issues due to application fonts being added
or removed during the application lifetime.

1. If a text had font family "foo" set, and this font did not
exist at the time, then loading "foo" at a later stage would not
update the text to use the correct font, since the result of
the previous request had been cached.

2. A variation of #1 was if the font "foo" was loaded by a FontLoader
in the scene and referred to by name in the text component. In this
case, there was a race condition, where the font lookup would sometimes
yield different results on the main thread and on the render thread,
and text would be garbled.

3. When a font was removed from the font database, then references to
it would remain in the caches (glyph cache + font cache) in the render
thread. With certain backends (DirectWrite, CoreText) this caused errors
or even crashes, as the cached font engines would be referring to data
that had been removed.

The work-around for #1 and #2 was merely to avoid hardcoding names for
fonts, but instead getting them from the FontLoader. This way, you can
avoid requesting the font family before it is available (and thus avoid
caching the wrong result). However, for #3 there is no known work-around.

This patch fixes all three (together with a smaller patch for qtbase) by
invalidating all text and related caches in Qt Quick when fonts are
either added or removed from the font database. This does add some
overhead if font loading happens during runtime, but the alternative is
broken behavior and dangling pointers.

This is done during the synchronization step. Before synchronization,
the font cache is flushed and all text components are marked for update,
so that fonts are re-requested against the new font database.

After synchronization, we delete all distance field glyph caches which
are not currently in use, to avoid having references to stale application
font data in the list.

[ChangeLog][Text] Fix multiple issues with usage of application fonts when
they are added or removed during the lifetime of the application.

Task-number: QTBUG-100697
Task-number: QDS-1142
Change-Id: Ib309e54e0ee97b6be6d2a7211964043fd51c9ec5
Reviewed-by: Tor Arne Vestbø &lt;tor.arne.vestbo@qt.io&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>scenegraph: Remove unused separateIndexBuffer logic</title>
<updated>2022-02-11T08:37:56+00:00</updated>
<author>
<name>Laszlo Agocs</name>
<email>laszlo.agocs@qt.io</email>
</author>
<published>2022-02-07T11:52:33+00:00</published>
<link rel='alternate' type='text/html' href='https://code.qt.io/cgit/qt/qtdeclarative.git/commit/?id=790cf19efd294876c16e1db8ef5a5449beb0d041'/>
<id>790cf19efd294876c16e1db8ef5a5449beb0d041</id>
<content type='text'>
The flag has been unconditionally set to true since Qt 6.0.

Change-Id: Ie6ad91f00b5c7ac7d6a7745035175f23c9641a42
Reviewed-by: Hatem ElKharashy &lt;hatem.elkharashy@qt.io&gt;
Reviewed-by: Andy Nichols &lt;andy.nichols@qt.io&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The flag has been unconditionally set to true since Qt 6.0.

Change-Id: Ie6ad91f00b5c7ac7d6a7745035175f23c9641a42
Reviewed-by: Hatem ElKharashy &lt;hatem.elkharashy@qt.io&gt;
Reviewed-by: Andy Nichols &lt;andy.nichols@qt.io&gt;
</pre>
</div>
</content>
</entry>
</feed>
