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