gpu_asynch.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 ObtainContext() override;
  22. void ReleaseContext() override;
  23. void PushGPUEntries(Tegra::CommandList&& entries) override;
  24. void SwapBuffers(const Tegra::FramebufferConfig* framebuffer) override;
  25. void FlushRegion(VAddr addr, u64 size) override;
  26. void InvalidateRegion(VAddr addr, u64 size) override;
  27. void FlushAndInvalidateRegion(VAddr addr, u64 size) override;
  28. void WaitIdle() const override;
  29. void OnCommandListEnd() override;
  30. protected:
  31. void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override;
  32. private:
  33. GPUThread::ThreadManager gpu_thread;
  34. std::unique_ptr<Core::Frontend::GraphicsContext> cpu_context;
  35. std::unique_ptr<Core::Frontend::GraphicsContext> gpu_context;
  36. };
  37. } // namespace VideoCommon