[gpu] Move SkiaVulkanMemoryAllocator to gpu/vulkan
Move SkiaVulkanMemoryAllocator from gpu/vulkan/init:skia to gpu/vulkan in order to later use it over VulkanDeviceQueue. Bug: 407730048 Change-Id: Ibc766a84863c0b3052afa0f85e573e86c0432acd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6579803 Reviewed-by: Kyle Charbonneau <kylechar@chromium.org> Reviewed-by: Bo Liu <boliu@chromium.org> Commit-Queue: Saifuddin Hitawala <hitawala@chromium.org> Reviewed-by: Vasiliy Telezhnikov <vasilyt@chromium.org> Cr-Commit-Position: refs/heads/main@{#1464323}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
93abefec3e
commit
f6c1cdee6c
android_webview
components/viz/common
gpu/vulkan
@ -80,7 +80,6 @@ source_set("gfx") {
|
|||||||
"//gpu/skia_bindings",
|
"//gpu/skia_bindings",
|
||||||
"//gpu/vulkan:vulkan",
|
"//gpu/vulkan:vulkan",
|
||||||
"//gpu/vulkan/init",
|
"//gpu/vulkan/init",
|
||||||
"//gpu/vulkan/init:skia",
|
|
||||||
"//services/viz/privileged/mojom",
|
"//services/viz/privileged/mojom",
|
||||||
"//services/viz/public/mojom",
|
"//services/viz/public/mojom",
|
||||||
"//skia",
|
"//skia",
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
#include "base/native_library.h"
|
#include "base/native_library.h"
|
||||||
#include "gpu/config/skia_limits.h"
|
#include "gpu/config/skia_limits.h"
|
||||||
#include "gpu/vulkan/init/skia_vk_memory_allocator_impl.h"
|
|
||||||
#include "gpu/vulkan/init/vulkan_factory.h"
|
#include "gpu/vulkan/init/vulkan_factory.h"
|
||||||
|
#include "gpu/vulkan/skia_vk_memory_allocator_impl.h"
|
||||||
#include "gpu/vulkan/vulkan_device_queue.h"
|
#include "gpu/vulkan/vulkan_device_queue.h"
|
||||||
#include "gpu/vulkan/vulkan_fence_helper.h"
|
#include "gpu/vulkan/vulkan_fence_helper.h"
|
||||||
#include "gpu/vulkan/vulkan_function_pointers.h"
|
#include "gpu/vulkan/vulkan_function_pointers.h"
|
||||||
|
@ -293,7 +293,6 @@ shared_library_with_jni("libstandalonelibwebviewchromium") {
|
|||||||
"//content/public/test/android:content_native_test_support",
|
"//content/public/test/android:content_native_test_support",
|
||||||
"//gpu/vulkan",
|
"//gpu/vulkan",
|
||||||
"//gpu/vulkan/init",
|
"//gpu/vulkan/init",
|
||||||
"//gpu/vulkan/init:skia",
|
|
||||||
"//ui/gl",
|
"//ui/gl",
|
||||||
]
|
]
|
||||||
libs = [ "android" ]
|
libs = [ "android" ]
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/native_library.h"
|
#include "base/native_library.h"
|
||||||
#include "base/threading/thread_restrictions.h"
|
#include "base/threading/thread_restrictions.h"
|
||||||
#include "gpu/vulkan/init/skia_vk_memory_allocator_impl.h"
|
|
||||||
#include "gpu/vulkan/init/vulkan_factory.h"
|
#include "gpu/vulkan/init/vulkan_factory.h"
|
||||||
|
#include "gpu/vulkan/skia_vk_memory_allocator_impl.h"
|
||||||
#include "gpu/vulkan/vulkan_device_queue.h"
|
#include "gpu/vulkan/vulkan_device_queue.h"
|
||||||
#include "gpu/vulkan/vulkan_function_pointers.h"
|
#include "gpu/vulkan/vulkan_function_pointers.h"
|
||||||
#include "gpu/vulkan/vulkan_implementation.h"
|
#include "gpu/vulkan/vulkan_implementation.h"
|
||||||
|
@ -109,7 +109,6 @@ if (enable_vulkan) {
|
|||||||
"//base",
|
"//base",
|
||||||
"//gpu/vulkan",
|
"//gpu/vulkan",
|
||||||
"//gpu/vulkan:buildflags",
|
"//gpu/vulkan:buildflags",
|
||||||
"//gpu/vulkan/init:skia",
|
|
||||||
"//ui/gfx",
|
"//ui/gfx",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "gpu/vulkan/buildflags.h"
|
#include "gpu/vulkan/buildflags.h"
|
||||||
#include "gpu/vulkan/init/skia_vk_memory_allocator_impl.h"
|
#include "gpu/vulkan/skia_vk_memory_allocator_impl.h"
|
||||||
#include "gpu/vulkan/vulkan_device_queue.h"
|
#include "gpu/vulkan/vulkan_device_queue.h"
|
||||||
#include "gpu/vulkan/vulkan_fence_helper.h"
|
#include "gpu/vulkan/vulkan_fence_helper.h"
|
||||||
#include "gpu/vulkan/vulkan_function_pointers.h"
|
#include "gpu/vulkan/vulkan_function_pointers.h"
|
||||||
|
@ -86,6 +86,8 @@ if (enable_vulkan) {
|
|||||||
sources = [
|
sources = [
|
||||||
"semaphore_handle.cc",
|
"semaphore_handle.cc",
|
||||||
"semaphore_handle.h",
|
"semaphore_handle.h",
|
||||||
|
"skia_vk_memory_allocator_impl.cc",
|
||||||
|
"skia_vk_memory_allocator_impl.h",
|
||||||
"vulkan_command_buffer.cc",
|
"vulkan_command_buffer.cc",
|
||||||
"vulkan_command_buffer.h",
|
"vulkan_command_buffer.h",
|
||||||
"vulkan_command_pool.cc",
|
"vulkan_command_pool.cc",
|
||||||
@ -127,6 +129,7 @@ if (enable_vulkan) {
|
|||||||
"//build:android_buildflags",
|
"//build:android_buildflags",
|
||||||
"//components/crash/core/common:crash_key",
|
"//components/crash/core/common:crash_key",
|
||||||
"//gpu/ipc/common:vulkan_ycbcr_info",
|
"//gpu/ipc/common:vulkan_ycbcr_info",
|
||||||
|
"//third_party/vulkan_memory_allocator",
|
||||||
"//ui/base:ozone_buildflags",
|
"//ui/base:ozone_buildflags",
|
||||||
"//ui/gfx",
|
"//ui/gfx",
|
||||||
"//ui/gl",
|
"//ui/gl",
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
include_rules = [
|
include_rules = [
|
||||||
"+components/crash/core/common/crash_key.h",
|
"+components/crash/core/common/crash_key.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
specific_include_rules = {
|
||||||
|
"skia_vk_memory_allocator_impl.*": [
|
||||||
|
"+third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h",
|
||||||
|
"+third_party/skia/include/gpu/vk/VulkanTypes.h",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
@ -41,24 +41,3 @@ component("init") {
|
|||||||
deps += [ "//gpu/vulkan/mac" ]
|
deps += [ "//gpu/vulkan/mac" ]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
component("skia") {
|
|
||||||
output_name = "vulkan_init_skia"
|
|
||||||
|
|
||||||
sources = [
|
|
||||||
"skia_vk_memory_allocator_impl.cc",
|
|
||||||
"skia_vk_memory_allocator_impl.h",
|
|
||||||
]
|
|
||||||
|
|
||||||
defines = [ "IS_VULKAN_INIT_IMPL" ]
|
|
||||||
|
|
||||||
configs += [ "//build/config/compiler:wexit_time_destructors" ]
|
|
||||||
|
|
||||||
public_deps = [
|
|
||||||
"//base",
|
|
||||||
"//gpu/vulkan",
|
|
||||||
"//skia",
|
|
||||||
]
|
|
||||||
|
|
||||||
deps = [ "//third_party/vulkan_memory_allocator" ]
|
|
||||||
}
|
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
specific_include_rules = {
|
|
||||||
"skia_vk_memory_allocator_impl.*": [
|
|
||||||
"+third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h",
|
|
||||||
"+third_party/skia/include/gpu/vk/VulkanTypes.h",
|
|
||||||
],
|
|
||||||
}
|
|
@ -2,8 +2,7 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include "gpu/vulkan/skia_vk_memory_allocator_impl.h"
|
||||||
#include "gpu/vulkan/init/skia_vk_memory_allocator_impl.h"
|
|
||||||
|
|
||||||
#include <vk_mem_alloc.h>
|
#include <vk_mem_alloc.h>
|
||||||
#include <vulkan/vulkan_core.h>
|
#include <vulkan/vulkan_core.h>
|
||||||
@ -15,7 +14,6 @@
|
|||||||
#include "gpu/vulkan/vma_wrapper.h"
|
#include "gpu/vulkan/vma_wrapper.h"
|
||||||
#include "gpu/vulkan/vulkan_device_queue.h"
|
#include "gpu/vulkan/vulkan_device_queue.h"
|
||||||
#include "gpu/vulkan/vulkan_function_pointers.h"
|
#include "gpu/vulkan/vulkan_function_pointers.h"
|
||||||
#include "gpu/vulkan/vulkan_util.h"
|
|
||||||
#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h"
|
#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h"
|
||||||
#include "third_party/skia/include/gpu/vk/VulkanTypes.h"
|
#include "third_party/skia/include/gpu/vk/VulkanTypes.h"
|
||||||
|
|
||||||
@ -30,12 +28,14 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator {
|
|||||||
~SkiaVulkanMemoryAllocator() override = default;
|
~SkiaVulkanMemoryAllocator() override = default;
|
||||||
|
|
||||||
SkiaVulkanMemoryAllocator(const SkiaVulkanMemoryAllocator&) = delete;
|
SkiaVulkanMemoryAllocator(const SkiaVulkanMemoryAllocator&) = delete;
|
||||||
SkiaVulkanMemoryAllocator& operator=(const SkiaVulkanMemoryAllocator&) = delete;
|
SkiaVulkanMemoryAllocator& operator=(const SkiaVulkanMemoryAllocator&) =
|
||||||
|
delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
VkResult allocateImageMemory(VkImage image,
|
VkResult allocateImageMemory(
|
||||||
uint32_t flags,
|
VkImage image,
|
||||||
skgpu::VulkanBackendMemory* backend_memory) override {
|
uint32_t flags,
|
||||||
|
skgpu::VulkanBackendMemory* backend_memory) override {
|
||||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"),
|
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"),
|
||||||
"SkiaVulkanMemoryAllocator::allocateMemoryForImage");
|
"SkiaVulkanMemoryAllocator::allocateMemoryForImage");
|
||||||
VmaAllocationCreateInfo info = {
|
VmaAllocationCreateInfo info = {
|
||||||
@ -68,15 +68,19 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator {
|
|||||||
VmaAllocation allocation;
|
VmaAllocation allocation;
|
||||||
VkResult result = vma::AllocateMemoryForImage(allocator_, image, &info,
|
VkResult result = vma::AllocateMemoryForImage(allocator_, image, &info,
|
||||||
&allocation, nullptr);
|
&allocation, nullptr);
|
||||||
if (VK_SUCCESS == result)
|
if (VK_SUCCESS == result) {
|
||||||
*backend_memory = reinterpret_cast<skgpu::VulkanBackendMemory>(allocation);
|
*backend_memory =
|
||||||
|
reinterpret_cast<skgpu::VulkanBackendMemory>(allocation);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult allocateBufferMemory(VkBuffer buffer,
|
VkResult allocateBufferMemory(
|
||||||
BufferUsage usage,
|
VkBuffer buffer,
|
||||||
uint32_t flags,
|
BufferUsage usage,
|
||||||
skgpu::VulkanBackendMemory* backend_memory) override {
|
uint32_t flags,
|
||||||
|
skgpu::VulkanBackendMemory* backend_memory) override {
|
||||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"),
|
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"),
|
||||||
"SkiaVulkanMemoryAllocator::allocateMemoryForBuffer");
|
"SkiaVulkanMemoryAllocator::allocateMemoryForBuffer");
|
||||||
VmaAllocationCreateInfo info = {
|
VmaAllocationCreateInfo info = {
|
||||||
@ -128,8 +132,10 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator {
|
|||||||
VmaAllocation allocation;
|
VmaAllocation allocation;
|
||||||
VkResult result = vma::AllocateMemoryForBuffer(allocator_, buffer, &info,
|
VkResult result = vma::AllocateMemoryForBuffer(allocator_, buffer, &info,
|
||||||
&allocation, nullptr);
|
&allocation, nullptr);
|
||||||
if (VK_SUCCESS == result)
|
if (VK_SUCCESS == result) {
|
||||||
*backend_memory = reinterpret_cast<skgpu::VulkanBackendMemory>(allocation);
|
*backend_memory =
|
||||||
|
reinterpret_cast<skgpu::VulkanBackendMemory>(allocation);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -170,7 +176,8 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator {
|
|||||||
alloc->fBackendMemory = memory;
|
alloc->fBackendMemory = memory;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult mapMemory(const skgpu::VulkanBackendMemory& memory, void** data) override {
|
VkResult mapMemory(const skgpu::VulkanBackendMemory& memory,
|
||||||
|
void** data) override {
|
||||||
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"),
|
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"),
|
||||||
"SkiaVulkanMemoryAllocator::mapMemory");
|
"SkiaVulkanMemoryAllocator::mapMemory");
|
||||||
const VmaAllocation allocation =
|
const VmaAllocation allocation =
|
@ -2,8 +2,8 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef GPU_VULKAN_INIT_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_
|
#ifndef GPU_VULKAN_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_
|
||||||
#define GPU_VULKAN_INIT_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_
|
#define GPU_VULKAN_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_
|
||||||
|
|
||||||
#include "base/component_export.h"
|
#include "base/component_export.h"
|
||||||
#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h"
|
#include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h"
|
||||||
@ -12,10 +12,10 @@ namespace gpu {
|
|||||||
|
|
||||||
class VulkanDeviceQueue;
|
class VulkanDeviceQueue;
|
||||||
|
|
||||||
COMPONENT_EXPORT(VULKAN_INIT)
|
COMPONENT_EXPORT(VULKAN)
|
||||||
sk_sp<skgpu::VulkanMemoryAllocator> CreateSkiaVulkanMemoryAllocator(
|
sk_sp<skgpu::VulkanMemoryAllocator> CreateSkiaVulkanMemoryAllocator(
|
||||||
VulkanDeviceQueue* device_queue);
|
VulkanDeviceQueue* device_queue);
|
||||||
|
|
||||||
} // namespace gpu
|
} // namespace gpu
|
||||||
|
|
||||||
#endif // GPU_VULKAN_INIT_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_
|
#endif // GPU_VULKAN_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_
|
Reference in New Issue
Block a user