Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central gfx/wr #3840

Merged
merged 6 commits into from Jan 23, 2020
Next

Bug 1610738 - Add primitive flag to specify a compositor surface is p…

…referred r=sotaro

This allows calling code to specify whether a primitive would prefer
to be promoted to a compositor surface and/or picture cache slice.

This is a performance hint that can be used for large external
primitives, such as videos and canvas elements.

Differential Revision: https://phabricator.services.mozilla.com/D60637

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/71ed65a465d2bcfcf8e02ab8779c6700754ccdb2
  • Loading branch information
gw3583 authored and moz-gfx committed Jan 23, 2020
commit da299f8789abc766f95680fc067173f05ab764d2
@@ -2985,6 +2985,10 @@ bitflags! {
const SCROLLBAR_CONTAINER = 64;
/// If set, this cluster contains clear rectangle primitives.
const IS_CLEAR_PRIMITIVE = 128;
/// This is used as a performance hint - this primitive may be promoted to a native
/// compositor surface under certain (implementation specific) conditions. This
/// is typically used for large videos, and canvas elements.
const PREFER_COMPOSITOR_SURFACE = 256;
}
}

@@ -3112,6 +3116,10 @@ impl PrimitiveList {
flags.insert(ClusterFlags::SCROLLBAR_CONTAINER);
}

if prim_flags.contains(PrimitiveFlags::PREFER_COMPOSITOR_SURFACE) {
flags.insert(ClusterFlags::PREFER_COMPOSITOR_SURFACE);
}

// Insert the primitive into the first or last cluster as required
match insert_position {
PrimitiveListPosition::Begin => {
@@ -43,6 +43,10 @@ bitflags! {
const IS_SCROLLBAR_CONTAINER = 1 << 1;
/// If set, this primitive represents a scroll bar thumb
const IS_SCROLLBAR_THUMB = 1 << 2;
/// This is used as a performance hint - this primitive may be promoted to a native
/// compositor surface under certain (implementation specific) conditions. This
/// is typically used for large videos, and canvas elements.
const PREFER_COMPOSITOR_SURFACE = 1 << 3;
}
}

@@ -251,10 +251,6 @@ bitflags! {
///
/// See https://github.com/servo/webrender/pull/2555/
const ALLOW_MIPMAPS = 2;
/// This is used as a performance hint - this image may be promoted to a native
/// compositor surface under certain (implementation specific) conditions. This
/// is typically used for large videos, and canvas elements.
const PREFER_COMPOSITOR_SURFACE = 4;
}
}

@@ -325,12 +321,6 @@ impl ImageDescriptor {
pub fn allow_mipmaps(&self) -> bool {
self.flags.contains(ImageDescriptorFlags::ALLOW_MIPMAPS)
}

/// Returns true if this descriptor wants to be drawn as a native
/// compositor surface.
pub fn prefer_compositor_surface(&self) -> bool {
self.flags.contains(ImageDescriptorFlags::PREFER_COMPOSITOR_SURFACE)
}
}

/// Represents the backing store of an arbitrary series of pixels for display by
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.