Commit 883ba02c authored by Behdad Bakhshinategh's avatar Behdad Bakhshinategh Committed by Commit Bot

Revert "Utility function to create VkImage from ScopedHardwareBufferHandle."

This reverts commit d64b01c3.

Reason for revert: crbug.com/1098916
vulkan_pixel_skia_gold_test and vulkan_content_browsertests failures on on Android device Pixel 2

Original change's description:
> Utility function to create VkImage from ScopedHardwareBufferHandle.
> 
> Add a utility function to create VkImage from
> ScopedHardwareBufferHandle. This helps to unify
> common code.
> 
> Bug: 1091945
> Change-Id: I87448b6a577bba95420ed0dd4f8d6925501cdec5
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2263478
> Reviewed-by: Peng Huang <penghuang@chromium.org>
> Commit-Queue: vikas soni <vikassoni@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#781848}

TBR=penghuang@chromium.org,vikassoni@chromium.org

Change-Id: I8016e4e108e4baad6b9d1e533fe616cc0f009f45
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1091945
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2264587Reviewed-by: default avatarBehdad Bakhshinategh <behdadb@chromium.org>
Commit-Queue: Behdad Bakhshinategh <behdadb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#782041}
parent ab94cfee
......@@ -6,14 +6,9 @@
#include <android/hardware_buffer.h>
#include "base/android/scoped_hardware_buffer_handle.h"
#include "base/check.h"
#include "base/notreached.h"
#include "components/viz/common/gpu/vulkan_context_provider.h"
#include "components/viz/common/resources/resource_format_utils.h"
#include "gpu/command_buffer/service/shared_context_state.h"
#include "gpu/command_buffer/service/texture_manager.h"
#include "gpu/vulkan/vulkan_image.h"
#include "ui/gfx/color_space.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_gl_api_implementation.h"
......@@ -165,19 +160,4 @@ scoped_refptr<gles2::TexturePassthrough> GenGLTexturePassthrough(
return passthrough_texture;
}
std::unique_ptr<VulkanImage> CreateVkImageFromAhbHandle(
base::android::ScopedHardwareBufferHandle ahb_handle,
SharedContextState* context_state,
const gfx::Size& size,
const viz::ResourceFormat& format) {
DCHECK(context_state);
DCHECK(context_state->GrContextIsVulkan());
auto* device_queue = context_state->vk_context_provider()->GetDeviceQueue();
gfx::GpuMemoryBufferHandle gmb_handle(std::move(ahb_handle));
return VulkanImage::CreateFromGpuMemoryBufferHandle(
device_queue, std::move(gmb_handle), size, ToVkFormat(format),
0 /* usage */);
}
} // namespace gpu
......@@ -5,8 +5,6 @@
#ifndef GPU_COMMAND_BUFFER_SERVICE_AHARDWAREBUFFER_UTILS_H_
#define GPU_COMMAND_BUFFER_SERVICE_AHARDWAREBUFFER_UTILS_H_
#include <memory>
#include "base/memory/scoped_refptr.h"
#include "components/viz/common/resources/resource_format.h"
#include "gpu/gpu_gles2_export.h"
......@@ -15,12 +13,6 @@ extern "C" typedef struct AHardwareBuffer AHardwareBuffer;
typedef unsigned int GLenum;
namespace base {
namespace android {
class ScopedHardwareBufferHandle;
} // namespace android
} // namespace base
namespace gfx {
class ColorSpace;
class Rect;
......@@ -28,9 +20,6 @@ class Size;
} // namespace gfx
namespace gpu {
class SharedContextState;
class VulkanImage;
namespace gles2 {
class Texture;
class TexturePassthrough;
......@@ -71,13 +60,6 @@ scoped_refptr<gles2::TexturePassthrough> GenGLTexturePassthrough(
const size_t estimated_size,
const gfx::Rect& cleared_rect);
// Create a vulkan image from the AHB handle.
std::unique_ptr<VulkanImage> CreateVkImageFromAhbHandle(
base::android::ScopedHardwareBufferHandle ahb_handle,
SharedContextState* context_state,
const gfx::Size& size,
const viz::ResourceFormat& format);
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_SERVICE_AHARDWAREBUFFER_UTILS_H_
......@@ -645,9 +645,11 @@ SharedImageBackingAHB::ProduceSkia(
// Check whether we are in Vulkan mode OR GL mode and accordingly create
// Skia representation.
if (context_state->GrContextIsVulkan()) {
auto vulkan_image = CreateVkImageFromAhbHandle(
GetAhbHandle(), context_state.get(), size(), format());
auto* device_queue = context_state->vk_context_provider()->GetDeviceQueue();
gfx::GpuMemoryBufferHandle gmb_handle(GetAhbHandle());
auto vulkan_image = VulkanImage::CreateFromGpuMemoryBufferHandle(
device_queue, std::move(gmb_handle), size(), ToVkFormat(format()),
0 /* usage */);
if (!vulkan_image)
return nullptr;
......
......@@ -13,7 +13,6 @@
#include "components/viz/common/resources/resource_sizes.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "gpu/command_buffer/service/abstract_texture.h"
#include "gpu/command_buffer/service/ahardwarebuffer_utils.h"
#include "gpu/command_buffer/service/mailbox_manager.h"
#include "gpu/command_buffer/service/memory_tracking.h"
#include "gpu/command_buffer/service/shared_context_state.h"
......@@ -267,10 +266,13 @@ class SharedImageRepresentationVideoSkiaVk
if (!vulkan_image_) {
DCHECK(!promise_texture_);
auto vulkan_image =
CreateVkImageFromAhbHandle(scoped_hardware_buffer_->TakeBuffer(),
context_state_.get(), size(), format());
gfx::GpuMemoryBufferHandle gmb_handle(
scoped_hardware_buffer_->TakeBuffer());
auto* device_queue =
context_state_->vk_context_provider()->GetDeviceQueue();
vulkan_image_ = VulkanImage::CreateFromGpuMemoryBufferHandle(
device_queue, std::move(gmb_handle), size(), ToVkFormat(format()),
0 /* usage */);
if (!vulkan_image_)
return nullptr;
......
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