Commit 00e8c194 authored by Vikas Soni's avatar Vikas Soni Committed by Commit Bot

Create SharedImageBackingFactoryAHB only when AHB is supported.

Although the SharedImageBackingFactoryAHB do not perform any AHB
related operations in its constructor, we still want its object to be
created only when AHB is supported to make sure we are not unnecessarily
creating the object and not using it.
As an example for Android N, since AHB is not supported, this object
will never be used but we were still creating this object. This resulted
in crash on android N though actual reason of crash is still unknown.

Bug: 1128900
Change-Id: If1e9949c9d415bce0ed856f94c437802c4896ead
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459347
Commit-Queue: vikas soni <vikassoni@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814958}
parent a9fefa8d
...@@ -442,6 +442,7 @@ void SharedImageBackingAHB::EndOverlayAccess() { ...@@ -442,6 +442,7 @@ void SharedImageBackingAHB::EndOverlayAccess() {
SharedImageBackingFactoryAHB::SharedImageBackingFactoryAHB( SharedImageBackingFactoryAHB::SharedImageBackingFactoryAHB(
const GpuDriverBugWorkarounds& workarounds, const GpuDriverBugWorkarounds& workarounds,
const GpuFeatureInfo& gpu_feature_info) { const GpuFeatureInfo& gpu_feature_info) {
DCHECK(base::AndroidHardwareBufferCompat::IsSupportAvailable());
scoped_refptr<gles2::FeatureInfo> feature_info = scoped_refptr<gles2::FeatureInfo> feature_info =
new gles2::FeatureInfo(workarounds, gpu_feature_info); new gles2::FeatureInfo(workarounds, gpu_feature_info);
feature_info->Initialize(ContextType::CONTEXT_TYPE_OPENGLES2, false, feature_info->Initialize(ContextType::CONTEXT_TYPE_OPENGLES2, false,
......
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#endif // defined(OS_FUCHSIA) #endif // defined(OS_FUCHSIA)
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "base/android/android_hardware_buffer_compat.h"
#include "base/android/scoped_hardware_buffer_fence_sync.h" #include "base/android/scoped_hardware_buffer_fence_sync.h"
#include "gpu/command_buffer/service/shared_image_backing_scoped_hardware_buffer_fence_sync.h" #include "gpu/command_buffer/service/shared_image_backing_scoped_hardware_buffer_fence_sync.h"
#endif #endif
...@@ -136,7 +137,7 @@ SharedImageFactory::SharedImageFactory( ...@@ -136,7 +137,7 @@ SharedImageFactory::SharedImageFactory(
interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryAHB>( interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryAHB>(
workarounds, gpu_feature_info); workarounds, gpu_feature_info);
} }
} else { } else if (base::AndroidHardwareBufferCompat::IsSupportAvailable()) {
interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryAHB>( interop_backing_factory_ = std::make_unique<SharedImageBackingFactoryAHB>(
workarounds, gpu_feature_info); workarounds, gpu_feature_info);
} }
......
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