Travis Geiselbrecht | 4c68d02 | 2010-05-21 22:50:27 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2010 Travis Geiselbrecht |
| 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining |
| 5 | * a copy of this software and associated documentation files |
| 6 | * (the "Software"), to deal in the Software without restriction, |
| 7 | * including without limitation the rights to use, copy, modify, merge, |
| 8 | * publish, distribute, sublicense, and/or sell copies of the Software, |
| 9 | * and to permit persons to whom the Software is furnished to do so, |
| 10 | * subject to the following conditions: |
| 11 | * |
| 12 | * The above copyright notice and this permission notice shall be |
| 13 | * included in all copies or substantial portions of the Software. |
| 14 | * |
| 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
| 19 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
| 20 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
| 21 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
| 23 | #include <err.h> |
| 24 | #include <debug.h> |
| 25 | #include <platform.h> |
| 26 | #include "platform_p.h" |
| 27 | #include <platform/armemu.h> |
| 28 | #include <dev/display.h> |
| 29 | #include <lib/gfx.h> |
| 30 | #include <reg.h> |
| 31 | |
| 32 | static int display_w, display_h; |
| 33 | static void *display_fb; |
| 34 | |
| 35 | inline static int has_display(void) |
| 36 | { |
| 37 | return *REG32(SYSINFO_FEATURES) & SYSINFO_FEATURE_DISPLAY; |
| 38 | } |
| 39 | |
| 40 | void platform_init_display(void) |
| 41 | { |
| 42 | if (!has_display()) |
| 43 | return; |
| 44 | |
| 45 | display_fb = (void *)DISPLAY_FRAMEBUFFER; |
Travis Geiselbrecht | d4c88e2 | 2010-06-04 14:12:35 -0700 | [diff] [blame] | 46 | display_w = *REG32(DISPLAY_WIDTH); |
| 47 | display_h = *REG32(DISPLAY_HEIGHT); |
Travis Geiselbrecht | 4c68d02 | 2010-05-21 22:50:27 -0700 | [diff] [blame] | 48 | |
| 49 | gfx_draw_pattern(); |
| 50 | } |
| 51 | |
| 52 | void display_get_info(struct display_info *info) |
| 53 | { |
| 54 | if (!has_display()) |
| 55 | return; |
| 56 | |
| 57 | info->framebuffer = display_fb; |
| 58 | info->format = GFX_FORMAT_RGB_x888; |
| 59 | info->width = display_w; |
| 60 | info->height = display_h; |
| 61 | info->stride = display_w; |
| 62 | info->flush = NULL; |
| 63 | } |
| 64 | |