From a63579e119613fe225eb4de39aa5ad88c8e1e4ff Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Fri, 29 Apr 2011 13:20:56 -0300 Subject: [PATCH] ubb-vga2.c (line, frame): start line timer outside the "line" function The indirection introduced with the non-contiguous frame buffer caused significant horizontal distortions. We can compensate for them by starting the timer before loading the line pointer and calling "line". --- ubb-vga/ubb-vga2.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ubb-vga/ubb-vga2.c b/ubb-vga/ubb-vga2.c index e201efd..1a6e6d6 100644 --- a/ubb-vga/ubb-vga2.c +++ b/ubb-vga/ubb-vga2.c @@ -230,8 +230,6 @@ static void line(const uint32_t *line) /* Back porch */ - TCNT(TIMER) = 0; - MSC_STRPCL = 1 << 3; /* reset the MSC */ // while (MSC_STAT & (1 << 15)); @@ -351,8 +349,16 @@ static void frame(void *const *f) PDDATS = HSYNC; until(mode->line_cycles-US(0.79)); - for (p = f; p != f+mode->yres; p++) + /* + * Note: resetting the timer just before calling "line" isn't enough. + * We have t reset it before the loop and right after returning from + * "line". + */ + TCNT(TIMER) = 0; + for (p = f; p != f+mode->yres; p++) { line(*p); + TCNT(TIMER) = 0; + } /* Back porch */ hdelay(14);