Skip to content

Commit c510a2e

Browse files
committed
Added a few more scaling matrices.
1 parent 0479586 commit c510a2e

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

source/arm11/hardware/lgyfb.c

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,22 +117,56 @@ void LGYFB_init(void)
117117
{
118118
if(DMA330_run(0, program)) return;
119119

120+
//REG_LGYFB_TOP_SIZE = LGYFB_SIZE(240u, 160u);
120121
REG_LGYFB_TOP_SIZE = LGYFB_SIZE(360u, 240u);
121122
REG_LGYFB_TOP_STAT = LGYFB_IRQ_MASK;
122123
REG_LGYFB_TOP_IRQ = 0;
123124
REG_LGYFB_TOP_ALPHA = 0xFF;
124125

125-
static const s16 matrix[6][8] =
126+
/*
127+
* Limitations:
128+
* First pattern bit must be 1 and last 0 or it loses sync with the DS/GBA input.
129+
*
130+
* Matrix ranges:
131+
* in[-3] -1024-1023 (0xFC00-0x03FF)
132+
* in[-2] -4096-4095 (0xF000-0x0FFF)
133+
* in[-1] -32768-32767 (0x8000-0x7FFF)
134+
* in[0] -32768-32767 (0x8000-0x7FFF)
135+
* in[1] -4096-4095 (0xF000-0x0FFF)
136+
* in[2] -1024-1023 (0xFC00-0x03FF)
137+
*
138+
* Note: At scanline start the in FIFO is all filled with the first pixel.
139+
*/
140+
static const s16 scaleMatrix[6][8] =
126141
{
142+
// Original from AGB_FIRM.
127143
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[-3]
128144
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[-2]
129145
{ 0, 0x2000, 0x4000, 0, 0x2000, 0x4000, 0, 0}, // in[-1]
130146
{0x4000, 0x2000, 0, 0x4000, 0x2000, 0, 0, 0}, // in[0]
131147
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[1]
132148
{ 0, 0, 0, 0, 0, 0, 0, 0} // in[2]
133149
// out[0] out[1] out[2] out[3] out[4] out[5] out[6] out[7]
150+
151+
// Razor sharp (pixel duplication).
152+
/*{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[-3]
153+
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[-2]
154+
{ 0, 0, 0x4000, 0, 0, 0x4000, 0, 0}, // in[-1]
155+
{0x4000, 0x4000, 0, 0x4000, 0x4000, 0, 0, 0}, // in[0]
156+
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[1]
157+
{ 0, 0, 0, 0, 0, 0, 0, 0}*/ // in[2]
158+
// out[0] out[1] out[2] out[3] out[4] out[5] out[6] out[7]
159+
160+
// Sharp interpolated.
161+
/*{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[-3]
162+
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[-2]
163+
{ 0, 0, 0x2000, 0, 0, 0x2000, 0, 0}, // in[-1]
164+
{0x4000, 0x4000, 0x2000, 0x4000, 0x4000, 0x2000, 0, 0}, // in[0]
165+
{ 0, 0, 0, 0, 0, 0, 0, 0}, // in[1]
166+
{ 0, 0, 0, 0, 0, 0, 0, 0}*/ // in[2]
167+
// out[0] out[1] out[2] out[3] out[4] out[5] out[6] out[7]
134168
};
135-
setScaleMatrixTop(6, 0b00011011, matrix);
169+
setScaleMatrixTop(6, 0b00011011, scaleMatrix);
136170

137171
// With RGB8 output solid red and blue are converted to 0xF8 and green to 0xFA.
138172
// The green bias exists on the whole range of green colors.
@@ -503,8 +537,11 @@ void LGYFB_deinit(void)
503537
#include "fsutil.h"
504538
void LGYFB_dbgDumpFrame(void)
505539
{
506-
GX_displayTransfer((u32*)0x18200000, 160u<<16 | 256u, (u32*)0x18400000, 160u<<16 | 256u, 1u<<12 | 1u<<8);
540+
/*GX_displayTransfer((u32*)0x18200000, 160u<<16 | 256u, (u32*)0x18400000, 160u<<16 | 256u, 1u<<12 | 1u<<8);
541+
GFX_waitForEvent(GFX_EVENT_PPF, false);
542+
fsQuickWrite((void*)0x18400000, "sdmc:/lgyfb_dbg_frame.bgr", 256 * 160 * 3);*/
543+
GX_displayTransfer((u32*)0x18200000, 240u<<16 | 512u, (u32*)0x18400000, 240u<<16 | 512u, 1u<<12 | 1u<<8);
507544
GFX_waitForEvent(GFX_EVENT_PPF, false);
508-
fsQuickWrite((void*)0x18400000, "sdmc:/lgyfb_dbg_frame.bgr", 256 * 160 * 3);
545+
fsQuickWrite((void*)0x18400000, "sdmc:/lgyfb_dbg_frame.bgr", 512 * 240 * 3);
509546
}
510547
#endif

0 commit comments

Comments
 (0)