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

Side by Side Diff: target/stm32746g-eval2/lcd.c

Issue 1777783003: [display] Refactor to avoid implicit framebuffer allocation. (Closed) Base URL: https://github.com/littlekernel/lk.git@master
Patch Set: update other targets 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 Travis Geiselbrecht 2 * Copyright (c) 2015 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * 47 *
48 ****************************************************************************** 48 ******************************************************************************
49 */ 49 */
50 50
51 #include <err.h> 51 #include <err.h>
52 #include <debug.h> 52 #include <debug.h>
53 #include <trace.h> 53 #include <trace.h>
54 #include <target.h> 54 #include <target.h>
55 #include <compiler.h> 55 #include <compiler.h>
56 #include <string.h> 56 #include <string.h>
57 #include <lib/gfx.h>
58 #include <dev/gpio.h> 57 #include <dev/gpio.h>
59 #include <dev/display.h> 58 #include <dev/display.h>
60 #include <arch/ops.h> 59 #include <arch/ops.h>
61 #include <platform/stm32.h> 60 #include <platform/stm32.h>
62 61
63 /* 62 /*
64 * lcd initialization sequence, taken from 63 * lcd initialization sequence, taken from
65 * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32756G_EVAL/stm32756g_eval_lcd.[ch] 64 * STM32Cube_FW_F7_V1.1.0/Drivers/BSP/STM32756G_EVAL/stm32756g_eval_lcd.[ch]
66 */ 65 */
67 66
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 /* clear it out */ 381 /* clear it out */
383 memset((void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress, 0, BSP_LCD_Get XSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize()); 382 memset((void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress, 0, BSP_LCD_Get XSize() * BSP_LCD_GetYSize() * BSP_LCD_PixelSize());
384 383
385 /* turn the display on */ 384 /* turn the display on */
386 BSP_LCD_DisplayOn(); 385 BSP_LCD_DisplayOn();
387 386
388 return LCD_OK; 387 return LCD_OK;
389 } 388 }
390 389
391 /* LK display api here */ 390 /* LK display api here */
392 status_t display_get_info(struct display_info *info) 391 status_t display_get_framebuffer(struct display_framebuffer *fb)
393 { 392 {
394 info->framebuffer = (void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress; 393 fb->image.pixels = (void *)hLtdcEval.LayerCfg[ActiveLayer].FBStartAdress;
395 394
396 if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB888 8) { 395 if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB888 8) {
397 info->format = GFX_FORMAT_ARGB_8888; 396 fb->format = DISPLAY_FORMAT_ARGB_8888;
397 fb->image.format = IMAGE_FORMAT_ARGB_8888;
398 } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ RGB565) { 398 } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ RGB565) {
399 info->format = GFX_FORMAT_RGB_565; 399 fb->format = DISPLAY_FORMAT_RGB_565;
400 fb->image.format = IMAGE_FORMAT_RGB_565;
400 } else { 401 } else {
401 panic("unhandled pixel format\n"); 402 panic("unhandled pixel format\n");
402 return ERR_NOT_FOUND; 403 return ERR_NOT_FOUND;
404 }
405
406 fb->image.width = BSP_LCD_GetXSize();
407 fb->image.height = BSP_LCD_GetYSize();
408 fb->image.rowbytes = BSP_LCD_GetXSize();
409 fb->flush = NULL;
410
411 return NO_ERROR;
412 }
413
414 status_t display_get_info(struct display_info *info)
415 {
416 if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ARGB888 8) {
417 info->format = DISPLAY_FORMAT_ARGB_8888;
418 } else if (hLtdcEval.LayerCfg[ActiveLayer].PixelFormat == LTDC_PIXEL_FORMAT_ RGB565) {
419 info->format = DISPLAY_FORMAT_RGB_565;
420 } else {
421 panic("unhandled pixel format\n");
422 return ERR_NOT_FOUND;
403 } 423 }
404 424
405 info->width = BSP_LCD_GetXSize(); 425 info->width = BSP_LCD_GetXSize();
406 info->height = BSP_LCD_GetYSize(); 426 info->height = BSP_LCD_GetYSize();
407 info->stride = BSP_LCD_GetXSize();
408 info->flush = NULL;
409 427
410 return NO_ERROR; 428 return NO_ERROR;
411 } 429 }
412
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698