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