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