gpu.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <memory>
  6. #include <unordered_map>
  7. #include "common/common_types.h"
  8. #include "video_core/engines/fermi_2d.h"
  9. #include "video_core/engines/maxwell_3d.h"
  10. #include "video_core/engines/maxwell_compute.h"
  11. #include "video_core/memory_manager.h"
  12. namespace Tegra {
  13. enum class EngineID {
  14. FERMI_TWOD_A = 0x902D, // 2D Engine
  15. MAXWELL_B = 0xB197, // 3D Engine
  16. MAXWELL_COMPUTE_B = 0xB1C0,
  17. KEPLER_INLINE_TO_MEMORY_B = 0xA140,
  18. MAXWELL_DMA_COPY_A = 0xB0B5,
  19. };
  20. class GPU final {
  21. public:
  22. GPU() {
  23. memory_manager = std::make_unique<MemoryManager>();
  24. maxwell_3d = std::make_unique<Engines::Maxwell3D>();
  25. fermi_2d = std::make_unique<Engines::Fermi2D>();
  26. maxwell_compute = std::make_unique<Engines::MaxwellCompute>();
  27. }
  28. ~GPU() = default;
  29. /// Processes a command list stored at the specified address in GPU memory.
  30. void ProcessCommandList(GPUVAddr address, u32 size);
  31. std::unique_ptr<MemoryManager> memory_manager;
  32. private:
  33. /// Writes a single register in the engine bound to the specified subchannel
  34. void WriteReg(u32 method, u32 subchannel, u32 value);
  35. /// Mapping of command subchannels to their bound engine ids.
  36. std::unordered_map<u32, EngineID> bound_engines;
  37. /// 3D engine
  38. std::unique_ptr<Engines::Maxwell3D> maxwell_3d;
  39. /// 2D engine
  40. std::unique_ptr<Engines::Fermi2D> fermi_2d;
  41. /// Compute engine
  42. std::unique_ptr<Engines::MaxwellCompute> maxwell_compute;
  43. };
  44. } // namespace Tegra