gpu_asynch.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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, bool use_nvdec);
  18. ~GPUAsynch() override;
  19. void Start() override;
  20. void ObtainContext() override;
  21. void ReleaseContext() override;
  22. void PushGPUEntries(Tegra::CommandList&& entries) override;
  23. void PushCommandBuffer(Tegra::ChCommandHeaderList& 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. };
  36. } // namespace VideoCommon