amdgpu: wait_reg_mem and write_data implementation

Command list parsing is temporary moved to async task
This commit is contained in:
psucien 2024-05-09 22:59:35 +02:00
parent bfb18135fb
commit 8e0c67f12e
5 changed files with 103 additions and 11 deletions

View file

@ -3,11 +3,14 @@
#pragma once
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/types.h"
#include <array>
#include <condition_variable>
#include <functional>
#include <future>
namespace AmdGpu {
@ -612,9 +615,26 @@ struct Liverpool {
public:
Liverpool();
void Submit(u32* cmdbuf, u32 size_in_bytes) {
ASSERT_MSG(!cp.valid(), "Trying to submit while previous submission is pending");
cp = std::async(&Liverpool::ProcessCmdList, this, cmdbuf, size_in_bytes);
}
void SubmitDone() {
// This is wrong as `submitDone()` should never be blocking. The behavior will be
// reworked with mutiple queues introduction
cp.get();
}
void SetEopCallback(auto const& cb) {
eop_callback = cb;
}
private:
void ProcessCmdList(u32* cmdbuf, u32 size_in_bytes);
std::function<void(void)> eop_callback{};
std::future<void> cp{};
std::condition_variable cv_reg_mem{};
std::mutex m_reg_mem{};
};
static_assert(GFX6_3D_REG_INDEX(ps_program) == 0x2C08);