Commit c5b9d646 authored by Jonathan Backer's avatar Jonathan Backer Committed by Commit Bot

Don't allow WrappedSkImage for OneCopyRasterBufferProvider

OneCopyRasterBufferProvider set SHARED_IMAGE_USAGE_RASTER |
SHARED_IMAGE_USAGE_DISPLAY, which technically met the criteria as coded
but was unsupported.

Change-Id: I21ab072c75044122b2ba1dd4f625ad0cac2a3d66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1562078
Commit-Queue: Jonathan Backer <backer@chromium.org>
Auto-Submit: Jonathan Backer <backer@chromium.org>
Reviewed-by: default avatarPeng Huang <penghuang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#649671}
parent 26753d0d
...@@ -20,9 +20,10 @@ enum SharedImageUsage : uint32_t { ...@@ -20,9 +20,10 @@ enum SharedImageUsage : uint32_t {
SHARED_IMAGE_USAGE_DISPLAY = 1 << 3, SHARED_IMAGE_USAGE_DISPLAY = 1 << 3,
// Image will be used as a scanout buffer (overlay) // Image will be used as a scanout buffer (overlay)
SHARED_IMAGE_USAGE_SCANOUT = 1 << 4, SHARED_IMAGE_USAGE_SCANOUT = 1 << 4,
// Image will be used in OOP rasterization // Image will be used in OOP rasterization. This flag is used on top of
// TODO(backer): Fold back into SHARED_IMAGE_USAGE_RASTER once RasterInterface // SHARED_IMAGE_USAGE_RASTER to indicate that the client will only use
// can CPU raster (CopySubImage?) to SkImage. // RasterInterface for OOP rasterization. TODO(backer): Eliminate once we can
// CPU raster to SkImage via RasterInterface.
SHARED_IMAGE_USAGE_OOP_RASTERIZATION = 1 << 5, SHARED_IMAGE_USAGE_OOP_RASTERIZATION = 1 << 5,
// Image will be used for RGB emulation in WebGL on Mac. // Image will be used for RGB emulation in WebGL on Mac.
SHARED_IMAGE_USAGE_RGB_EMULATION = 1 << 6, SHARED_IMAGE_USAGE_RGB_EMULATION = 1 << 6,
......
...@@ -208,12 +208,13 @@ bool SharedImageFactory::IsSharedBetweenThreads(uint32_t usage) { ...@@ -208,12 +208,13 @@ bool SharedImageFactory::IsSharedBetweenThreads(uint32_t usage) {
SharedImageBackingFactory* SharedImageFactory::GetFactoryByUsage( SharedImageBackingFactory* SharedImageFactory::GetFactoryByUsage(
uint32_t usage, uint32_t usage,
bool* allow_legacy_mailbox) { bool* allow_legacy_mailbox) {
// wrapped_sk_image_factory_ is only used for OOPR. // wrapped_sk_image_factory_ is only used for OOPR and supports
constexpr auto kUsageOOPR = SHARED_IMAGE_USAGE_RASTER | // a limited number of flags (e.g. no SHARED_IMAGE_USAGE_SCANOUT).
constexpr auto kWrappedSkImageUsage = SHARED_IMAGE_USAGE_RASTER |
SHARED_IMAGE_USAGE_OOP_RASTERIZATION | SHARED_IMAGE_USAGE_OOP_RASTERIZATION |
SHARED_IMAGE_USAGE_DISPLAY; SHARED_IMAGE_USAGE_DISPLAY;
bool oopr_only_usage = !(usage & ~kUsageOOPR); bool using_wrapped_sk_image =
bool using_wrapped_sk_image = wrapped_sk_image_factory_ && oopr_only_usage; wrapped_sk_image_factory_ && (usage == kWrappedSkImageUsage);
bool vulkan_usage = using_vulkan_ && (usage & SHARED_IMAGE_USAGE_DISPLAY); bool vulkan_usage = using_vulkan_ && (usage & SHARED_IMAGE_USAGE_DISPLAY);
bool gl_usage = usage & SHARED_IMAGE_USAGE_GLES2; bool gl_usage = usage & SHARED_IMAGE_USAGE_GLES2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment