Force LgyFb to insert 16 pixels of padding horizontally. Makes tiled output finally work.

This commit is contained in:
profi200 2020-05-14 16:27:11 +02:00
parent 31da2d7f62
commit 63f03cd824
No known key found for this signature in database
GPG Key ID: 17B42AE5911139F3
4 changed files with 10 additions and 21 deletions

View File

@ -19,8 +19,8 @@
#define LGYFB_DMA_E (1u<<15) #define LGYFB_DMA_E (1u<<15)
#define LGYFB_UNK (1u<<16) #define LGYFB_UNK (1u<<16)
// REG_LGYFB_SIZE // REG_LGYFB_SIZE width and hight
#define LGYFB_SIZE(v, h) (((v) - 1)<<16 | ((h) - 1)) #define LGYFB_SIZE(w, h) (((h) - 1)<<16 | ((w) - 1))
// REG_LGYFB_STAT and REG_LGYFB_IRQ // REG_LGYFB_STAT and REG_LGYFB_IRQ
#define LGYFB_IRQ_DMA_REQ (1u) #define LGYFB_IRQ_DMA_REQ (1u)

View File

@ -51,20 +51,18 @@ void LGYFB_init(void)
{ {
if(DMA330_run(0, program)) return; if(DMA330_run(0, program)) return;
REG_LGYFB_TOP_SIZE = LGYFB_SIZE(160u, 240u); // Insert 16 pixels padding horizontally to fit the texture.
REG_LGYFB_TOP_SIZE = LGYFB_SIZE(256u, 160u);
REG_LGYFB_TOP_STAT = LGYFB_IRQ_MASK; REG_LGYFB_TOP_STAT = LGYFB_IRQ_MASK;
REG_LGYFB_TOP_IRQ = 0; REG_LGYFB_TOP_IRQ = 0;
REG_LGYFB_TOP_ALPHA = 0xFF; REG_LGYFB_TOP_ALPHA = 0xFF;
REG_LGYFB_TOP_CNT = LGYFB_DMA_E /*| LGYFB_OUT_SWIZZLE*/ | LGYFB_OUT_FMT_5551 | LGYFB_ENABLE; REG_LGYFB_TOP_CNT = LGYFB_DMA_E | LGYFB_OUT_SWIZZLE | LGYFB_OUT_FMT_5551 | LGYFB_ENABLE;
IRQ_registerHandler(IRQ_CDMA_EVENT0, 13, 0, true, lgyFbDmaIrqHandler); IRQ_registerHandler(IRQ_CDMA_EVENT0, 13, 0, true, lgyFbDmaIrqHandler);
} }
void rotateFrame(void) void rotateFrame(void)
{ {
GX_displayTransfer((u32*)0x18400000, 160u<<16 | 256u, (u32*)0x18200000, 160u<<16 | 256u, 3u<<12 | 3u<<8 | 1u<<1);
GFX_waitForEvent(GFX_EVENT_PPF, false);
alignas(16) static const u8 firstList[1136] = alignas(16) static const u8 firstList[1136] =
{ {
0x01, 0x00, 0x00, 0x00, 0x10, 0x01, 0x0F, 0x00, 0x00, 0x00, 0x06, 0x03, 0x01, 0x00, 0x00, 0x00, 0x10, 0x01, 0x0F, 0x00, 0x00, 0x00, 0x06, 0x03,

View File

@ -1,9 +1,9 @@
# 8 bytes burst with 4 transfers. Total 32 bytes per burst. # 8 bytes burst with 16 transfers. Total 128 bytes per burst.
# Source fixed address and destination incrementing. # Source fixed address and destination incrementing.
# Source and destination unprivileged, non-secure data access. # Source and destination unprivileged, non-secure data access.
MOV CCR, SB4 SS64 SAF SP2 DB4 DS64 DAI DP2 MOV CCR, SB16 SS64 SAF SP2 DB16 DS64 DAI DP2
MOV SAR, 0x10311000 MOV SAR, 0x10311000
MOV DAR, 0x18400000 MOV DAR, 0x18200000
FLUSHP 14 FLUSHP 14
@ -16,21 +16,12 @@ LPFE
# LgyFb sometimes (at the end of each scanline?) sends # LgyFb sometimes (at the end of each scanline?) sends
# single requests. Since we can transfer all 8 scanlines # single requests. Since we can transfer all 8 scanlines
# with bursts only we will ignore them. # with bursts only we will ignore them.
LP 7 LP 31
LP 15
LDB
STB
LPENDB
ADDH DAR, 0x20
LPENDB
LP 14
LDB LDB
STB STB
LPENDB LPENDB
LDPB 14 LDPB 14
STB STB
ADDH DAR, 0x20
LPEND LPEND
WMB WMB
SEV 0 SEV 0

View File

@ -36,7 +36,7 @@ void clearScreens(void)
void updateScreens(void) void updateScreens(void)
{ {
GX_textureCopy((u32*)RENDERBUF_TOP, 0, (u32*)GFX_getFramebuffer(SCREEN_TOP), GX_textureCopy(RENDERBUF_TOP, 0, GFX_getFramebuffer(SCREEN_TOP),
0, SCREEN_SIZE_TOP + SCREEN_SIZE_BOT); 0, SCREEN_SIZE_TOP + SCREEN_SIZE_BOT);
GFX_waitForEvent(GFX_EVENT_PPF, true); // Texture copy GFX_waitForEvent(GFX_EVENT_PPF, true); // Texture copy
GFX_swapFramebufs(); GFX_swapFramebufs();