Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: platform/armemu/display.c

Issue 1777783003: [display] Refactor to avoid implicit framebuffer allocation. (Closed) Base URL: https://github.com/littlekernel/lk.git@master
Patch Set: fix stride confusion Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/text/text.c ('k') | target/dartuinoP0/display/LS013B7DH06.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010 Travis Geiselbrecht 2 * Copyright (c) 2010 Travis Geiselbrecht
3 * 3 *
4 * Permission is hereby granted, free of charge, to any person obtaining 4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files 5 * a copy of this software and associated documentation files
6 * (the "Software"), to deal in the Software without restriction, 6 * (the "Software"), to deal in the Software without restriction,
7 * including without limitation the rights to use, copy, modify, merge, 7 * including without limitation the rights to use, copy, modify, merge,
8 * publish, distribute, sublicense, and/or sell copies of the Software, 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, 9 * and to permit persons to whom the Software is furnished to do so,
10 * subject to the following conditions: 10 * subject to the following conditions:
(...skipping 10 matching lines...) Expand all
21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */ 22 */
23 #include <err.h> 23 #include <err.h>
24 #include <debug.h> 24 #include <debug.h>
25 #include <platform.h> 25 #include <platform.h>
26 #include "platform_p.h" 26 #include "platform_p.h"
27 #include <platform/armemu.h> 27 #include <platform/armemu.h>
28 #include <dev/display.h> 28 #include <dev/display.h>
29 #include <lib/gfx.h> 29 #include <lib/gfx.h>
30 #include <reg.h> 30 #include <reg.h>
31 #include <assert.h>
31 32
32 #define DRAW_TEST_PATTERN 0 33 #define DRAW_TEST_PATTERN 0
33 34
34 static int display_w, display_h; 35 static int display_w, display_h;
35 static void *display_fb; 36 static void *display_fb;
36 37
37 inline static int has_display(void) 38 inline static int has_display(void)
38 { 39 {
39 return *REG32(SYSINFO_FEATURES) & SYSINFO_FEATURE_DISPLAY; 40 return *REG32(SYSINFO_FEATURES) & SYSINFO_FEATURE_DISPLAY;
40 } 41 }
41 42
42 void platform_init_display(void) 43 void platform_init_display(void)
43 { 44 {
44 if (!has_display()) 45 if (!has_display())
45 return; 46 return;
46 47
47 display_fb = (void *)DISPLAY_FRAMEBUFFER; 48 display_fb = (void *)DISPLAY_FRAMEBUFFER;
48 display_w = *REG32(DISPLAY_WIDTH); 49 display_w = *REG32(DISPLAY_WIDTH);
49 display_h = *REG32(DISPLAY_HEIGHT); 50 display_h = *REG32(DISPLAY_HEIGHT);
50 51
51 #if DRAW_TEST_PATTERN 52 #if DRAW_TEST_PATTERN
52 gfx_draw_pattern(); 53 gfx_draw_pattern();
53 #endif 54 #endif
54 } 55 }
55 56
57 status_t display_get_framebuffer(struct display_framebuffer *fb)
58 {
59 DEBUG_ASSERT(fb);
60 if (!has_display())
61 return ERR_NOT_FOUND;
62
63 fb->image.format = IMAGE_FORMAT_RGB_x888;
64 fb->image.pixels = display_fb;
65 fb->image.width = display_w;
66 fb->image.height = display_h;
67 fb->image.stride = display_w;
68 fb->image.rowbytes = display_w * 4;
69 fb->flush = NULL;
70 fb->format = DISPLAY_FORMAT_RGB_x888;
71
72 return NO_ERROR;
73 }
74
56 status_t display_get_info(struct display_info *info) 75 status_t display_get_info(struct display_info *info)
57 { 76 {
77 DEBUG_ASSERT(info);
58 if (!has_display()) 78 if (!has_display())
59 return ERR_NOT_FOUND; 79 return ERR_NOT_FOUND;
60 80
61 info->framebuffer = display_fb; 81 info->format = DISPLAY_FORMAT_RGB_x888;
62 info->format = GFX_FORMAT_RGB_x888;
63 info->width = display_w; 82 info->width = display_w;
64 info->height = display_h; 83 info->height = display_h;
65 info->stride = display_w;
66 info->flush = NULL;
67 84
68 return NO_ERROR; 85 return NO_ERROR;
69 } 86 }
70 87
OLDNEW
« no previous file with comments | « lib/text/text.c ('k') | target/dartuinoP0/display/LS013B7DH06.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698