gpu_asynch.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2019 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include "video_core/gpu.h"
  6. #include "video_core/gpu_thread.h"
  7. namespace Core::Frontend {
  8. class GraphicsContext;
  9. }
  10. namespace VideoCore {
  11. class RendererBase;
  12. } // namespace VideoCore
  13. namespace VideoCommon {
  14. /// Implementation of GPU interface that runs the GPU asynchronously
  15. class GPUAsynch final : public Tegra::GPU {
  16. public:
  17. explicit GPUAsynch(Core::System& system, std::unique_ptr<VideoCore::RendererBase>&& renderer,
  18. std::unique_ptr<Core::Frontend::GraphicsContext>&& context);
  19. ~GPUAsynch() override;
  20. void Start() override;
  21. void PushGPUEntries(Tegra::CommandList&& entries) override;
  22. void SwapBuffers(const Tegra::FramebufferConfig* framebuffer) override;
  23. void FlushRegion(VAddr addr, u64 size) override;
  24. void InvalidateRegion(VAddr addr, u64 size) override;
  25. void FlushAndInvalidateRegion(VAddr addr, u64 size) override;
  26. void WaitIdle() const override;
  27. void OnCommandListEnd() override;
  28. protected:
  29. void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override;
  30. private:
  31. GPUThread::ThreadManager gpu_thread;
  32. std::unique_ptr<Core::Frontend::GraphicsContext> cpu_context;
  33. std::unique_ptr<Core::Frontend::GraphicsContext> gpu_context;
  34. };
  35. } // namespace VideoCommon