#include "components/viz/common/gpu/vulkan_in_process_context_provider.h"
#include <string_view>
#include <utility>
#include "gpu/vulkan/buildflags.h"
#include "gpu/vulkan/init/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"
#include "gpu/vulkan/vulkan_implementation.h"
#include "gpu/vulkan/vulkan_instance.h"
#include "gpu/vulkan/vulkan_util.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"
#include "third_party/skia/include/gpu/ganesh/vk/GrVkDirectContext.h"
#include "third_party/skia/include/gpu/vk/VulkanBackendContext.h"
#include "third_party/skia/include/gpu/vk/VulkanExtensions.h"
#include "third_party/skia/include/gpu/vk/VulkanTypes.h"
namespace {
constexpr uint32_t kSyncCpuMemoryLimitAtMemoryPressureCritical = …;
}
namespace viz {
scoped_refptr<VulkanInProcessContextProvider>
VulkanInProcessContextProvider::Create(
gpu::VulkanImplementation* vulkan_implementation,
uint32_t heap_memory_limit,
uint32_t sync_cpu_memory_limit,
const bool is_thread_safe,
const gpu::GPUInfo* gpu_info,
base::TimeDelta cooldown_duration_at_memory_pressure_critical) { … }
scoped_refptr<VulkanInProcessContextProvider>
VulkanInProcessContextProvider::CreateForCompositorGpuThread(
gpu::VulkanImplementation* vulkan_implementation,
std::unique_ptr<gpu::VulkanDeviceQueue> vulkan_device_queue,
uint32_t sync_cpu_memory_limit,
base::TimeDelta cooldown_duration_at_memory_pressure_critical) { … }
VulkanInProcessContextProvider::VulkanInProcessContextProvider(
gpu::VulkanImplementation* vulkan_implementation,
uint32_t heap_memory_limit,
uint32_t sync_cpu_memory_limit,
base::TimeDelta cooldown_duration_at_memory_pressure_critical)
: … { … }
VulkanInProcessContextProvider::~VulkanInProcessContextProvider() { … }
bool VulkanInProcessContextProvider::Initialize(const gpu::GPUInfo* gpu_info,
const bool is_thread_safe) { … }
void VulkanInProcessContextProvider::InitializeForCompositorGpuThread(
std::unique_ptr<gpu::VulkanDeviceQueue> vulkan_device_queue) { … }
bool VulkanInProcessContextProvider::InitializeGrContext(
const GrContextOptions& context_options) { … }
void VulkanInProcessContextProvider::Destroy() { … }
gpu::VulkanImplementation*
VulkanInProcessContextProvider::GetVulkanImplementation() { … }
gpu::VulkanDeviceQueue* VulkanInProcessContextProvider::GetDeviceQueue() { … }
GrDirectContext* VulkanInProcessContextProvider::GetGrContext() { … }
GrVkSecondaryCBDrawContext*
VulkanInProcessContextProvider::GetGrSecondaryCBDrawContext() { … }
void VulkanInProcessContextProvider::EnqueueSecondaryCBSemaphores(
std::vector<VkSemaphore> semaphores) { … }
void VulkanInProcessContextProvider::EnqueueSecondaryCBPostSubmitTask(
base::OnceClosure closure) { … }
std::optional<uint32_t> VulkanInProcessContextProvider::GetSyncCpuMemoryLimit()
const { … }
void VulkanInProcessContextProvider::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel level) { … }
}