0

Check support for GLImageBackingFactory only once

The GetFactoryByUsage makes checks support for GLImageBackingFactory
twice, once without GMB and once with GMB with interop checks in
between. This needs to be corrected in order to move all factory calls
to an array to make it more cleaner.

Bug: 1215299
Change-Id: Iec321cfcddcca5c9d3bea05fdc3c9744ccc96e9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2971973
Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org>
Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org>
Cr-Commit-Position: refs/heads/master@{#894640}
This commit is contained in:
Saifuddin Hitawala
2021-06-22 12:37:13 +00:00
committed by Chromium LUCI CQ
parent 52ad2f048f
commit 6ed262ba85
2 changed files with 11 additions and 10 deletions

@ -90,6 +90,16 @@ bool SharedImageBackingFactoryOzone::IsSupported(
return false;
}
// TODO(hitawala): Until SharedImageBackingOzone supports all use cases prefer
// using SharedImageBackingGLImage instead
bool needs_interop_factory = (gr_context_type == GrContextType::kVulkan &&
(usage & SHARED_IMAGE_USAGE_DISPLAY)) ||
(usage & SHARED_IMAGE_USAGE_WEBGPU) ||
(usage & SHARED_IMAGE_USAGE_VIDEO_DECODE);
if (!needs_interop_factory) {
return false;
}
*allow_legacy_mailbox = false;
return true;
}

@ -530,15 +530,6 @@ SharedImageBackingFactory* SharedImageFactory::GetFactoryByUsage(
return gl_texture_backing_factory_.get();
}
// check if GpuMemoryBufferType is empty. If empty prefer
// |gl_image_backing_factory_| first
if (gmb_type == gfx::EMPTY_BUFFER && gl_image_backing_factory_ &&
gl_image_backing_factory_->IsSupported(
usage, format, share_between_threads, gmb_type, gr_context_type_,
allow_legacy_mailbox)) {
return gl_image_backing_factory_.get();
}
#if defined(OS_ANDROID)
if (egl_backing_factory_ &&
egl_backing_factory_->IsSupported(usage, format, share_between_threads,
@ -565,7 +556,7 @@ SharedImageBackingFactory* SharedImageFactory::GetFactoryByUsage(
return external_vk_image_factory_.get();
#endif // !defined(OS_ANDROID)
if (gmb_type != gfx::EMPTY_BUFFER && gl_image_backing_factory_ &&
if (gl_image_backing_factory_ &&
gl_image_backing_factory_->IsSupported(
usage, format, share_between_threads, gmb_type, gr_context_type_,
allow_legacy_mailbox)) {