gpu_asynch.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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}, gpu_context(std::move(context)),
  13. cpu_context(renderer->GetRenderWindow().CreateSharedContext()) {}
  14. GPUAsynch::~GPUAsynch() = default;
  15. void GPUAsynch::Start() {
  16. cpu_context->MakeCurrent();
  17. gpu_thread.StartThread(*renderer, *gpu_context, *dma_pusher);
  18. }
  19. void GPUAsynch::PushGPUEntries(Tegra::CommandList&& entries) {
  20. gpu_thread.SubmitList(std::move(entries));
  21. }
  22. void GPUAsynch::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
  23. gpu_thread.SwapBuffers(framebuffer);
  24. }
  25. void GPUAsynch::FlushRegion(CacheAddr addr, u64 size) {
  26. gpu_thread.FlushRegion(addr, size);
  27. }
  28. void GPUAsynch::InvalidateRegion(CacheAddr addr, u64 size) {
  29. gpu_thread.InvalidateRegion(addr, size);
  30. }
  31. void GPUAsynch::FlushAndInvalidateRegion(CacheAddr addr, u64 size) {
  32. gpu_thread.FlushAndInvalidateRegion(addr, size);
  33. }
  34. void GPUAsynch::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const {
  35. auto& interrupt_manager = system.InterruptManager();
  36. interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value);
  37. }
  38. void GPUAsynch::WaitIdle() const {
  39. gpu_thread.WaitIdle();
  40. }
  41. } // namespace VideoCommon