Framebuffer driver: Add a display number to each interface in order to support multiple displays

This commit is contained in:
Gregory Nutt 2016-04-14 12:23:52 -06:00
parent 8763ff02fb
commit 7308fdcdf2
10 changed files with 74 additions and 40 deletions

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/ltdc/ltdc_main.c * examples/ltdc/ltdc_main.c
* *
* Copyright (C) 2008, 2011-2012, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2008, 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -2084,13 +2084,13 @@ int ltdc_main(int argc, char *argv[])
FAR struct fb_videoinfo_s vinfo; FAR struct fb_videoinfo_s vinfo;
FAR struct fb_vtable_s *fbtable; FAR struct fb_vtable_s *fbtable;
if (up_fbinitialize()<0) if (up_fbinitialize(0) < 0)
{ {
dbg("up_fbinitialize() failed\n"); dbg("up_fbinitialize() failed\n");
return -1; return -1;
} }
fbtable = up_fbgetvplane(0); fbtable = up_fbgetvplane(0,0);
if (!fbtable) if (!fbtable)
{ {

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nx/nx_main.c * examples/nx/nx_main.c
* *
* Copyright (C) 2008-2011, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2011, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -482,18 +482,22 @@ static inline int nxeg_suinitialize(void)
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nxeg_initialize: Initializing framebuffer\n"); printf("nxeg_initialize: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nxeg_initialize: up_fbinitialize failed: %d\n", -ret); printf("nxeg_initialize: up_fbinitialize failed: %d\n", -ret);
g_exitcode = NXEXIT_FBINITIALIZE; g_exitcode = NXEXIT_FBINITIALIZE;
return ERROR; return ERROR;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NX_VPLANE);
if (!dev) if (!dev)
{ {
printf("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); printf("nxeg_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NX_VPLANE);
g_exitcode = NXEXIT_FBGETVPLANE; g_exitcode = NXEXIT_FBGETVPLANE;
return ERROR; return ERROR;
} }
@ -502,10 +506,12 @@ static inline int nxeg_suinitialize(void)
/* Then open NX */ /* Then open NX */
printf("nxeg_initialize: Open NX\n"); printf("nxeg_initialize: Open NX\n");
g_hnx = nx_open(dev); g_hnx = nx_open(dev);
if (!g_hnx) if (!g_hnx)
{ {
printf("nxeg_suinitialize: nx_open failed: %d\n", errno); printf("nxeg_suinitialize: nx_open failed: %d\n", errno);
g_exitcode = NXEXIT_NXOPEN; g_exitcode = NXEXIT_NXOPEN;
return ERROR; return ERROR;
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nx/nx_server.c * examples/nx/nx_server.c
* *
* Copyright (C) 2008-2009, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -141,17 +141,19 @@ int nx_servertask(int argc, char *argv[])
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nx_servertask: Initializing framebuffer\n"); printf("nx_servertask: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nx_servertask: up_fbinitialize failed: %d\n", -ret); printf("nx_servertask: up_fbinitialize failed: %d\n", -ret);
return 1; return 1;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NX_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NX_VPLANE);
if (!dev) if (!dev)
{ {
printf("nx_servertask: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NX_VPLANE); printf("nx_servertask: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NX_VPLANE);
return 2; return 2;
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nxhello/nxhello_main.c * examples/nxhello/nxhello_main.c
* *
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -181,18 +181,22 @@ static inline int nxhello_initialize(void)
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nxhello_initialize: Initializing framebuffer\n"); printf("nxhello_initialize: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nxhello_initialize: up_fbinitialize failed: %d\n", -ret); printf("nxhello_initialize: up_fbinitialize failed: %d\n", -ret);
g_nxhello.code = NXEXIT_FBINITIALIZE; g_nxhello.code = NXEXIT_FBINITIALIZE;
return ERROR; return ERROR;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXHELLO_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXHELLO_VPLANE);
if (!dev) if (!dev)
{ {
printf("nxhello_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXHELLO_VPLANE); printf("nxhello_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXHELLO_VPLANE);
g_nxhello.code = NXEXIT_FBGETVPLANE; g_nxhello.code = NXEXIT_FBGETVPLANE;
return ERROR; return ERROR;
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nximage/nximage_main.c * examples/nximage/nximage_main.c
* *
* Copyright (C) 2011, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2011, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -185,18 +185,22 @@ static inline int nximage_initialize(void)
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nximage_initialize: Initializing framebuffer\n"); printf("nximage_initialize: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nximage_initialize: up_fbinitialize failed: %d\n", -ret); printf("nximage_initialize: up_fbinitialize failed: %d\n", -ret);
g_nximage.code = NXEXIT_FBINITIALIZE; g_nximage.code = NXEXIT_FBINITIALIZE;
return ERROR; return ERROR;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXIMAGE_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXIMAGE_VPLANE);
if (!dev) if (!dev)
{ {
printf("nximage_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXIMAGE_VPLANE); printf("nximage_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXIMAGE_VPLANE);
g_nximage.code = NXEXIT_FBGETVPLANE; g_nximage.code = NXEXIT_FBGETVPLANE;
return ERROR; return ERROR;
} }
@ -212,6 +216,7 @@ static inline int nximage_initialize(void)
g_nximage.code = NXEXIT_NXOPEN; g_nximage.code = NXEXIT_NXOPEN;
return ERROR; return ERROR;
} }
return OK; return OK;
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nxlines/nxlines_main.c * examples/nxlines/nxlines_main.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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -177,18 +177,22 @@ static inline int nxlines_initialize(void)
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nxlines_initialize: Initializing framebuffer\n"); printf("nxlines_initialize: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nxlines_initialize: up_fbinitialize failed: %d\n", -ret); printf("nxlines_initialize: up_fbinitialize failed: %d\n", -ret);
g_nxlines.code = NXEXIT_FBINITIALIZE; g_nxlines.code = NXEXIT_FBINITIALIZE;
return ERROR; return ERROR;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXLINES_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXLINES_VPLANE);
if (!dev) if (!dev)
{ {
printf("nxlines_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXLINES_VPLANE); printf("nxlines_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXLINES_VPLANE);
g_nxlines.code = NXEXIT_FBGETVPLANE; g_nxlines.code = NXEXIT_FBGETVPLANE;
return ERROR; return ERROR;
} }
@ -197,10 +201,12 @@ static inline int nxlines_initialize(void)
/* Then open NX */ /* Then open NX */
printf("nxlines_initialize: Open NX\n"); printf("nxlines_initialize: Open NX\n");
g_nxlines.hnx = nx_open(dev); g_nxlines.hnx = nx_open(dev);
if (!g_nxlines.hnx) if (!g_nxlines.hnx)
{ {
printf("nxlines_initialize: nx_open failed: %d\n", errno); printf("nxlines_initialize: nx_open failed: %d\n", errno);
g_nxlines.code = NXEXIT_NXOPEN; g_nxlines.code = NXEXIT_NXOPEN;
return ERROR; return ERROR;
} }

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nxterm/nxterm_server.c * examples/nxterm/nxterm_server.c
* *
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved. * Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -137,17 +137,19 @@ int nxterm_server(int argc, char *argv[])
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nxterm_server: Initializing framebuffer\n"); printf("nxterm_server: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nxterm_server: up_fbinitialize failed: %d\n", -ret); printf("nxterm_server: up_fbinitialize failed: %d\n", -ret);
return 1; return 1;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTERM_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXTERM_VPLANE);
if (!dev) if (!dev)
{ {
printf("nxterm_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTERM_VPLANE); printf("nxterm_server: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXTERM_VPLANE);
return 2; return 2;
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nxtext/nxtext_main.c * examples/nxtext/nxtext_main.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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -223,18 +223,22 @@ static inline int nxtext_suinitialize(void)
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nxtext_initialize: Initializing framebuffer\n"); printf("nxtext_initialize: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nxtext_initialize: up_fbinitialize failed: %d\n", -ret); printf("nxtext_initialize: up_fbinitialize failed: %d\n", -ret);
g_exitcode = NXEXIT_FBINITIALIZE; g_exitcode = NXEXIT_FBINITIALIZE;
return ERROR; return ERROR;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTEXT_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXTEXT_VPLANE);
if (!dev) if (!dev)
{ {
printf("nxtext_initialize: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTEXT_VPLANE); printf("nxtext_initialize: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXTEXT_VPLANE);
g_exitcode = NXEXIT_FBGETVPLANE; g_exitcode = NXEXIT_FBGETVPLANE;
return ERROR; return ERROR;
} }
@ -243,13 +247,16 @@ static inline int nxtext_suinitialize(void)
/* Then open NX */ /* Then open NX */
printf("nxtext_initialize: Open NX\n"); printf("nxtext_initialize: Open NX\n");
g_hnx = nx_open(dev); g_hnx = nx_open(dev);
if (!g_hnx) if (!g_hnx)
{ {
printf("nxtext_initialize: nx_open failed: %d\n", errno); printf("nxtext_initialize: nx_open failed: %d\n", errno);
g_exitcode = NXEXIT_NXOPEN; g_exitcode = NXEXIT_NXOPEN;
return ERROR; return ERROR;
} }
return OK; return OK;
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* examples/nxtext/nxtext_server.c * examples/nxtext/nxtext_server.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 <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -140,17 +140,19 @@ int nxtext_server(int argc, char *argv[])
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
printf("nxtext_server: Initializing framebuffer\n"); printf("nxtext_server: Initializing framebuffer\n");
ret = up_fbinitialize();
ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
printf("nxtext_server: up_fbinitialize failed: %d\n", -ret); printf("nxtext_server: up_fbinitialize failed: %d\n", -ret);
return 1; return 1;
} }
dev = up_fbgetvplane(CONFIG_EXAMPLES_NXTEXT_VPLANE); dev = up_fbgetvplane(0, CONFIG_EXAMPLES_NXTEXT_VPLANE);
if (!dev) if (!dev)
{ {
printf("nxtext_server: up_fbgetvplane failed, vplane=%d\n", CONFIG_EXAMPLES_NXTEXT_VPLANE); printf("nxtext_server: up_fbgetvplane failed, vplane=%d\n",
CONFIG_EXAMPLES_NXTEXT_VPLANE);
return 2; return 2;
} }
#endif #endif

View File

@ -1,7 +1,7 @@
/**************************************************************************** /****************************************************************************
* apps/graphics/traveler/src/trv_graphics.c * apps/graphics/traveler/src/trv_graphics.c
* *
* Copyright (C) 2014 Gregory Nutt. All rights reserved. * Copyright (C) 2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -83,20 +83,20 @@ static FAR struct fb_vtable_s *trv_get_fbdev(void)
/* Initialize the frame buffer device */ /* Initialize the frame buffer device */
ret = up_fbinitialize(); ret = up_fbinitialize(0);
if (ret < 0) if (ret < 0)
{ {
trv_abort("ERROR: up_fbinitialize failed: %d\n", -ret); trv_abort("ERROR: up_fbinitialize() failed: %d\n", -ret);
} }
/* Set up to use video plane 0. There is no support for anything but /* Set up to use video plane 0. There is no support for anything but
* video plane 0. * video plane 0.
*/ */
fbdev = up_fbgetvplane(0); fbdev = up_fbgetvplane(0,0);
if (!fbdev) if (!fbdev)
{ {
trv_abort("ERROR: up_fbgetvplane(0) failed\n"); trv_abort("ERROR: up_fbgetvplane() failed\n");
} }
return fbdev; return fbdev;