-
-
Notifications
You must be signed in to change notification settings - Fork 147
psyqo: add selectable framebuffer Layout #2051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -217,6 +217,19 @@ | |||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void psyqo::GPU::setDisplayArea(bool firstBuffer) { | ||||||||||
| uint32_t x = 0; | ||||||||||
| uint32_t y = 0; | ||||||||||
| if constexpr (c_layout == Layout::Horizontal) { | ||||||||||
| x = firstBuffer ? 0 : m_width; | ||||||||||
|
Comment on lines
+223
to
+224
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win Flip the horizontal display-area mapping.
🐛 Proposed fix uint32_t y = 0;
if constexpr (c_layout == Layout::Horizontal) {
- x = firstBuffer ? 0 : m_width;
+ x = firstBuffer ? m_width : 0;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| } else if constexpr (c_layout == Layout::VerticalSwitch) { | ||||||||||
| y = firstBuffer ? 256 : 16; | ||||||||||
| } else { | ||||||||||
| y = firstBuffer ? 256 : 0; | ||||||||||
| } | ||||||||||
| Hardware::GPU::Ctrl = 0x05000000 | (x << 0) | (y << 10); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void psyqo::GPU::flip() { | ||||||||||
| do { | ||||||||||
| pumpCallbacks(); | ||||||||||
|
|
@@ -227,12 +240,7 @@ | |||||||||
| parity ^= 1; | ||||||||||
| if (!m_interlaced) { | ||||||||||
| bool firstBuffer = !parity; | ||||||||||
| // Set Display Area | ||||||||||
| if (firstBuffer) { | ||||||||||
| Hardware::GPU::Ctrl = 0x05000000 | (256 << 10); | ||||||||||
| } else { | ||||||||||
| Hardware::GPU::Ctrl = 0x05000000; | ||||||||||
| } | ||||||||||
| setDisplayArea(firstBuffer); | ||||||||||
|
Check notice on line 243 in src/mips/psyqo/src/gpu.cpp
|
||||||||||
| } else if (!pcsx_present()) { | ||||||||||
| while (1) { | ||||||||||
| uint32_t stat = Hardware::GPU::Ctrl; | ||||||||||
|
|
@@ -280,9 +288,22 @@ | |||||||||
| int16_t height = m_height; | ||||||||||
| bool firstBuffer = !parity || m_interlaced; | ||||||||||
|
|
||||||||||
| scissor.start = Prim::DrawingAreaStart(Vertex{{.x = 0, .y = firstBuffer ? int16_t(0) : int16_t(256)}}); | ||||||||||
| scissor.end = Prim::DrawingAreaEnd(Vertex{{.x = width, .y = firstBuffer ? height : int16_t(256 + height)}}); | ||||||||||
| scissor.offset = Prim::DrawingOffset(Vertex{{.x = int16_t(0), .y = firstBuffer ? int16_t(0) : int16_t(256)}}); | ||||||||||
| if constexpr (c_layout == Layout::Horizontal) { | ||||||||||
| int16_t x = firstBuffer ? int16_t(0) : width; | ||||||||||
| scissor.start = Prim::DrawingAreaStart(Vertex{{.x = x, .y = 0}}); | ||||||||||
| scissor.end = Prim::DrawingAreaEnd(Vertex{{.x = int16_t(x + width), .y = height}}); | ||||||||||
| scissor.offset = Prim::DrawingOffset(Vertex{{.x = x, .y = 0}}); | ||||||||||
| } else { | ||||||||||
| int16_t y; | ||||||||||
| if constexpr (c_layout == Layout::VerticalSwitch) { | ||||||||||
| y = firstBuffer ? int16_t(16) : int16_t(256); | ||||||||||
| } else { | ||||||||||
| y = firstBuffer ? int16_t(0) : int16_t(256); | ||||||||||
| } | ||||||||||
| scissor.start = Prim::DrawingAreaStart(Vertex{{.x = 0, .y = y}}); | ||||||||||
| scissor.end = Prim::DrawingAreaEnd(Vertex{{.x = width, .y = int16_t(y + height)}}); | ||||||||||
| scissor.offset = Prim::DrawingOffset(Vertex{{.x = int16_t(0), .y = y}}); | ||||||||||
| } | ||||||||||
|
Check warning on line 306 in src/mips/psyqo/src/gpu.cpp
|
||||||||||
| } | ||||||||||
|
|
||||||||||
| void psyqo::GPU::getNextScissor(Prim::Scissor &scissor) { | ||||||||||
|
|
@@ -291,9 +312,22 @@ | |||||||||
| int16_t height = m_height; | ||||||||||
| bool firstBuffer = !parity || m_interlaced; | ||||||||||
|
|
||||||||||
| scissor.start = Prim::DrawingAreaStart(Vertex{{.x = 0, .y = firstBuffer ? int16_t(256) : int16_t(0)}}); | ||||||||||
| scissor.end = Prim::DrawingAreaEnd(Vertex{{.x = width, .y = firstBuffer ? int16_t(256 + height) : height}}); | ||||||||||
| scissor.offset = Prim::DrawingOffset(Vertex{{.x = int16_t(0), .y = firstBuffer ? int16_t(256) : int16_t(0)}}); | ||||||||||
| if constexpr (c_layout == Layout::Horizontal) { | ||||||||||
| int16_t x = firstBuffer ? width : int16_t(0); | ||||||||||
| scissor.start = Prim::DrawingAreaStart(Vertex{{.x = x, .y = 0}}); | ||||||||||
| scissor.end = Prim::DrawingAreaEnd(Vertex{{.x = int16_t(x + width), .y = height}}); | ||||||||||
| scissor.offset = Prim::DrawingOffset(Vertex{{.x = x, .y = 0}}); | ||||||||||
| } else { | ||||||||||
| int16_t y; | ||||||||||
| if constexpr (c_layout == Layout::VerticalSwitch) { | ||||||||||
| y = firstBuffer ? int16_t(256) : int16_t(16); | ||||||||||
| } else { | ||||||||||
| y = firstBuffer ? int16_t(256) : int16_t(0); | ||||||||||
| } | ||||||||||
| scissor.start = Prim::DrawingAreaStart(Vertex{{.x = 0, .y = y}}); | ||||||||||
| scissor.end = Prim::DrawingAreaEnd(Vertex{{.x = width, .y = int16_t(y + height)}}); | ||||||||||
| scissor.offset = Prim::DrawingOffset(Vertex{{.x = int16_t(0), .y = y}}); | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void psyqo::GPU::clear(Color bg) { | ||||||||||
|
|
@@ -307,15 +341,35 @@ | |||||||||
| int16_t height = m_height; | ||||||||||
| bool firstBuffer = !m_parity || m_interlaced; | ||||||||||
| ff.setColor(bg); | ||||||||||
| ff.rect = Rect{0, firstBuffer ? int16_t(0) : int16_t(256), width, height}; | ||||||||||
| if constexpr (c_layout == Layout::Horizontal) { | ||||||||||
| ff.rect = Rect{firstBuffer ? int16_t(0) : width, 0, width, height}; | ||||||||||
| } else { | ||||||||||
| int16_t y; | ||||||||||
| if constexpr (c_layout == Layout::VerticalSwitch) { | ||||||||||
| y = firstBuffer ? int16_t(16) : int16_t(256); | ||||||||||
| } else { | ||||||||||
| y = firstBuffer ? int16_t(0) : int16_t(256); | ||||||||||
| } | ||||||||||
| ff.rect = Rect{0, y, width, height}; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void psyqo::GPU::getNextClear(Prim::FastFill &ff, Color bg) const { | ||||||||||
| int16_t width = m_width; | ||||||||||
| int16_t height = m_height; | ||||||||||
| bool firstBuffer = !m_parity || m_interlaced; | ||||||||||
| ff.setColor(bg); | ||||||||||
| ff.rect = Rect{0, firstBuffer ? int16_t(256) : int16_t(0), width, height}; | ||||||||||
| if constexpr (c_layout == Layout::Horizontal) { | ||||||||||
| ff.rect = Rect{firstBuffer ? width : int16_t(0), 0, width, height}; | ||||||||||
| } else { | ||||||||||
| int16_t y; | ||||||||||
| if constexpr (c_layout == Layout::VerticalSwitch) { | ||||||||||
| y = firstBuffer ? int16_t(256) : int16_t(16); | ||||||||||
| } else { | ||||||||||
| y = firstBuffer ? int16_t(256) : int16_t(0); | ||||||||||
| } | ||||||||||
| ff.rect = Rect{0, y, width, height}; | ||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| void psyqo::GPU::uploadToVRAM(const uint16_t *data, Rect rect) { | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Reject conflicting layout defines at compile time.
If both
PSYQO_USE_VERTICAL_SWITCH_LAYOUTandPSYQO_USE_HORIZONTAL_LAYOUTare defined, this silently selectsVerticalSwitch, which can hide a build configuration mistake.🛠️ Proposed fix
📝 Committable suggestion
🤖 Prompt for AI Agents