diff --git a/android_webview/browser/gfx/BUILD.gn b/android_webview/browser/gfx/BUILD.gn index fc1fa8888b109..5b2857e7be719 100644 --- a/android_webview/browser/gfx/BUILD.gn +++ b/android_webview/browser/gfx/BUILD.gn @@ -80,7 +80,6 @@ source_set("gfx") { "//gpu/skia_bindings", "//gpu/vulkan:vulkan", "//gpu/vulkan/init", - "//gpu/vulkan/init:skia", "//services/viz/privileged/mojom", "//services/viz/public/mojom", "//skia", diff --git a/android_webview/browser/gfx/aw_vulkan_context_provider.cc b/android_webview/browser/gfx/aw_vulkan_context_provider.cc index 8a7be4ac76dae..2cc4f6ce6d9d7 100644 --- a/android_webview/browser/gfx/aw_vulkan_context_provider.cc +++ b/android_webview/browser/gfx/aw_vulkan_context_provider.cc @@ -20,8 +20,8 @@ #include "base/logging.h" #include "base/native_library.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/skia_vk_memory_allocator_impl.h" #include "gpu/vulkan/vulkan_device_queue.h" #include "gpu/vulkan/vulkan_fence_helper.h" #include "gpu/vulkan/vulkan_function_pointers.h" diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index c89e3ae81ab84..4cb3fd8d86df4 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn @@ -293,7 +293,6 @@ shared_library_with_jni("libstandalonelibwebviewchromium") { "//content/public/test/android:content_native_test_support", "//gpu/vulkan", "//gpu/vulkan/init", - "//gpu/vulkan/init:skia", "//ui/gl", ] libs = [ "android" ] diff --git a/android_webview/test/shell/src/draw_fn/context_manager.cc b/android_webview/test/shell/src/draw_fn/context_manager.cc index 54d4aacd4b910..4f00eae345120 100644 --- a/android_webview/test/shell/src/draw_fn/context_manager.cc +++ b/android_webview/test/shell/src/draw_fn/context_manager.cc @@ -19,8 +19,8 @@ #include "base/memory/raw_ptr.h" #include "base/native_library.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/skia_vk_memory_allocator_impl.h" #include "gpu/vulkan/vulkan_device_queue.h" #include "gpu/vulkan/vulkan_function_pointers.h" #include "gpu/vulkan/vulkan_implementation.h" diff --git a/components/viz/common/BUILD.gn b/components/viz/common/BUILD.gn index 690d2c0315e3c..466e2f63c190b 100644 --- a/components/viz/common/BUILD.gn +++ b/components/viz/common/BUILD.gn @@ -109,7 +109,6 @@ if (enable_vulkan) { "//base", "//gpu/vulkan", "//gpu/vulkan:buildflags", - "//gpu/vulkan/init:skia", "//ui/gfx", ] } diff --git a/components/viz/common/gpu/vulkan_in_process_context_provider.cc b/components/viz/common/gpu/vulkan_in_process_context_provider.cc index c042ab5527368..2f6c49d037a3c 100644 --- a/components/viz/common/gpu/vulkan_in_process_context_provider.cc +++ b/components/viz/common/gpu/vulkan_in_process_context_provider.cc @@ -13,7 +13,7 @@ #include <utility> #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_fence_helper.h" #include "gpu/vulkan/vulkan_function_pointers.h" diff --git a/gpu/vulkan/BUILD.gn b/gpu/vulkan/BUILD.gn index 444813c46d77f..e8bf66b6db8f8 100644 --- a/gpu/vulkan/BUILD.gn +++ b/gpu/vulkan/BUILD.gn @@ -86,6 +86,8 @@ if (enable_vulkan) { sources = [ "semaphore_handle.cc", "semaphore_handle.h", + "skia_vk_memory_allocator_impl.cc", + "skia_vk_memory_allocator_impl.h", "vulkan_command_buffer.cc", "vulkan_command_buffer.h", "vulkan_command_pool.cc", @@ -127,6 +129,7 @@ if (enable_vulkan) { "//build:android_buildflags", "//components/crash/core/common:crash_key", "//gpu/ipc/common:vulkan_ycbcr_info", + "//third_party/vulkan_memory_allocator", "//ui/base:ozone_buildflags", "//ui/gfx", "//ui/gl", diff --git a/gpu/vulkan/DEPS b/gpu/vulkan/DEPS index 90e574cf75585..a6f2779b29557 100644 --- a/gpu/vulkan/DEPS +++ b/gpu/vulkan/DEPS @@ -1,3 +1,10 @@ include_rules = [ "+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", + ], +} diff --git a/gpu/vulkan/init/BUILD.gn b/gpu/vulkan/init/BUILD.gn index f1fc57100ad93..d93d8e155739f 100644 --- a/gpu/vulkan/init/BUILD.gn +++ b/gpu/vulkan/init/BUILD.gn @@ -41,24 +41,3 @@ component("init") { 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" ] -} diff --git a/gpu/vulkan/init/DEPS b/gpu/vulkan/init/DEPS deleted file mode 100644 index a4a291f280a31..0000000000000 --- a/gpu/vulkan/init/DEPS +++ /dev/null @@ -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", - ], -} diff --git a/gpu/vulkan/init/skia_vk_memory_allocator_impl.cc b/gpu/vulkan/skia_vk_memory_allocator_impl.cc similarity index 90% rename from gpu/vulkan/init/skia_vk_memory_allocator_impl.cc rename to gpu/vulkan/skia_vk_memory_allocator_impl.cc index cdfc7d6d73aec..3573ad6c001b3 100644 --- a/gpu/vulkan/init/skia_vk_memory_allocator_impl.cc +++ b/gpu/vulkan/skia_vk_memory_allocator_impl.cc @@ -2,8 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. - -#include "gpu/vulkan/init/skia_vk_memory_allocator_impl.h" +#include "gpu/vulkan/skia_vk_memory_allocator_impl.h" #include <vk_mem_alloc.h> #include <vulkan/vulkan_core.h> @@ -15,7 +14,6 @@ #include "gpu/vulkan/vma_wrapper.h" #include "gpu/vulkan/vulkan_device_queue.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/VulkanTypes.h" @@ -30,12 +28,14 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator { ~SkiaVulkanMemoryAllocator() override = default; SkiaVulkanMemoryAllocator(const SkiaVulkanMemoryAllocator&) = delete; - SkiaVulkanMemoryAllocator& operator=(const SkiaVulkanMemoryAllocator&) = delete; + SkiaVulkanMemoryAllocator& operator=(const SkiaVulkanMemoryAllocator&) = + delete; private: - VkResult allocateImageMemory(VkImage image, - uint32_t flags, - skgpu::VulkanBackendMemory* backend_memory) override { + VkResult allocateImageMemory( + VkImage image, + uint32_t flags, + skgpu::VulkanBackendMemory* backend_memory) override { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"), "SkiaVulkanMemoryAllocator::allocateMemoryForImage"); VmaAllocationCreateInfo info = { @@ -68,15 +68,19 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator { VmaAllocation allocation; VkResult result = vma::AllocateMemoryForImage(allocator_, image, &info, &allocation, nullptr); - if (VK_SUCCESS == result) - *backend_memory = reinterpret_cast<skgpu::VulkanBackendMemory>(allocation); + if (VK_SUCCESS == result) { + *backend_memory = + reinterpret_cast<skgpu::VulkanBackendMemory>(allocation); + } + return result; } - VkResult allocateBufferMemory(VkBuffer buffer, - BufferUsage usage, - uint32_t flags, - skgpu::VulkanBackendMemory* backend_memory) override { + VkResult allocateBufferMemory( + VkBuffer buffer, + BufferUsage usage, + uint32_t flags, + skgpu::VulkanBackendMemory* backend_memory) override { TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("gpu.vulkan.vma"), "SkiaVulkanMemoryAllocator::allocateMemoryForBuffer"); VmaAllocationCreateInfo info = { @@ -128,8 +132,10 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator { VmaAllocation allocation; VkResult result = vma::AllocateMemoryForBuffer(allocator_, buffer, &info, &allocation, nullptr); - if (VK_SUCCESS == result) - *backend_memory = reinterpret_cast<skgpu::VulkanBackendMemory>(allocation); + if (VK_SUCCESS == result) { + *backend_memory = + reinterpret_cast<skgpu::VulkanBackendMemory>(allocation); + } return result; } @@ -170,7 +176,8 @@ class SkiaVulkanMemoryAllocator : public skgpu::VulkanMemoryAllocator { 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"), "SkiaVulkanMemoryAllocator::mapMemory"); const VmaAllocation allocation = diff --git a/gpu/vulkan/init/skia_vk_memory_allocator_impl.h b/gpu/vulkan/skia_vk_memory_allocator_impl.h similarity index 67% rename from gpu/vulkan/init/skia_vk_memory_allocator_impl.h rename to gpu/vulkan/skia_vk_memory_allocator_impl.h index 4b0f951ce4d3c..fb879597bcb89 100644 --- a/gpu/vulkan/init/skia_vk_memory_allocator_impl.h +++ b/gpu/vulkan/skia_vk_memory_allocator_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef GPU_VULKAN_INIT_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_ -#define GPU_VULKAN_INIT_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_ +#ifndef GPU_VULKAN_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_ +#define GPU_VULKAN_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_ #include "base/component_export.h" #include "third_party/skia/include/gpu/vk/VulkanMemoryAllocator.h" @@ -12,10 +12,10 @@ namespace gpu { class VulkanDeviceQueue; -COMPONENT_EXPORT(VULKAN_INIT) +COMPONENT_EXPORT(VULKAN) sk_sp<skgpu::VulkanMemoryAllocator> CreateSkiaVulkanMemoryAllocator( VulkanDeviceQueue* device_queue); } // namespace gpu -#endif // GPU_VULKAN_INIT_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_ +#endif // GPU_VULKAN_SKIA_VK_MEMORY_ALLOCATOR_IMPL_H_