blob: 5b339659dd6a8199170fc695ea4dc853d888d167 [file] [log] [blame]
Travis Geiselbrecht4c68d022010-05-21 22:50:27 -07001/*
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
32static int display_w, display_h;
33static void *display_fb;
34
35inline static int has_display(void)
36{
37 return *REG32(SYSINFO_FEATURES) & SYSINFO_FEATURE_DISPLAY;
38}
39
40void platform_init_display(void)
41{
42 if (!has_display())
43 return;
44
45 display_fb = (void *)DISPLAY_FRAMEBUFFER;
Travis Geiselbrechtd4c88e22010-06-04 14:12:35 -070046 display_w = *REG32(DISPLAY_WIDTH);
47 display_h = *REG32(DISPLAY_HEIGHT);
Travis Geiselbrecht4c68d022010-05-21 22:50:27 -070048
49 gfx_draw_pattern();
50}
51
52void 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