1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> 2 <HTML 3 ><HEAD 4 ><TITLE 5 >ioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF</TITLE 6 ><META 7 NAME="GENERATOR" 8 CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK 9 REL="HOME" 10 TITLE="Video for Linux Two API Specification" 11 HREF="book1.htm"><LINK 12 REL="UP" 13 TITLE="Function Reference" 14 HREF="r7624.htm"><LINK 15 REL="PREVIOUS" 16 TITLE="ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, 17 VIDIOC_TRY_EXT_CTRLS" 18 HREF="r10386.htm"><LINK 19 REL="NEXT" 20 TITLE="ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, 21 VIDIOC_TRY_FMT" 22 HREF="r10944.htm"></HEAD 23 ><BODY 24 CLASS="REFENTRY" 25 BGCOLOR="#FFFFFF" 26 TEXT="#000000" 27 LINK="#0000FF" 28 VLINK="#840084" 29 ALINK="#0000FF" 30 ><DIV 31 CLASS="NAVHEADER" 32 ><TABLE 33 SUMMARY="Header navigation table" 34 WIDTH="100%" 35 BORDER="0" 36 CELLPADDING="0" 37 CELLSPACING="0" 38 ><TR 39 ><TH 40 COLSPAN="3" 41 ALIGN="center" 42 >Video for Linux Two API Specification: Revision 0.24</TH 43 ></TR 44 ><TR 45 ><TD 46 WIDTH="10%" 47 ALIGN="left" 48 VALIGN="bottom" 49 ><A 50 HREF="r10386.htm" 51 ACCESSKEY="P" 52 >Prev</A 53 ></TD 54 ><TD 55 WIDTH="80%" 56 ALIGN="center" 57 VALIGN="bottom" 58 ></TD 59 ><TD 60 WIDTH="10%" 61 ALIGN="right" 62 VALIGN="bottom" 63 ><A 64 HREF="r10944.htm" 65 ACCESSKEY="N" 66 >Next</A 67 ></TD 68 ></TR 69 ></TABLE 70 ><HR 71 ALIGN="LEFT" 72 WIDTH="100%"></DIV 73 ><H1 74 ><A 75 NAME="VIDIOC-G-FBUF" 76 ></A 77 >ioctl VIDIOC_G_FBUF, VIDIOC_S_FBUF</H1 78 ><DIV 79 CLASS="REFNAMEDIV" 80 ><A 81 NAME="AEN10599" 82 ></A 83 ><H2 84 >Name</H2 85 >VIDIOC_G_FBUF, VIDIOC_S_FBUF -- Get or set frame buffer overlay parameters</DIV 86 ><DIV 87 CLASS="REFSYNOPSISDIV" 88 ><A 89 NAME="AEN10603" 90 ></A 91 ><H2 92 >Synopsis</H2 93 ><DIV 94 CLASS="FUNCSYNOPSIS" 95 ><P 96 ></P 97 ><A 98 NAME="AEN10604" 99 ></A 100 ><P 101 ><CODE 102 ><CODE 103 CLASS="FUNCDEF" 104 >int ioctl</CODE 105 >(int fd, int request, struct v4l2_framebuffer *argp);</CODE 106 ></P 107 ><P 108 ></P 109 ></DIV 110 ><DIV 111 CLASS="FUNCSYNOPSIS" 112 ><P 113 ></P 114 ><A 115 NAME="AEN10614" 116 ></A 117 ><P 118 ><CODE 119 ><CODE 120 CLASS="FUNCDEF" 121 >int ioctl</CODE 122 >(int fd, int request, const struct v4l2_framebuffer *argp);</CODE 123 ></P 124 ><P 125 ></P 126 ></DIV 127 ></DIV 128 ><DIV 129 CLASS="REFSECT1" 130 ><A 131 NAME="AEN10624" 132 ></A 133 ><H2 134 >Arguments</H2 135 ><P 136 ></P 137 ><DIV 138 CLASS="VARIABLELIST" 139 ><DL 140 ><DT 141 ><CODE 142 CLASS="PARAMETER" 143 >fd</CODE 144 ></DT 145 ><DD 146 ><P 147 >File descriptor returned by <A 148 HREF="r14090.htm" 149 ><CODE 150 CLASS="FUNCTION" 151 >open()</CODE 152 ></A 153 >.</P 154 ></DD 155 ><DT 156 ><CODE 157 CLASS="PARAMETER" 158 >request</CODE 159 ></DT 160 ><DD 161 ><P 162 >VIDIOC_G_FBUF, VIDIOC_S_FBUF</P 163 ></DD 164 ><DT 165 ><CODE 166 CLASS="PARAMETER" 167 >argp</CODE 168 ></DT 169 ><DD 170 ><P 171 ></P 172 ></DD 173 ></DL 174 ></DIV 175 ></DIV 176 ><DIV 177 CLASS="REFSECT1" 178 ><A 179 NAME="AEN10644" 180 ></A 181 ><H2 182 >Description</H2 183 ><P 184 >Applications can use the <CODE 185 CLASS="CONSTANT" 186 >VIDIOC_G_FBUF</CODE 187 > and 188 <CODE 189 CLASS="CONSTANT" 190 >VIDIOC_S_FBUF</CODE 191 > ioctl to get and set the 192 framebuffer parameters for a <A 193 HREF="x6570.htm" 194 >Video 195 Overlay</A 196 > or <A 197 HREF="x6909.htm" 198 >Video Output Overlay</A 199 > 200 (OSD). The type of overlay is implied by the device type (capture or 201 output device) and can be determined with the <A 202 HREF="r13105.htm" 203 ><CODE 204 CLASS="CONSTANT" 205 >VIDIOC_QUERYCAP</CODE 206 ></A 207 > ioctl. 208 One <TT 209 CLASS="FILENAME" 210 >/dev/videoN</TT 211 > device must not support both 212 kinds of overlay.</P 213 ><P 214 >The V4L2 API distinguishes destructive and non-destructive 215 overlays. A destructive overlay copies captured video images into the 216 video memory of a graphics card. A non-destructive overlay blends 217 video images into a VGA signal or graphics into a video signal. 218 <I 219 CLASS="WORDASWORD" 220 >Video Output Overlays</I 221 > are always 222 non-destructive.</P 223 ><P 224 >To get the current parameters applications call the 225 <CODE 226 CLASS="CONSTANT" 227 >VIDIOC_G_FBUF</CODE 228 > ioctl with a pointer to a 229 <CODE 230 CLASS="STRUCTNAME" 231 >v4l2_framebuffer</CODE 232 > structure. The driver fills 233 all fields of the structure or returns an <SPAN 234 CLASS="ERRORCODE" 235 >EINVAL</SPAN 236 > error code when overlays are 237 not supported.</P 238 ><P 239 >To set the parameters for a <I 240 CLASS="WORDASWORD" 241 >Video Output 242 Overlay</I 243 >, applications must initialize the 244 <CODE 245 CLASS="STRUCTFIELD" 246 >flags</CODE 247 > field of a struct 248 <CODE 249 CLASS="STRUCTNAME" 250 >v4l2_framebuffer</CODE 251 >. Since the framebuffer is 252 implemented on the TV card all other parameters are determined by the 253 driver. When an application calls <CODE 254 CLASS="CONSTANT" 255 >VIDIOC_S_FBUF</CODE 256 > 257 with a pointer to this structure, the driver prepares for the overlay 258 and returns the framebuffer parameters as 259 <CODE 260 CLASS="CONSTANT" 261 >VIDIOC_G_FBUF</CODE 262 > does, or it returns an error 263 code.</P 264 ><P 265 >To set the parameters for a <I 266 CLASS="WORDASWORD" 267 >non-destructive 268 Video Overlay</I 269 >, applications must initialize the 270 <CODE 271 CLASS="STRUCTFIELD" 272 >flags</CODE 273 > field, the 274 <CODE 275 CLASS="STRUCTFIELD" 276 >fmt</CODE 277 > substructure, and call 278 <CODE 279 CLASS="CONSTANT" 280 >VIDIOC_S_FBUF</CODE 281 >. Again the driver prepares for the 282 overlay and returns the framebuffer parameters as 283 <CODE 284 CLASS="CONSTANT" 285 >VIDIOC_G_FBUF</CODE 286 > does, or it returns an error 287 code.</P 288 ><P 289 >For a <I 290 CLASS="WORDASWORD" 291 >destructive Video Overlay</I 292 > 293 applications must additionally provide a 294 <CODE 295 CLASS="STRUCTFIELD" 296 >base</CODE 297 > address. Setting up a DMA to a 298 random memory location can jeopardize the system security, its 299 stability or even damage the hardware, therefore only the superuser 300 can set the parameters for a destructive video overlay.</P 301 ><DIV 302 CLASS="TABLE" 303 ><A 304 NAME="V4L2-FRAMEBUFFER" 305 ></A 306 ><P 307 ><B 308 >Table 1. struct <CODE 309 CLASS="STRUCTNAME" 310 >v4l2_framebuffer</CODE 311 ></B 312 ></P 313 ><TABLE 314 BORDER="0" 315 FRAME="void" 316 WIDTH="100%" 317 CLASS="CALSTABLE" 318 ><COL 319 WIDTH="20%" 320 TITLE="C1"><COL 321 WIDTH="20%" 322 TITLE="C2"><COL 323 WIDTH="20%" 324 TITLE="C3"><COL 325 WIDTH="40%" 326 TITLE="C4"><TBODY 327 VALIGN="TOP" 328 ><TR 329 ><TD 330 >__u32</TD 331 ><TD 332 ><CODE 333 CLASS="STRUCTFIELD" 334 >capability</CODE 335 ></TD 336 ><TD 337 > </TD 338 ><TD 339 >Overlay capability flags set by the driver, see 340 <A 341 HREF="r10595.htm#FRAMEBUFFER-CAP" 342 >Table 2</A 343 >.</TD 344 ></TR 345 ><TR 346 ><TD 347 >__u32</TD 348 ><TD 349 ><CODE 350 CLASS="STRUCTFIELD" 351 >flags</CODE 352 ></TD 353 ><TD 354 > </TD 355 ><TD 356 >Overlay control flags set by application and 357 driver, see <A 358 HREF="r10595.htm#FRAMEBUFFER-FLAGS" 359 >Table 3</A 360 ></TD 361 ></TR 362 ><TR 363 ><TD 364 >void *</TD 365 ><TD 366 ><CODE 367 CLASS="STRUCTFIELD" 368 >base</CODE 369 ></TD 370 ><TD 371 > </TD 372 ><TD 373 ><P 374 >Physical base address of the framebuffer, 375 that is the address of the pixel in the top left corner of the 376 framebuffer.<SUP 377 >a</SUP 378 ></P 379 ><P 380 >This field is irrelevant to 381 <I 382 CLASS="WORDASWORD" 383 >non-destructive Video Overlays</I 384 >. For 385 <I 386 CLASS="WORDASWORD" 387 >destructive Video Overlays</I 388 > applications must 389 provide a base address. The driver may accept only base addresses 390 which are a multiple of two, four or eight bytes. For 391 <I 392 CLASS="WORDASWORD" 393 >Video Output Overlays</I 394 > the driver must return 395 a valid base address, so applications can find the corresponding Linux 396 framebuffer device (see <A 397 HREF="x6909.htm" 398 >Section 4.4</A 399 >).</P 400 ></TD 401 ></TR 402 ><TR 403 ><TD 404 >struct <A 405 HREF="c2030.htm#V4L2-PIX-FORMAT" 406 >v4l2_pix_format</A 407 ></TD 408 ><TD 409 ><CODE 410 CLASS="STRUCTFIELD" 411 >fmt</CODE 412 ></TD 413 ><TD 414 > </TD 415 ><TD 416 >Layout of the frame buffer. The 417 <CODE 418 CLASS="STRUCTNAME" 419 >v4l2_pix_format</CODE 420 > structure is defined in <A 421 HREF="c2030.htm" 422 >Chapter 2</A 423 >, for clarification the fields and acceptable values 424 are listed below:</TD 425 ></TR 426 ><TR 427 ><TD 428 > </TD 429 ><TD 430 >__u32</TD 431 ><TD 432 ><CODE 433 CLASS="STRUCTFIELD" 434 >width</CODE 435 ></TD 436 ><TD 437 >Width of the frame buffer in pixels.</TD 438 ></TR 439 ><TR 440 ><TD 441 > </TD 442 ><TD 443 >__u32</TD 444 ><TD 445 ><CODE 446 CLASS="STRUCTFIELD" 447 >height</CODE 448 ></TD 449 ><TD 450 >Height of the frame buffer in pixels.</TD 451 ></TR 452 ><TR 453 ><TD 454 > </TD 455 ><TD 456 >__u32</TD 457 ><TD 458 ><CODE 459 CLASS="STRUCTFIELD" 460 >pixelformat</CODE 461 ></TD 462 ><TD 463 ><P 464 >The pixel format of the 465 framebuffer.</P 466 ><P 467 >For <I 468 CLASS="WORDASWORD" 469 >non-destructive Video 470 Overlays</I 471 > this field only defines a format for the 472 struct <A 473 HREF="x6570.htm#V4L2-WINDOW" 474 >v4l2_window</A 475 > <CODE 476 CLASS="STRUCTFIELD" 477 >chromakey</CODE 478 > 479 field.</P 480 ><P 481 >For <I 482 CLASS="WORDASWORD" 483 >destructive Video 484 Overlays</I 485 > applications must initialize this field. For 486 <I 487 CLASS="WORDASWORD" 488 >Video Output Overlays</I 489 > the driver must return 490 a valid format.</P 491 ><P 492 >Usually this is an RGB format (for example 493 <A 494 HREF="r2492.htm#V4L2-PIX-FMT-RGB565" 495 ><CODE 496 CLASS="CONSTANT" 497 >V4L2_PIX_FMT_RGB565</CODE 498 ></A 499 >) 500 but YUV formats (only packed YUV formats when chroma keying is used, 501 not including <CODE 502 CLASS="CONSTANT" 503 >V4L2_PIX_FMT_YUYV</CODE 504 > and 505 <CODE 506 CLASS="CONSTANT" 507 >V4L2_PIX_FMT_UYVY</CODE 508 >) and the 509 <CODE 510 CLASS="CONSTANT" 511 >V4L2_PIX_FMT_PAL8</CODE 512 > format are also permitted. The 513 behavior of the driver when an application requests a compressed 514 format is undefined. See <A 515 HREF="c2030.htm" 516 >Chapter 2</A 517 > for information on 518 pixel formats.</P 519 ></TD 520 ></TR 521 ><TR 522 ><TD 523 > </TD 524 ><TD 525 >enum <A 526 HREF="x6386.htm#V4L2-FIELD" 527 >v4l2_field</A 528 ></TD 529 ><TD 530 ><CODE 531 CLASS="STRUCTFIELD" 532 >field</CODE 533 ></TD 534 ><TD 535 >Drivers and applications shall ignore this field. 536 If applicable, the field order is selected with the <A 537 HREF="r10944.htm" 538 ><CODE 539 CLASS="CONSTANT" 540 >VIDIOC_S_FMT</CODE 541 ></A 542 > 543 ioctl, using the <CODE 544 CLASS="STRUCTFIELD" 545 >field</CODE 546 > field of 547 struct <A 548 HREF="x6570.htm#V4L2-WINDOW" 549 >v4l2_window</A 550 >.</TD 551 ></TR 552 ><TR 553 ><TD 554 > </TD 555 ><TD 556 >__u32</TD 557 ><TD 558 ><CODE 559 CLASS="STRUCTFIELD" 560 >bytesperline</CODE 561 ></TD 562 ><TD 563 >Distance in bytes between the leftmost pixels in 564 two adjacent lines.</TD 565 ></TR 566 ><TR 567 ><TD 568 COLSPAN="4" 569 ><P 570 >This field is irrelevant to 571 <I 572 CLASS="WORDASWORD" 573 >non-destructive Video 574 Overlays</I 575 >.</P 576 ><P 577 >For <I 578 CLASS="WORDASWORD" 579 >destructive Video 580 Overlays</I 581 > both applications and drivers can set this field 582 to request padding bytes at the end of each line. Drivers however may 583 ignore the requested value, returning <CODE 584 CLASS="STRUCTFIELD" 585 >width</CODE 586 > 587 times bytes-per-pixel or a larger value required by the hardware. That 588 implies applications can just set this field to zero to get a 589 reasonable default.</P 590 ><P 591 >For <I 592 CLASS="WORDASWORD" 593 >Video Output 594 Overlays</I 595 > the driver must return a valid 596 value.</P 597 ><P 598 >Video hardware may access padding bytes, therefore 599 they must reside in accessible memory. Consider for example the case 600 where padding bytes after the last line of an image cross a system 601 page boundary. Capture devices may write padding bytes, the value is 602 undefined. Output devices ignore the contents of padding 603 bytes.</P 604 ><P 605 >When the image format is planar the 606 <CODE 607 CLASS="STRUCTFIELD" 608 >bytesperline</CODE 609 > value applies to the largest 610 plane and is divided by the same factor as the 611 <CODE 612 CLASS="STRUCTFIELD" 613 >width</CODE 614 > field for any smaller planes. For 615 example the Cb and Cr planes of a YUV 4:2:0 image have half as many 616 padding bytes following each line as the Y plane. To avoid ambiguities 617 drivers must return a <CODE 618 CLASS="STRUCTFIELD" 619 >bytesperline</CODE 620 > value 621 rounded up to a multiple of the scale factor.</P 622 ></TD 623 ></TR 624 ><TR 625 ><TD 626 > </TD 627 ><TD 628 >__u32</TD 629 ><TD 630 ><CODE 631 CLASS="STRUCTFIELD" 632 >sizeimage</CODE 633 ></TD 634 ><TD 635 ><P 636 >This field is irrelevant to 637 <I 638 CLASS="WORDASWORD" 639 >non-destructive Video Overlays</I 640 >. For 641 <I 642 CLASS="WORDASWORD" 643 >destructive Video Overlays</I 644 > applications must 645 initialize this field. For <I 646 CLASS="WORDASWORD" 647 >Video Output 648 Overlays</I 649 > the driver must return a valid 650 format.</P 651 ><P 652 >Together with <CODE 653 CLASS="STRUCTFIELD" 654 >base</CODE 655 > it 656 defines the framebuffer memory accessible by the 657 driver.</P 658 ></TD 659 ></TR 660 ><TR 661 ><TD 662 > </TD 663 ><TD 664 >enum <A 665 HREF="x2123.htm#V4L2-COLORSPACE" 666 >v4l2_colorspace</A 667 ></TD 668 ><TD 669 ><CODE 670 CLASS="STRUCTFIELD" 671 >colorspace</CODE 672 ></TD 673 ><TD 674 >This information supplements the 675 <CODE 676 CLASS="STRUCTFIELD" 677 >pixelformat</CODE 678 > and must be set by the driver, 679 see <A 680 HREF="x2123.htm" 681 >Section 2.2</A 682 >.</TD 683 ></TR 684 ><TR 685 ><TD 686 > </TD 687 ><TD 688 >__u32</TD 689 ><TD 690 ><CODE 691 CLASS="STRUCTFIELD" 692 >priv</CODE 693 ></TD 694 ><TD 695 >Reserved for additional information about custom 696 (driver defined) formats. When not used drivers and applications must 697 set this field to zero.</TD 698 ></TR 699 ></TBODY 700 ><TR 701 ><TD 702 COLSPAN="4" 703 >Notes:<BR><A 704 NAME="FTN.AEN10706" 705 >a. </A 706 >A physical base address may not suit all 707 platforms. GK notes in theory we should pass something like PCI device 708 + memory region + offset instead. If you encounter problems please 709 discuss on the Video4Linux mailing list: 710 <A 711 HREF="https://listman.redhat.com/mailman/listinfo/video4linux-list" 712 TARGET="_top" 713 >https://listman.redhat.com/mailman/listinfo/video4linux-list</A 714 >.<BR></TD 715 ></TR 716 ></TABLE 717 ></DIV 718 ><DIV 719 CLASS="TABLE" 720 ><A 721 NAME="FRAMEBUFFER-CAP" 722 ></A 723 ><P 724 ><B 725 >Table 2. Frame Buffer Capability Flags</B 726 ></P 727 ><TABLE 728 BORDER="0" 729 FRAME="void" 730 WIDTH="100%" 731 CLASS="CALSTABLE" 732 ><COL 733 WIDTH="38%" 734 TITLE="C1"><COL 735 WIDTH="12%" 736 TITLE="C2"><COL 737 WIDTH="50%" 738 TITLE="C3"><TBODY 739 VALIGN="TOP" 740 ><TR 741 ><TD 742 ><CODE 743 CLASS="CONSTANT" 744 >V4L2_FBUF_CAP_EXTERNOVERLAY</CODE 745 ></TD 746 ><TD 747 >0x0001</TD 748 ><TD 749 >The device is capable of non-destructive overlays. 750 When the driver clears this flag, only destructive overlays are 751 supported. There are no drivers yet which support both destructive and 752 non-destructive overlays.</TD 753 ></TR 754 ><TR 755 ><TD 756 ><CODE 757 CLASS="CONSTANT" 758 >V4L2_FBUF_CAP_CHROMAKEY</CODE 759 ></TD 760 ><TD 761 >0x0002</TD 762 ><TD 763 >The device supports clipping by chroma-keying the 764 images. That is, image pixels replace pixels in the VGA or video 765 signal only where the latter assume a certain color. Chroma-keying 766 makes no sense for destructive overlays.</TD 767 ></TR 768 ><TR 769 ><TD 770 ><CODE 771 CLASS="CONSTANT" 772 >V4L2_FBUF_CAP_LIST_CLIPPING</CODE 773 ></TD 774 ><TD 775 >0x0004</TD 776 ><TD 777 >The device supports clipping using a list of clip 778 rectangles.</TD 779 ></TR 780 ><TR 781 ><TD 782 ><CODE 783 CLASS="CONSTANT" 784 >V4L2_FBUF_CAP_BITMAP_CLIPPING</CODE 785 ></TD 786 ><TD 787 >0x0008</TD 788 ><TD 789 >The device supports clipping using a bit mask.</TD 790 ></TR 791 ><TR 792 ><TD 793 ><CODE 794 CLASS="CONSTANT" 795 >V4L2_FBUF_CAP_LOCAL_ALPHA</CODE 796 ></TD 797 ><TD 798 >0x0010</TD 799 ><TD 800 >The device supports clipping/blending using the 801 alpha channel of the framebuffer or VGA signal. Alpha blending makes 802 no sense for destructive overlays.</TD 803 ></TR 804 ><TR 805 ><TD 806 ><CODE 807 CLASS="CONSTANT" 808 >V4L2_FBUF_CAP_GLOBAL_ALPHA</CODE 809 ></TD 810 ><TD 811 >0x0020</TD 812 ><TD 813 >The device supports alpha blending using a global 814 alpha value. Alpha blending makes no sense for destructive overlays.</TD 815 ></TR 816 ><TR 817 ><TD 818 ><CODE 819 CLASS="CONSTANT" 820 >V4L2_FBUF_CAP_LOCAL_INV_ALPHA</CODE 821 ></TD 822 ><TD 823 >0x0040</TD 824 ><TD 825 >The device supports clipping/blending using the 826 inverted alpha channel of the framebuffer or VGA signal. Alpha 827 blending makes no sense for destructive overlays.</TD 828 ></TR 829 ></TBODY 830 ></TABLE 831 ></DIV 832 ><DIV 833 CLASS="TABLE" 834 ><A 835 NAME="FRAMEBUFFER-FLAGS" 836 ></A 837 ><P 838 ><B 839 >Table 3. Frame Buffer Flags</B 840 ></P 841 ><TABLE 842 BORDER="0" 843 FRAME="void" 844 WIDTH="100%" 845 CLASS="CALSTABLE" 846 ><COL 847 WIDTH="38%" 848 TITLE="C1"><COL 849 WIDTH="12%" 850 TITLE="C2"><COL 851 WIDTH="50%" 852 TITLE="C3"><TBODY 853 VALIGN="TOP" 854 ><TR 855 ><TD 856 ><CODE 857 CLASS="CONSTANT" 858 >V4L2_FBUF_FLAG_PRIMARY</CODE 859 ></TD 860 ><TD 861 >0x0001</TD 862 ><TD 863 >The framebuffer is the primary graphics surface. 864 In other words, the overlay is destructive. [?]</TD 865 ></TR 866 ><TR 867 ><TD 868 ><CODE 869 CLASS="CONSTANT" 870 >V4L2_FBUF_FLAG_OVERLAY</CODE 871 ></TD 872 ><TD 873 >0x0002</TD 874 ><TD 875 >The frame buffer is an overlay surface the same 876 size as the capture. [?]</TD 877 ></TR 878 ><TR 879 ><TD 880 COLSPAN="3" 881 >The purpose of 882 <CODE 883 CLASS="CONSTANT" 884 >V4L2_FBUF_FLAG_PRIMARY</CODE 885 > and 886 <CODE 887 CLASS="CONSTANT" 888 >V4L2_FBUF_FLAG_OVERLAY</CODE 889 > was never quite clear. 890 Most drivers seem to ignore these flags. For compatibility with the 891 <I 892 CLASS="WORDASWORD" 893 >bttv</I 894 > driver applications should set the 895 <CODE 896 CLASS="CONSTANT" 897 >V4L2_FBUF_FLAG_OVERLAY</CODE 898 > flag.</TD 899 ></TR 900 ><TR 901 ><TD 902 ><CODE 903 CLASS="CONSTANT" 904 >V4L2_FBUF_FLAG_CHROMAKEY</CODE 905 ></TD 906 ><TD 907 >0x0004</TD 908 ><TD 909 >Use chroma-keying. The chroma-key color is 910 determined by the <CODE 911 CLASS="STRUCTFIELD" 912 >chromakey</CODE 913 > field of 914 struct <A 915 HREF="x6570.htm#V4L2-WINDOW" 916 >v4l2_window</A 917 > and negotiated with the <A 918 HREF="r10944.htm" 919 ><CODE 920 CLASS="CONSTANT" 921 >VIDIOC_S_FMT</CODE 922 ></A 923 > ioctl, see <A 924 HREF="x6570.htm" 925 >Section 4.2</A 926 > 927 and 928 <A 929 HREF="x6909.htm" 930 >Section 4.4</A 931 >.</TD 932 ></TR 933 ><TR 934 ><TD 935 COLSPAN="3" 936 >There are no flags to enable 937 clipping using a list of clip rectangles or a bitmap. These methods 938 are negotiated with the <A 939 HREF="r10944.htm" 940 ><CODE 941 CLASS="CONSTANT" 942 >VIDIOC_S_FMT</CODE 943 ></A 944 > ioctl, see <A 945 HREF="x6570.htm" 946 >Section 4.2</A 947 > and <A 948 HREF="x6909.htm" 949 >Section 4.4</A 950 >.</TD 951 ></TR 952 ><TR 953 ><TD 954 ><CODE 955 CLASS="CONSTANT" 956 >V4L2_FBUF_FLAG_LOCAL_ALPHA</CODE 957 ></TD 958 ><TD 959 >0x0008</TD 960 ><TD 961 >Use the alpha channel of the framebuffer to clip or 962 blend framebuffer pixels with video images. The blend 963 function is: output = framebuffer pixel * alpha + video pixel * (1 - 964 alpha). The actual alpha depth depends on the framebuffer pixel 965 format.</TD 966 ></TR 967 ><TR 968 ><TD 969 ><CODE 970 CLASS="CONSTANT" 971 >V4L2_FBUF_FLAG_GLOBAL_ALPHA</CODE 972 ></TD 973 ><TD 974 >0x0010</TD 975 ><TD 976 >Use a global alpha value to blend the framebuffer 977 with video images. The blend function is: output = (framebuffer pixel 978 * alpha + video pixel * (255 - alpha)) / 255. The alpha value is 979 determined by the <CODE 980 CLASS="STRUCTFIELD" 981 >global_alpha</CODE 982 > field of 983 struct <A 984 HREF="x6570.htm#V4L2-WINDOW" 985 >v4l2_window</A 986 > and negotiated with the <A 987 HREF="r10944.htm" 988 ><CODE 989 CLASS="CONSTANT" 990 >VIDIOC_S_FMT</CODE 991 ></A 992 > ioctl, see <A 993 HREF="x6570.htm" 994 >Section 4.2</A 995 > 996 and <A 997 HREF="x6909.htm" 998 >Section 4.4</A 999 >.</TD 1000 ></TR 1001 ><TR 1002 ><TD 1003 ><CODE 1004 CLASS="CONSTANT" 1005 >V4L2_FBUF_FLAG_LOCAL_INV_ALPHA</CODE 1006 ></TD 1007 ><TD 1008 >0x0020</TD 1009 ><TD 1010 >Like 1011 <CODE 1012 CLASS="CONSTANT" 1013 >V4L2_FBUF_FLAG_LOCAL_ALPHA</CODE 1014 >, use the alpha channel 1015 of the framebuffer to clip or blend framebuffer pixels with video 1016 images, but with an inverted alpha value. The blend function is: 1017 output = framebuffer pixel * (1 - alpha) + video pixel * alpha. The 1018 actual alpha depth depends on the framebuffer pixel format.</TD 1019 ></TR 1020 ></TBODY 1021 ></TABLE 1022 ></DIV 1023 ></DIV 1024 ><DIV 1025 CLASS="REFSECT1" 1026 ><A 1027 NAME="AEN10920" 1028 ></A 1029 ><H2 1030 >Return Value</H2 1031 ><P 1032 >On success <SPAN 1033 CLASS="RETURNVALUE" 1034 >0</SPAN 1035 > is returned, on error <SPAN 1036 CLASS="RETURNVALUE" 1037 >-1</SPAN 1038 > and the <CODE 1039 CLASS="VARNAME" 1040 >errno</CODE 1041 > variable is set appropriately:</P 1042 ><P 1043 ></P 1044 ><DIV 1045 CLASS="VARIABLELIST" 1046 ><DL 1047 ><DT 1048 ><SPAN 1049 CLASS="ERRORCODE" 1050 >EPERM</SPAN 1051 ></DT 1052 ><DD 1053 ><P 1054 ><CODE 1055 CLASS="CONSTANT" 1056 >VIDIOC_S_FBUF</CODE 1057 > can only be called 1058 by a privileged user to negotiate the parameters for a destructive 1059 overlay.</P 1060 ></DD 1061 ><DT 1062 ><SPAN 1063 CLASS="ERRORCODE" 1064 >EBUSY</SPAN 1065 ></DT 1066 ><DD 1067 ><P 1068 >The framebuffer parameters cannot be changed at this 1069 time because overlay is already enabled, or capturing is enabled 1070 and the hardware cannot capture and overlay simultaneously.</P 1071 ></DD 1072 ><DT 1073 ><SPAN 1074 CLASS="ERRORCODE" 1075 >EINVAL</SPAN 1076 ></DT 1077 ><DD 1078 ><P 1079 >The ioctl is not supported or the 1080 <CODE 1081 CLASS="CONSTANT" 1082 >VIDIOC_S_FBUF</CODE 1083 > parameters are unsuitable.</P 1084 ></DD 1085 ></DL 1086 ></DIV 1087 ></DIV 1088 ><DIV 1089 CLASS="NAVFOOTER" 1090 ><HR 1091 ALIGN="LEFT" 1092 WIDTH="100%"><TABLE 1093 SUMMARY="Footer navigation table" 1094 WIDTH="100%" 1095 BORDER="0" 1096 CELLPADDING="0" 1097 CELLSPACING="0" 1098 ><TR 1099 ><TD 1100 WIDTH="33%" 1101 ALIGN="left" 1102 VALIGN="top" 1103 ><A 1104 HREF="r10386.htm" 1105 ACCESSKEY="P" 1106 >Prev</A 1107 ></TD 1108 ><TD 1109 WIDTH="34%" 1110 ALIGN="center" 1111 VALIGN="top" 1112 ><A 1113 HREF="book1.htm" 1114 ACCESSKEY="H" 1115 >Home</A 1116 ></TD 1117 ><TD 1118 WIDTH="33%" 1119 ALIGN="right" 1120 VALIGN="top" 1121 ><A 1122 HREF="r10944.htm" 1123 ACCESSKEY="N" 1124 >Next</A 1125 ></TD 1126 ></TR 1127 ><TR 1128 ><TD 1129 WIDTH="33%" 1130 ALIGN="left" 1131 VALIGN="top" 1132 >ioctl VIDIOC_G_EXT_CTRLS, VIDIOC_S_EXT_CTRLS, 1133 VIDIOC_TRY_EXT_CTRLS</TD 1134 ><TD 1135 WIDTH="34%" 1136 ALIGN="center" 1137 VALIGN="top" 1138 ><A 1139 HREF="r7624.htm" 1140 ACCESSKEY="U" 1141 >Up</A 1142 ></TD 1143 ><TD 1144 WIDTH="33%" 1145 ALIGN="right" 1146 VALIGN="top" 1147 >ioctl VIDIOC_G_FMT, VIDIOC_S_FMT, 1148 VIDIOC_TRY_FMT</TD 1149 ></TR 1150 ></TABLE 1151 ></DIV 1152 ></BODY 1153 ></HTML 1154 > 1155