@@ -117,22 +117,56 @@ void LGYFB_init(void)
117
117
{
118
118
if (DMA330_run (0 , program )) return ;
119
119
120
+ //REG_LGYFB_TOP_SIZE = LGYFB_SIZE(240u, 160u);
120
121
REG_LGYFB_TOP_SIZE = LGYFB_SIZE (360u , 240u );
121
122
REG_LGYFB_TOP_STAT = LGYFB_IRQ_MASK ;
122
123
REG_LGYFB_TOP_IRQ = 0 ;
123
124
REG_LGYFB_TOP_ALPHA = 0xFF ;
124
125
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 ] =
126
141
{
142
+ // Original from AGB_FIRM.
127
143
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, // in[-3]
128
144
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, // in[-2]
129
145
{ 0 , 0x2000 , 0x4000 , 0 , 0x2000 , 0x4000 , 0 , 0 }, // in[-1]
130
146
{0x4000 , 0x2000 , 0 , 0x4000 , 0x2000 , 0 , 0 , 0 }, // in[0]
131
147
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }, // in[1]
132
148
{ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } // in[2]
133
149
// 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]
134
168
};
135
- setScaleMatrixTop (6 , 0b00011011 , matrix );
169
+ setScaleMatrixTop (6 , 0b00011011 , scaleMatrix );
136
170
137
171
// With RGB8 output solid red and blue are converted to 0xF8 and green to 0xFA.
138
172
// The green bias exists on the whole range of green colors.
@@ -503,8 +537,11 @@ void LGYFB_deinit(void)
503
537
#include "fsutil.h"
504
538
void LGYFB_dbgDumpFrame (void )
505
539
{
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 );
507
544
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 );
509
546
}
510
547
#endif
0 commit comments