Bug 1868026 - Fix compositor surface promotion with underlay + masks on translucent slices r=gfx-reviewers,lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D195384
This commit is contained in:
Glenn Watson 2023-12-04 19:09:41 +00:00
Родитель cd132f9486
Коммит 6e436ebb49
4 изменённых файлов: 47 добавлений и 12 удалений

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

@ -2463,20 +2463,30 @@ impl TileCacheInstance {
return SurfacePromotionResult::Failed;
}
// For now, only support a small (arbitrary) number of compositor surfaces.
if surface_kind == CompositorSurfaceKind::Overlay {
// Non-opaque compositor surfaces require sub-slices, as they are drawn
// as overlays.
if sub_slice_index == self.sub_slices.len() - 1 {
return SurfacePromotionResult::Failed;
}
// Each strategy has different restrictions on whether we can promote
match surface_kind {
CompositorSurfaceKind::Overlay => {
// For now, only support a small (arbitrary) number of compositor surfaces.
// Non-opaque compositor surfaces require sub-slices, as they are drawn
// as overlays.
if sub_slice_index == self.sub_slices.len() - 1 {
return SurfacePromotionResult::Failed;
}
// If a complex clip is being applied to this primitive, it can't be
// promoted directly to a compositor surface unless it's opaque (in
// which case we draw as an underlay + alpha cutout)
if prim_clip_chain.needs_mask {
return SurfacePromotionResult::Failed;
// If a complex clip is being applied to this primitive, it can't be
// promoted directly to a compositor surface unless it's opaque (in
// which case we draw as an underlay + alpha cutout)
if prim_clip_chain.needs_mask {
return SurfacePromotionResult::Failed;
}
}
CompositorSurfaceKind::Underlay => {
// Underlay strategy relies on the slice being opaque if a mask is needed
if prim_clip_chain.needs_mask && self.backdrop.kind.is_none() {
return SurfacePromotionResult::Failed;
}
}
CompositorSurfaceKind::Blit => unreachable!(),
}
// If not on the root picture cache, it has some kind of

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

@ -7,3 +7,4 @@ fuzzy(2,2500) == filter-overlay.yaml filter-overlay-ref.yaml
platform(linux,mac) == mask.yaml mask.png
platform(linux) fuzzy(7,86000) == underlay.yaml underlay.png
fuzzy(2,2600) == transparent-opaque-image.yaml transparent-opaque-image-ref.yaml
platform(linux) == underlay-mask-on-translucent-slice.yaml underlay-mask-on-translucent-slice.png

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 259 KiB

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

@ -0,0 +1,24 @@
# Verify that a compositor surface with a mask, which is placed on
# a translucent picture cache slice draws correctly.
---
root:
items:
- type: rect
bounds: [50, 50, 440, 338]
color: red
- type: clip
id: 3
complex:
- rect: [70, 70, 400, 298]
radius: 32
- type: scroll-frame
bounds: [50, 50, 200, 200]
items:
- type: yuv-image
format: planar
src-y: barn-y.png
src-u: barn-u.png
src-v: barn-v.png
bounds: [70, 70, 400, 298]
prefer-compositor-surface: true
clip-chain: [3]