#include "gpu/command_buffer/service/task_graph.h"
#include <algorithm>
#include <utility>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/synchronization/lock.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
namespace gpu {
namespace {
void UpdateReleaseCount(
base::flat_map<SyncPointClientId, uint64_t>* release_map,
const SyncPointClientId& client_id,
uint64_t release) { … }
}
FenceSyncReleaseDelegate::FenceSyncReleaseDelegate(
SyncPointManager* sync_point_manager)
: … { … }
void FenceSyncReleaseDelegate::Release() { … }
void FenceSyncReleaseDelegate::Release(uint64_t release) { … }
void FenceSyncReleaseDelegate::Reset(const SyncToken& release_upperbound) { … }
TaskGraph::Sequence::Task::Task(base::OnceClosure task_closure,
uint32_t order_num,
const SyncToken& release,
ReportingCallback report_callback)
: … { … }
TaskGraph::Sequence::Task::Task(Task&& other) = default;
TaskGraph::Sequence::Task::~Task() { … }
TaskGraph::Sequence::Task& TaskGraph::Sequence::Task::operator=(Task&& other) =
default;
TaskGraph::Sequence::WaitFence::WaitFence(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id)
: … { … }
TaskGraph::Sequence::WaitFence::WaitFence(WaitFence&& other) = default;
TaskGraph::Sequence::WaitFence::~WaitFence() = default;
TaskGraph::Sequence::WaitFence& TaskGraph::Sequence::WaitFence::operator=(
WaitFence&& other) = default;
TaskGraph::Sequence::Sequence(
TaskGraph* task_graph,
base::RepeatingClosure front_task_unblocked_callback,
scoped_refptr<base::SingleThreadTaskRunner> validation_runner)
: … { … }
TaskGraph::Sequence::~Sequence() { … }
void TaskGraph::Sequence::CreateSyncPointClientState(
CommandBufferNamespace namespace_id,
CommandBufferId command_buffer_id) { … }
uint32_t TaskGraph::Sequence::AddTask(TaskCallback task_callback,
std::vector<SyncToken> wait_fences,
const SyncToken& release,
ReportingCallback report_callback) { … }
uint32_t TaskGraph::Sequence::AddTask(base::OnceClosure task_closure,
std::vector<SyncToken> wait_fences,
const SyncToken& release,
ReportingCallback report_callback) { … }
uint32_t TaskGraph::Sequence::BeginTask(base::OnceClosure* task_closure) { … }
void TaskGraph::Sequence::FinishTask() { … }
void TaskGraph::Sequence::ContinueTask(TaskCallback task_callback) { … }
void TaskGraph::Sequence::ContinueTask(base::OnceClosure task_closure) { … }
void TaskGraph::Sequence::SetLastTaskFirstDependencyTimeIfNeeded() { … }
base::TimeDelta TaskGraph::Sequence::FrontTaskWaitingDependencyDelta() { … }
base::TimeDelta TaskGraph::Sequence::FrontTaskSchedulingDelay() { … }
void TaskGraph::Sequence::RemoveWaitFence(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id) { … }
bool TaskGraph::Sequence::IsFrontTaskUnblocked() const { … }
void TaskGraph::Sequence::Destroy() { … }
void TaskGraph::Sequence::UpdateValidationTimer() { … }
std::pair<TaskGraph::Sequence::WaitFenceConstIter,
TaskGraph::Sequence::WaitFenceConstIter>
TaskGraph::Sequence::GetTaskWaitFences(const Task& task) const { … }
const TaskGraph::Sequence::Task* TaskGraph::Sequence::FindReleaseTask(
const SyncToken& sync_token) const { … }
base::OnceClosure TaskGraph::Sequence::CreateTaskClosure(
TaskCallback task_callback) { … }
TaskGraph::TaskGraph(SyncPointManager* sync_point_manager)
: … { … }
TaskGraph::~TaskGraph() { … }
SequenceId TaskGraph::CreateSequence(
base::RepeatingClosure front_task_unblocked_callback,
scoped_refptr<base::SingleThreadTaskRunner> validation_runner) { … }
void TaskGraph::AddSequence(std::unique_ptr<Sequence> sequence) { … }
void TaskGraph::CreateSyncPointClientState(SequenceId sequence_id,
CommandBufferNamespace namespace_id,
CommandBufferId command_buffer_id) { … }
void TaskGraph::DestroySequence(SequenceId sequence_id) { … }
TaskGraph::Sequence* TaskGraph::GetSequence(SequenceId sequence_id) { … }
void TaskGraph::SyncTokenFenceReleased(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id,
SequenceId waiting_sequence_id) { … }
void TaskGraph::ValidateSequenceTaskFenceDeps(Sequence* root_sequence) { … }
void TaskGraph::ValidateTaskFenceDeps(
Sequence* sequence,
TaskGraph::Sequence::TaskIter task_iter,
TaskGraph::ReleaseMap* pending_releases,
TaskGraph::ReleaseMap* force_releases,
TaskGraph::ValidateStateMap* validate_states) { … }
TaskGraph::ValidateState& TaskGraph::GetSequenceValidateState(
TaskGraph::ValidateStateMap* validate_states,
ReleaseMap* pending_releases,
Sequence* sequence) { … }
}