15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    NV_vdpau_interop
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_NV_vdpau_interop
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciContributors
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    Stephen Warren, NVIDIA
125bd8deadSopenharmony_ci    James Jones, NVIDIA
135bd8deadSopenharmony_ci
145bd8deadSopenharmony_ciContact
155bd8deadSopenharmony_ci
165bd8deadSopenharmony_ci    Stephen Warren, NVIDIA (swarren 'at' nvidia.com)
175bd8deadSopenharmony_ci
185bd8deadSopenharmony_ciStatus
195bd8deadSopenharmony_ci
205bd8deadSopenharmony_ci    Complete.
215bd8deadSopenharmony_ci
225bd8deadSopenharmony_ciVersion
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ci    11 (2 Jan 2014)
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciNumber
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    396
295bd8deadSopenharmony_ci
305bd8deadSopenharmony_ciDependencies
315bd8deadSopenharmony_ci
325bd8deadSopenharmony_ci    This extension is written against the OpenGL 3.2 Specification
335bd8deadSopenharmony_ci    but can apply to OpenGL 1.1 and up.
345bd8deadSopenharmony_ci
355bd8deadSopenharmony_ci    OpenGL 1.1 is required.
365bd8deadSopenharmony_ci    GL_EXT_framebuffer_object affects the definition of this extension.
375bd8deadSopenharmony_ci    GL_ARB_texture_rectangle affects the definition of this extension.
385bd8deadSopenharmony_ci    GL_ARB_texture_non_power_of_two affects the definition of this
395bd8deadSopenharmony_ci    extension.
405bd8deadSopenharmony_ci
415bd8deadSopenharmony_ciOverview
425bd8deadSopenharmony_ci
435bd8deadSopenharmony_ci    This extension allows VDPAU video and output surfaces to be used
445bd8deadSopenharmony_ci    for texturing and rendering.
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci    This allows the GL to process and display the content of video
475bd8deadSopenharmony_ci    streams decoded using VDPAU.
485bd8deadSopenharmony_ci
495bd8deadSopenharmony_ci    Alternatively, the GL may modify VDPAU surfaces in-place, and VDPAU
505bd8deadSopenharmony_ci    may then process and/or display those surfaces itself.
515bd8deadSopenharmony_ci
525bd8deadSopenharmony_ci    This allows the GL to be used to combine application user-interface
535bd8deadSopenharmony_ci    elements with decoded video, implement custom video-processing
545bd8deadSopenharmony_ci    algorithms, etc.
555bd8deadSopenharmony_ci
565bd8deadSopenharmony_ciIP Status
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci    There are no known IP issues. 
595bd8deadSopenharmony_ci
605bd8deadSopenharmony_ciNew Types
615bd8deadSopenharmony_ci
625bd8deadSopenharmony_ci    typedef GLintptr GLvdpauSurfaceNV;
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ciNew Procedures and Functions
655bd8deadSopenharmony_ci
665bd8deadSopenharmony_ci    void VDPAUInitNV (const void *vdpDevice,
675bd8deadSopenharmony_ci                      const void *getProcAddress);
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci    void VDPAUFiniNV (void);
705bd8deadSopenharmony_ci
715bd8deadSopenharmony_ci    vdpauSurfaceNV VDPAURegisterVideoSurfaceNV (const void *vdpSurface,
725bd8deadSopenharmony_ci                                                enum       target,
735bd8deadSopenharmony_ci                                                sizei      numTextureNames,
745bd8deadSopenharmony_ci                                                const uint *textureNames);
755bd8deadSopenharmony_ci
765bd8deadSopenharmony_ci    vdpauSurfaceNV VDPAURegisterOutputSurfaceNV (const void *vdpSurface,
775bd8deadSopenharmony_ci                                                 enum       target,
785bd8deadSopenharmony_ci                                                 sizei      numTextureNames,
795bd8deadSopenharmony_ci                                                 const uint *textureNames);
805bd8deadSopenharmony_ci
815bd8deadSopenharmony_ci    boolean VDPAUIsSurfaceNV (vdpauSurfaceNV surface);
825bd8deadSopenharmony_ci
835bd8deadSopenharmony_ci    void VDPAUUnregisterSurfaceNV (vdpauSurfaceNV surface);
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci    void VDPAUGetSurfaceivNV (vdpauSurfaceNV surface,
865bd8deadSopenharmony_ci                              enum           pname,
875bd8deadSopenharmony_ci                              sizei          bufSize,
885bd8deadSopenharmony_ci                              sizei          *length,
895bd8deadSopenharmony_ci                              int            *values);
905bd8deadSopenharmony_ci
915bd8deadSopenharmony_ci    void VDPAUSurfaceAccessNV (vdpauSurfaceNV surface,
925bd8deadSopenharmony_ci                               enum           access);
935bd8deadSopenharmony_ci
945bd8deadSopenharmony_ci    void VDPAUMapSurfacesNV (sizei                numSurfaces,
955bd8deadSopenharmony_ci                             const vdpauSurfaceNV *surfaces);
965bd8deadSopenharmony_ci
975bd8deadSopenharmony_ci    void VDPAUUnmapSurfacesNV (sizei                numSurface,
985bd8deadSopenharmony_ci                               const vdpauSurfaceNV *surfaces);
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ciNew Tokens
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    Accepted as the <pname> parameter of VDPAUGetSurfaceivNV:
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci        SURFACE_STATE_NV                0x86EB
1055bd8deadSopenharmony_ci
1065bd8deadSopenharmony_ci    Returned in <values> for VDPAUGetSurfaceivNV <pname> 
1075bd8deadSopenharmony_ci    SURFACE_STATE_NV:
1085bd8deadSopenharmony_ci
1095bd8deadSopenharmony_ci        SURFACE_REGISTERED_NV           0x86FD
1105bd8deadSopenharmony_ci        SURFACE_MAPPED_NV               0x8700
1115bd8deadSopenharmony_ci
1125bd8deadSopenharmony_ci    Accepted as the <pname> parameter of VDPAUSurfaceAccessNV:
1135bd8deadSopenharmony_ci
1145bd8deadSopenharmony_ci        WRITE_DISCARD_NV                 0x88BE
1155bd8deadSopenharmony_ci
1165bd8deadSopenharmony_ciAdditions to Chapter 2 of the OpenGL 3.2 (unabridged) Specification
1175bd8deadSopenharmony_ci(OpenGL Operation)
1185bd8deadSopenharmony_ci
1195bd8deadSopenharmony_ci    Add to Table 2.2, GL data types:
1205bd8deadSopenharmony_ci
1215bd8deadSopenharmony_ci    GL Type         Minimum    Description
1225bd8deadSopenharmony_ci                    Bit Width
1235bd8deadSopenharmony_ci    -------         ---------  ----------------------------------------------
1245bd8deadSopenharmony_ci    vdpauSurfaceNV  <ptrbits>  VDPAU surface object handle (see section 3.8.3)
1255bd8deadSopenharmony_ci
1265bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 3.2 (unabridged) Specification
1275bd8deadSopenharmony_ci(Rasterization)
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    Insert a new section following "Alternate Texture Image
1305bd8deadSopenharmony_ci    Specification Commands" (Section 3.8.2). Renumber existing section
1315bd8deadSopenharmony_ci    3.8.3 "Compressed Texture Images" and all following 3.8.* sections.
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ci    3.8.3, Alternate Texture Image Specification Using VDPAU Surfaces
1345bd8deadSopenharmony_ci    -----------------------------------------------------------------
1355bd8deadSopenharmony_ci
1365bd8deadSopenharmony_ci    Texture images may also be specified using image data taken
1375bd8deadSopenharmony_ci    directly from the framebuffer, in the form of VDPAU surfaces.
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    VDPAU surfaces are logically ascribed an interop state. States
1405bd8deadSopenharmony_ci    and transitions are:
1415bd8deadSopenharmony_ci
1425bd8deadSopenharmony_ci              VDPAUUnegisterSurfaceNV/VDPAUFiniNV
1435bd8deadSopenharmony_ci            /----------------------------------------\
1445bd8deadSopenharmony_ci            |                                        |
1455bd8deadSopenharmony_ci            v            VDPAURegister*SurfaceNV     |
1465bd8deadSopenharmony_ci    Unknown/unregistered ----------------------> Registered
1475bd8deadSopenharmony_ci            ^                                       |  ^
1485bd8deadSopenharmony_ci            |                    VDPAUMapSurfacesNV |  | VDPAUUnmapSurfacesNV
1495bd8deadSopenharmony_ci            |                                       v  |
1505bd8deadSopenharmony_ci            \------------------------------------- Mapped
1515bd8deadSopenharmony_ci              VDPAUFiniNV
1525bd8deadSopenharmony_ci
1535bd8deadSopenharmony_ci    In order to use such "interop" functionality, the command
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci        void VDPAUInitNV (const void *vdpDevice,
1565bd8deadSopenharmony_ci                          const void *getProcAddress);
1575bd8deadSopenharmony_ci
1585bd8deadSopenharmony_ci    must be used to inform the GL which VDPAU device to interact with.
1595bd8deadSopenharmony_ci    <vdpDevice> must be an extant VdpDevice handle previously created
1605bd8deadSopenharmony_ci    using VDPAU. <getProcAddress> must be the VdpGetProcAddress
1615bd8deadSopenharmony_ci    generated during VdpDevice creation.
1625bd8deadSopenharmony_ci
1635bd8deadSopenharmony_ci    When interop functionality is no longer required, the GL may be
1645bd8deadSopenharmony_ci    informed using the command
1655bd8deadSopenharmony_ci
1665bd8deadSopenharmony_ci        void VDPAUFiniNV (void);
1675bd8deadSopenharmony_ci
1685bd8deadSopenharmony_ci    This operation will succeed even if surfaces exist in the mapped
1695bd8deadSopenharmony_ci    or registered states; such surfaces will internally be unmapped and
1705bd8deadSopenharmony_ci    unregistered before interop state is destroyed.
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ci    The command
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci        vdpauSurfaceNV VDPAURegisterVideoSurfaceNV (const void *vdpSurface,
1755bd8deadSopenharmony_ci                                                    enum       target,
1765bd8deadSopenharmony_ci                                                    sizei      numTextureNames,
1775bd8deadSopenharmony_ci                                                    const uint *textureNames);
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci    defines a set of two-dimensional textures, where the image data may
1805bd8deadSopenharmony_ci    be taken from the VdpVideoSurface <vdpSurface>. <target> must be
1815bd8deadSopenharmony_ci    one of TEXTURE_2D or TEXTURE_RECTANGLE. <numTextureNames>
1825bd8deadSopenharmony_ci    determines how many textures are defined. <textureNames> contains
1835bd8deadSopenharmony_ci    the names of the textures that are defined. The surface is
1845bd8deadSopenharmony_ci    transitioned into the registered state.
1855bd8deadSopenharmony_ci
1865bd8deadSopenharmony_ci    Legal values for <numTextureNames> are derived from the
1875bd8deadSopenharmony_ci    VdpChromaType of <vdpSurface>, as defined in table 3.8.3.1.
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci                                                              Internal
1905bd8deadSopenharmony_ci      VdpChromaType        numTextureNames  Index  Size       Format    Content
1915bd8deadSopenharmony_ci      -------------        ---------------  -----  ----       --------  -------------------
1925bd8deadSopenharmony_ci      VDP_CHROMA_TYPE_420  4                0      w   x h/2  R8        Top-field luma
1935bd8deadSopenharmony_ci                                            1      w   x h/2  R8        Bottom-field luma
1945bd8deadSopenharmony_ci                                            2      w/2 x h/4  R8G8      Top-field chroma
1955bd8deadSopenharmony_ci                                            3      w/2 x h/4  R8G8      Bottom-field chroma
1965bd8deadSopenharmony_ci      VDP_CHROMA_TYPE_422  4                0      w   x h/2  R8        Top-field luma
1975bd8deadSopenharmony_ci                                            1      w   x h/2  R8        Bottom-field luma
1985bd8deadSopenharmony_ci                                            2      w/2 x h/2  R8G8      Top-field chroma
1995bd8deadSopenharmony_ci                                            3      w/2 x h/2  R8G8      Bottom-field chroma
2005bd8deadSopenharmony_ci
2015bd8deadSopenharmony_ci      Table 3.8.3.1: Supported VdpChromaType values, and derived values
2025bd8deadSopenharmony_ci      of <numTextureNames>, and texture parameters for each texture.
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    VDPAURegisterVideoSurfaceNV's return value is a handle used by
2055bd8deadSopenharmony_ci    various other commands detailed below.
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ci    The command
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci        vdpauSurfaceNV VDPAURegisterOutputSurfaceNV (const void *vdpSurface,
2105bd8deadSopenharmony_ci                                                     enum       target,
2115bd8deadSopenharmony_ci                                                     sizei      numTextureNames,
2125bd8deadSopenharmony_ci                                                     const uint *textureNames);
2135bd8deadSopenharmony_ci
2145bd8deadSopenharmony_ci    defines a set of two-dimensional textures, where the image data may
2155bd8deadSopenharmony_ci    be taken from the VdpOutputSurface vdpSurface. <target> must be one
2165bd8deadSopenharmony_ci    of TEXTURE_2D or TEXTURE_RECTANGLE. <numTextureNames> determines
2175bd8deadSopenharmony_ci    how many textures are defined. <textureNames> contains the names of
2185bd8deadSopenharmony_ci    the textures that are defined. The surface is transitioned into the
2195bd8deadSopenharmony_ci    registered state.
2205bd8deadSopenharmony_ci
2215bd8deadSopenharmony_ci    Legal values for <numTextureNames> are derived from the
2225bd8deadSopenharmony_ci    VdpRGBAFormat of <vdpSurface>, as defined in table 3.8.3.2.
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci                                                                  Internal
2255bd8deadSopenharmony_ci      VdpRGBAFormat                numTextureNames  Index  Size   Format    Content
2265bd8deadSopenharmony_ci      -------------                ---------------  -----  ----   --------  --------------
2275bd8deadSopenharmony_ci      VDP_RGBA_FORMAT_B8G8R8A8     1                0      w x h  ARGB8     Entire surface
2285bd8deadSopenharmony_ci      VDP_RGBA_FORMAT_R10G10B10A2  1                0      w x h  A2BGR10   Entire surface
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci      Table 3.8.3.2: Supported VdpRGBAFormat values, and derived values
2315bd8deadSopenharmony_ci      of <numTextureNames>, and texture parameters for each texture.
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    In all cases, textures defined by VDPAU surfaces will be y-
2345bd8deadSopenharmony_ci    inverted; applications are expected to use y-inverted texture co-
2355bd8deadSopenharmony_ci    ordinates when using such textures.
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci    VDPAURegisterOutputSurfaceNV's return value is a handle to be used
2385bd8deadSopenharmony_ci    as the surface parameter to various other commands detailed below.
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    The command
2415bd8deadSopenharmony_ci
2425bd8deadSopenharmony_ci        void VDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
2435bd8deadSopenharmony_ci
2445bd8deadSopenharmony_ci    may be used to revert the effect of VDPAURegisterVideoSurfaceNV or
2455bd8deadSopenharmony_ci    VDPAURegisterOutputSurfaceNV; namely, any <textureName>s that were
2465bd8deadSopenharmony_ci    passed into the register function will be returned to their default
2475bd8deadSopenharmony_ci    state. The surface will be transitioned into the unregistered state.
2485bd8deadSopenharmony_ci    This operation will succeed even if the surface is in the mapped
2495bd8deadSopenharmony_ci    state; such surfaces will internally be unmapped before being
2505bd8deadSopenharmony_ci    unregistered.
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    The command
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci        void VDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface,
2555bd8deadSopenharmony_ci                                   enum             access);
2565bd8deadSopenharmony_ci
2575bd8deadSopenharmony_ci    informs the GL whether the application expects only to read from the
2585bd8deadSopenharmony_ci    VDPAU surface using the GL (<access> set to READ_ONLY), only to
2595bd8deadSopenharmony_ci    write to the VDPAU surface using the GL (<access> set to
2605bd8deadSopenharmony_ci    WRITE_DISCARD_NV), or both (<access> set to READ_WRITE). In
2615bd8deadSopenharmony_ci    implementations that need to copy image data during
2625bd8deadSopenharmony_ci    VDPAUMapSurfacesNV or VDPAUUnmapSurfacesNV, this flag may allow the
2635bd8deadSopenharmony_ci    GL to skip some of those copy operations to improve performance.
2645bd8deadSopenharmony_ci
2655bd8deadSopenharmony_ci    An <access> value of READ_ONLY ensures that any writes to the
2665bd8deadSopenharmony_ci    surface made by VDPAU prior to VDPAUMapSurfacesNV will be seen by
2675bd8deadSopenharmony_ci    the GL when reading the surface after VDPAUMapSurfacesNV. If the
2685bd8deadSopenharmony_ci    GL writes to the surface, results are undefined, possibly including
2695bd8deadSopenharmony_ci    program termination.
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    An <access> value of READ_WRITE ensures that any writes to the
2725bd8deadSopenharmony_ci    surface made by VDPAU prior to VDPAUMapSurfacesNV will be seen by
2735bd8deadSopenharmony_ci    the GL when reading the surface after VDPAUMapSurfacesNV. Equally,
2745bd8deadSopenharmony_ci    any writes to the surface made by the GL prior to
2755bd8deadSopenharmony_ci    VDPAUUnmapSurfacesNV will be seen by VDPAU after
2765bd8deadSopenharmony_ci    VDPAUUnmapSurfacesNV.
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ci    An <access> value of WRITE_DISCARD_NV ensures that any writes to the
2795bd8deadSopenharmony_ci    surface made by the GL prior to VDPAUUnmapSurfacesNV will be seen
2805bd8deadSopenharmony_ci    by VDPAU after VDPAUUnmapSurfacesNV. If the GL reads from the
2815bd8deadSopenharmony_ci    surface prior to writing those particular pixels itself, the
2825bd8deadSopenharmony_ci    graphical results are undefined, but should not include program
2835bd8deadSopenharmony_ci    termination.
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    VDPAUSurfaceAccessNV sets the access flag for the VDPAU surface.
2865bd8deadSopenharmony_ci    the GL reads the access flag only during VDPAUMapSurfacesNV.
2875bd8deadSopenharmony_ci    VDPAUUnmapSurfacesNV uses the value of the access flag that was
2885bd8deadSopenharmony_ci    set when the previous VDPAUMapSurfacesNV was called.
2895bd8deadSopenharmony_ci    VDPAUSurfaceAccessNV itself has no effect on the image data of any
2905bd8deadSopenharmony_ci    surface, and in particular does not initiate any copy operations.
2915bd8deadSopenharmony_ci
2925bd8deadSopenharmony_ci    Calling VDPAUSurfaceAccessNV when the surface is in a mapped state
2935bd8deadSopenharmony_ci    is illegal, and will generate an error.
2945bd8deadSopenharmony_ci
2955bd8deadSopenharmony_ci    The command
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci        void VDPAUMapSurfacesNV (sizei          numSurfaces,
2985bd8deadSopenharmony_ci                                 vdpauSurfaceNV *surfaces);
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci    moves a set of VDPAU surfaces from the registered state into the
3015bd8deadSopenharmony_ci    mapped state.
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ci    The command
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci        void VDPAUUnmapSurfacesNV (sizei           numSurface,
3065bd8deadSopenharmony_ci                                   vdpauSurfaceNV* surfaces);
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci    moves a set of VDPAU surfaces from the mapped state into the
3095bd8deadSopenharmony_ci    registered state.
3105bd8deadSopenharmony_ci
3115bd8deadSopenharmony_ci    Using the GL to texture from, or write to, a surface in any state
3125bd8deadSopenharmony_ci    other than mapped will yield undefined results, potentially
3135bd8deadSopenharmony_ci    including program termination.
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci    Using any other API to access a VDPAU surface while that surface is
3165bd8deadSopenharmony_ci    in the mapped state in the GL will yield undefined results,
3175bd8deadSopenharmony_ci    potentially including program termination.
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ci    Texture image data for VDPAU surfaces in the mapped state is
3205bd8deadSopenharmony_ci    defined as being identical to the VDPAU surface content.
3215bd8deadSopenharmony_ci
3225bd8deadSopenharmony_ci    While a VDPAU surface is in the mapped or registered states, the
3235bd8deadSopenharmony_ci    textures associated with that surface are immutable. In other
3245bd8deadSopenharmony_ci    words, operations that affect texture state, or attempt to replace
3255bd8deadSopenharmony_ci    the source of the texture image data (e.g. TexImage2D) will return
3265bd8deadSopenharmony_ci    an error. Rendering to the texture is allowed.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ciAdditions to Chapter 4 of the OpenGL 3.2 (unabridged) Specification
3295bd8deadSopenharmony_ci(Per-Fragment Operations and the Frame Buffer)
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    None
3325bd8deadSopenharmony_ci
3335bd8deadSopenharmony_ciAdditions to Chapter 5 of the OpenGL 3.2 (unabridged) Specification
3345bd8deadSopenharmony_ci(Special Functions)
3355bd8deadSopenharmony_ci
3365bd8deadSopenharmony_ci    None
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ciAdditions to Chapter 6 of the OpenGL 3.2 (unabridged) Specification
3395bd8deadSopenharmony_ci(State and State Requests)
3405bd8deadSopenharmony_ci
3415bd8deadSopenharmony_ci    Add a new subsection to "Querying GL state" (section
3425bd8deadSopenharmony_ci    6.1) describing VDPAU surface object queries.
3435bd8deadSopenharmony_ci
3445bd8deadSopenharmony_ci   "6.1.X VDPAU Surface Object Queries
3455bd8deadSopenharmony_ci
3465bd8deadSopenharmony_ci    Properties of VDPAU surface objects may be queried using the command
3475bd8deadSopenharmony_ci
3485bd8deadSopenharmony_ci        void VDPAUGetSurfaceivNV (vdpauSurfaceNV surface,
3495bd8deadSopenharmony_ci                                  enum           pname,
3505bd8deadSopenharmony_ci                                  sizei          bufSize,
3515bd8deadSopenharmony_ci                                  sizei          *length,
3525bd8deadSopenharmony_ci                                  int            *values);
3535bd8deadSopenharmony_ci
3545bd8deadSopenharmony_ci    The value or values being queried are returned in the parameters
3555bd8deadSopenharmony_ci    <length> and <values>.
3565bd8deadSopenharmony_ci
3575bd8deadSopenharmony_ci    On success, VDPAUGetSurfaceivNV replaces up to <bufSize> integers
3585bd8deadSopenharmony_ci    in <values> with the corresponding property values of the object
3595bd8deadSopenharmony_ci    being queried. The actual number of integers replaced is returned
3605bd8deadSopenharmony_ci    in *<length>. If <length> is NULL, no length is returned.
3615bd8deadSopenharmony_ci
3625bd8deadSopenharmony_ci    If <pname> is SURFACE_STATE_NV, a single value representing the state
3635bd8deadSopenharmony_ci    of the VDPAU surface object (SURFACE_REGISTERED_NV,
3645bd8deadSopenharmony_ci    SURFACE_MAPPED_NV) is placed in <values>.
3655bd8deadSopenharmony_ci
3665bd8deadSopenharmony_ci    If <surface> is not the name of a VDPAU surface object, an
3675bd8deadSopenharmony_ci    INVALID_VALUE error is generated. If <pname> is not one of the
3685bd8deadSopenharmony_ci    values described above, an INVALID_ENUM error is generated. If an
3695bd8deadSopenharmony_ci    error occurs, nothing will be written to <values> or <length>.
3705bd8deadSopenharmony_ci
3715bd8deadSopenharmony_ci    The command
3725bd8deadSopenharmony_ci
3735bd8deadSopenharmony_ci        boolean VDPAUIsSurfaceNV (vdpauSurfaceNV surface);
3745bd8deadSopenharmony_ci
3755bd8deadSopenharmony_ci    returns TRUE if <surface> is the name of a VDPAU surface object. If
3765bd8deadSopenharmony_ci    <surface> is not the name of a VDPAU surface object, or if an error
3775bd8deadSopenharmony_ci    condition occurs, IsSurface returns FALSE (note that zero is not
3785bd8deadSopenharmony_ci    the name of a VDPAU surface object).
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ciAdditions to the AGL/GLX/WGL Specifications
3815bd8deadSopenharmony_ci
3825bd8deadSopenharmony_ci    None
3835bd8deadSopenharmony_ci
3845bd8deadSopenharmony_ciAdditions to the OpenGL Shading Language
3855bd8deadSopenharmony_ci
3865bd8deadSopenharmony_ci    None
3875bd8deadSopenharmony_ci
3885bd8deadSopenharmony_ciGLX Protocol
3895bd8deadSopenharmony_ci
3905bd8deadSopenharmony_ci    VDPAU implementations currently only support direct-rendering.
3915bd8deadSopenharmony_ci    Consequently, no GLX protocol is currently defined for this
3925bd8deadSopenharmony_ci    extension.
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ciDependencies on GL_ARB_texture_rectangle
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    If GL_ARB_texture_rectangle is not supported, TEXTURE_RECTANGLE may
3975bd8deadSopenharmony_ci    not be used as target for VDPAURegisterVideoSurfaceNV.
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ciDependencies on GL_ARB_texture_non_power_of_two
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ci    If GL_ARB_texture_non_power_of_two is not supported, only VDPAU
4025bd8deadSopenharmony_ci    surfaces with power-of-two size may be used with target TEXTURE_2D.
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ciErrors
4055bd8deadSopenharmony_ci
4065bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <vdpDevice> or
4075bd8deadSopenharmony_ci    <getProcAddressOpaque> parameters to VDPAUInitNV is NULL.
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ci    INVALID_OPERATION is generated if VDPAUInitNV is called on a given
4105bd8deadSopenharmony_ci    GL context, where VDPAUInitNV has been called, and VDPAUFiniNV has
4115bd8deadSopenharmony_ci    not been called since.
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ci    INVALID_OPERATION is generated by VDPAUInitNV,
4145bd8deadSopenharmony_ci    VDPAURegisterVideoSurfaceNV, or VDPAURegisterOutputSurfaceNV if the
4155bd8deadSopenharmony_ci    VDPAU driver refuses the request for some reason.
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ci    INVALID_OPERATION is generated if VDPAUFiniNV,
4185bd8deadSopenharmony_ci    VDPAURegisterVideoSurfaceNV, VDPAURegisterOutputSurfaceNV,
4195bd8deadSopenharmony_ci    VDPAUIsSurfaceNV, VDPAUGetSurfaceivNV, VDPAUSurfaceAccessNV,
4205bd8deadSopenharmony_ci    VDPAUMapSurfacesNV, or VDPAUUnmapSurfacesNV are called on a given
4215bd8deadSopenharmony_ci    GL context, where VDPAUInitNV has not been called, or VDPAUFiniNV
4225bd8deadSopenharmony_ci    has been called since.
4235bd8deadSopenharmony_ci
4245bd8deadSopenharmony_ci    INVALID_ENUM is generated if the <target> parameter of
4255bd8deadSopenharmony_ci    VDPAURegisterVideoSurfaceNV or VDPAURegisterOutputSurfaceNV is not
4265bd8deadSopenharmony_ci    TEXTURE_2D or TEXTURE_RECTANGLE.
4275bd8deadSopenharmony_ci
4285bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <numTextureNames> parameter of
4295bd8deadSopenharmony_ci    VDPAURegisterVideoSurfaceNV or VDPAURegisterOutputSurfaceNV does
4305bd8deadSopenharmony_ci    not match the required value; see tables 3.8.3.1 and 3.8.3.2.
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ci    INVALID_OPERATION is generated if any texture named by an entry
4335bd8deadSopenharmony_ci    within the <textureNames> parameter of VDPAURegisterVideoSurfaceNV
4345bd8deadSopenharmony_ci    or VDPAURegisterOutputSurfaceNV is marked as immutable.
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci    INVALID_VALUE is generated if the VDPAU surface named by the
4375bd8deadSopenharmony_ci    <vdpSurface> parameter of VDPAURegisterVideoSurfaceNV or
4385bd8deadSopenharmony_ci    VDPAUUnregisterOutputSurfaceNV does not have a supported format;
4395bd8deadSopenharmony_ci    see tables 3.8.3.1 and 3.8.3.2.
4405bd8deadSopenharmony_ci
4415bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <surface> parameter of
4425bd8deadSopenharmony_ci    VDPAUGetSurfaceivNV, VDPAUSurfaceAccessNV, VDPAUMapSurfacesNV,
4435bd8deadSopenharmony_ci    VDPAUUnmapSurfacesNV is not the name of a VDPAU surface object.
4445bd8deadSopenharmony_ci
4455bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <surface> parameter of
4465bd8deadSopenharmony_ci    VDPAUUnregisterSurfaceNV is neither zero nor the name of a VDPAU
4475bd8deadSopenharmony_ci    surface object.
4485bd8deadSopenharmony_ci
4495bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <bufSize> parameter of
4505bd8deadSopenharmony_ci    VDPAUGetSurfaceivNV is too small to return the results via the
4515bd8deadSopenharmony_ci    <values> paramter.
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ci    INVALID_ENUM is generated if the <pname> parameter of
4545bd8deadSopenharmony_ci    VDPAUGetSurfaceivNV is not SURFACE_STATE_NV.
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    INVALID_VALUE is generated if the <access> parameter of
4575bd8deadSopenharmony_ci    VDPAUSurfaceAccessNV is none of READ_ONLY, WRITE_ONLY, nor
4585bd8deadSopenharmony_ci    READ_WRITE.
4595bd8deadSopenharmony_ci
4605bd8deadSopenharmony_ci    INVALID_OPERATION is generated if the state of the surface(s) named
4615bd8deadSopenharmony_ci    by the <surface> parameter of VDPAUSurfaceAccessNV, or named by any
4625bd8deadSopenharmony_ci    entry within the <surfaces> parameter of VDPAUMapSurfacesNV is
4635bd8deadSopenharmony_ci    SURFACE_MAPPED_NV.
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci    INVALID_OPERATION is generated if the state of any of the surfaces 
4665bd8deadSopenharmony_ci    named by entries within the <surfaces> parameter of
4675bd8deadSopenharmony_ci    VDPAUUnmapSurfacesNV is not SURFACE_MAPPED_NV.
4685bd8deadSopenharmony_ci
4695bd8deadSopenharmony_ciNew State
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ciTable 6.X.  VDPAU Surface Objects.
4725bd8deadSopenharmony_ci
4735bd8deadSopenharmony_ciGet value           Type  Get command          Initial value                 Description     Section
4745bd8deadSopenharmony_ci------------------  ----  -----------          ----------------------------  --------------- -------
4755bd8deadSopenharmony_ciSURFACE_STATE_NV    Z     VDPAUGetSurfaceivNV  GL_SURFACE_REGISTERED_NV      Surface state   3.8.3
4765bd8deadSopenharmony_ci
4775bd8deadSopenharmony_ciNew Implementation State
4785bd8deadSopenharmony_ci
4795bd8deadSopenharmony_ci    None
4805bd8deadSopenharmony_ci
4815bd8deadSopenharmony_ciIssues
4825bd8deadSopenharmony_ci
4835bd8deadSopenharmony_ci    1. Should YUV surfaces be exposed as a frame Y and frame UV
4845bd8deadSopenharmony_ci       texture, or two field Y and two field UV textures?
4855bd8deadSopenharmony_ci
4865bd8deadSopenharmony_ci       RESOLVED: YUV surfaces will be exposed as separate fields
4875bd8deadSopenharmony_ci
4885bd8deadSopenharmony_ci       Exposing the surface as separate fields allows applications to
4895bd8deadSopenharmony_ci       directly implement de-interlacing algorithms other than weave
4905bd8deadSopenharmony_ci       without having to undo the weaving of fields together. Put
4915bd8deadSopenharmony_ci       another way:
4925bd8deadSopenharmony_ci
4935bd8deadSopenharmony_ci       Frames:
4945bd8deadSopenharmony_ci
4955bd8deadSopenharmony_ci         Pros:
4965bd8deadSopenharmony_ci
4975bd8deadSopenharmony_ci         * Simple applications can directly access the entire frame,
4985bd8deadSopenharmony_ci           without having to manually implement weave de-interlacing.
4995bd8deadSopenharmony_ci           This also applies for progressive content.
5005bd8deadSopenharmony_ci
5015bd8deadSopenharmony_ci           However, simple applications probably won't want to interop
5025bd8deadSopenharmony_ci           on a VdpVideoSurface, but will rather rely on VDPAU's
5035bd8deadSopenharmony_ci           VdpVideoMixer for post-processing, and instead interop on a
5045bd8deadSopenharmony_ci           VdpOutputSurface.
5055bd8deadSopenharmony_ci
5065bd8deadSopenharmony_ci         Cons:
5075bd8deadSopenharmony_ci
5085bd8deadSopenharmony_ci         * In order to implement bob de-interlacing, vertical
5095bd8deadSopenharmony_ci           interpolation between lines of a single field is required.
5105bd8deadSopenharmony_ci           The GL's texturing does not allow interpolation to skip
5115bd8deadSopenharmony_ci           lines in a texture. Consequently, the two fields must be
5125bd8deadSopenharmony_ci           manually separated by the application using a shader and
5135bd8deadSopenharmony_ci           some texture co-ordinate calculation prior to bobbing. This
5145bd8deadSopenharmony_ci           forces a copy operation, which would reduce performance.
5155bd8deadSopenharmony_ci
5165bd8deadSopenharmony_ci         * In NVIDIA's implementation, VDPAU surfaces are stored as
5175bd8deadSopenharmony_ci           separate fields. Consequently, VDPAUMapSurfacesNV would have
5185bd8deadSopenharmony_ci           to perform a copy operation, which would reduce performance.
5195bd8deadSopenharmony_ci
5205bd8deadSopenharmony_ci       Fields:
5215bd8deadSopenharmony_ci
5225bd8deadSopenharmony_ci         Pros:
5235bd8deadSopenharmony_ci
5245bd8deadSopenharmony_ci         * Advanced de-interlacing and post-processing algorithms get
5255bd8deadSopenharmony_ci           direct access to individual fields.
5265bd8deadSopenharmony_ci
5275bd8deadSopenharmony_ci         * In NVIDIA's implementation, no copying is required during
5285bd8deadSopenharmony_ci           VDPAUMapSurfacesNV.
5295bd8deadSopenharmony_ci
5305bd8deadSopenharmony_ci         Cons:
5315bd8deadSopenharmony_ci
5325bd8deadSopenharmony_ci         * Simple applications that simply want to weave, or for
5335bd8deadSopenharmony_ci           progressive content, must manually combine the fields.
5345bd8deadSopenharmony_ci           However, this operation is relatively simple to code, and
5355bd8deadSopenharmony_ci           sample code will be provided.
5365bd8deadSopenharmony_ci
5375bd8deadSopenharmony_ci    2. Should Map/Unmap functions be removed, such that the GL
5385bd8deadSopenharmony_ci       implements those operations transparently at appropriate times?
5395bd8deadSopenharmony_ci
5405bd8deadSopenharmony_ci       RESOLVED: No, map/unmap functions will be kept.
5415bd8deadSopenharmony_ci
5425bd8deadSopenharmony_ci       The map/unmap functions provide a convenient place to perform
5435bd8deadSopenharmony_ci       synchronization between VDPAU and the GL command streams, and
5445bd8deadSopenharmony_ci       any format-converting copies that may be required by the GL or
5455bd8deadSopenharmony_ci       VDPAU implementation. Without explicit application-controlled
5465bd8deadSopenharmony_ci       APIs, it would potentially be difficult to trigger those
5475bd8deadSopenharmony_ci       operations at the appropriate time. It would also be less
5485bd8deadSopenharmony_ci       obvious to software developers when such operations were
5495bd8deadSopenharmony_ci       occurring, which may prevent successful investigation of
5505bd8deadSopenharmony_ci       interop performance.
5515bd8deadSopenharmony_ci
5525bd8deadSopenharmony_ci    3. Should SurfaceAccess function be removed, and instead an
5535bd8deadSopenharmony_ci       "access" parameter added to the Map function?
5545bd8deadSopenharmony_ci
5555bd8deadSopenharmony_ci       RESOLVED: No, a separate function will be kept.
5565bd8deadSopenharmony_ci
5575bd8deadSopenharmony_ci       The value of this flag typically will not change on a per-frame
5585bd8deadSopenharmony_ci       basis, so specifying it for each map call was deemed redundant.
5595bd8deadSopenharmony_ci       For an advanced application that needs to change the flag often,
5605bd8deadSopenharmony_ci       the overhead of using a separate function should not be too
5615bd8deadSopenharmony_ci       significant.
5625bd8deadSopenharmony_ci
5635bd8deadSopenharmony_ciRevision History
5645bd8deadSopenharmony_ci
5655bd8deadSopenharmony_ci    1. 23 Dec 2009 - Stephen W
5665bd8deadSopenharmony_ci        Initial version
5675bd8deadSopenharmony_ci
5685bd8deadSopenharmony_ci    2. 5 Jan 2010 - Stephen W
5695bd8deadSopenharmony_ci        -Renamed VDPAUSetSurfaceAccessNV to VDPAUSurfaceAccessNV thus
5705bd8deadSopenharmony_ci         avoiding the word Set.
5715bd8deadSopenharmony_ci        -Fixed/wrote "Dependencies", "Dependencies on ..." sections.
5725bd8deadSopenharmony_ci        -Initial version of "Additions to Chapter 3".
5735bd8deadSopenharmony_ci        -Fill in answers for issues 1-3.
5745bd8deadSopenharmony_ci
5755bd8deadSopenharmony_ci    3. 7 Jan 2010 - Stephen W
5765bd8deadSopenharmony_ci        -Dropped the GL prefix from type names.
5775bd8deadSopenharmony_ci        -Refer to "the GL" not "GL".
5785bd8deadSopenharmony_ci        -Removed XXX re: PROXY_TEXTURE_*; those targets don't seem
5795bd8deadSopenharmony_ci         useful for this extension.
5805bd8deadSopenharmony_ci        -Use <> around function parameter names in text.
5815bd8deadSopenharmony_ci        -Reword description of legal values for <numTextureNames>.
5825bd8deadSopenharmony_ci         Number, title, and reformat related tables.
5835bd8deadSopenharmony_ci         Rename "format" column to "internal format".
5845bd8deadSopenharmony_ci        -Describe VDPAUSurfaceAccessNV before Map/Ummap for more
5855bd8deadSopenharmony_ci         logical ordering.
5865bd8deadSopenharmony_ci        -Significant text rewrite to more explicitly describe states,
5875bd8deadSopenharmony_ci         state transitions, legal access to surfaces by various APIs
5885bd8deadSopenharmony_ci         during specific states, etc.
5895bd8deadSopenharmony_ci        -Explicitly state that registered/mapped textures are
5905bd8deadSopenharmony_ci         immutable.
5915bd8deadSopenharmony_ci        -Re-used VBO's READ/WRITE/READ_WRITE enums instead of inventing
5925bd8deadSopenharmony_ci         new enums.
5935bd8deadSopenharmony_ci        -Added explicit type GLvdpauSurfaceNV instead of using GLvoid*.
5945bd8deadSopenharmony_ci        -Added VDPAUIsSurface, VDPAUGetSurfaceiv, and associated
5955bd8deadSopenharmony_ci         tokens.
5965bd8deadSopenharmony_ci        -Documented state, state queries, and errors.
5975bd8deadSopenharmony_ci
5985bd8deadSopenharmony_ci    4. 13 Jan 2010 - Stephen W
5995bd8deadSopenharmony_ci        - Added token WRITE_DISCARD_NV. Stated semantics of each legal
6005bd8deadSopenharmony_ci          value of VDPAUSurfaceAccessNV's <access> parameter.
6015bd8deadSopenharmony_ci
6025bd8deadSopenharmony_ci    5. 13 Jan 2010 - Stephen W
6035bd8deadSopenharmony_ci        - Removed some XXXs. Marked spec as complete.
6045bd8deadSopenharmony_ci
6055bd8deadSopenharmony_ci    6. 18 Jan 2010 - Stephen W
6065bd8deadSopenharmony_ci        - Added missing NV suffix to VDPAUIsSurfaceNV,
6075bd8deadSopenharmony_ci          VDPAUGetSurfaceivNV
6085bd8deadSopenharmony_ci
6095bd8deadSopenharmony_ci    7. 18 Jan 2010
6105bd8deadSopenharmony_ci        - Made various function parameters const.
6115bd8deadSopenharmony_ci
6125bd8deadSopenharmony_ci    8. 24 Feb 2010
6135bd8deadSopenharmony_ci        - Fixed typo in table 3.8.3.1; the heights of luma surfaces
6145bd8deadSopenharmony_ci          were incorrectly specified.
6155bd8deadSopenharmony_ci
6165bd8deadSopenharmony_ci    9. 29 May 2010
6175bd8deadSopenharmony_ci        - Fix minor typos and formatting issues.
6185bd8deadSopenharmony_ci
6195bd8deadSopenharmony_ci    10. 16 Jun 2010
6205bd8deadSopenharmony_ci        - Added "New Types" section
6215bd8deadSopenharmony_ci
6225bd8deadSopenharmony_ci    11.  2 Jan 2014
6235bd8deadSopenharmony_ci        - Fixed return type of VDPAUIsSurfaceNV and remove it from the
6245bd8deadSopenharmony_ci          list of commands that generate INVALID_VALUE.
6255bd8deadSopenharmony_ci
626