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 } VASurfaceMemoryType; 48 49 typedef struct _VASurfaceAttributeTPI { 50 VASurfaceMemoryType type; 51 unsigned int width; 52 unsigned int height; 53 unsigned int size; 54 unsigned int pixel_format; /* buffer format */ 55 unsigned int tiling; /* the memory is tiling or not */ 56 unsigned int luma_stride; /* luma stride, could be width aligned with a special value */ 57 unsigned int chroma_u_stride; /* chroma stride */ 58 unsigned int chroma_v_stride; 59 unsigned int luma_offset; /* could be 0 */ 60 unsigned int chroma_u_offset; /* U offset from the beginning of the memory */ 61 unsigned int chroma_v_offset; /* V offset from the beginning of the memory */ 62 unsigned int count; /* buffer count for surface creation */ 63 unsigned int *buffers; /* buffer handles or user pointers */ 64 unsigned int reserved[4]; /* used to pass additional information, like 65 * Android native window pointer 66 */ 67 } VASurfaceAttributeTPI; 68 69 70 VAStatus vaPutSurfaceBuf ( 71 VADisplay dpy, 72 VASurfaceID surface, 73 unsigned char* data, 74 int* data_len, 75 short srcx, 76 short srcy, 77 unsigned short srcw, 78 unsigned short srch, 79 short destx, 80 short desty, 81 unsigned short destw, 82 unsigned short desth, 83 VARectangle *cliprects, /* client supplied clip list */ 84 unsigned int number_cliprects, /* number of clip rects in the clip list */ 85 unsigned int flags /* de-interlacing flags */ 86 ); 87 88 89 VAStatus vaCreateSurfacesWithAttribute ( 90 VADisplay dpy, 91 int width, 92 int height, 93 int format, 94 int num_surfaces, 95 VASurfaceID *surfaces, /* out */ 96 VASurfaceAttributeTPI *attribute_tpi 97 ); 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif 104