chromium/third_party/angle/src/libANGLE/renderer/vulkan/CommandProcessor.cpp

//
// Copyright 2020 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// CommandProcessor.cpp:
//    Implements the class methods for CommandProcessor.
//

#include "libANGLE/renderer/vulkan/CommandProcessor.h"
#include "common/system_utils.h"
#include "libANGLE/renderer/vulkan/SyncVk.h"
#include "libANGLE/renderer/vulkan/vk_renderer.h"

namespace rx
{
namespace vk
{
namespace
{
constexpr bool kOutputVmaStatsString =;
// When suballocation garbages is more than this, we may wait for GPU to finish and free up some
// memory for allocation.
constexpr VkDeviceSize kMaxBufferSuballocationGarbageSize =;

void InitializeSubmitInfo(VkSubmitInfo *submitInfo,
                          const PrimaryCommandBuffer &commandBuffer,
                          const std::vector<VkSemaphore> &waitSemaphores,
                          const std::vector<VkPipelineStageFlags> &waitSemaphoreStageMasks,
                          const VkSemaphore &signalSemaphore)
{}

void GetDeviceQueue(VkDevice device,
                    bool makeProtected,
                    uint32_t queueFamilyIndex,
                    uint32_t queueIndex,
                    VkQueue *queue)
{}
}  // namespace

// SharedFence implementation
SharedFence::SharedFence() :{}
SharedFence::SharedFence(const SharedFence &other)
    :{}
SharedFence::SharedFence(SharedFence &&other)
    :{}

SharedFence::~SharedFence()
{}

VkResult SharedFence::init(VkDevice device, FenceRecycler *recycler)
{}

SharedFence &SharedFence::operator=(const SharedFence &other)
{}

SharedFence &SharedFence::operator=(SharedFence &&other)
{}

void SharedFence::destroy(VkDevice device)
{}

void SharedFence::release()
{}

operator bool()

VkResult SharedFence::getStatus(VkDevice device) const
{}

VkResult SharedFence::wait(VkDevice device, uint64_t timeout) const
{}

// FenceRecycler implementation
void FenceRecycler::destroy(Context *context)
{}

void FenceRecycler::fetch(VkDevice device, Fence *fenceOut)
{}

void FenceRecycler::recycle(Fence &&fence)
{}

// CommandProcessorTask implementation
void CommandProcessorTask::initTask()
{}

void CommandProcessorTask::initFlushWaitSemaphores(
    ProtectionType protectionType,
    egl::ContextPriority priority,
    std::vector<VkSemaphore> &&waitSemaphores,
    std::vector<VkPipelineStageFlags> &&waitSemaphoreStageMasks)
{}

void CommandProcessorTask::initOutsideRenderPassProcessCommands(
    ProtectionType protectionType,
    egl::ContextPriority priority,
    OutsideRenderPassCommandBufferHelper *commandBuffer)
{}

void CommandProcessorTask::initRenderPassProcessCommands(
    ProtectionType protectionType,
    egl::ContextPriority priority,
    RenderPassCommandBufferHelper *commandBuffer,
    const RenderPass *renderPass,
    VkFramebuffer framebufferOverride)
{}

void CommandProcessorTask::copyPresentInfo(const VkPresentInfoKHR &other)
{}

void CommandProcessorTask::initPresent(egl::ContextPriority priority,
                                       const VkPresentInfoKHR &presentInfo,
                                       SwapchainStatus *swapchainStatus)
{}

void CommandProcessorTask::initFlushAndQueueSubmit(VkSemaphore semaphore,
                                                   SharedExternalFence &&externalFence,
                                                   ProtectionType protectionType,
                                                   egl::ContextPriority priority,
                                                   const QueueSerial &submitQueueSerial)
{}

void CommandProcessorTask::initOneOffQueueSubmit(VkCommandBuffer commandBufferHandle,
                                                 ProtectionType protectionType,
                                                 egl::ContextPriority priority,
                                                 VkSemaphore waitSemaphore,
                                                 VkPipelineStageFlags waitSemaphoreStageMask,
                                                 const QueueSerial &submitQueueSerial)
{}

CommandProcessorTask &CommandProcessorTask::operator=(CommandProcessorTask &&rhs)
{}

// CommandBatch implementation.
CommandBatch::CommandBatch() :{}

CommandBatch::~CommandBatch() = default;

CommandBatch::CommandBatch(CommandBatch &&other) :{}

CommandBatch &CommandBatch::operator=(CommandBatch &&other)
{}

void CommandBatch::destroy(VkDevice device)
{}

bool CommandBatch::hasFence() const
{}

void CommandBatch::releaseFence()
{}

void CommandBatch::destroyFence(VkDevice device)
{}

VkFence CommandBatch::getFenceHandle() const
{}

VkResult CommandBatch::getFenceStatus(VkDevice device) const
{}

VkResult CommandBatch::waitFence(VkDevice device, uint64_t timeout) const
{}

VkResult CommandBatch::waitFenceUnlocked(VkDevice device,
                                         uint64_t timeout,
                                         std::unique_lock<angle::SimpleMutex> *lock) const
{}

// CommandProcessor implementation.
void CommandProcessor::handleError(VkResult errorCode,
                                   const char *file,
                                   const char *function,
                                   unsigned int line)
{}

CommandProcessor::CommandProcessor(vk::Renderer *renderer, CommandQueue *commandQueue)
    :{}

CommandProcessor::~CommandProcessor() = default;

angle::Result CommandProcessor::checkAndPopPendingError(Context *errorHandlingContext)
{}

angle::Result CommandProcessor::queueCommand(CommandProcessorTask &&task)
{}

void CommandProcessor::requestCommandsAndGarbageCleanup()
{}

void CommandProcessor::processTasks()
{}

angle::Result CommandProcessor::processTasksImpl(bool *exitThread)
{}

angle::Result CommandProcessor::processTask(CommandProcessorTask *task)
{}

angle::Result CommandProcessor::waitForAllWorkToBeSubmitted(Context *context)
{}

angle::Result CommandProcessor::init()
{}

void CommandProcessor::destroy(Context *context)
{}

void CommandProcessor::handleDeviceLost(vk::Renderer *renderer)
{}

VkResult CommandProcessor::present(egl::ContextPriority priority,
                                   const VkPresentInfoKHR &presentInfo,
                                   SwapchainStatus *swapchainStatus)
{}

angle::Result CommandProcessor::enqueueSubmitCommands(Context *context,
                                                      ProtectionType protectionType,
                                                      egl::ContextPriority priority,
                                                      VkSemaphore signalSemaphore,
                                                      SharedExternalFence &&externalFence,
                                                      const QueueSerial &submitQueueSerial)
{}

angle::Result CommandProcessor::enqueueSubmitOneOffCommands(
    Context *context,
    ProtectionType protectionType,
    egl::ContextPriority contextPriority,
    VkCommandBuffer commandBufferHandle,
    VkSemaphore waitSemaphore,
    VkPipelineStageFlags waitSemaphoreStageMask,
    SubmitPolicy submitPolicy,
    const QueueSerial &submitQueueSerial)
{}

void CommandProcessor::enqueuePresent(egl::ContextPriority contextPriority,
                                      const VkPresentInfoKHR &presentInfo,
                                      SwapchainStatus *swapchainStatus)
{}

angle::Result CommandProcessor::enqueueFlushWaitSemaphores(
    ProtectionType protectionType,
    egl::ContextPriority priority,
    std::vector<VkSemaphore> &&waitSemaphores,
    std::vector<VkPipelineStageFlags> &&waitSemaphoreStageMasks)
{}

angle::Result CommandProcessor::enqueueFlushOutsideRPCommands(
    Context *context,
    ProtectionType protectionType,
    egl::ContextPriority priority,
    OutsideRenderPassCommandBufferHelper **outsideRPCommands)
{}

angle::Result CommandProcessor::enqueueFlushRenderPassCommands(
    Context *context,
    ProtectionType protectionType,
    egl::ContextPriority priority,
    const RenderPass &renderPass,
    VkFramebuffer framebufferOverride,
    RenderPassCommandBufferHelper **renderPassCommands)
{}

angle::Result CommandProcessor::waitForResourceUseToBeSubmitted(Context *context,
                                                                const ResourceUse &use)
{}

angle::Result CommandProcessor::waitForPresentToBeSubmitted(SwapchainStatus *swapchainStatus)
{}

// CommandQueue public API implementation. These must be thread safe and never called from
// CommandQueue class itself.
CommandQueue::CommandQueue()
    :{}

CommandQueue::~CommandQueue() = default;

void CommandQueue::destroy(Context *context)
{}

angle::Result CommandQueue::init(Context *context,
                                 const QueueFamily &queueFamily,
                                 bool enableProtectedContent,
                                 uint32_t queueCount)
{}

void CommandQueue::handleDeviceLost(vk::Renderer *renderer)
{}

angle::Result CommandQueue::postSubmitCheck(Context *context)
{}

angle::Result CommandQueue::finishResourceUse(Context *context,
                                              const ResourceUse &use,
                                              uint64_t timeout)
{}

angle::Result CommandQueue::finishQueueSerial(Context *context,
                                              const QueueSerial &queueSerial,
                                              uint64_t timeout)
{}

angle::Result CommandQueue::waitIdle(Context *context, uint64_t timeout)
{}

angle::Result CommandQueue::waitForResourceUseToFinishWithUserTimeout(Context *context,
                                                                      const ResourceUse &use,
                                                                      uint64_t timeout,
                                                                      VkResult *result)
{}

bool CommandQueue::isBusy(vk::Renderer *renderer) const
{}

void CommandQueue::flushWaitSemaphores(ProtectionType protectionType,
                                       egl::ContextPriority priority,
                                       std::vector<VkSemaphore> &&waitSemaphores,
                                       std::vector<VkPipelineStageFlags> &&waitSemaphoreStageMasks)
{}

angle::Result CommandQueue::flushOutsideRPCommands(
    Context *context,
    ProtectionType protectionType,
    egl::ContextPriority priority,
    OutsideRenderPassCommandBufferHelper **outsideRPCommands)
{}

angle::Result CommandQueue::flushRenderPassCommands(
    Context *context,
    ProtectionType protectionType,
    egl::ContextPriority priority,
    const RenderPass &renderPass,
    VkFramebuffer framebufferOverride,
    RenderPassCommandBufferHelper **renderPassCommands)
{}

angle::Result CommandQueue::submitCommands(Context *context,
                                           ProtectionType protectionType,
                                           egl::ContextPriority priority,
                                           VkSemaphore signalSemaphore,
                                           SharedExternalFence &&externalFence,
                                           const QueueSerial &submitQueueSerial)
{}

angle::Result CommandQueue::queueSubmitOneOff(Context *context,
                                              ProtectionType protectionType,
                                              egl::ContextPriority contextPriority,
                                              VkCommandBuffer commandBufferHandle,
                                              VkSemaphore waitSemaphore,
                                              VkPipelineStageFlags waitSemaphoreStageMask,
                                              SubmitPolicy submitPolicy,
                                              const QueueSerial &submitQueueSerial)
{}

angle::Result CommandQueue::queueSubmit(Context *context,
                                        std::unique_lock<angle::SimpleMutex> &&dequeueLock,
                                        egl::ContextPriority contextPriority,
                                        const VkSubmitInfo &submitInfo,
                                        DeviceScoped<CommandBatch> &commandBatch,
                                        const QueueSerial &submitQueueSerial)
{}

void CommandQueue::queuePresent(egl::ContextPriority contextPriority,
                                const VkPresentInfoKHR &presentInfo,
                                SwapchainStatus *swapchainStatus)
{}

const angle::VulkanPerfCounters CommandQueue::getPerfCounters() const
{}

void CommandQueue::resetPerFramePerfCounters()
{}

angle::Result CommandQueue::retireFinishedCommandsAndCleanupGarbage(Context *context)
{}

// CommandQueue private API implementation. These are called by public API, so lock already held.
angle::Result CommandQueue::checkOneCommandBatch(Context *context, bool *finished)
{}

angle::Result CommandQueue::finishOneCommandBatchAndCleanup(Context *context,
                                                            uint64_t timeout,
                                                            bool *anyFinished)
{}

angle::Result CommandQueue::finishOneCommandBatchAndCleanupImpl(Context *context, uint64_t timeout)
{}

angle::Result CommandQueue::retireFinishedCommandsLocked(Context *context)
{}

angle::Result CommandQueue::checkCompletedCommandsLocked(Context *context)
{}

angle::Result CommandQueue::ensurePrimaryCommandBufferValid(Context *context,
                                                            ProtectionType protectionType,
                                                            egl::ContextPriority priority)
{}

// QueuePriorities:
constexpr float kVulkanQueuePriorityLow    =;
constexpr float kVulkanQueuePriorityMedium =;
constexpr float kVulkanQueuePriorityHigh   =;

const float QueueFamily::kQueuePriorities[static_cast<uint32_t>(egl::ContextPriority::EnumCount)] =;

DeviceQueueMap::~DeviceQueueMap() {}

void DeviceQueueMap::destroy()
{}

void DeviceQueueMap::initialize(VkDevice device,
                                const QueueFamily &queueFamily,
                                bool makeProtected,
                                uint32_t queueIndex,
                                uint32_t queueCount)
{}

void QueueFamily::initialize(const VkQueueFamilyProperties &queueFamilyProperties,
                             uint32_t queueFamilyIndex)
{}

uint32_t QueueFamily::FindIndex(const std::vector<VkQueueFamilyProperties> &queueFamilyProperties,
                                VkQueueFlags flags,
                                int32_t matchNumber,
                                uint32_t *matchCount)
{}

}  // namespace vk
}  // namespace rx