aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorcstout <cstout@google.com>2016-03-10 09:49:22 -0800
committercstout <cstout@google.com>2016-03-10 09:49:22 -0800
commitc1255f7f471cab1024440e107faa63c5cf49262b (patch)
tree4103aae97b6d6790708d6bd20253f3db79c20601 /platform
parente290cb1b8b1dea29f0247bda4cf92725b8acf017 (diff)
downloadcommon-c1255f7f471cab1024440e107faa63c5cf49262b.tar.gz
[display] Refactor to avoid implicit framebuffer allocation.
Preparation to allow other images to be presented to the display. Separate definitions of display and image formats. display_get_info no longer provides a framebuffer. display_get_framebuffer allocates a framebuffer for convenience. Review URL: https://codereview.chromium.org/1777783003 .
Diffstat (limited to 'platform')
-rw-r--r--platform/armemu/display.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/platform/armemu/display.c b/platform/armemu/display.c
index 72ecb7be..0ab09bae 100644
--- a/platform/armemu/display.c
+++ b/platform/armemu/display.c
@@ -28,6 +28,7 @@
#include <dev/display.h>
#include <lib/gfx.h>
#include <reg.h>
+#include <assert.h>
#define DRAW_TEST_PATTERN 0
@@ -53,17 +54,33 @@ void platform_init_display(void)
#endif
}
+status_t display_get_framebuffer(struct display_framebuffer *fb)
+{
+ DEBUG_ASSERT(fb);
+ if (!has_display())
+ return ERR_NOT_FOUND;
+
+ fb->image.format = IMAGE_FORMAT_RGB_x888;
+ fb->image.pixels = display_fb;
+ fb->image.width = display_w;
+ fb->image.height = display_h;
+ fb->image.stride = display_w;
+ fb->image.rowbytes = display_w * 4;
+ fb->flush = NULL;
+ fb->format = DISPLAY_FORMAT_RGB_x888;
+
+ return NO_ERROR;
+}
+
status_t display_get_info(struct display_info *info)
{
+ DEBUG_ASSERT(info);
if (!has_display())
return ERR_NOT_FOUND;
- info->framebuffer = display_fb;
- info->format = GFX_FORMAT_RGB_x888;
+ info->format = DISPLAY_FORMAT_RGB_x888;
info->width = display_w;
info->height = display_h;
- info->stride = display_w;
- info->flush = NULL;
return NO_ERROR;
}