]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/video/cfb_console.c
Update from 2013.01 to 2013.07
[karo-tx-uboot.git] / drivers / video / cfb_console.c
index 26f673a96a9b8937932df50395cecbac87b0e23f..96ef8f9c2620186d3588439b8e60faaca4821f2f 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2002 ELTEC Elektronik AG
  * Frank Gottschling <fgottschling@eltec.de>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+ 
  */
 
 /*
 #endif
 #endif
 
+#ifdef CONFIG_VIDEO_MXS
+#define VIDEO_FB_16BPP_WORD_SWAP
+#endif
+
 /*
  * Defines for the MB862xx driver
  */
  */
 #include <video_fb.h>
 
+#include <splash.h>
+
 /*
  * some Macros
  */
 #if defined(CONFIG_CMD_BMP) || defined(CONFIG_SPLASH_SCREEN)
 #include <watchdog.h>
 #include <bmp_layout.h>
-
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-#define BMP_ALIGN_CENTER       0x7FFF
-#endif
-
+#include <splash.h>
 #endif
 
 /*
@@ -568,8 +554,6 @@ static void video_drawchars(int xx, int yy, unsigned char *s, int count)
                                        SWAP32((video_font_draw_table32
                                                [bits & 15][3] & eorx) ^ bgx);
                        }
-                       if (cfb_do_flush_cache)
-                               flush_cache((ulong)dest0, 32);
                        dest0 += VIDEO_FONT_WIDTH * VIDEO_PIXEL_SIZE;
                        s++;
                }
@@ -638,8 +622,6 @@ static void video_invertchar(int xx, int yy)
                for (x = firstx; x < lastx; x++) {
                        u8 *dest = (u8 *)(video_fb_address) + x + y;
                        *dest = ~*dest;
-                       if (cfb_do_flush_cache)
-                               flush_cache((ulong)dest, 4);
                }
        }
 }
@@ -683,6 +665,8 @@ void console_cursor(int state)
                }
                cursor_state = state;
        }
+       if (cfb_do_flush_cache)
+               flush_cache(VIDEO_FB_ADRS, VIDEO_SIZE);
 }
 #endif
 
@@ -735,8 +719,6 @@ static void console_clear_line(int line, int begin, int end)
                        memsetl(offset + i * VIDEO_LINE_LEN, size, bgx);
        }
 #endif
-       if (cfb_do_flush_cache)
-               flush_cache((ulong)CONSOLE_ROW_FIRST, CONSOLE_SIZE);
 }
 
 static void console_scrollup(void)
@@ -1142,6 +1124,8 @@ void video_putc(const char c)
 #else
        parse_putc(c);
 #endif
+       if (cfb_do_flush_cache)
+               flush_cache(VIDEO_FB_ADRS, VIDEO_SIZE);
 }
 
 void video_puts(const char *s)
@@ -1515,13 +1499,6 @@ int video_display_bitmap(ulong bmp_image, int x, int y)
 
        padded_line = (((width * bpp + 7) / 8) + 3) & ~0x3;
 
-       /*
-        * Just ignore elements which are completely beyond screen
-        * dimensions.
-        */
-       if ((x >= VIDEO_VISIBLE_COLS) || (y >= VIDEO_VISIBLE_ROWS))
-               return 0;
-
 #ifdef CONFIG_SPLASH_SCREEN_ALIGN
        if (x == BMP_ALIGN_CENTER)
                x = max(0, (VIDEO_VISIBLE_COLS - width) / 2);
@@ -1534,6 +1511,13 @@ int video_display_bitmap(ulong bmp_image, int x, int y)
                y = max(0, VIDEO_VISIBLE_ROWS - height + y + 1);
 #endif /* CONFIG_SPLASH_SCREEN_ALIGN */
 
+       /*
+        * Just ignore elements which are completely beyond screen
+        * dimensions.
+        */
+       if ((x >= VIDEO_VISIBLE_COLS) || (y >= VIDEO_VISIBLE_ROWS))
+               return 0;
+
        if ((x + width) > VIDEO_VISIBLE_COLS)
                width = VIDEO_VISIBLE_COLS - x;
        if ((y + height) > VIDEO_VISIBLE_ROWS)
@@ -1795,6 +1779,8 @@ int video_display_bitmap(ulong bmp_image, int x, int y)
        }
 #endif
 
+       if (cfb_do_flush_cache)
+               flush_cache(VIDEO_FB_ADRS, VIDEO_SIZE);
        return (0);
 }
 #endif
@@ -1970,31 +1956,14 @@ static void *video_logo(void)
        __maybe_unused ulong addr;
        __maybe_unused char *s;
 
-#ifdef CONFIG_SPLASH_SCREEN_ALIGN
-       s = getenv("splashpos");
-       if (s != NULL) {
-               if (s[0] == 'm')
-                       video_logo_xpos = BMP_ALIGN_CENTER;
-               else
-                       video_logo_xpos = simple_strtol(s, NULL, 0);
-
-               s = strchr(s + 1, ',');
-               if (s != NULL) {
-                       if (s[1] == 'm')
-                               video_logo_ypos = BMP_ALIGN_CENTER;
-                       else
-                               video_logo_ypos = simple_strtol(s + 1, NULL, 0);
-               }
-       }
-#endif /* CONFIG_SPLASH_SCREEN_ALIGN */
+       splash_get_pos(&video_logo_xpos, &video_logo_ypos);
 
 #ifdef CONFIG_SPLASH_SCREEN
        s = getenv("splashimage");
        if (s != NULL) {
-
+               splash_screen_prepare();
                addr = simple_strtoul(s, NULL, 16);
 
-
                if (video_display_bitmap(addr,
                                        video_logo_xpos,
                                        video_logo_ypos) == 0) {
@@ -2205,6 +2174,9 @@ static int video_init(void)
        console_col = 0;
        console_row = 0;
 
+       if (cfb_do_flush_cache)
+               flush_cache(VIDEO_FB_ADRS, VIDEO_SIZE);
+
        return 0;
 }