xref: /third_party/NuttX/include/nuttx/video/fb.h (revision beacf11b)
1/****************************************************************************
2 * include/nuttx/video/fb.h
3 *
4 * Licensed to the Apache Software Foundation (ASF) under one or more
5 * contributor license agreements.  See the NOTICE file distributed with
6 * this work for additional information regarding copyright ownership.  The
7 * ASF licenses this file to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance with the
9 * License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
16 * License for the specific language governing permissions and limitations
17 * under the License.
18 *
19 ****************************************************************************/
20
21#ifndef __INCLUDE_NUTTX_VIDEO_FB_H
22#define __INCLUDE_NUTTX_VIDEO_FB_H
23
24/****************************************************************************
25 * Included Files
26 ****************************************************************************/
27
28#include "los_config.h"
29#include "los_vm_map.h"
30
31#define CONFIG_FB_CMAP
32#define CONFIG_FB_OVERLAY_BLIT
33#define CONFIG_FB_OVERLAY
34#define CONFIG_FB_TRANSPARENCY
35
36
37/****************************************************************************
38 * Pre-processor definitions
39 ****************************************************************************/
40
41/* Color format definitions.  The pretty much define the color pixel processing
42 * organization of the video controller.
43 */
44
45/* Monochrome Formats *******************************************************/
46
47#define FB_FMT_Y1             0         /* BPP=1, monochrome */
48#define FB_FMT_Y2             1         /* BPP=2, 2-bit uncompressed greyscale */
49#define FB_FMT_Y4             2         /* BPP=4, 4-bit uncompressed greyscale */
50#define FB_FMT_Y8             3         /* BPP=8, 8-bit uncompressed greyscale */
51#define FB_FMT_Y16            4         /* BPP=16, 16-bit uncompressed greyscale */
52#define FB_FMT_GREY           FB_FMT_Y8 /* BPP=8 */
53#define FB_FMT_Y800           FB_FMT_Y8 /* BPP=8 */
54
55#define FB_ISMONO(f)          (((f) >= FB_FMT_Y4) && (f) <= FB_FMT_Y16)
56
57/* RGB video formats ********************************************************/
58
59/* Standard RGB */
60
61#define FB_FMT_RGB1           FB_FMT_Y1   /* BPP=1 */
62#define FB_FMT_RGB4           5           /* BPP=4 */
63#define FB_FMT_RGB8           6           /* BPP=8 RGB palette index */
64#define FB_FMT_RGB8_222       7           /* BPP=8  R=2, G=2, B=2 */
65#define FB_FMT_RGB8_332       8           /* BPP=8  R=3, G=3, B=2 */
66#define FB_FMT_RGB12_444      9           /* BPP=12 R=4, G=4, B=4 */
67#define FB_FMT_RGB16_555      10          /* BPP=16 R=5, G=5, B=5 (1 unused bit) */
68#define FB_FMT_RGB16_565      11          /* BPP=16 R=6, G=6, B=5 */
69#define FB_FMT_RGB24          12          /* BPP=24 */
70#define FB_FMT_RGB32          13          /* BPP=32 */
71
72/* Run length encoded RGB */
73
74#define FB_FMT_RGBRLE4        14          /* BPP=4 */
75#define FB_FMT_RGBRLE8        15          /* BPP=8 */
76
77/* Raw RGB */
78
79#define FB_FMT_RGBRAW         16          /* BPP=? */
80
81/* Raw RGB with arbitrary sample packing within a pixel. Packing and precision
82 * of R, G and B components is determined by bit masks for each.
83 */
84
85#define FB_FMT_RGBBTFLD16     17          /* BPP=16 */
86#define FB_FMT_RGBBTFLD24     18          /* BPP=24 */
87#define FB_FMT_RGBBTFLD32     19          /* BPP=32 */
88#define FB_FMT_RGBA16         20          /* BPP=16 Raw RGB with alpha */
89#define FB_FMT_RGBA32         21          /* BPP=32 Raw RGB with alpha */
90
91/* Raw RGB with a transparency field. Layout is as for standard RGB at 16 and
92 * 32 bits per pixel but the msb in each pixel indicates whether the pixel is
93 * transparent or not.
94 */
95
96#define FB_FMT_RGBT16         22          /* BPP=16 */
97#define FB_FMT_RGBT32         23          /* BPP=32 */
98
99#define FB_ISRGB(f)           (((f) >= FB_FMT_RGB1) && (f) <= FB_FMT_RGBT32)
100
101/* Packed YUV Formats *******************************************************/
102
103#define FB_FMT_AYUV           24          /* BPP=32  Combined YUV and alpha */
104#define FB_FMT_CLJR           25          /* BPP=8   4 pixels packed into a uint32_t.
105                                           *         YUV 4:1:1 with l< 8 bits
106                                           *         per YUV sample */
107#define FB_FMT_CYUV           26          /* BPP=16  UYVY except that height is
108                                           *         reversed */
109#define FB_FMT_IRAW           27          /* BPP=?   Intel uncompressed YUV */
110#define FB_FMT_IUYV           28          /* BPP=16  Interlaced UYVY (line order
111                                           *         0,2,4,.., 1,3,5...) */
112#define FB_FMT_IY41           29          /* BPP=12  Interlaced Y41P (line order
113                                           *         0,2,4,.., 1,3,5...) */
114#define FB_FMT_IYU2           30          /* BPP=24 */
115#define FB_FMT_HDYC           31          /* BPP=16  UYVY except uses the BT709
116                                           *         color space  */
117#define FB_FMT_UYVP           32          /* BPP=24? YCbCr 4:2:2, 10-bits per
118                                           *         component in U0Y0V0Y1 order */
119#define FB_FMT_UYVY           33          /* BPP=16  YUV 4:2:2 */
120#define FB_FMT_UYNV           FB_FMT_UYVY /* BPP=16  */
121#define FB_FMT_Y422           FB_FMT_UYVY /* BPP=16  */
122#define FB_FMT_V210           34          /* BPP=32  10-bit 4:2:2 YCrCb */
123#define FB_FMT_V422           35          /* BPP=16  Upside down version of UYVY */
124#define FB_FMT_V655           36          /* BPP=16? 16-bit YUV 4:2:2 */
125#define FB_FMT_VYUY           37          /* BPP=?   ATI Packed YUV Data */
126#define FB_FMT_YUYV           38          /* BPP=16  YUV 4:2:2 */
127#define FB_FMT_YUY2           FB_FMT_YUYV /* BPP=16  YUV 4:2:2 */
128#define FB_FMT_YUNV           FB_FMT_YUYV /* BPP=16  YUV 4:2:2 */
129#define FB_FMT_YVYU           39          /* BPP=16  YUV 4:2:2 */
130#define FB_FMT_Y41P           40          /* BPP=12  YUV 4:1:1 */
131#define FB_FMT_Y411           41          /* BPP=12  YUV 4:1:1 */
132#define FB_FMT_Y211           42          /* BPP=8  */
133#define FB_FMT_Y41T           43          /* BPP=12  Y41P LSB for transparency */
134#define FB_FMT_Y42T           44          /* BPP=16  UYVY LSB for transparency */
135#define FB_FMT_YUVP           45          /* BPP=24? YCbCr 4:2:2 Y0U0Y1V0 order */
136
137#define FB_ISYUVPACKED(f)     (((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP)
138
139/* Packed Planar YUV Formats ************************************************/
140
141#define FB_FMT_YVU9           46          /* BPP=9   8-bit Y followed by 8-bit
142                                           *         4x4 VU */
143#define FB_FMT_YUV9           47          /* BPP=9? */
144#define FB_FMT_IF09           48          /* BPP=9.5 YVU9 + 4x4 plane of delta
145                                           *         relative to tframe. */
146#define FB_FMT_YV16           49          /* BPP=16  8-bit Y followed by 8-bit
147                                           *         2x1 VU */
148#define FB_FMT_YV12           50          /* BPP=12  8-bit Y followed by 8-bit
149                                           *         2x2 VU */
150#define FB_FMT_I420           51          /* BPP=12  8-bit Y followed by 8-bit
151                                           *         2x2 UV */
152#define FB_FMT_IYUV           FB_FMT_I420 /* BPP=12 */
153#define FB_FMT_NV12           52          /* BPP=12  8-bit Y followed by an
154                                           *         interleaved 2x2 UV */
155#define FB_FMT_NV21           53          /* BPP=12  NV12 with UV reversed */
156#define FB_FMT_IMC1           54          /* BPP=12  YV12 except UV planes same
157                                           *         stride as Y */
158#define FB_FMT_IMC2           55          /* BPP=12  IMC1 except UV lines
159                                           *         interleaved at half stride
160                                           *         boundaries */
161#define FB_FMT_IMC3           56          /* BPP=12  As IMC1 except that UV
162                                           *         swapped */
163#define FB_FMT_IMC4           57          /* BPP=12  As IMC2  except that UV
164                                           *         swapped */
165#define FB_FMT_CLPL           58          /* BPP=12  YV12 but including a level
166                                           *         of indirection. */
167#define FB_FMT_Y41B           59          /* BPP=12?  4:1:1 planar. */
168#define FB_FMT_Y42B           60          /* BPP=16?  YUV 4:2:2 planar. */
169#define FB_FMT_CXY1           61          /* BPP=12 */
170#define FB_FMT_CXY2           62          /* BPP=16 */
171
172#define FB_ISYUVPLANAR(f)     (((f) >= FB_FMT_AYUV) && (f) <= FB_FMT_YUVP)
173#define FB_ISYUV(f)           (FB_ISYUVPACKED(f) || FB_ISYUVPLANAR(f))
174
175/* Hardware cursor control **************************************************/
176
177#ifdef CONFIG_FB_HWCURSOR
178#  define FB_CUR_ENABLE       0x01        /* Enable the cursor */
179#  define FB_CUR_SETIMAGE     0x02        /* Set the cursor image */
180#  define FB_CUR_SETPOSITION  0x04        /* Set the position of the cursor */
181#  define FB_CUR_SETSIZE      0x08        /* Set the size of the cursor */
182#  define FB_CUR_XOR          0x10        /* Use XOR vs COPY ROP on image */
183#endif
184
185/* Hardware overlay acceleration *******************************************/
186
187#ifdef CONFIG_FB_OVERLAY
188#  define FB_ACCL_TRANSP      0x01        /* Hardware tranparency support */
189#  define FB_ACCL_CHROMA      0x02        /* Hardware chromakey support */
190#  define FB_ACCL_COLOR       0x04        /* Hardware color support */
191#  define FB_ACCL_AREA        0x08        /* Hardware support area selection */
192
193#ifdef CONFIG_FB_OVERLAY_BLIT
194#  define FB_ACCL_BLIT        0x10        /* Hardware blit support */
195#  define FB_ACCL_BLEND       0x20        /* Hardware blend support */
196#endif
197
198/* Overlay transparency mode ************************************************/
199
200#  define FB_CONST_ALPHA      0x00         /* Transparency by alpha value */
201#  define FB_PIXEL_ALPHA      0x01         /* Transparency by pixel alpha value */
202
203#endif /* CONFIG_FB_OVERLAY */
204
205/* FB character driver IOCTL commands ***************************************/
206#define _FBIOCBASE      (0x2800) /* Frame buffer character driver ioctl commands */
207#define _IOC_X(type,nr)   ((type)|(nr))
208#define _FBIOC(nr)       _IOC_X(_FBIOCBASE,nr)
209
210/* ioctls */
211
212#define FBIOGET_VIDEOINFO     _FBIOC(0x0001)  /* Get color plane info */
213                                              /* Argument: writable struct
214                                               *           fb_videoinfo_s */
215#define FBIOGET_PLANEINFO     _FBIOC(0x0002)  /* Get video plane info */
216                                              /* Argument: writable struct
217                                               *           fb_planeinfo_s */
218
219#ifdef CONFIG_FB_CMAP
220#  define FBIOGET_CMAP        _FBIOC(0x0003)  /* Get RGB color mapping */
221                                              /* Argument: writable struct
222                                               *           fb_cmap_s */
223#  define FBIOPUT_CMAP        _FBIOC(0x0004)  /* Put RGB color mapping */
224                                              /* Argument: read-only struct
225                                               *           fb_cmap_s */
226#endif
227
228#ifdef CONFIG_FB_HWCURSOR
229#  define FBIOGET_CURSOR      _FBIOC(0x0005)  /* Get cursor attributes */
230                                              /* Argument: writable struct
231                                               *           fb_cursorattrib_s */
232#  define FBIOPUT_CURSOR      _FBIOC(0x0006)  /* Set cursor attributes */
233                                              /* Argument: read-only struct
234                                               *           fb_setcursor_s */
235#endif
236
237#ifdef CONFIG_LCD_UPDATE
238#  define FBIO_UPDATE         _FBIOC(0x0007)  /* Update a rectangular region in
239                                               * the framebuffer
240                                               * Argument: read-only struct
241                                               *           nxgl_rect_s */
242#endif
243
244#ifdef CONFIG_FB_SYNC
245#  define FBIO_WAITFORVSYNC   _FBIOC(0x0008)  /* Wait for vertical sync */
246#endif
247
248#ifdef CONFIG_FB_OVERLAY
249#  define FBIOGET_OVERLAYINFO _FBIOC(0x0009)  /* Get video overlay info */
250                                              /* Argument: writable struct
251                                               *           fb_overlayinfo_s */
252#  define FBIO_SELECT_OVERLAY _FBIOC(0x000a)  /* Select overlay */
253                                              /* Argument: read-only
254                                               *           unsigned long */
255#  define FBIOSET_TRANSP      _FBIOC(0x000b)  /* Set opacity or transparency
256                                               * Argument: read-only struct
257                                               *           fb_overlayinfo_s */
258#  define FBIOSET_CHROMAKEY   _FBIOC(0x000c)  /* Set chroma key
259                                               * Argument: read-only struct
260                                               *           fb_overlayinfo_s */
261#  define FBIOSET_COLOR       _FBIOC(0x000d)  /* Set color
262                                               * Argument: read-only struct
263                                               *           fb_overlayinfo_s */
264#  define FBIOSET_BLANK       _FBIOC(0x000e)  /* Blank or unblank
265                                               * Argument: read-only struct
266                                               *           fb_overlayinfo_s */
267#  define FBIOSET_AREA        _FBIOC(0x000f)  /* Set active overlay area
268                                               * Argument: read-only struct
269                                               *           fb_overlayinfo_s */
270#ifdef CONFIG_FB_OVERLAY_BLIT
271#  define FBIOSET_BLIT        _FBIOC(0x0010)  /* Blit area between overlays
272                                               * Argument: read-only struct
273                                               *           fb_overlayblit_s */
274#  define FBIOSET_BLEND       _FBIOC(0x0011)  /* Blend area between overlays
275                                               * Argument: read-only struct
276                                               *           fb_overlayblend_s */
277#endif
278#endif /* CONFIG_FB_OVERLAY */
279
280#define FIOC_MMAP               _FBIOC(0x0012)
281
282/****************************************************************************
283 * Public Types
284 ****************************************************************************/
285
286/* If any dimension of the display exceeds 65,536 pixels, then the following
287 * type will need to change:
288 */
289
290typedef uint16_t fb_coord_t;
291
292/* This structure describes the overall video controller */
293
294struct fb_videoinfo_s
295{
296  uint8_t    fmt;         /* see FB_FMT_*  */
297  fb_coord_t xres;        /* Horizontal resolution in pixel columns */
298  fb_coord_t yres;        /* Vertical resolution in pixel rows */
299  uint8_t    nplanes;     /* Number of color planes supported */
300#ifdef CONFIG_FB_OVERLAY
301  uint8_t    noverlays;   /* Number of overlays supported */
302#endif
303};
304
305/* This structure describes one color plane.  Some YUV formats may support
306 * up to 4 planes
307 */
308
309struct fb_planeinfo_s
310{
311  void  *fbmem;       /* Start of frame buffer memory */
312  size_t     fblen;       /* Length of frame buffer memory in bytes */
313  fb_coord_t stride;      /* Length of a line in bytes */
314  uint8_t    display;     /* Display number */
315  uint8_t    bpp;         /* Bits per pixel */
316};
317
318#ifdef CONFIG_FB_OVERLAY
319/* This structure describes the transparency. */
320
321struct fb_transp_s
322{
323  uint8_t    transp;      /* Transparency */
324  uint8_t    transp_mode; /* Transparency mode */
325};
326
327/* This structure describes an area. */
328
329struct fb_area_s
330{
331  fb_coord_t x;           /* x-offset of the area */
332  fb_coord_t y;           /* y-offset of the area */
333  fb_coord_t w;           /* Width of the area */
334  fb_coord_t h;           /* Height of the area */
335};
336
337/* This structure describes one overlay. */
338
339struct fb_overlayinfo_s
340{
341  void   *fbmem;          /* Start of frame buffer virtual memory */
342  void   *memphys;        /* Start of frame buffer physical memory */
343  size_t     fblen;           /* Length of frame buffer memory in bytes */
344  fb_coord_t stride;          /* Length of a line in bytes */
345  uint8_t    overlay;         /* Overlay number */
346  uint8_t    bpp;             /* Bits per pixel */
347  uint8_t    blank;           /* Blank or unblank */
348  uint32_t   chromakey;       /* Chroma key argb8888 formatted */
349  uint32_t   color;           /* Color argb8888 formatted */
350  struct fb_transp_s transp;  /* Transparency */
351  struct fb_area_s sarea;     /* Selected area within the overlay */
352  uint32_t   accl;            /* Supported hardware acceleration */
353};
354
355#ifdef CONFIG_FB_OVERLAY_BLIT
356/* This structure describes an overlay area within a whole overlay */
357
358struct fb_overlayarea_s
359{
360  uint8_t  overlay;      /* Number overlay */
361  struct fb_area_s area; /* Overlay area */
362};
363
364/* This structure describes blit operation */
365
366struct fb_overlayblit_s
367{
368  struct fb_overlayarea_s dest;       /* The destination overlay area */
369  struct fb_overlayarea_s src;        /* The source overlay area */
370};
371
372/* This structure describes blend operation */
373
374struct fb_overlayblend_s
375{
376  struct fb_overlayarea_s dest;       /* The destination overlay area */
377  struct fb_overlayarea_s foreground; /* The foreground overlay area */
378  struct fb_overlayarea_s background; /* The background overlay area */
379};
380#endif
381#endif /* CONFIG_FB_OVERLAY */
382
383/* On video controllers that support mapping of a pixel palette value
384 * to an RGB encoding, the following structure may be used to define
385 * that mapping.
386 */
387
388#ifdef CONFIG_FB_CMAP
389struct fb_cmap_s
390{
391  uint16_t  first;        /* Offset offset first color entry in tables */
392  uint16_t  len;          /* Number of color entries  in tables */
393
394  /* Tables of  color component.  Any may be NULL if not used */
395
396  uint8_t *red;           /* Table of 8-bit red values */
397  uint8_t *green;         /* Table of 8-bit green values */
398  uint8_t *blue;          /* Table of 8-bit blue values */
399#ifdef CONFIG_FB_TRANSPARENCY
400  uint8_t *transp;        /* Table of 8-bit transparency */
401#endif
402};
403#endif
404
405#ifdef CONFIG_FB_HWCURSOR
406#ifdef CONFIG_FB_HWCURSORIMAGE
407/* If the video controller hardware supports a hardware cursor and
408 * that hardware cursor supports user-provided images, then the
409 * following structure may be used to provide the cursor image
410 */
411
412struct fb_cursorimage_s
413{
414  fb_coord_t     width;    /* Width of the cursor image in pixels */
415  fb_coord_t     height;   /* Height of the cursor image in pixels */
416  const uint8_t *image;    /* Pointer to image data */
417};
418#endif
419
420/* The following structure defines the cursor position/size */
421
422struct fb_cursorpos_s
423{
424  fb_coord_t x;            /* X position in pixels */
425  fb_coord_t y;            /* Y position in rows */
426};
427
428/* If the hardware supports setting the cursor size, then this structure
429 * is used to provide the size.
430 */
431
432#ifdef CONFIG_FB_HWCURSORSIZE
433struct fb_cursorsize_s
434{
435  fb_coord_t h;            /* Height in rows */
436  fb_coord_t w;            /* Width in pixels */
437};
438#endif
439
440/* The following is used to get the cursor attributes */
441
442struct fb_cursorattrib_s
443{
444#ifdef CONFIG_FB_HWCURSORIMAGE
445  uint8_t fmt;                   /* Video format of cursor */
446#endif
447  struct fb_cursorpos_s  pos;    /* Current cursor position */
448#ifdef CONFIG_FB_HWCURSORSIZE
449  struct fb_cursorsize_s mxsize; /* Maximum cursor size */
450  struct fb_cursorsize_s size;   /* Current size */
451#endif
452};
453
454struct fb_setcursor_s
455{
456  uint8_t flags;                 /* See FB_CUR_* definitions */
457  struct fb_cursorpos_s pos;     /* Cursor position */
458#ifdef CONFIG_FB_HWCURSORSIZE
459  struct fb_cursorsize_s  size;  /* Cursor size */
460#endif
461#ifdef CONFIG_FB_HWCURSORIMAGE
462  struct fb_cursorimage_s img;   /* Cursor image */
463#endif
464};
465#endif
466
467/* The framebuffer "object" is accessed through within the OS via
468 * the following vtable:
469 */
470
471struct fb_vtable_s
472{
473  /* Get information about the video controller configuration and the
474   * configuration of each color plane.
475   */
476
477  int (*getvideoinfo)(struct fb_vtable_s *vtable,
478                      struct fb_videoinfo_s *vinfo);
479  int (*getplaneinfo)(struct fb_vtable_s *vtable, int planeno,
480                      struct fb_planeinfo_s *pinfo);
481
482#ifdef CONFIG_FB_CMAP
483  /* The following are provided only if the video hardware supports RGB
484   * color mapping
485   */
486
487  int (*getcmap)(struct fb_vtable_s *vtable,
488                 struct fb_cmap_s *cmap);
489  int (*putcmap)(struct fb_vtable_s *vtable,
490                 const struct fb_cmap_s *cmap);
491#endif
492
493#ifdef CONFIG_FB_HWCURSOR
494  /* The following are provided only if the video hardware supports a
495   * hardware cursor.
496   */
497
498  int (*getcursor)(struct fb_vtable_s *vtable,
499                   struct fb_cursorattrib_s *attrib);
500  int (*setcursor)(struct fb_vtable_s *vtable,
501                   struct fb_setcursor_s *settings);
502#endif
503
504#ifdef CONFIG_FB_SYNC
505  /* The following are provided only if the video hardware signals
506   * vertical snyc.
507   */
508
509  int (*waitforvsync)(struct fb_vtable_s *vtable);
510#endif
511
512#ifdef CONFIG_FB_OVERLAY
513  /* Get information about the video controller configuration and the
514   * configuration of each overlay.
515   */
516
517  int (*getoverlayinfo)(struct fb_vtable_s *vtable, int overlayno,
518                        struct fb_overlayinfo_s *oinfo);
519
520  /* The following are provided only if the video hardware supports
521   * transparency
522   */
523
524  int (*settransp)(struct fb_vtable_s *vtable,
525                   const struct fb_overlayinfo_s *oinfo);
526
527  /* The following are provided only if the video hardware supports
528   * chromakey
529   */
530
531  int (*setchromakey)(struct fb_vtable_s *vtable,
532                      const struct fb_overlayinfo_s *oinfo);
533
534  /* The following are provided only if the video hardware supports
535   * filling the overlay with a color.
536   */
537
538  int (*setcolor)(struct fb_vtable_s *vtable,
539                  const struct fb_overlayinfo_s *oinfo);
540
541  /* The following allows to switch the overlay on or off */
542
543  int (*setblank)(struct fb_vtable_s *vtable,
544                  const struct fb_overlayinfo_s *oinfo);
545
546  /* The following allows to set the active area for subsequently overlay
547   * operations.
548   */
549
550  int (*setarea)(struct fb_vtable_s *vtable,
551                 const struct fb_overlayinfo_s *oinfo);
552
553# ifdef CONFIG_FB_OVERLAY_BLIT
554  /* The following are provided only if the video hardware supports
555   * blit operation between overlays.
556   */
557
558  int (*blit)(struct fb_vtable_s *vtable,
559              const struct fb_overlayblit_s *blit);
560
561  /* The following are provided only if the video hardware supports
562   * blend operation between overlays.
563   */
564
565  int (*blend)(struct fb_vtable_s *vtable,
566               const struct fb_overlayblend_s *blend);
567# endif
568#endif
569    int (*fb_open)(struct fb_vtable_s *vtable);
570    int (*fb_release)(struct fb_vtable_s *vtable);
571#ifdef CONFIG_FB_OVERLAY
572    int (*fb_pan_display)(struct fb_vtable_s *vtable, struct fb_overlayinfo_s *oinfo);
573#endif
574    int (*fb_ioctl)(struct fb_vtable_s *vtable, int cmd, unsigned long arg);
575    int (*fb_check_var)(struct fb_vtable_s *vtable, unsigned long arg);
576    int (*fb_set_par)(struct fb_vtable_s *vtable);
577    ssize_t (*fb_mmap)(struct fb_vtable_s *vtable, LosVmMapRegion *region);
578};
579
580/****************************************************************************
581 * Public Data
582 ****************************************************************************/
583
584#ifdef __cplusplus
585#define EXTERN extern "C"
586extern "C"
587{
588#else
589#define EXTERN extern
590#endif
591
592/****************************************************************************
593 * Public Function Prototypes
594 ****************************************************************************/
595
596/****************************************************************************
597 * If an architecture supports a framebuffer, then it must provide the
598 * following APIs to access the framebuffer.
599 ****************************************************************************/
600
601/****************************************************************************
602 * Name: up_fbinitialize
603 *
604 * Description:
605 *   Initialize the framebuffer video hardware associated with the display.
606 *
607 *   There are multiple logic paths that may call up_fbinitialize() so any
608 *   implementation of up_fbinitialize() should be tolerant of being called
609 *   multiple times.
610 *
611 * Input Parameters:
612 *   display - In the case of hardware with multiple displays, this
613 *             specifies the display.  Normally this is zero.
614 *
615 * Returned Value:
616 *   Zero is returned on success; a negated errno value is returned on any
617 *   failure.
618 *
619 ****************************************************************************/
620
621int up_fbinitialize(int display);
622
623/****************************************************************************
624 * Name: up_fbgetvplane
625 *
626 * Description:
627 *   Return a a reference to the framebuffer object for the specified video
628 *   plane of the specified plane.  Many OSDs support multiple planes of video.
629 *
630 * Input Parameters:
631 *   display - In the case of hardware with multiple displays, this
632 *             specifies the display.  Normally this is zero.
633 *   vplane  - Identifies the plane being queried.
634 *
635 * Returned Value:
636 *   A non-NULL pointer to the frame buffer access structure is returned on
637 *   success; NULL is returned on any failure.
638 *
639 ****************************************************************************/
640
641struct fb_vtable_s *up_fbgetvplane(int display, int vplane);
642
643/****************************************************************************
644 * Name: up_fbuninitialize
645 *
646 * Description:
647 *   Uninitialize the framebuffer support for the specified display.
648 *
649 * Input Parameters:
650 *   display - In the case of hardware with multiple displays, this
651 *             specifies the display.  Normally this is zero.
652 *
653 * Returned Value:
654 *   None
655 *
656 ****************************************************************************/
657
658void up_fbuninitialize(int display);
659
660/****************************************************************************
661 * Name: fb_register
662 *
663 * Description:
664 *   Register the framebuffer character device at /dev/fbN where N is the
665 *   display number if the devices supports only a single plane.  If the
666 *   hardware supports multiple color planes, then the device will be
667 *   registered at /dev/fbN.M where N is the again display number but M
668 *   is the display plane.
669 *
670 * Input Parameters:
671 *   display - The display number for the case of boards supporting multiple
672 *             displays or for hardware that supports multiple
673 *             layers (each layer is consider a display).  Typically zero.
674 *   plane   - Identifies the color plane on hardware that supports separate
675 *             framebuffer "planes" for each color component.
676 *
677 * Returned Value:
678 *   Zero (OK) is returned success; a negated errno value is returned on any
679 *   failure.
680 *
681 ****************************************************************************/
682
683int fb_register(int display, int plane);
684
685int fb_unregister(int display);
686
687#undef EXTERN
688#ifdef __cplusplus
689}
690#endif
691
692#endif /* __INCLUDE_NUTTX_VIDEO_FB_H */
693