Skip to content

Commit b55358b

Browse files
authored
gh-12979: Import compositor patches from upstream (gh-13054)
1 parent dba5a04 commit b55358b

File tree

4 files changed

+98
-5
lines changed

4 files changed

+98
-5
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/gfx/webrender_bindings/DCLayerTree.cpp b/gfx/webrender_bindings/DCLayerTree.cpp
2+
--- a/gfx/webrender_bindings/DCLayerTree.cpp
3+
+++ b/gfx/webrender_bindings/DCLayerTree.cpp
4+
@@ -2097,10 +2097,14 @@
5+
hr = mCompositionSurface->BeginDraw(&updateRect, __uuidof(ID3D11Texture2D),
6+
(void**)getter_AddRefs(backBuffer),
7+
&offset);
8+
9+
if (FAILED(hr)) {
10+
+ LayoutDeviceIntRect rect = widget::WinUtils::ToIntRect(updateRect);
11+
+
12+
+ gfxCriticalNote << "DCLayerCompositionSurface::Bind failed: "
13+
+ << gfx::hexa(hr) << " " << rect;
14+
RenderThread::Get()->HandleWebRenderError(WebRenderError::BEGIN_DRAW);
15+
return;
16+
}
17+
18+
const auto gl = mDCLayerTree->GetGLContext();
19+
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
diff --git a/gfx/webrender_bindings/DCLayerTree.cpp b/gfx/webrender_bindings/DCLayerTree.cpp
2+
--- a/gfx/webrender_bindings/DCLayerTree.cpp
3+
+++ b/gfx/webrender_bindings/DCLayerTree.cpp
4+
@@ -2182,18 +2182,18 @@
5+
6+
updatePos = {0, 0};
7+
}
8+
9+
mFirstDraw = false;
10+
+ LayoutDeviceIntRect rect = widget::WinUtils::ToIntRect(updateRect);
11+
+ MOZ_ASSERT(!rect.IsEmpty());
12+
13+
hr = mCompositionSurface->BeginDraw(&updateRect, __uuidof(ID3D11Texture2D),
14+
(void**)getter_AddRefs(backBuffer),
15+
&offset);
16+
17+
if (FAILED(hr)) {
18+
- LayoutDeviceIntRect rect = widget::WinUtils::ToIntRect(updateRect);
19+
-
20+
gfxCriticalNote << "DCLayerCompositionSurface::Bind failed: "
21+
<< gfx::hexa(hr) << " " << rect;
22+
RenderThread::Get()->HandleWebRenderError(WebRenderError::BEGIN_DRAW);
23+
return;
24+
}
25+
diff --git a/gfx/wr/webrender/src/renderer/composite.rs b/gfx/wr/webrender/src/renderer/composite.rs
26+
--- a/gfx/wr/webrender/src/renderer/composite.rs
27+
+++ b/gfx/wr/webrender/src/renderer/composite.rs
28+
@@ -1120,11 +1120,13 @@
29+
// Only use supplied clear color for first content layer we encounter
30+
let clear_color = content_clear_color.take().unwrap_or(ColorF::TRANSPARENT);
31+
32+
if let Some(ref mut _compositor) = self.compositor_config.layer_compositor() {
33+
if let Some(PartialPresentMode::Single { dirty_rect }) = partial_present_mode {
34+
- if dirty_rect.is_empty() {
35+
+ let device_rect = DeviceRect::from_size(device_size.to_f32());
36+
+ let clipped_dirty_rect = dirty_rect.intersection_unchecked(&device_rect);
37+
+ if clipped_dirty_rect.is_empty() {
38+
continue;
39+
}
40+
}
41+
}
42+
43+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/gfx/wr/webrender/src/renderer/composite.rs b/gfx/wr/webrender/src/renderer/composite.rs
2+
--- a/gfx/wr/webrender/src/renderer/composite.rs
3+
+++ b/gfx/wr/webrender/src/renderer/composite.rs
4+
@@ -974,12 +974,15 @@
5+
.iter()
6+
.chain(self.layer_compositor_frame_state_in_prev_frame.as_ref().unwrap().rects_without_id.iter()) {
7+
combined_dirty_rect = combined_dirty_rect.union(&rect);
8+
}
9+
10+
+ let device_rect = DeviceRect::from_size(device_size.to_f32());
11+
+ let clipped_dirty_rect = combined_dirty_rect.intersection_unchecked(&device_rect);
12+
+
13+
partial_present_mode = Some(PartialPresentMode::Single {
14+
- dirty_rect: combined_dirty_rect,
15+
+ dirty_rect: clipped_dirty_rect,
16+
});
17+
} else {
18+
partial_present_mode = None;
19+
}
20+
21+

src/external-patches/manifest.json

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
44
[
5-
{
6-
"type": "phabricator",
7-
"id": "D279007",
8-
"name": "Fix MacOS Crash on Shutdown Firefox 149"
9-
},
105
{
116
"type": "phabricator",
127
"id": "D284084",
@@ -40,5 +35,20 @@
4035
// the parameter's help description with the correct one.
4136
"application": "Application"
4237
}
38+
},
39+
{
40+
"type": "phabricator",
41+
"id": "D291099",
42+
"name": "gh-12979 1 Add gfxCriticalNote to DCLayerCompositionSurface"
43+
},
44+
{
45+
"type": "phabricator",
46+
"id": "D291123",
47+
"name": "gh-12979 2 Compositor rendering performance fix"
48+
},
49+
{
50+
"type": "phabricator",
51+
"id": "D291714",
52+
"name": "gh-12979 3 Clip dirty_rect to device_size"
4353
}
4454
]

0 commit comments

Comments
 (0)