Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2008, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
Channagoud Kadabi | 7af9fbc | 2015-02-13 20:09:55 -0800 | [diff] [blame] | 5 | * Copyright (c) 2009-2015, The Linux Foundation. All rights reserved. |
Shashank Mittal | 4f99a88 | 2010-02-01 13:58:50 -0800 | [diff] [blame] | 6 | * |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * * Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * * Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in |
| 14 | * the documentation and/or other materials provided with the |
| 15 | * distribution. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 23 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 24 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 25 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 27 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | * SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #include <debug.h> |
| 32 | #include <err.h> |
| 33 | #include <stdlib.h> |
| 34 | #include <dev/fbcon.h> |
Chandan Uddaraju | 40b227d | 2010-08-03 19:25:41 -0700 | [diff] [blame] | 35 | #include <splash.h> |
Greg Grisco | d625055 | 2011-06-29 14:40:23 -0700 | [diff] [blame] | 36 | #include <platform.h> |
| 37 | #include <string.h> |
Channagoud Kadabi | 7af9fbc | 2015-02-13 20:09:55 -0800 | [diff] [blame] | 38 | #include <arch/ops.h> |
Channagoud Kadabi | 875a2a7 | 2015-04-24 17:26:38 -0700 | [diff] [blame] | 39 | #if ENABLE_WBC |
| 40 | #include <pm_app_smbchg.h> |
| 41 | #endif |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 42 | |
| 43 | #include "font5x12.h" |
| 44 | |
| 45 | struct pos { |
| 46 | int x; |
| 47 | int y; |
| 48 | }; |
| 49 | |
| 50 | static struct fbcon_config *config = NULL; |
| 51 | |
Chandan Uddaraju | 2943fd6 | 2010-06-21 10:56:39 -0700 | [diff] [blame] | 52 | #define RGB565_BLACK 0x0000 |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 53 | #define RGB565_WHITE 0xffff |
| 54 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 55 | #define RGB888_BLACK 0x000000 |
| 56 | #define RGB888_WHITE 0xffffff |
| 57 | |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 58 | #define FONT_WIDTH 5 |
| 59 | #define FONT_HEIGHT 12 |
| 60 | |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 61 | #define SCALE_FACTOR 2 |
| 62 | |
| 63 | static uint32_t BGCOLOR; |
| 64 | static uint32_t FGCOLOR; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 65 | |
| 66 | static struct pos cur_pos; |
| 67 | static struct pos max_pos; |
| 68 | |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 69 | static void fbcon_drawglyph(char *pixels, uint32_t paint, unsigned stride, |
| 70 | unsigned bpp, unsigned *glyph) |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 71 | { |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 72 | unsigned x, y, i, j, k; |
| 73 | unsigned data, temp; |
| 74 | uint32_t fg_color = paint; |
| 75 | stride -= FONT_WIDTH * SCALE_FACTOR; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 76 | |
| 77 | data = glyph[0]; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 78 | for (y = 0; y < FONT_HEIGHT / 2; ++y) { |
| 79 | temp = data; |
| 80 | for (i = 0; i < SCALE_FACTOR; i++) { |
| 81 | data = temp; |
| 82 | for (x = 0; x < FONT_WIDTH; ++x) { |
| 83 | if (data & 1) { |
| 84 | for (j = 0; j < SCALE_FACTOR; j++) { |
| 85 | fg_color = paint; |
| 86 | for (k = 0; k < bpp; k++) { |
| 87 | *pixels = (unsigned char) fg_color; |
| 88 | fg_color = fg_color >> 8; |
| 89 | pixels++; |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | else |
| 94 | { |
| 95 | for (j = 0; j < SCALE_FACTOR; j++) { |
| 96 | pixels = pixels + bpp; |
| 97 | } |
| 98 | } |
| 99 | data >>= 1; |
| 100 | } |
| 101 | pixels += (stride * bpp); |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 102 | } |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 103 | } |
| 104 | |
| 105 | data = glyph[1]; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 106 | for (y = 0; y < FONT_HEIGHT / 2; ++y) { |
| 107 | temp = data; |
| 108 | for (i = 0; i < SCALE_FACTOR; i++) { |
| 109 | data = temp; |
| 110 | for (x = 0; x < FONT_WIDTH; ++x) { |
| 111 | if (data & 1) { |
| 112 | for (j = 0; j < SCALE_FACTOR; j++) { |
| 113 | fg_color = paint; |
| 114 | for (k = 0; k < bpp; k++) { |
| 115 | *pixels = (unsigned char) fg_color; |
| 116 | fg_color = fg_color >> 8; |
| 117 | pixels++; |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | else |
| 122 | { |
| 123 | for (j = 0; j < SCALE_FACTOR; j++) { |
| 124 | pixels = pixels + bpp; |
| 125 | } |
| 126 | } |
| 127 | data >>= 1; |
| 128 | } |
| 129 | pixels += (stride * bpp); |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 130 | } |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 131 | } |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 132 | |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 133 | } |
| 134 | |
Dima Zavin | 25ed994 | 2009-01-28 17:04:19 -0800 | [diff] [blame] | 135 | static void fbcon_flush(void) |
| 136 | { |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 137 | unsigned total_x, total_y; |
| 138 | unsigned bytes_per_bpp; |
| 139 | |
Dima Zavin | 25ed994 | 2009-01-28 17:04:19 -0800 | [diff] [blame] | 140 | if (config->update_start) |
| 141 | config->update_start(); |
| 142 | if (config->update_done) |
| 143 | while (!config->update_done()); |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 144 | |
| 145 | total_x = config->width; |
| 146 | total_y = config->height; |
| 147 | bytes_per_bpp = ((config->bpp) / 8); |
| 148 | arch_clean_invalidate_cache_range((addr_t) config->base, (total_x * total_y * bytes_per_bpp)); |
Dima Zavin | 25ed994 | 2009-01-28 17:04:19 -0800 | [diff] [blame] | 149 | } |
| 150 | |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 151 | /* TODO: Take stride into account */ |
| 152 | static void fbcon_scroll_up(void) |
| 153 | { |
| 154 | unsigned short *dst = config->base; |
| 155 | unsigned short *src = dst + (config->width * FONT_HEIGHT); |
| 156 | unsigned count = config->width * (config->height - FONT_HEIGHT); |
| 157 | |
| 158 | while(count--) { |
| 159 | *dst++ = *src++; |
| 160 | } |
| 161 | |
| 162 | count = config->width * FONT_HEIGHT; |
| 163 | while(count--) { |
| 164 | *dst++ = BGCOLOR; |
| 165 | } |
Dima Zavin | 25ed994 | 2009-01-28 17:04:19 -0800 | [diff] [blame] | 166 | |
| 167 | fbcon_flush(); |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | /* TODO: take stride into account */ |
Shashank Mittal | 4f99a88 | 2010-02-01 13:58:50 -0800 | [diff] [blame] | 171 | void fbcon_clear(void) |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 172 | { |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 173 | unsigned long i = 0, j = 0; |
| 174 | unsigned char *pixels = config->base; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 175 | unsigned count = config->width * config->height; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 176 | uint32_t bg_color; |
| 177 | for (i = 0; i < count; i++) { |
| 178 | bg_color = BGCOLOR; |
| 179 | for (j = 0; j < (config->bpp / 8); j++) { |
| 180 | *pixels = (unsigned char) bg_color; |
| 181 | bg_color = bg_color >> 8; |
| 182 | pixels++; |
| 183 | } |
| 184 | } |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 185 | } |
| 186 | |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 187 | |
| 188 | static void fbcon_set_colors(unsigned bg, unsigned fg) |
| 189 | { |
| 190 | BGCOLOR = bg; |
| 191 | FGCOLOR = fg; |
| 192 | } |
| 193 | |
| 194 | void fbcon_putc(char c) |
| 195 | { |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 196 | char *pixels; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 197 | |
| 198 | /* ignore anything that happens before fbcon is initialized */ |
| 199 | if (!config) |
| 200 | return; |
| 201 | |
| 202 | if((unsigned char)c > 127) |
| 203 | return; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 204 | |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 205 | if((unsigned char)c < 32) { |
| 206 | if(c == '\n') |
| 207 | goto newline; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 208 | else if (c == '\r') { |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 209 | cur_pos.x = 0; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 210 | return; |
| 211 | } |
| 212 | else |
| 213 | return; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 214 | } |
| 215 | |
| 216 | pixels = config->base; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 217 | pixels += cur_pos.y * SCALE_FACTOR * ((config->bpp / 8) * FONT_HEIGHT * config->width); |
| 218 | pixels += cur_pos.x * SCALE_FACTOR * ((config->bpp / 8) * (FONT_WIDTH + 1)); |
| 219 | fbcon_drawglyph(pixels, FGCOLOR, config->stride, (config->bpp / 8), |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 220 | font5x12 + (c - 32) * 2); |
| 221 | |
| 222 | cur_pos.x++; |
| 223 | if (cur_pos.x < max_pos.x) |
| 224 | return; |
| 225 | |
| 226 | newline: |
| 227 | cur_pos.y++; |
| 228 | cur_pos.x = 0; |
| 229 | if(cur_pos.y >= max_pos.y) { |
| 230 | cur_pos.y = max_pos.y - 1; |
| 231 | fbcon_scroll_up(); |
Dima Zavin | 25ed994 | 2009-01-28 17:04:19 -0800 | [diff] [blame] | 232 | } else |
| 233 | fbcon_flush(); |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 234 | } |
| 235 | |
| 236 | void fbcon_setup(struct fbcon_config *_config) |
| 237 | { |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 238 | uint32_t bg = 0; |
| 239 | uint32_t fg = 0; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 240 | |
| 241 | ASSERT(_config); |
| 242 | |
| 243 | config = _config; |
| 244 | |
| 245 | switch (config->format) { |
| 246 | case FB_FORMAT_RGB565: |
Shashank Mittal | c648e71 | 2010-10-06 18:37:42 -0700 | [diff] [blame] | 247 | fg = RGB565_WHITE; |
| 248 | bg = RGB565_BLACK; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 249 | break; |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 250 | case FB_FORMAT_RGB888: |
| 251 | fg = RGB888_WHITE; |
| 252 | bg = RGB888_BLACK; |
| 253 | break; |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 254 | default: |
| 255 | dprintf(CRITICAL, "unknown framebuffer pixel format\n"); |
| 256 | ASSERT(0); |
| 257 | break; |
| 258 | } |
| 259 | |
| 260 | fbcon_set_colors(bg, fg); |
| 261 | |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 262 | cur_pos.x = 0; |
| 263 | cur_pos.y = 0; |
Sandeep Panda | df39f75 | 2015-05-08 14:01:16 +0530 | [diff] [blame] | 264 | max_pos.x = config->width / ((FONT_WIDTH + 1) * SCALE_FACTOR); |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 265 | max_pos.y = (config->height - 1) / FONT_HEIGHT; |
Shashank Mittal | 3704083 | 2010-08-24 15:57:57 -0700 | [diff] [blame] | 266 | #if !DISPLAY_SPLASH_SCREEN |
| 267 | fbcon_clear(); |
| 268 | #endif |
Dima Zavin | d5b0b6a | 2009-01-15 18:09:25 -0800 | [diff] [blame] | 269 | } |
Shashank Mittal | 4f99a88 | 2010-02-01 13:58:50 -0800 | [diff] [blame] | 270 | |
| 271 | struct fbcon_config* fbcon_display(void) |
| 272 | { |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 273 | return config; |
Shashank Mittal | 4f99a88 | 2010-02-01 13:58:50 -0800 | [diff] [blame] | 274 | } |
Chandan Uddaraju | 40b227d | 2010-08-03 19:25:41 -0700 | [diff] [blame] | 275 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 276 | void fbcon_extract_to_screen(logo_img_header *header, void* address) |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 277 | { |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 278 | const uint8_t *imagestart = (const uint8_t *)address; |
| 279 | uint pos = 0, offset; |
| 280 | uint count = 0; |
| 281 | uint x = 0, y = 0; |
| 282 | uint8_t *base, *p; |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 283 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 284 | if (!config || header->width > config->width |
| 285 | || header->height > config->height) { |
| 286 | dprintf(INFO, "the logo img is too large\n"); |
| 287 | return; |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 288 | } |
| 289 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 290 | base = (uint8_t *) config->base; |
| 291 | |
| 292 | /* put the logo to be center */ |
| 293 | offset = (config->height - header->height) / 2; |
| 294 | if (offset) |
| 295 | base += (offset * config->width) * 3; |
| 296 | offset = (config->width - header->width ) / 2; |
| 297 | |
| 298 | x = offset; |
| 299 | while (count < (uint)header->height * (uint)header->width) { |
| 300 | uint8_t run = *(imagestart + pos); |
| 301 | bool repeat_run = (run & 0x80); |
| 302 | uint runlen = (run & 0x7f) + 1; |
| 303 | uint runpos; |
| 304 | |
| 305 | /* consume the run byte */ |
| 306 | pos++; |
| 307 | |
| 308 | p = base + (y * config->width + x) * 3; |
| 309 | |
| 310 | /* start of a run */ |
| 311 | for (runpos = 0; runpos < runlen; runpos++) { |
| 312 | *p++ = *(imagestart + pos); |
| 313 | *p++ = *(imagestart + pos + 1); |
| 314 | *p++ = *(imagestart + pos + 2); |
| 315 | count++; |
| 316 | |
| 317 | x++; |
| 318 | |
| 319 | /* if a run of raw pixels, consume an input pixel */ |
| 320 | if (!repeat_run) |
| 321 | pos += 3; |
| 322 | } |
| 323 | |
| 324 | /* if this was a run of repeated pixels, consume the one input pixel we repeated */ |
| 325 | if (repeat_run) |
| 326 | pos += 3; |
| 327 | |
| 328 | /* the generator will keep compressing data line by line */ |
| 329 | /* don't cross the lines */ |
| 330 | if (x == header->width + offset) { |
| 331 | y++; |
| 332 | x = offset; |
| 333 | } |
| 334 | } |
| 335 | |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 336 | } |
| 337 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 338 | void display_default_image_on_screen(void) |
Chandan Uddaraju | 40b227d | 2010-08-03 19:25:41 -0700 | [diff] [blame] | 339 | { |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 340 | unsigned i = 0; |
| 341 | unsigned total_x; |
| 342 | unsigned total_y; |
| 343 | unsigned bytes_per_bpp; |
| 344 | unsigned image_base; |
Channagoud Kadabi | 875a2a7 | 2015-04-24 17:26:38 -0700 | [diff] [blame] | 345 | #if DISPLAY_TYPE_MIPI |
| 346 | char *image = NULL; |
| 347 | #endif |
Channagoud Kadabi | 956cf50 | 2012-03-08 03:49:50 +0530 | [diff] [blame] | 348 | |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 349 | if (!config) { |
| 350 | dprintf(CRITICAL,"NULL configuration, image cannot be displayed\n"); |
| 351 | return; |
| 352 | } |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 353 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 354 | fbcon_clear(); // clear screen with Black color |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 355 | |
| 356 | total_x = config->width; |
| 357 | total_y = config->height; |
| 358 | bytes_per_bpp = ((config->bpp) / 8); |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 359 | image_base = ((((total_y/2) - (SPLASH_IMAGE_HEIGHT / 2) - 1) * |
| 360 | (config->width)) + (total_x/2 - (SPLASH_IMAGE_WIDTH / 2))); |
Channagoud Kadabi | 956cf50 | 2012-03-08 03:49:50 +0530 | [diff] [blame] | 361 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 362 | #if DISPLAY_TYPE_MIPI |
Channagoud Kadabi | 875a2a7 | 2015-04-24 17:26:38 -0700 | [diff] [blame] | 363 | #if ENABLE_WBC |
| 364 | image = (pm_appsbl_charging_in_progress() ? image_batt888 : imageBuffer_rgb888); |
| 365 | #else |
| 366 | image = imageBuffer_rgb888; |
| 367 | #endif |
| 368 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 369 | if (bytes_per_bpp == 3) { |
| 370 | for (i = 0; i < SPLASH_IMAGE_HEIGHT; i++) { |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 371 | memcpy (config->base + ((image_base + (i * (config->width))) * bytes_per_bpp), |
Channagoud Kadabi | 875a2a7 | 2015-04-24 17:26:38 -0700 | [diff] [blame] | 372 | image + (i * SPLASH_IMAGE_WIDTH * bytes_per_bpp), |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 373 | SPLASH_IMAGE_WIDTH * bytes_per_bpp); |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 374 | } |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 375 | } |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 376 | fbcon_flush(); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 377 | #if DISPLAY_MIPI_PANEL_NOVATEK_BLUE |
Aparna Mallavarapu | ce06a01 | 2013-09-06 23:03:24 +0530 | [diff] [blame] | 378 | if(is_cmd_mode_enabled()) |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 379 | mipi_dsi_cmd_mode_trigger(); |
Kinson Chik | e5c9343 | 2011-06-17 09:10:29 -0700 | [diff] [blame] | 380 | #endif |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 381 | |
Chandan Uddaraju | 78ae675 | 2010-10-19 12:57:10 -0700 | [diff] [blame] | 382 | #else |
Zohaib Alam | 0370875 | 2014-10-23 17:51:57 -0400 | [diff] [blame] | 383 | |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 384 | if (bytes_per_bpp == 2) { |
| 385 | for (i = 0; i < SPLASH_IMAGE_HEIGHT; i++) { |
| 386 | memcpy (config->base + ((image_base + (i * (config->width))) * bytes_per_bpp), |
| 387 | imageBuffer + (i * SPLASH_IMAGE_WIDTH * bytes_per_bpp), |
| 388 | SPLASH_IMAGE_WIDTH * bytes_per_bpp); |
Zohaib Alam | 0370875 | 2014-10-23 17:51:57 -0400 | [diff] [blame] | 389 | } |
| 390 | } |
| 391 | fbcon_flush(); |
Chandan Uddaraju | fe93e82 | 2010-11-21 20:44:47 -0800 | [diff] [blame] | 392 | #endif |
Chandan Uddaraju | 40b227d | 2010-08-03 19:25:41 -0700 | [diff] [blame] | 393 | } |
Mao Flynn | 7b379f3 | 2015-04-20 00:28:30 +0800 | [diff] [blame] | 394 | |
| 395 | |
| 396 | void display_image_on_screen(void) |
| 397 | { |
| 398 | #if DISPLAY_TYPE_MIPI |
| 399 | int fetch_image_from_partition(); |
| 400 | |
| 401 | if (fetch_image_from_partition() < 0) { |
| 402 | display_default_image_on_screen(); |
| 403 | } else { |
| 404 | /* data has been put into the right place */ |
| 405 | fbcon_flush(); |
| 406 | } |
| 407 | #else |
| 408 | display_default_image_on_screen(); |
| 409 | #endif |
| 410 | } |