Skip to content

Commit

Permalink
Implement accurate LCD RAM read timing, fix other timing errors, impr…
Browse files Browse the repository at this point in the history
…ove pixel batching
  • Loading branch information
calc84maniac committed May 13, 2024
1 parent 43ff7fc commit 22b5006
Show file tree
Hide file tree
Showing 3 changed files with 188 additions and 110 deletions.
14 changes: 7 additions & 7 deletions core/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,20 +164,20 @@ static void lcd_process_pixel(uint32_t *ticks, uint8_t red, uint8_t green, uint8
if (likely(lcd.curRow < lcd.LPP)) {
if (!likely(lcd.curCol) && likely(panel.displayMode == PANEL_DM_RGB)) {
if (!likely(lcd.curRow)) {
for (v = lcd.VBP; v; v--) {
for (v = (lcd.VSW - 1) + lcd.VBP; v; v--) {
if (!panel_hsync()) {
break;
}
panel_refresh_pixels(lcd.HSW + lcd.HBP + lcd.CPL + lcd.HFP);
panel_clock_pixels(lcd.HSW + lcd.HBP + lcd.CPL + lcd.HFP);
}
}
panel_hsync();
panel_refresh_pixels(lcd.HSW + lcd.HBP);
panel_clock_pixels(lcd.HSW + lcd.HBP);
}
if (likely(!sched_active(SCHED_PANEL))) {
panel_refresh_pixels(1);
panel_clock_pixels(1);
} else {
panel_refresh_pixels_until(sched_ticks_remaining_relative(SCHED_PANEL, SCHED_LCD_DMA, *ticks));
panel_clock_pixels_until(sched_ticks_remaining_relative(SCHED_PANEL, SCHED_LCD_DMA, *ticks));
}
if (likely(lcd.curCol < lcd.PPL && panel.params.RAMCTRL.RM)) {
if (!likely(lcd.control & 1 << 11)) {
Expand All @@ -193,13 +193,13 @@ static void lcd_process_pixel(uint32_t *ticks, uint8_t red, uint8_t green, uint8
lcd.curCol = 0;
lcd.curRow++;
if (likely(panel.displayMode == PANEL_DM_RGB)) {
panel_refresh_pixels(lcd.HFP);
panel_clock_pixels(lcd.HFP);
if (unlikely(lcd.curRow >= lcd.LPP)) {
for (v = lcd.VFP; v; v--) {
if (!panel_hsync()) {
break;
}
panel_refresh_pixels(lcd.HSW + lcd.HBP + lcd.CPL + lcd.HFP);
panel_clock_pixels(lcd.HSW + lcd.HBP + lcd.CPL + lcd.HFP);
}
}
}
Expand Down
Loading

0 comments on commit 22b5006

Please sign in to comment.