gpu_asynch.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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(CacheAddr addr, u64 size) override;
  24. void InvalidateRegion(CacheAddr addr, u64 size) override;
  25. void FlushAndInvalidateRegion(CacheAddr addr, u64 size) override;
  26. void WaitIdle() const override;
  27. protected:
  28. void TriggerCpuInterrupt(u32 syncpoint_id, u32 value) const override;
  29. private:
  30. GPUThread::ThreadManager gpu_thread;
  31. std::unique_ptr<Core::Frontend::GraphicsContext> cpu_context;
  32. std::unique_ptr<Core::Frontend::GraphicsContext> gpu_context;
  33. };
  34. } // namespace VideoCommon