diff options
| author | 2014-04-27 12:39:57 -0400 | |
|---|---|---|
| committer | 2014-04-27 12:39:57 -0400 | |
| commit | f0525a1eb4bc133f43c6dd10166965467a34dd45 (patch) | |
| tree | a9514ac3f3b062da41a170861991d8a5d57fd7af /src/core/hw/lcd.h | |
| parent | - changed HW IO map to use virtual addresses (diff) | |
| download | yuzu-f0525a1eb4bc133f43c6dd10166965467a34dd45.tar.gz yuzu-f0525a1eb4bc133f43c6dd10166965467a34dd45.tar.xz yuzu-f0525a1eb4bc133f43c6dd10166965467a34dd45.zip | |
added code to LCD modules keep track of framebuffer location in FCRAM or VRAM
Diffstat (limited to 'src/core/hw/lcd.h')
| -rw-r--r-- | src/core/hw/lcd.h | 77 |
1 files changed, 63 insertions, 14 deletions
diff --git a/src/core/hw/lcd.h b/src/core/hw/lcd.h index b047e7cea..2dd3b4adc 100644 --- a/src/core/hw/lcd.h +++ b/src/core/hw/lcd.h | |||
| @@ -8,6 +8,19 @@ | |||
| 8 | 8 | ||
| 9 | namespace LCD { | 9 | namespace LCD { |
| 10 | 10 | ||
| 11 | struct Registers { | ||
| 12 | u32 framebuffer_top_left_1; | ||
| 13 | u32 framebuffer_top_left_2; | ||
| 14 | u32 framebuffer_top_right_1; | ||
| 15 | u32 framebuffer_top_right_2; | ||
| 16 | u32 framebuffer_sub_left_1; | ||
| 17 | u32 framebuffer_sub_left_2; | ||
| 18 | u32 framebuffer_sub_right_1; | ||
| 19 | u32 framebuffer_sub_right_2; | ||
| 20 | }; | ||
| 21 | |||
| 22 | extern Registers g_regs; | ||
| 23 | |||
| 11 | enum { | 24 | enum { |
| 12 | TOP_ASPECT_X = 0x5, | 25 | TOP_ASPECT_X = 0x5, |
| 13 | TOP_ASPECT_Y = 0x3, | 26 | TOP_ASPECT_Y = 0x3, |
| @@ -17,24 +30,60 @@ enum { | |||
| 17 | BOTTOM_WIDTH = 320, | 30 | BOTTOM_WIDTH = 320, |
| 18 | 31 | ||
| 19 | // Physical addresses in FCRAM used by ARM9 applications - these are correct for real hardware | 32 | // Physical addresses in FCRAM used by ARM9 applications - these are correct for real hardware |
| 20 | FRAMEBUFFER_SEL = 0x20184E59, | 33 | PADDR_FRAMEBUFFER_SEL = 0x20184E59, |
| 21 | TOP_LEFT_FRAME1 = 0x20184E60, | 34 | PADDR_TOP_LEFT_FRAME1 = 0x20184E60, |
| 22 | TOP_LEFT_FRAME2 = 0x201CB370, | 35 | PADDR_TOP_LEFT_FRAME2 = 0x201CB370, |
| 23 | TOP_RIGHT_FRAME1 = 0x20282160, | 36 | PADDR_TOP_RIGHT_FRAME1 = 0x20282160, |
| 24 | TOP_RIGHT_FRAME2 = 0x202C8670, | 37 | PADDR_TOP_RIGHT_FRAME2 = 0x202C8670, |
| 25 | SUB_FRAME1 = 0x202118E0, | 38 | PADDR_SUB_FRAME1 = 0x202118E0, |
| 26 | SUB_FRAME2 = 0x20249CF0, | 39 | PADDR_SUB_FRAME2 = 0x20249CF0, |
| 27 | 40 | ||
| 28 | // Physical addresses in VRAM - I'm not sure how these are actually allocated (so not real) | 41 | // Physical addresses in VRAM - I'm not sure how these are actually allocated (so not real) |
| 29 | VRAM_FRAMEBUFFER_SEL = 0x18184E59, | 42 | PADDR_VRAM_FRAMEBUFFER_SEL = 0x18184E59, |
| 30 | VRAM_TOP_LEFT_FRAME1 = 0x18184E60, | 43 | PADDR_VRAM_TOP_LEFT_FRAME1 = 0x18184E60, |
| 31 | VRAM_TOP_LEFT_FRAME2 = 0x181CB370, | 44 | PADDR_VRAM_TOP_LEFT_FRAME2 = 0x181CB370, |
| 32 | VRAM_TOP_RIGHT_FRAME1 = 0x18282160, | 45 | PADDR_VRAM_TOP_RIGHT_FRAME1 = 0x18282160, |
| 33 | VRAM_TOP_RIGHT_FRAME2 = 0x182C8670, | 46 | PADDR_VRAM_TOP_RIGHT_FRAME2 = 0x182C8670, |
| 34 | VRAM_SUB_FRAME1 = 0x182118E0, | 47 | PADDR_VRAM_SUB_FRAME1 = 0x182118E0, |
| 35 | VRAM_SUB_FRAME2 = 0x18249CF0, | 48 | PADDR_VRAM_SUB_FRAME2 = 0x18249CF0, |
| 49 | }; | ||
| 50 | |||
| 51 | enum { | ||
| 52 | REG_FRAMEBUFFER_TOP_LEFT_1 = 0x1EF00468, // Main LCD, first framebuffer for 3D left | ||
| 53 | REG_FRAMEBUFFER_TOP_LEFT_2 = 0x1EF0046C, // Main LCD, second framebuffer for 3D left | ||
| 54 | REG_FRAMEBUFFER_TOP_RIGHT_1 = 0x1EF00494, // Main LCD, first framebuffer for 3D right | ||
| 55 | REG_FRAMEBUFFER_TOP_RIGHT_2 = 0x1EF00498, // Main LCD, second framebuffer for 3D right | ||
| 56 | REG_FRAMEBUFFER_SUB_LEFT_1 = 0x1EF00568, // Sub LCD, first framebuffer | ||
| 57 | REG_FRAMEBUFFER_SUB_LEFT_2 = 0x1EF0056C, // Sub LCD, second framebuffer | ||
| 58 | REG_FRAMEBUFFER_SUB_RIGHT_1 = 0x1EF00594, // Sub LCD, unused first framebuffer | ||
| 59 | REG_FRAMEBUFFER_SUB_RIGHT_2 = 0x1EF00598, // Sub LCD, unused second framebuffer | ||
| 36 | }; | 60 | }; |
| 37 | 61 | ||
| 62 | /// Framebuffer location | ||
| 63 | enum FramebufferLocation { | ||
| 64 | FRAMEBUFFER_LOCATION_UNKNOWN, ///< Framebuffer location is unknown | ||
| 65 | FRAMEBUFFER_LOCATION_FCRAM, ///< Framebuffer is in the GSP heap | ||
| 66 | FRAMEBUFFER_LOCATION_VRAM, ///< Framebuffer is in VRAM | ||
| 67 | }; | ||
| 68 | |||
| 69 | /** | ||
| 70 | * Sets whether the framebuffers are in the GSP heap (FCRAM) or VRAM | ||
| 71 | * @param | ||
| 72 | */ | ||
| 73 | void SetFramebufferLocation(const FramebufferLocation mode); | ||
| 74 | |||
| 75 | /** | ||
| 76 | * Gets a read-only pointer to a framebuffer in memory | ||
| 77 | * @param address Physical address of framebuffer | ||
| 78 | * @return Returns const pointer to raw framebuffer | ||
| 79 | */ | ||
| 80 | const u8* GetFramebufferPointer(const u32 address); | ||
| 81 | |||
| 82 | /** | ||
| 83 | * Gets the location of the framebuffers | ||
| 84 | */ | ||
| 85 | const FramebufferLocation GetFramebufferLocation(); | ||
| 86 | |||
| 38 | template <typename T> | 87 | template <typename T> |
| 39 | inline void Read(T &var, const u32 addr); | 88 | inline void Read(T &var, const u32 addr); |
| 40 | 89 | ||