Reinstate framebuffer setup on initScreens to allow old Luma to be chainloaded if FB address changes in b9s/new Luma, remove useless clearScreens for the alternate FBs after the first init

This commit is contained in:
Aurora Wright 2017-07-09 19:06:42 +02:00
parent 557f2057f7
commit 37ba2c15de
5 changed files with 20 additions and 11 deletions

View File

@ -37,7 +37,7 @@ extern u32 prepareForFirmlaunchSize;
extern volatile Arm11Operation operation; extern volatile Arm11Operation operation;
static void initScreens(u32 brightnessLevel, struct fb *fbs) static void initScreens(u32 brightnessLevel)
{ {
*(vu32 *)0x10141200 = 0x1007F; *(vu32 *)0x10141200 = 0x1007F;
*(vu32 *)0x10202014 = 0x00000001; *(vu32 *)0x10202014 = 0x00000001;
@ -70,13 +70,9 @@ static void initScreens(u32 brightnessLevel, struct fb *fbs)
*(vu32 *)0x1040045C = 0x00f00190; *(vu32 *)0x1040045C = 0x00f00190;
*(vu32 *)0x10400460 = 0x01c100d1; *(vu32 *)0x10400460 = 0x01c100d1;
*(vu32 *)0x10400464 = 0x01920002; *(vu32 *)0x10400464 = 0x01920002;
*(vu32 *)0x10400468 = (u32)fbs[0].top_left;
*(vu32 *)0x1040046C = (u32)fbs[1].top_left;
*(vu32 *)0x10400470 = 0x80341; *(vu32 *)0x10400470 = 0x80341;
*(vu32 *)0x10400474 = 0x00010501; *(vu32 *)0x10400474 = 0x00010501;
*(vu32 *)0x10400478 = 0; *(vu32 *)0x10400478 = 0;
*(vu32 *)0x10400494 = (u32)fbs[0].top_right;
*(vu32 *)0x10400498 = (u32)fbs[1].top_right;
*(vu32 *)0x10400490 = 0x000002D0; *(vu32 *)0x10400490 = 0x000002D0;
*(vu32 *)0x1040049C = 0x00000000; *(vu32 *)0x1040049C = 0x00000000;
@ -107,8 +103,6 @@ static void initScreens(u32 brightnessLevel, struct fb *fbs)
*(vu32 *)0x1040055C = 0x00f00140; *(vu32 *)0x1040055C = 0x00f00140;
*(vu32 *)0x10400560 = 0x01c100d1; *(vu32 *)0x10400560 = 0x01c100d1;
*(vu32 *)0x10400564 = 0x01920052; *(vu32 *)0x10400564 = 0x01920052;
*(vu32 *)0x10400568 = (u32)fbs[0].bottom;
*(vu32 *)0x1040056C = (u32)fbs[1].bottom;
*(vu32 *)0x10400570 = 0x80301; *(vu32 *)0x10400570 = 0x80301;
*(vu32 *)0x10400574 = 0x00010501; *(vu32 *)0x10400574 = 0x00010501;
*(vu32 *)0x10400578 = 0; *(vu32 *)0x10400578 = 0;
@ -120,6 +114,16 @@ static void initScreens(u32 brightnessLevel, struct fb *fbs)
*(vu32 *)0x10400584 = 0x10101 * i; *(vu32 *)0x10400584 = 0x10101 * i;
} }
static void setupFramebuffers(struct fb *fbs)
{
*(vu32 *)0x10400468 = (u32)fbs[0].top_left;
*(vu32 *)0x1040046c = (u32)fbs[1].top_left;
*(vu32 *)0x10400494 = (u32)fbs[0].top_right;
*(vu32 *)0x10400498 = (u32)fbs[1].top_right;
*(vu32 *)0x10400568 = (u32)fbs[0].bottom;
*(vu32 *)0x1040056c = (u32)fbs[1].bottom;
}
static void clearScreens(struct fb *fb) static void clearScreens(struct fb *fb)
{ {
//Setting up two simultaneous memory fills using the GPU //Setting up two simultaneous memory fills using the GPU
@ -173,7 +177,10 @@ void main(void)
case ARM11_READY: case ARM11_READY:
continue; continue;
case INIT_SCREENS: case INIT_SCREENS:
initScreens(*(vu32 *)ARM11_PARAMETERS_ADDRESS, (struct fb *)(ARM11_PARAMETERS_ADDRESS + 4)); initScreens(*(vu32 *)ARM11_PARAMETERS_ADDRESS);
break;
case SETUP_FRAMEBUFFERS:
setupFramebuffers((struct fb *)ARM11_PARAMETERS_ADDRESS);
break; break;
case CLEAR_SCREENS: case CLEAR_SCREENS:
clearScreens((struct fb *)ARM11_PARAMETERS_ADDRESS); clearScreens((struct fb *)ARM11_PARAMETERS_ADDRESS);

View File

@ -55,6 +55,7 @@ struct fb {
typedef enum typedef enum
{ {
INIT_SCREENS = 0, INIT_SCREENS = 0,
SETUP_FRAMEBUFFERS,
CLEAR_SCREENS, CLEAR_SCREENS,
SWAP_FRAMEBUFFERS, SWAP_FRAMEBUFFERS,
UPDATE_BRIGHTNESS, UPDATE_BRIGHTNESS,

View File

@ -49,7 +49,6 @@ bool loadSplash(void)
if(!isTopSplashValid && !isBottomSplashValid) return false; if(!isTopSplashValid && !isBottomSplashValid) return false;
initScreens(); initScreens();
clearScreens(true);
if(isTopSplashValid) isTopSplashValid = fileRead(fbs[1].top_left, topSplashFile, SCREEN_TOP_FBSIZE) == SCREEN_TOP_FBSIZE; if(isTopSplashValid) isTopSplashValid = fileRead(fbs[1].top_left, topSplashFile, SCREEN_TOP_FBSIZE) == SCREEN_TOP_FBSIZE;
if(isBottomSplashValid) isBottomSplashValid = fileRead(fbs[1].bottom, bottomSplashFile, SCREEN_BOTTOM_FBSIZE) == SCREEN_BOTTOM_FBSIZE; if(isBottomSplashValid) isBottomSplashValid = fileRead(fbs[1].bottom, bottomSplashFile, SCREEN_BOTTOM_FBSIZE) == SCREEN_BOTTOM_FBSIZE;

View File

@ -99,7 +99,6 @@ void initScreens(void)
if(!ARESCREENSINITIALIZED) if(!ARESCREENSINITIALIZED)
{ {
*(vu32 *)ARM11_PARAMETERS_ADDRESS = brightness[MULTICONFIG(BRIGHTNESS)]; *(vu32 *)ARM11_PARAMETERS_ADDRESS = brightness[MULTICONFIG(BRIGHTNESS)];
memcpy((void *)(ARM11_PARAMETERS_ADDRESS + 4), fbs, sizeof(fbs));
invokeArm11Function(INIT_SCREENS); invokeArm11Function(INIT_SCREENS);
//Turn on backlight //Turn on backlight
@ -107,10 +106,12 @@ void initScreens(void)
} }
else updateBrightness(MULTICONFIG(BRIGHTNESS)); else updateBrightness(MULTICONFIG(BRIGHTNESS));
memcpy((void *)ARM11_PARAMETERS_ADDRESS, fbs, sizeof(fbs));
invokeArm11Function(SETUP_FRAMEBUFFERS);
clearScreens(true);
needToSetup = false; needToSetup = false;
} }
clearScreens(false); clearScreens(false);
clearScreens(true);
swapFramebuffers(false); swapFramebuffers(false);
} }

View File

@ -54,6 +54,7 @@ struct fb {
typedef enum typedef enum
{ {
INIT_SCREENS = 0, INIT_SCREENS = 0,
SETUP_FRAMEBUFFERS,
CLEAR_SCREENS, CLEAR_SCREENS,
SWAP_FRAMEBUFFERS, SWAP_FRAMEBUFFERS,
UPDATE_BRIGHTNESS, UPDATE_BRIGHTNESS,