diff options
| author | 2015-02-08 11:38:00 -0200 | |
|---|---|---|
| committer | 2015-04-05 20:14:33 -0300 | |
| commit | 34b009cf38643dc8ac45a366d24208d36a2eb2f9 (patch) | |
| tree | ffd88b43959d9a46a2f4155413dc893356fe66bc /src | |
| parent | Merge pull request #680 from archshift/bg-color (diff) | |
| download | yuzu-34b009cf38643dc8ac45a366d24208d36a2eb2f9.tar.gz yuzu-34b009cf38643dc8ac45a366d24208d36a2eb2f9.tar.xz yuzu-34b009cf38643dc8ac45a366d24208d36a2eb2f9.zip | |
Clean-up mem_map constants and fix framebuffer translation errors
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/gsp_gpu.cpp | 10 | ||||
| -rw-r--r-- | src/core/mem_map.h | 26 | ||||
| -rw-r--r-- | src/core/mem_map_funcs.cpp | 18 |
3 files changed, 27 insertions, 27 deletions
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp index 26d3bcff6..8da063bd2 100644 --- a/src/core/hle/service/gsp_gpu.cpp +++ b/src/core/hle/service/gsp_gpu.cpp | |||
| @@ -204,16 +204,18 @@ static void ReadHWRegs(Service::Interface* self) { | |||
| 204 | 204 | ||
| 205 | static void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { | 205 | static void SetBufferSwap(u32 screen_id, const FrameBufferInfo& info) { |
| 206 | u32 base_address = 0x400000; | 206 | u32 base_address = 0x400000; |
| 207 | PAddr phys_address_left = Memory::VirtualToPhysicalAddress(info.address_left); | ||
| 208 | PAddr phys_address_right = Memory::VirtualToPhysicalAddress(info.address_right); | ||
| 207 | if (info.active_fb == 0) { | 209 | if (info.active_fb == 0) { |
| 208 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left1)), 4, | 210 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left1)), 4, |
| 209 | &info.address_left); | 211 | &phys_address_left); |
| 210 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right1)), 4, | 212 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right1)), 4, |
| 211 | &info.address_right); | 213 | &phys_address_right); |
| 212 | } else { | 214 | } else { |
| 213 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left2)), 4, | 215 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_left2)), 4, |
| 214 | &info.address_left); | 216 | &phys_address_left); |
| 215 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right2)), 4, | 217 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].address_right2)), 4, |
| 216 | &info.address_right); | 218 | &phys_address_right); |
| 217 | } | 219 | } |
| 218 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].stride)), 4, | 220 | WriteHWRegs(base_address + 4 * static_cast<u32>(GPU_REG_INDEX(framebuffer_config[screen_id].stride)), 4, |
| 219 | &info.stride); | 221 | &info.stride); |
diff --git a/src/core/mem_map.h b/src/core/mem_map.h index bce99dffa..ff730593e 100644 --- a/src/core/mem_map.h +++ b/src/core/mem_map.h | |||
| @@ -27,10 +27,16 @@ enum : u32 { | |||
| 27 | MPCORE_PRIV_PADDR_END = (MPCORE_PRIV_PADDR + MPCORE_PRIV_SIZE), | 27 | MPCORE_PRIV_PADDR_END = (MPCORE_PRIV_PADDR + MPCORE_PRIV_SIZE), |
| 28 | 28 | ||
| 29 | FCRAM_SIZE = 0x08000000, ///< FCRAM size | 29 | FCRAM_SIZE = 0x08000000, ///< FCRAM size |
| 30 | FCRAM_PADDR = 0x20000000, ///< FCRAM physical address | 30 | FCRAM_PADDR = 0x20000000, ///< FCRAM physical address |
| 31 | FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), ///< FCRAM end of physical space | 31 | FCRAM_PADDR_END = (FCRAM_PADDR + FCRAM_SIZE), |
| 32 | FCRAM_VADDR = 0x08000000, ///< FCRAM virtual address | 32 | |
| 33 | FCRAM_VADDR_END = (FCRAM_VADDR + FCRAM_SIZE), ///< FCRAM end of virtual space | 33 | HEAP_SIZE = FCRAM_SIZE, ///< Application heap size |
| 34 | HEAP_VADDR = 0x08000000, | ||
| 35 | HEAP_VADDR_END = (HEAP_VADDR + HEAP_SIZE), | ||
| 36 | |||
| 37 | HEAP_LINEAR_SIZE = FCRAM_SIZE, | ||
| 38 | HEAP_LINEAR_VADDR = 0x14000000, | ||
| 39 | HEAP_LINEAR_VADDR_END = (HEAP_LINEAR_VADDR + HEAP_LINEAR_SIZE), | ||
| 34 | 40 | ||
| 35 | AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size | 41 | AXI_WRAM_SIZE = 0x00080000, ///< AXI WRAM size |
| 36 | AXI_WRAM_PADDR = 0x1FF80000, ///< AXI WRAM physical address | 42 | AXI_WRAM_PADDR = 0x1FF80000, ///< AXI WRAM physical address |
| @@ -65,18 +71,6 @@ enum : u32 { | |||
| 65 | SYSTEM_MEMORY_VADDR = 0x04000000, | 71 | SYSTEM_MEMORY_VADDR = 0x04000000, |
| 66 | SYSTEM_MEMORY_VADDR_END = (SYSTEM_MEMORY_VADDR + SYSTEM_MEMORY_SIZE), | 72 | SYSTEM_MEMORY_VADDR_END = (SYSTEM_MEMORY_VADDR + SYSTEM_MEMORY_SIZE), |
| 67 | 73 | ||
| 68 | HEAP_SIZE = FCRAM_SIZE, ///< Application heap size | ||
| 69 | //HEAP_PADDR = HEAP_GSP_SIZE, | ||
| 70 | //HEAP_PADDR_END = (HEAP_PADDR + HEAP_SIZE), | ||
| 71 | HEAP_VADDR = 0x08000000, | ||
| 72 | HEAP_VADDR_END = (HEAP_VADDR + HEAP_SIZE), | ||
| 73 | |||
| 74 | HEAP_LINEAR_SIZE = 0x08000000, ///< Linear heap size... TODO: Define correctly? | ||
| 75 | HEAP_LINEAR_VADDR = 0x14000000, | ||
| 76 | HEAP_LINEAR_VADDR_END = (HEAP_LINEAR_VADDR + HEAP_LINEAR_SIZE), | ||
| 77 | HEAP_LINEAR_PADDR = 0x00000000, | ||
| 78 | HEAP_LINEAR_PADDR_END = (HEAP_LINEAR_PADDR + HEAP_LINEAR_SIZE), | ||
| 79 | |||
| 80 | HARDWARE_IO_SIZE = 0x01000000, | 74 | HARDWARE_IO_SIZE = 0x01000000, |
| 81 | HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start | 75 | HARDWARE_IO_PADDR = 0x10000000, ///< IO physical address start |
| 82 | HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start | 76 | HARDWARE_IO_VADDR = 0x1EC00000, ///< IO virtual address start |
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index a161a8204..5878b99dc 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp | |||
| @@ -23,10 +23,12 @@ VAddr PhysicalToVirtualAddress(const PAddr addr) { | |||
| 23 | // to virtual address translations here. This is quite hacky, but necessary until we implement | 23 | // to virtual address translations here. This is quite hacky, but necessary until we implement |
| 24 | // proper MMU emulation. | 24 | // proper MMU emulation. |
| 25 | // TODO: Screw it, I'll let bunnei figure out how to do this properly. | 25 | // TODO: Screw it, I'll let bunnei figure out how to do this properly. |
| 26 | if ((addr >= VRAM_PADDR) && (addr < VRAM_PADDR_END)) { | 26 | if (addr == 0) { |
| 27 | return 0; | ||
| 28 | } else if ((addr >= VRAM_PADDR) && (addr < VRAM_PADDR_END)) { | ||
| 27 | return addr - VRAM_PADDR + VRAM_VADDR; | 29 | return addr - VRAM_PADDR + VRAM_VADDR; |
| 28 | }else if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) { | 30 | } else if ((addr >= FCRAM_PADDR) && (addr < FCRAM_PADDR_END)) { |
| 29 | return addr - FCRAM_PADDR + FCRAM_VADDR; | 31 | return addr - FCRAM_PADDR + HEAP_LINEAR_VADDR; |
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr); | 34 | LOG_ERROR(HW_Memory, "Unknown physical address @ 0x%08x", addr); |
| @@ -39,10 +41,12 @@ PAddr VirtualToPhysicalAddress(const VAddr addr) { | |||
| 39 | // to virtual address translations here. This is quite hacky, but necessary until we implement | 41 | // to virtual address translations here. This is quite hacky, but necessary until we implement |
| 40 | // proper MMU emulation. | 42 | // proper MMU emulation. |
| 41 | // TODO: Screw it, I'll let bunnei figure out how to do this properly. | 43 | // TODO: Screw it, I'll let bunnei figure out how to do this properly. |
| 42 | if ((addr >= VRAM_VADDR) && (addr < VRAM_VADDR_END)) { | 44 | if (addr == 0) { |
| 43 | return addr - 0x07000000; | 45 | return 0; |
| 44 | } else if ((addr >= FCRAM_VADDR) && (addr < FCRAM_VADDR_END)) { | 46 | } else if ((addr >= VRAM_VADDR) && (addr < VRAM_VADDR_END)) { |
| 45 | return addr - FCRAM_VADDR + FCRAM_PADDR; | 47 | return addr - VRAM_VADDR + VRAM_PADDR; |
| 48 | } else if ((addr >= HEAP_LINEAR_VADDR) && (addr < HEAP_LINEAR_VADDR_END)) { | ||
| 49 | return addr - HEAP_LINEAR_VADDR + FCRAM_PADDR; | ||
| 46 | } | 50 | } |
| 47 | 51 | ||
| 48 | LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr); | 52 | LOG_ERROR(HW_Memory, "Unknown virtual address @ 0x%08x", addr); |