summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-12-08 03:38:14 +0100
committerGitHub <noreply@github.com>2021-12-08 03:38:14 +0100
commit815189eaf31c6fdeb7983d03d17ba3685b61f806 (patch)
tree340ac3f1c580dcc2560a2775b2014ae80259dd07 /src/video_core
parentMerge pull request #7506 from heinermann/focus_crash (diff)
parentAddress feedback (diff)
downloadyuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.tar
yuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.tar.gz
yuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.tar.bz2
yuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.tar.lz
yuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.tar.xz
yuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.tar.zst
yuzu-815189eaf31c6fdeb7983d03d17ba3685b61f806.zip
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/gpu.cpp44
-rw-r--r--src/video_core/gpu.h4
2 files changed, 16 insertions, 32 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index ab7c21a49..8788f5148 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -185,16 +185,6 @@ struct GPU::Impl {
return *dma_pusher;
}
- /// Returns a reference to the GPU CDMA pusher.
- [[nodiscard]] Tegra::CDmaPusher& CDmaPusher() {
- return *cdma_pusher;
- }
-
- /// Returns a const reference to the GPU CDMA pusher.
- [[nodiscard]] const Tegra::CDmaPusher& CDmaPusher() const {
- return *cdma_pusher;
- }
-
/// Returns a reference to the underlying renderer.
[[nodiscard]] VideoCore::RendererBase& Renderer() {
return *renderer;
@@ -338,25 +328,27 @@ struct GPU::Impl {
}
/// Push GPU command buffer entries to be processed
- void PushCommandBuffer(Tegra::ChCommandHeaderList& entries) {
+ void PushCommandBuffer(u32 id, Tegra::ChCommandHeaderList& entries) {
if (!use_nvdec) {
return;
}
- if (!cdma_pusher) {
- cdma_pusher = std::make_unique<Tegra::CDmaPusher>(gpu);
+ if (!cdma_pushers.contains(id)) {
+ cdma_pushers.insert_or_assign(id, std::make_unique<Tegra::CDmaPusher>(gpu));
}
// SubmitCommandBuffer would make the nvdec operations async, this is not currently working
// TODO(ameerj): RE proper async nvdec operation
// gpu_thread.SubmitCommandBuffer(std::move(entries));
-
- cdma_pusher->ProcessEntries(std::move(entries));
+ cdma_pushers[id]->ProcessEntries(std::move(entries));
}
/// Frees the CDMAPusher instance to free up resources
- void ClearCdmaInstance() {
- cdma_pusher.reset();
+ void ClearCdmaInstance(u32 id) {
+ const auto iter = cdma_pushers.find(id);
+ if (iter != cdma_pushers.end()) {
+ cdma_pushers.erase(iter);
+ }
}
/// Swap buffers (render frame)
@@ -659,7 +651,7 @@ struct GPU::Impl {
Core::System& system;
std::unique_ptr<Tegra::MemoryManager> memory_manager;
std::unique_ptr<Tegra::DmaPusher> dma_pusher;
- std::unique_ptr<Tegra::CDmaPusher> cdma_pusher;
+ std::map<u32, std::unique_ptr<Tegra::CDmaPusher>> cdma_pushers;
std::unique_ptr<VideoCore::RendererBase> renderer;
VideoCore::RasterizerInterface* rasterizer = nullptr;
const bool use_nvdec;
@@ -811,14 +803,6 @@ const Tegra::DmaPusher& GPU::DmaPusher() const {
return impl->DmaPusher();
}
-Tegra::CDmaPusher& GPU::CDmaPusher() {
- return impl->CDmaPusher();
-}
-
-const Tegra::CDmaPusher& GPU::CDmaPusher() const {
- return impl->CDmaPusher();
-}
-
VideoCore::RendererBase& GPU::Renderer() {
return impl->Renderer();
}
@@ -887,12 +871,12 @@ void GPU::PushGPUEntries(Tegra::CommandList&& entries) {
impl->PushGPUEntries(std::move(entries));
}
-void GPU::PushCommandBuffer(Tegra::ChCommandHeaderList& entries) {
- impl->PushCommandBuffer(entries);
+void GPU::PushCommandBuffer(u32 id, Tegra::ChCommandHeaderList& entries) {
+ impl->PushCommandBuffer(id, entries);
}
-void GPU::ClearCdmaInstance() {
- impl->ClearCdmaInstance();
+void GPU::ClearCdmaInstance(u32 id) {
+ impl->ClearCdmaInstance(id);
}
void GPU::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index c89a5d693..500411176 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -242,10 +242,10 @@ public:
void PushGPUEntries(Tegra::CommandList&& entries);
/// Push GPU command buffer entries to be processed
- void PushCommandBuffer(Tegra::ChCommandHeaderList& entries);
+ void PushCommandBuffer(u32 id, Tegra::ChCommandHeaderList& entries);
/// Frees the CDMAPusher instance to free up resources
- void ClearCdmaInstance();
+ void ClearCdmaInstance(u32 id);
/// Swap buffers (render frame)
void SwapBuffers(const Tegra::FramebufferConfig* framebuffer);