gpu_asynch.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2019 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include "core/core.h"
  5. #include "core/hardware_interrupt_manager.h"
  6. #include "video_core/gpu_asynch.h"
  7. #include "video_core/gpu_thread.h"
  8. #include "video_core/renderer_base.h"
  9. namespace VideoCommon {
  10. GPUAsynch::GPUAsynch(Core::System& system, std::unique_ptr<VideoCore::RendererBase>&& renderer_,
  11. std::unique_ptr<Core::Frontend::GraphicsContext>&& context)
  12. : GPU(system, std::move(renderer_), true), gpu_thread{system},
  13. cpu_context(renderer->GetRenderWindow().CreateSharedContext()),
  14. gpu_context(std::move(context)) {}
  15. GPUAsynch::~GPUAsynch() = default;
  16. void GPUAsynch::Start() {
  17. cpu_context->MakeCurrent();
  18. gpu_thread.StartThread(*renderer, *gpu_context, *dma_pusher);
  19. }
  20. void GPUAsynch::PushGPUEntries(Tegra::CommandList&& entries) {
  21. gpu_thread.SubmitList(std::move(entries));
  22. }
  23. void GPUAsynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
  24. gpu_thread.SwapBuffers(framebuffer);
  25. }
  26. void GPUAsynch::FlushRegion(VAddr addr, u64 size) {
  27. gpu_thread.FlushRegion(addr, size);
  28. }
  29. void GPUAsynch::InvalidateRegion(VAddr addr, u64 size) {
  30. gpu_thread.InvalidateRegion(addr, size);
  31. }
  32. void GPUAsynch::FlushAndInvalidateRegion(VAddr addr, u64 size) {
  33. gpu_thread.FlushAndInvalidateRegion(addr, size);
  34. }
  35. void GPUAsynch::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const {
  36. auto& interrupt_manager = system.InterruptManager();
  37. interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value);
  38. }
  39. void GPUAsynch::WaitIdle() const {
  40. gpu_thread.WaitIdle();
  41. }
  42. } // namespace VideoCommon