1 From e06df3445ac9a82446ddba30e2978cc693d39574 Mon Sep 17 00:00:00 2001
2 From: Shao Changbin <changbin.shao@intel.com>
3 Date: Thu, 4 Sep 2014 12:44:01 +0800
4 Subject: [PATCH] Introduce vaLockBuffer APIs in libva.
7 third_party/libva/va/va.h | 111 ++++++++++++++++++++++++++++++++++++++
8 third_party/libva/va/va_backend.h | 14 +++++
9 2 files changed, 125 insertions(+)
11 diff --git a/third_party/libva/va/va.h b/third_party/libva/va/va.h
12 index 845760c..9455023 100644
13 --- a/third_party/libva/va/va.h
14 +++ b/third_party/libva/va/va.h
21 #include <va/va_version.h>
23 @@ -1851,6 +1852,116 @@ VAStatus vaDestroyBuffer (
27 +/** VA buffer information */
29 + /** Buffer handle */
31 + /** Buffer type (See VABufferType). */
34 + * Buffer memory type (See VASurfaceAttribMemoryType).
36 + * On input to vaLockBuffer(), this field can serve as a hint to
37 + * specify the set of memory types the caller is interested in. On
38 + * successful return from vaLockBuffer(), the field is updated
39 + * with the best matching memory type.
42 + /** Size of the underlying buffer. */
47 + * Locks buffer for external API usage.
49 + * Locks the VA buffer object buf_id for external API usage like
50 + * EGL or OpenCL (OCL). This function is a synchronization point. This
51 + * means that any pending operation is guaranteed to be completed
52 + * prior to returning from the function.
54 + * If the referenced VA buffer object is the backing store of a VA
55 + * surface, then this function acts as if vaSyncSurface() on the
56 + * parent surface was called first.
58 + * The VABufferInfo argument shall be zero'ed on input. On
59 + * successful output, the data structure is filled in with all the
60 + * necessary buffer level implementation details like handle, type,
61 + * memory type and memory size.
63 + * Note: the external API implementation, or the application, can
64 + * express the memory types it is interested in by filling in the
65 + * mem_type field accordingly. On successful output, the memory type
66 + * that fits best the request and that was used is updated in the
67 + * VABufferInfo data structure. If none of the supplied memory types
68 + * is supported, then a VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE
69 + * error is returned.
71 + * The VABufferInfo data is valid until vaUnlockBuffer() is
72 + * called. Besides, no additional operation is allowed on any of the
73 + * buffer parent object until vaUnlockBuffer() is called. e.g. decoding
74 + * into a VA surface backed with the supplied VA buffer object
75 + * buf_id would fail with a VA_STATUS_ERROR_SURFACE_BUSY error.
78 + * - VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
79 + * does not support this interface
80 + * - VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
81 + * - VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
82 + * - VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
83 + * does not support exporting buffers of the specified type
84 + * - VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE: none of the requested
85 + * memory types in \ref VABufferInfo.mem_type was supported
87 + * @param[in] dpy the VA display
88 + * @param[in] buf_id the VA buffer
89 + * @param[in,out] buf_info_ptr the VA buffer information
90 + * @return VA_STATUS_SUCCESS if successful
96 + VABufferInfo * buf_info_ptr
100 + * Unlocks buffer after usage from external API.
102 + * Unlocks the VA buffer object buf_id from external API usage like
103 + * EGL or OpenCL (OCL). This function is a synchronization point. This
104 + * means that any pending operation is guaranteed to be completed
105 + * prior to returning from the function.
107 + * The VABufferInfo argument shall point to the original data
108 + * structure that was obtained from vaLockBuffer(), unaltered. This is
109 + * necessary so that the VA driver implementation could deallocate any
110 + * resources that were needed.
112 + * In any case, returning from this function invalidates any contents
113 + * in VABufferInfo. i.e. the underlyng buffer handle is no longer
114 + * valid. Therefore, VA driver implementations are free to reset this
115 + * data structure to safe defaults.
118 + * - VA_STATUS_ERROR_UNIMPLEMENTED: the VA driver implementation
119 + * does not support this interface
120 + * - VA_STATUS_ERROR_INVALID_DISPLAY: an invalid display was supplied
121 + * - VA_STATUS_ERROR_INVALID_BUFFER: an invalid buffer was supplied
122 + * - VA_STATUS_ERROR_UNSUPPORTED_BUFFERTYPE: the implementation
123 + * does not support exporting buffers of the specified type
125 + * @param[in] dpy the VA display
126 + * @param[in] buf_id the VA buffer
127 + * @param[in,out] buf_info_ptr the VA buffer information
128 + * @return VA_STATUS_SUCCESS if successful
134 + VABufferInfo * buf_info_ptr
138 Render (Decode) Pictures
140 diff --git a/third_party/libva/va/va_backend.h b/third_party/libva/va/va_backend.h
141 index bd82849..150f8ef 100644
142 --- a/third_party/libva/va/va_backend.h
143 +++ b/third_party/libva/va/va_backend.h
144 @@ -420,6 +420,20 @@ struct VADriverVTable
145 VASurfaceAttrib *attrib_list,
146 unsigned int *num_attribs
151 + VADriverContextP ctx,
153 + VABufferInfo * buf_info_ptr
158 + VADriverContextP ctx,
160 + VABufferInfo * buf_info_ptr
164 struct VADriverContext