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

Unified Diff: target/stm32f746g-disco/lcd.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « target/stm32746g-eval2/lcd.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: target/stm32f746g-disco/lcd.c
diff --git a/target/stm32f746g-disco/lcd.c b/target/stm32f746g-disco/lcd.c
index fd0f6bbe5042731235508419f6f8eff1b9eefd1e..3a27996494cc774339043f8864ca445ce56fa8ab 100644
--- a/target/stm32f746g-disco/lcd.c
+++ b/target/stm32f746g-disco/lcd.c
@@ -54,7 +54,6 @@
#include <target.h>
#include <compiler.h>
#include <string.h>
-#include <lib/gfx.h>
#include <dev/gpio.h>
#include <dev/display.h>
#include <kernel/novm.h>
@@ -402,14 +401,37 @@ uint8_t BSP_LCD_Init(void)
}
/* LK display (lib/gfx.h) calls this function */
-status_t display_get_info(struct display_info *info)
+status_t display_get_framebuffer(struct display_framebuffer *fb)
{
- info->framebuffer = (void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress;
+ fb->image.pixels = (void *)ltdc_handle.LayerCfg[active_layer].FBStartAdress;
if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) {
- info->format = GFX_FORMAT_ARGB_8888;
+ fb->format = DISPLAY_FORMAT_ARGB_8888;
+ fb->image.format = IMAGE_FORMAT_ARGB_8888;
+ fb->image.rowbytes = BSP_LCD_GetXSize() * 4;
} else if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565) {
- info->format = GFX_FORMAT_RGB_565;
+ fb->format = DISPLAY_FORMAT_RGB_565;
+ fb->image.format = IMAGE_FORMAT_RGB_565;
+ fb->image.rowbytes = BSP_LCD_GetXSize() * 2;
+ } else {
+ panic("unhandled pixel format\n");
+ return ERR_NOT_FOUND;
+ }
+
+ fb->image.width = BSP_LCD_GetXSize();
+ fb->image.height = BSP_LCD_GetYSize();
+ fb->image.stride = BSP_LCD_GetXSize();
+ fb->flush = NULL;
+
+ return NO_ERROR;
+}
+
+status_t display_get_info(struct display_info *info)
+{
+ if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB8888) {
+ info->format = DISPLAY_FORMAT_ARGB_8888;
+ } else if (ltdc_handle.LayerCfg[active_layer].PixelFormat == LTDC_PIXEL_FORMAT_RGB565) {
+ info->format = DISPLAY_FORMAT_RGB_565;
} else {
panic("unhandled pixel format\n");
return ERR_NOT_FOUND;
@@ -417,9 +439,6 @@ status_t display_get_info(struct display_info *info)
info->width = BSP_LCD_GetXSize();
info->height = BSP_LCD_GetYSize();
- info->stride = BSP_LCD_GetXSize();
- info->flush = NULL;
return NO_ERROR;
}
-
« no previous file with comments | « target/stm32746g-eval2/lcd.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698