diff --git a/ChangeLog b/ChangeLog index 2455cd6d27..7ed20c82d2 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9309,7 +9309,7 @@ adds support for initializing of the ltdc controller and the lcd device connected on the stm32f429i-disco. The following methods are provided for the generic fb interface: up_fbinitialize, - up_fbgetvplane, and fb_uninitialize. The following methods are + up_fbgetvplane, and up_fbuninitialize. The following methods are provided for the ltdc interface: up_ltdcgetlayer. From Marco Krahl (2014-12-19). * zrch/arm/src/stm32/Kconfig: Add configuration option for ltdc. This @@ -11647,3 +11647,6 @@ output and the low-level psock interfaces for network I/O. This saves a little memory which might be important for small footprint configurations (2015-04-14). + * Framebuffer driver: Add a display number to each interface in order + to support multiple display devices (2015-04-14). + diff --git a/arch/arm/src/dm320/dm320_framebuffer.c b/arch/arm/src/dm320/dm320_framebuffer.c index 6a7f44e819..057a4a9d6b 100644 --- a/arch/arm/src/dm320/dm320_framebuffer.c +++ b/arch/arm/src/dm320/dm320_framebuffer.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/dm320/dm320_framebuffer.c * - * Copyright (C) 2008-2009, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2009, 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -1361,11 +1361,19 @@ static int dm320_setcursor(FAR struct fb_vtable_s *vtable, FAR struct fb_setcurs * Name: up_fbinitialize * * Description: - * Initialize the video hardware + * Initialize the framebuffer video hardware associated with the display. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. * ****************************************************************************/ -int up_fbinitialize(void) +int up_fbinitialize(int display) { int ret; @@ -1388,17 +1396,21 @@ int up_fbinitialize(void) * Name: up_fbgetvplane * * Description: - * Return a a reference to the framebuffer object for the specified video plane. + * Return a a reference to the framebuffer object for the specified video + * plane of the specified plane. Many OSDs support multiple planes of video. * * Input parameters: - * None + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. * - * Returned value: - * Reference to the framebuffer object (NULL on failure) + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. * ****************************************************************************/ -FAR struct fb_vtable_s *up_fbgetvplane(int vplane) +FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) { switch (vplane) { diff --git a/arch/arm/src/lpc17xx/lpc17_lcd.c b/arch/arm/src/lpc17xx/lpc17_lcd.c index 03f3e4e6b5..f2b892ee4c 100644 --- a/arch/arm/src/lpc17xx/lpc17_lcd.c +++ b/arch/arm/src/lpc17xx/lpc17_lcd.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src//lpc17xx/lpc17_lcd.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -455,11 +455,19 @@ static int lpc17_setcursor(FAR struct fb_vtable_s *vtable, * Name: up_fbinitialize * * Description: - * Initialize the framebuffer video hardware + * Initialize the framebuffer video hardware associated with the display. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. * ****************************************************************************/ -int up_fbinitialize(void) +int up_fbinitialize(int display) { uint32_t regval; int i; @@ -699,21 +707,24 @@ int up_fbinitialize(void) } /**************************************************************************** - * Name: lpc17_fbgetvplane + * Name: up_fbgetvplane * * Description: * Return a a reference to the framebuffer object for the specified video - * plane. + * plane of the specified plane. Many OSDs support multiple planes of video. * * Input parameters: - * None + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. * - * Returned value: - * Reference to the framebuffer object (NULL on failure) + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. * ****************************************************************************/ -FAR struct fb_vtable_s *up_fbgetvplane(int vplane) +FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) { gvdbg("vplane: %d\n", vplane); if (vplane == 0) @@ -727,14 +738,21 @@ FAR struct fb_vtable_s *up_fbgetvplane(int vplane) } /**************************************************************************** - * Name: fb_uninitialize + * Name: up_fbuninitialize * * Description: - * Unitialize the framebuffer support + * Uninitialize the framebuffer support for the specified display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None * ****************************************************************************/ -void fb_uninitialize(void) +void up_fbuninitialize(int display) { uint32_t regval; int i; diff --git a/arch/arm/src/sama5/sam_lcd.c b/arch/arm/src/sama5/sam_lcd.c index c41d880d54..f696e71a69 100644 --- a/arch/arm/src/sama5/sam_lcd.c +++ b/arch/arm/src/sama5/sam_lcd.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/sama5/sam_lcd.c * - * Copyright (C) 2013-2014 Gregory Nutt. All rights reserved. + * Copyright (C) 2013-2014, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -2893,14 +2893,22 @@ static void sam_show_hcr(void) ****************************************************************************/ /**************************************************************************** - * Name: sam_fbinitialize + * Name: up_fbinitialize * * Description: - * Initialize the framebuffer video hardware + * Initialize the framebuffer video hardware associated with the display. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. * ****************************************************************************/ -int up_fbinitialize(void) +int up_fbinitialize(int display) { #if defined(CONFIG_SAMA5_LCDC_OVR1) && defined(CONFIG_SAMA5_LCDC_HEO) uint32_t regval; @@ -2984,21 +2992,24 @@ int up_fbinitialize(void) } /**************************************************************************** - * Name: sam_fbgetvplane + * Name: up_fbgetvplane * * Description: * Return a a reference to the framebuffer object for the specified video - * plane. + * plane of the specified plane. Many OSDs support multiple planes of video. * * Input parameters: - * None + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. * - * Returned value: - * Reference to the framebuffer object (NULL on failure) + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. * ****************************************************************************/ -struct fb_vtable_s *up_fbgetvplane(int vplane) +FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) { gvdbg("vplane: %d\n", vplane); if (vplane == 0) @@ -3012,15 +3023,21 @@ struct fb_vtable_s *up_fbgetvplane(int vplane) } /**************************************************************************** - * Name: fb_uninitialize + * Name: up_fbuninitialize * * Description: - * Uninitialize the framebuffer driver. Bad things will happen if you - * call this without first calling fb_initialize()! + * Uninitialize the framebuffer support for the specified display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None * ****************************************************************************/ -void fb_uninitialize(void) +void up_fbuninitialize(int display) { /* Disable the LCD controller */ diff --git a/arch/arm/src/stm32/stm32_ltdc.c b/arch/arm/src/stm32/stm32_ltdc.c index 2da314a792..72bfb53201 100644 --- a/arch/arm/src/stm32/stm32_ltdc.c +++ b/arch/arm/src/stm32/stm32_ltdc.c @@ -3533,7 +3533,7 @@ struct fb_vtable_s *stm32_ltdcgetvplane(int vplane) } /**************************************************************************** - * Name: fb_uninitialize + * Name: stm32_ltdcuninitialize * * Description: * Uninitialize the framebuffer driver. Bad things will happen if you diff --git a/arch/sim/src/up_framebuffer.c b/arch/sim/src/up_framebuffer.c index 15a8168e6d..406f49ab22 100644 --- a/arch/sim/src/up_framebuffer.c +++ b/arch/sim/src/up_framebuffer.c @@ -344,11 +344,19 @@ static int up_setcursor(FAR struct fb_vtable_s *vtable, * Name: up_fbinitialize * * Description: - * Initialize the video hardware + * Initialize the framebuffer video hardware associated with the display. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. * ****************************************************************************/ -int up_fbinitialize(void) +int up_fbinitialize(int display) { #ifdef CONFIG_SIM_X11FB return up_x11initialize(CONFIG_SIM_FBWIDTH, CONFIG_SIM_FBHEIGHT, @@ -363,17 +371,21 @@ int up_fbinitialize(void) * Name: up_fbgetvplane * * Description: - * Return a a reference to the framebuffer object for the specified video plane. + * Return a a reference to the framebuffer object for the specified video + * plane of the specified plane. Many OSDs support multiple planes of video. * * Input parameters: - * None + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. * - * Returned value: - * Reference to the framebuffer object (NULL on failure) + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. * ****************************************************************************/ -FAR struct fb_vtable_s *up_fbgetvplane(int vplane) +FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) { if (vplane == 0) { @@ -386,10 +398,21 @@ FAR struct fb_vtable_s *up_fbgetvplane(int vplane) } /**************************************************************************** - * Name: up_fbteardown + * Name: up_fbuninitialize + * + * Description: + * Uninitialize the framebuffer support for the specified display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None + * ****************************************************************************/ -void fb_uninitialize(void) +void up_fbuninitialize(int display) { } diff --git a/configs/sama5d3x-ek/src/sam_ov2640.c b/configs/sama5d3x-ek/src/sam_ov2640.c index cc401ac56a..ad55d0a4a6 100644 --- a/configs/sama5d3x-ek/src/sam_ov2640.c +++ b/configs/sama5d3x-ek/src/sam_ov2640.c @@ -85,14 +85,14 @@ static inline FAR struct fb_vtable_s *ov2640_lcd_initialize(void) /* Initialize the frame buffer device */ - ret = up_fbinitialize(); + ret = up_fbinitialize(0); if (ret < 0) { gdbg("ERROR: up_fbinitialize failed: %d\n", -ret); return NULL; } - vplane = up_fbgetvplane(0); + vplane = up_fbgetvplane(0, 0); if (!vplane) { gdbg("ERROR: up_fbgetvplane failed\n"); diff --git a/configs/sim/README.txt b/configs/sim/README.txt index 2b0ce395f4..759b75647f 100644 --- a/configs/sim/README.txt +++ b/configs/sim/README.txt @@ -677,8 +677,8 @@ nx11 the simulation is built and can only be eliminated by calling up_simtouchscreen(0) from your application. - b. You must first up_fbinitialize() before calling up_simtouchscreen() - or you will get a crash. + b. You must first call up_fbinitialize(0) before calling + up_simtouchscreen() or you will get a crash. c. Call sim_tcunininitializee() when you are finished with the simulated touchscreen. diff --git a/configs/sim/src/sim_touchscreen.c b/configs/sim/src/sim_touchscreen.c index 57ec36c1ae..5187aa411f 100644 --- a/configs/sim/src/sim_touchscreen.c +++ b/configs/sim/src/sim_touchscreen.c @@ -1,7 +1,7 @@ /**************************************************************************** * config/sim/src/sim_touchscreen.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -104,14 +104,14 @@ int board_tsc_setup(int minor) */ ivdbg("Initializing framebuffer\n"); - ret = up_fbinitialize(); + ret = up_fbinitialize(0); if (ret < 0) { idbg("up_fbinitialize failed: %d\n", -ret); goto errout; } - dev = up_fbgetvplane(0); + dev = up_fbgetvplane(0, 0); if (!dev) { idbg("up_fbgetvplane 0 failed\n"); @@ -156,7 +156,7 @@ errout_with_nx: nx_close(g_simtc.hnx); goto errout; errout_with_fb: - fb_uninitialize(); + up_fbuninitialize(0); errout: return ret; } diff --git a/configs/stm32f429i-disco/src/stm32_boot.c b/configs/stm32f429i-disco/src/stm32_boot.c index 2cf12677bc..77653432e0 100644 --- a/configs/stm32f429i-disco/src/stm32_boot.c +++ b/configs/stm32f429i-disco/src/stm32_boot.c @@ -1,7 +1,7 @@ /************************************************************************************ * configs/stm32f429i-disco/src/stm32_boot.c * - * Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -134,7 +134,7 @@ void board_initialize(void) #ifdef CONFIG_STM32F429I_DISCO_ILI9341_FBIFACE /* Initialize the framebuffer driver */ - up_fbinitialize(); + up_fbinitialize(0); #endif #ifdef CONFIG_STM32F429I_DISCO_ILI9341_LCDIFACE diff --git a/configs/stm32f429i-disco/src/stm32_lcd.c b/configs/stm32f429i-disco/src/stm32_lcd.c index 884ce0e31b..2f527abc81 100644 --- a/configs/stm32f429i-disco/src/stm32_lcd.c +++ b/configs/stm32f429i-disco/src/stm32_lcd.c @@ -512,18 +512,23 @@ int board_lcd_initialize(void) #endif /* CONFIG_STM32F429I_DISCO_ILI9341_LCDIFACE */ #ifdef CONFIG_STM32_LTDC -/************************************************************************************ +/**************************************************************************** * Name: up_fbinitialize * * Description: - * The generic method to initialize the framebuffer device + * Initialize the framebuffer video hardware associated with the display. * - * Return: - * OK - On succes + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. * - ************************************************************************************/ + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. + * + ****************************************************************************/ -int up_fbinitialize(void) +int up_fbinitialize(int display) { #ifdef CONFIG_STM32F429I_DISCO_ILI9341_FBIFACE int ret; @@ -546,34 +551,45 @@ int up_fbinitialize(void) #endif } -/************************************************************************************ +/**************************************************************************** * Name: up_fbgetvplane * * Description: - * The generic method to get the videoplane. + * Return a a reference to the framebuffer object for the specified video + * plane of the specified plane. Many OSDs support multiple planes of video. * - * Paramater: - * vplane - Number othe video plane + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. * - * Return: - * Reference to the fb_vtable_s on success otherwise NULL. + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. * - ************************************************************************************/ + ****************************************************************************/ -FAR struct fb_vtable_s *up_fbgetvplane(int vplane) +FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane) { return stm32_ltdcgetvplane(vplane); } -/************************************************************************************ - * Name: up_uninitialize +/**************************************************************************** + * Name: up_fbuninitialize * * Description: - * The generic method to uninitialize the framebuffer device + * Uninitialize the framebuffer support for the specified display. * - ************************************************************************************/ + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None + * + ****************************************************************************/ -void fb_uninitialize(void) +void up_fbuninitialize(int display) { stm32_ltdcuninitialize(); } diff --git a/graphics/nxmu/nx_start.c b/graphics/nxmu/nx_start.c index 197f3ac5f5..78e98132ee 100644 --- a/graphics/nxmu/nx_start.c +++ b/graphics/nxmu/nx_start.c @@ -1,7 +1,7 @@ /**************************************************************************** * graphics/nxmu/nx_start.c * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -128,16 +128,18 @@ int nx_server(int argc, char *argv[]) (void)dev->setpower(dev, ((3*CONFIG_LCD_MAXPOWER + 3)/4)); #else /* CONFIG_NX_LCDDRIVER */ - /* Initialize the frame buffer device */ + /* Initialize the frame buffer device. + * REVISIT: display == 0 is assumed. + */ - ret = up_fbinitialize(); + ret = up_fbinitialize(0); if (ret < 0) { gdbg("ERROR: up_fbinitialize failed: %d\n", ret); return EXIT_FAILURE; } - dev = up_fbgetvplane(CONFIG_NXSTART_VPLANE); + dev = up_fbgetvplane(0, CONFIG_NXSTART_VPLANE); if (!dev) { gdbg("ERROR: up_fbgetvplane failed, vplane=%d\n", CONFIG_NXSTART_VPLANE); diff --git a/include/nuttx/video/fb.h b/include/nuttx/video/fb.h index 4046fb546c..287bddb22a 100644 --- a/include/nuttx/video/fb.h +++ b/include/nuttx/video/fb.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/video/fb.h * - * Copyright (C) 2008-2011, 2013 Gregory Nutt. All rights reserved. + * Copyright (C) 2008-2011, 2013, 2016 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -360,23 +360,64 @@ extern "C" ****************************************************************************/ /**************************************************************************** - * Name: up_fbinitialize, up_fbuninitialize, up_fbgetvplane + * If an architecture supports a framebuffer, then it must provide the + * following APIs to access the framebuffer. + ****************************************************************************/ + +/**************************************************************************** + * Name: up_fbinitialize * * Description: - * If an architecture supports a framebuffer, then it must provide APIs - * to access the framebuffer as follows: + * Initialize the framebuffer video hardware associated with the display. * - * up_fbinitialize - Initialize the framebuffer video hardware - * up_fbgetvplane - Return a a reference to the framebuffer object for - * the specified video plane. Most OSDs support - * multiple planes of video. - * up_fbuninitialize - Uninitialize the framebuffer support + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * Zero is returned on success; a negated errno value is returned on any + * failure. * ****************************************************************************/ -int up_fbinitialize(void); -FAR struct fb_vtable_s *up_fbgetvplane(int vplane); -void fb_uninitialize(void); +int up_fbinitialize(int display); + +/**************************************************************************** + * Name: up_fbgetvplane + * + * Description: + * Return a a reference to the framebuffer object for the specified video + * plane of the specified plane. Many OSDs support multiple planes of video. + * + * Input parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * vplane - Identifies the plane being queried. + * + * Returned Value: + * A non-NULL pointer to the frame buffer access structure is returned on + * success; NULL is returned on any failure. + * + ****************************************************************************/ + +FAR struct fb_vtable_s *up_fbgetvplane(int display, int vplane); + +/**************************************************************************** + * Name: up_fbuninitialize + * + * Description: + * Uninitialize the framebuffer support for the specified display. + * + * Input Parameters: + * display - In the case of hardware with multiple displays, this + * specifies the display. Normally this is zero. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void up_fbuninitialize(int display); #undef EXTERN #ifdef __cplusplus