Home | History | Annotate | Download | only in va
      1 /*
      2  * Copyright (c) 2007-2009 Intel Corporation. All Rights Reserved.
      3  *
      4  * Permission is hereby granted, free of charge, to any person obtaining a
      5  * copy of this software and associated documentation files (the
      6  * "Software"), to deal in the Software without restriction, including
      7  * without limitation the rights to use, copy, modify, merge, publish,
      8  * distribute, sub license, and/or sell copies of the Software, and to
      9  * permit persons to whom the Software is furnished to do so, subject to
     10  * the following conditions:
     11  *
     12  * The above copyright notice and this permission notice (including the
     13  * next paragraph) shall be included in all copies or substantial portions
     14  * of the Software.
     15  *
     16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
     19  * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
     20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
     21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
     22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     23  */
     24 #ifndef _VA_TPI_H_
     25 #define _VA_TPI_H_
     26 
     27 #include <va/va.h>
     28 
     29 #ifdef __cplusplus
     30 extern "C" {
     31 #endif
     32 
     33 
     34 typedef enum {
     35     VAExternalMemoryNULL, /* it is not external buffer, but requires the implementation allocates
     36                            * the surface with the input attribute
     37                            */
     38     VAExternalMemoryV4L2Buffer,
     39     VAExternalMemoryCIFrame, /* the memory is from camera frames and buffers points the frame ID list */
     40     VAExternalMemoryUserPointer, /* the memory is malloc-ed and buffers points to the buffers */
     41     VAExternalMemoryKernelDRMBufffer, /* the memory is from kernel DRM buffers and buffers points the
     42                                        * DRM buffer handle list
     43                                        */
     44     VAExternalMemoryAndroidGrallocBuffer, /* the memory is from Android Gralloc memory, and buffers points
     45                                            * the gralloc native_handle_t list
     46                                            */
     47     VAExternalMemoryIONSharedFD, /* the memory is allocated from ION and shared as a fd */
     48     VAExternalMemoryNoneCacheUserPointer, /* the memory is uncached and allocated from user space*/
     49 } VASurfaceMemoryType;
     50 
     51 typedef struct _VASurfaceAttributeTPI {
     52     VASurfaceMemoryType type;
     53     unsigned int width;
     54     unsigned int height;
     55     unsigned int size;
     56     unsigned int pixel_format; /* buffer format */
     57     unsigned int tiling; /* the memory is tiling or not */
     58     unsigned int luma_stride; /* luma stride, could be width aligned with a special value */
     59     unsigned int chroma_u_stride; /* chroma stride */
     60     unsigned int chroma_v_stride;
     61     unsigned int luma_offset; /* could be 0 */
     62     unsigned int chroma_u_offset; /* U offset from the beginning of the memory */
     63     unsigned int chroma_v_offset; /* V offset from the beginning of the memory */
     64     unsigned int count; /* buffer count for surface creation */
     65     unsigned long *buffers; /* buffer handles or user pointers */
     66     unsigned int reserved[4]; /* used to pass additional information, like
     67                                * Android native window pointer
     68                                */
     69 } VASurfaceAttributeTPI;
     70 
     71 
     72 VAStatus vaPutSurfaceBuf (
     73     VADisplay dpy,
     74     VASurfaceID surface,
     75     unsigned char* data,
     76     int* data_len,
     77     short srcx,
     78     short srcy,
     79     unsigned short srcw,
     80     unsigned short srch,
     81     short destx,
     82     short desty,
     83     unsigned short destw,
     84     unsigned short desth,
     85     VARectangle *cliprects, /* client supplied clip list */
     86     unsigned int number_cliprects, /* number of clip rects in the clip list */
     87     unsigned int flags /* de-interlacing flags */
     88 );
     89 
     90 VAStatus vaSetTimestampForSurface (
     91     VADisplay dpy,
     92     VASurfaceID surface,
     93     long long timestamp
     94 );
     95 
     96 
     97 VAStatus vaCreateSurfacesWithAttribute (
     98     VADisplay dpy,
     99     int width,
    100     int height,
    101     int format,
    102     int num_surfaces,
    103     VASurfaceID *surfaces,       /* out */
    104     VASurfaceAttributeTPI *attribute_tpi
    105 );
    106 
    107 #ifdef __cplusplus
    108 }
    109 #endif
    110 
    111 #endif
    112