mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-05 19:51:45 +00:00
Make di.c accept arbitrary FB addresses, fix flickering issues
This commit is contained in:
parent
170cd2d8c4
commit
461e886244
4 changed files with 35 additions and 13 deletions
|
@ -190,10 +190,18 @@ void display_enable_backlight(bool on) {
|
|||
|
||||
u32 *display_init_framebuffer(void *address)
|
||||
{
|
||||
static cfg_op_t conf[sizeof(cfg_display_framebuffer)/sizeof(cfg_op_t)] = {0};
|
||||
if(conf[0].val == 0) {
|
||||
for (u32 i = 0; i < sizeof(cfg_display_framebuffer)/sizeof(cfg_op_t); i++) {
|
||||
conf[i] = cfg_display_framebuffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
u32 *lfb_addr = (u32 *)address;
|
||||
|
||||
//This configures the framebuffer @ 0xC0000000 with a resolution of 1280x720 (line stride 768).
|
||||
exec_cfg((u32 *)DISPLAY_A_BASE, cfg_display_framebuffer, 32);
|
||||
conf[19].val = (u32)address;
|
||||
//This configures the framebuffer @ address with a resolution of 1280x720 (line stride 768).
|
||||
exec_cfg((u32 *)DISPLAY_A_BASE, conf, 32);
|
||||
|
||||
sleep(35000);
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ void load_sbk(void) {
|
|||
|
||||
int main(void) {
|
||||
const char *bct0;
|
||||
u32 *lfb_base;
|
||||
void *lfb_base = (void *)0xC0000000;
|
||||
const char *stage2_path;
|
||||
stage2_args_t stage2_args = {0};
|
||||
|
||||
|
@ -67,12 +67,14 @@ int main(void) {
|
|||
/* TODO: What can be stripped out to make this minimal? */
|
||||
nx_hwinit();
|
||||
|
||||
/* Zero-fill the framebuffer and register it as printk provider. */
|
||||
video_init(lfb_base);
|
||||
|
||||
/* Initialize the display. */
|
||||
display_init();
|
||||
|
||||
/* Register the display as a printk provider. */
|
||||
lfb_base = display_init_framebuffer((void *)0xC0000000);
|
||||
video_init(lfb_base);
|
||||
/* Set the framebuffer. */
|
||||
display_init_framebuffer(lfb_base);
|
||||
|
||||
/* Turn on the backlight after initializing the lfb */
|
||||
/* to avoid flickering. */
|
||||
|
|
|
@ -190,10 +190,18 @@ void display_enable_backlight(bool on) {
|
|||
|
||||
u32 *display_init_framebuffer(void *address)
|
||||
{
|
||||
static cfg_op_t conf[sizeof(cfg_display_framebuffer)/sizeof(cfg_op_t)] = {0};
|
||||
if(conf[0].val == 0) {
|
||||
for (u32 i = 0; i < sizeof(cfg_display_framebuffer)/sizeof(cfg_op_t); i++) {
|
||||
conf[i] = cfg_display_framebuffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
u32 *lfb_addr = (u32 *)address;
|
||||
|
||||
//This configures the framebuffer @ 0xC0000000 with a resolution of 1280x720 (line stride 768).
|
||||
exec_cfg((u32 *)DISPLAY_A_BASE, cfg_display_framebuffer, 32);
|
||||
conf[19].val = (u32)address;
|
||||
//This configures the framebuffer @ address with a resolution of 1280x720 (line stride 768).
|
||||
exec_cfg((u32 *)DISPLAY_A_BASE, conf, 32);
|
||||
|
||||
sleep(35000);
|
||||
|
||||
|
|
|
@ -22,22 +22,26 @@ int main(int argc, void **argv) {
|
|||
loader_ctx_t *loader_ctx = get_loader_ctx();
|
||||
void *framebuffer = memalign(0x1000, CONFIG_VIDEO_VISIBLE_ROWS * CONFIG_VIDEO_COLS * CONFIG_VIDEO_PIXEL_SIZE);
|
||||
|
||||
/* Initialize the display. */
|
||||
display_init();
|
||||
|
||||
/* Note: the framebuffer needs to be >= 0xC0000000, this is fine because of where our heap is. */
|
||||
if (framebuffer == NULL) {
|
||||
generic_panic();
|
||||
}
|
||||
|
||||
/* Initalize the framebuffer and console/stdout */
|
||||
display_init_framebuffer(framebuffer);
|
||||
/* Zero-fill the framebuffer and set the console up. */
|
||||
console_init(framebuffer);
|
||||
|
||||
/* Initialize the display. */
|
||||
display_init();
|
||||
|
||||
/* Set the framebuffer. */
|
||||
display_init_framebuffer(framebuffer);
|
||||
|
||||
/* Turn on the backlight after initializing the lfb */
|
||||
/* to avoid flickering. */
|
||||
display_enable_backlight(true);
|
||||
|
||||
if (argc != STAGE2_ARGC) {
|
||||
printf("Error: Invalid argc (expected %d, got %d)!\n", STAGE2_ARGC, argc);
|
||||
generic_panic();
|
||||
}
|
||||
g_stage2_args = (stage2_args_t *)argv[STAGE2_ARGV_ARGUMENT_STRUCT];
|
||||
|
|
Loading…
Reference in a new issue