Bug 1709548 - Don't clear backbuffer if dirty region is empty. r=nical

On Mali-G77 devices we have seen an flickering black bars appear on
pages where we are compositing with an empty dirty region. In such
cases we end up calling eglSetDamageRegion with an empty region,
followed by glClear with an empty scissor rect. Technically calling
eglSetDamageRegion with an empty dirty region is allowed, it just
means you cannot render to the backbuffer at all that frame. The
subsequent glClear call should therefore be fine since an empty
scissor rect is set, but the Mali driver does not like it.

This patch skips calling glClear altogether if the dirty region is
empty, preventing the black bars from appearing.

Differential Revision: https://phabricator.services.mozilla.com/D114346
This commit is contained in:
Jamie Nicol 2021-05-05 14:05:40 +00:00
Родитель 37d368f0d1
Коммит d6c51544d5
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -3544,7 +3544,11 @@ impl Renderer {
match partial_present_mode {
Some(PartialPresentMode::Single { dirty_rect }) => {
if occlusion.test(&dirty_rect.to_box2d()) {
// There is no need to clear if the dirty rect is occluded. Additionally,
// on Mali-G77 we have observed artefacts when calling glClear (even with
// the empty scissor rect set) after calling eglSetDamageRegion with an
// empty damage region. So avoid clearing in that case. See bug 1709548.
if !dirty_rect.is_empty() && occlusion.test(&dirty_rect.to_box2d()) {
// We have a single dirty rect, so clear only that
self.device.clear_target(clear_color,
None,