xref: /aosp_15_r20/external/intel-media-driver/media_softlet/linux/common/ddi/media_libva_common_next.h (revision ba62d9d3abf0e404f2022b4cd7a85e107f48596f)
1 /*
2 * Copyright (c) 2021-2022, Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 */
22 //!
23 
24 //! \file     media_libva_common_next.h
25 //! \brief    libva common next head file
26 //!
27 
28 #ifndef __MEDIA_LIBVA_COMMON_NEXT_H__
29 #define __MEDIA_LIBVA_COMMON_NEXT_H__
30 
31 #include <va/va.h>
32 #include <va/va_backend.h>
33 #include <semaphore.h>
34 #include "GmmLib.h"
35 #include "mos_bufmgr_api.h"
36 #include "mos_defs_specific.h"
37 
38 #define DDI_MEDIA_MAX_SURFACE_NUMBER_CONTEXT       127
39 #define DDI_MEDIA_MAX_INSTANCE_NUMBER              0x0FFFFFFF
40 
41 #define DDI_MEDIA_VACONTEXTID_OFFSET_DECODER       0x10000000
42 #define DDI_MEDIA_VACONTEXTID_OFFSET_ENCODER       0x20000000
43 #define DDI_MEDIA_VACONTEXTID_OFFSET_PROT          0x30000000
44 #define DDI_MEDIA_VACONTEXTID_OFFSET_VP            0x40000000
45 #define DDI_MEDIA_VACONTEXTID_BASE                 0x90000000
46 #define DDI_MEDIA_MASK_VACONTEXT_TYPE              0xF0000000
47 
48 #define DDI_MEDIA_SOFTLET_VACONTEXTID_DECODER_OFFSET      (DDI_MEDIA_VACONTEXTID_BASE + DDI_MEDIA_VACONTEXTID_OFFSET_DECODER)
49 #define DDI_MEDIA_SOFTLET_VACONTEXTID_ENCODER_OFFSET      (DDI_MEDIA_VACONTEXTID_BASE + DDI_MEDIA_VACONTEXTID_OFFSET_ENCODER)
50 #define DDI_MEDIA_SOFTLET_VACONTEXTID_CP_OFFSET           (DDI_MEDIA_VACONTEXTID_BASE + DDI_MEDIA_VACONTEXTID_OFFSET_PROT)
51 #define DDI_MEDIA_SOFTLET_VACONTEXTID_VP_OFFSET           (DDI_MEDIA_VACONTEXTID_BASE + DDI_MEDIA_VACONTEXTID_OFFSET_VP)
52 
53 #define DDI_MEDIA_MASK_VACONTEXTID                 0x0FFFFFFF
54 
55 #define DDI_MEDIA_CONTEXT_TYPE_DECODER             1
56 #define DDI_MEDIA_CONTEXT_TYPE_ENCODER             2
57 #define DDI_MEDIA_CONTEXT_TYPE_VP                  3
58 #define DDI_MEDIA_CONTEXT_TYPE_MEDIA               4
59 #define DDI_MEDIA_CONTEXT_TYPE_CM                  5
60 #define DDI_MEDIA_CONTEXT_TYPE_PROTECTED           6
61 #define DDI_MEDIA_CONTEXT_TYPE_MFE                 7
62 #define DDI_MEDIA_CONTEXT_TYPE_NONE                0
63 #define DDI_MEDIA_INVALID_VACONTEXTID              0
64 
65 #define DDI_MEDIA_MAX_COLOR_PLANES                 4       //Maximum color planes supported by media driver, like (A/R/G/B in different planes)
66 
67 #define DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_BASE   0       // Dec config_id starts at this value
68 #define DDI_CODEC_GEN_CONFIG_ATTRIBUTES_DEC_MAX    1023
69 #define DDI_CODEC_GEN_CONFIG_ATTRIBUTES_ENC_BASE   1024    // Enc config_id starts at this value
70 #define DDI_CODEC_GEN_CONFIG_ATTRIBUTES_ENC_MAX    2047
71 #define DDI_VP_GEN_CONFIG_ATTRIBUTES_BASE          2048    // VP config_id starts at this value
72 #define DDI_VP_GEN_CONFIG_ATTRIBUTES_MAX           4091
73 #define DDI_CP_GEN_CONFIG_ATTRIBUTES_BASE          4092    // CP config_id starts at this value
74 
75 //codec specific defination
76 #define DDI_CODEC_LEFT_SHIFT_FOR_REFLIST1          16
77 #define DDI_CODEC_GEN_MAX_SURFACE_ATTRIBUTES       40
78 
79 #define DDI_CODEC_VDENC_MAX_L0_REF_FRAMES_LDB      3
80 #define DDI_CODEC_VDENC_MAX_L1_REF_FRAMES_LDB      3
81 #define DDI_CODEC_VDENC_MAX_L0_REF_FRAMES          3
82 #define DDI_CODEC_VDENC_MAX_L1_REF_FRAMES          0
83 #define DDI_CODEC_VDENC_MAX_L1_REF_FRAMES_RAB_AVC  1
84 
85 #define DDI_CODEC_FEI_MAX_NUM_MVPREDICTOR     4
86 typedef pthread_mutex_t  MEDIA_MUTEX_T, *PMEDIA_MUTEX_T;
87 #define MEDIA_MUTEX_INITIALIZER  PTHREAD_MUTEX_INITIALIZER
88 typedef sem_t            MEDIA_SEM_T, *PMEDIA_SEM_T;
89 
90 typedef enum _DDI_MEDIA_FORMAT
91 {
92     Media_Format_NV12        ,
93     Media_Format_NV21        ,
94     Media_Format_Buffer      ,
95     Media_Format_2DBuffer    ,
96     Media_Format_Perf_Buffer ,
97     Media_Format_X8R8G8B8    ,
98     Media_Format_A8R8G8B8    ,
99     Media_Format_X8B8G8R8    ,
100     Media_Format_A8B8G8R8    ,
101     Media_Format_R8G8B8A8    ,
102     Media_Format_R5G6B5      ,
103     Media_Format_R10G10B10A2 ,
104     Media_Format_B10G10R10A2 ,
105     Media_Format_R10G10B10X2 ,
106     Media_Format_B10G10R10X2 ,
107     Media_Format_CPU         ,
108 
109     Media_Format_YUY2        ,
110     Media_Format_UYVY        ,
111     Media_Format_YV12        ,
112     Media_Format_IYUV        ,
113     Media_Format_I420        ,
114 
115     Media_Format_422H        ,
116     Media_Format_444P        ,
117     Media_Format_411P        ,
118     Media_Format_400P        ,
119     Media_Format_422V        ,
120     Media_Format_IMC3        ,
121 
122     Media_Format_P010        ,
123     Media_Format_R8G8B8      ,
124     Media_Format_RGBP        ,
125     Media_Format_BGRP        ,
126 
127     Media_Format_P016        ,
128     Media_Format_Y210        ,
129     Media_Format_Y216        ,
130     Media_Format_AYUV        ,
131 #if VA_CHECK_VERSION(1, 13, 0)
132     Media_Format_XYUV        ,
133 #endif
134     Media_Format_Y410        ,
135     Media_Format_Y416        ,
136     Media_Format_Y8          ,
137     Media_Format_Y16S        ,
138     Media_Format_Y16U        ,
139     Media_Format_VYUY        ,
140     Media_Format_YVYU        ,
141     Media_Format_A16R16G16B16,
142     Media_Format_A16B16G16R16,
143     Media_Format_P012        ,
144 #if VA_CHECK_VERSION(1, 9, 0)
145     Media_Format_Y212        ,
146     Media_Format_Y412        ,
147 #endif
148     Media_Format_Count
149 } DDI_MEDIA_FORMAT;
150 
151 typedef enum _DDI_MEDIA_STATUS_REPORT_QUERY_STATE
152 {
153     DDI_MEDIA_STATUS_REPORT_QUERY_STATE_INIT,
154     DDI_MEDIA_STATUS_REPORT_QUERY_STATE_PENDING,
155     DDI_MEDIA_STATUS_REPORT_QUERY_STATE_COMPLETED,
156     DDI_MEDIA_STATUS_REPORT_QUERY_STATE_RELEASED
157 } DDI_MEDIA_STATUS_REPORT_QUERY_STATE;
158 
159 //!
160 //! \brief Surface descriptor for external DRM buffer
161 //!
162 typedef struct _DDI_MEDIA_SURFACE_DESCRIPTOR
163 {
164     uint32_t   uiPlanes;                              // brief number of planes for planar layout
165     uint32_t   uiPitches[DDI_MEDIA_MAX_COLOR_PLANES]; // pitch for each plane in bytes
166     uint32_t   uiOffsets[DDI_MEDIA_MAX_COLOR_PLANES]; // offset for each plane in bytes
167     uintptr_t  ulBuffer;                              // buffer handle or user pointer
168     uint32_t   uiSize;                                // buffer size
169     uint32_t   uiFlags;                               // See "Surface external buffer descriptor flags"
170     uint32_t   uiVaMemType;                           // VA Mem type
171     uint32_t   uiTile;                                // Used for user pointer
172     uint32_t   uiBuffserSize;                         // Used for user pointer
173     bool       bIsGralloc;                            // buffer allocated by Gralloc
174     void      *pPrivateData;                          // brief reserved for passing private data
175     GMM_RESCREATE_PARAMS GmmParam;                    // GMM Params for Gralloc buffer
176     uint64_t   modifier;                              // used for VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2 or VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_3
177 } DDI_MEDIA_SURFACE_DESCRIPTOR,*PDDI_MEDIA_SURFACE_DESCRIPTOR;
178 
179 typedef union _DDI_MEDIA_SURFACE_STATUS_REPORT
180 {
181     //!
182     //! \struct _DDI_MEDIA_SURFACE_DECODE_STATUS
183     //! \brief  Ddi media surface decode status
184     //!
185     struct _DDI_MEDIA_SURFACE_DECODE_STATUS
186     {
187         uint32_t                   status;    // indicate latest decode status for current surface, refer to CODECHAL_STATUS in CodechalDecodeStatusReport.
188         uint32_t                   errMbNum;  // indicate number of MB s with decode error, refer to NumMbsAffected in CodechalDecodeStatusReport
189         uint32_t                   crcValue;  // indicate the CRC value of the decoded data
190     } decode;
191     //!
192     //! \struct _DDI_MEDIA_SURFACE_CENC_STATUS
193     //! \brief  Ddi media surface cenc status
194     //!
195     struct _DDI_MEDIA_SURFACE_CENC_STATUS
196     {
197         uint32_t                   status;    // indicate latest cenc status for current surface, refer to CODECHAL_STATUS in CodechalDecodeStatusReport.
198         uint32_t                   reserved;  // reserved
199     } cenc;
200     //!
201     //! \struct _DDI_MEDIA_SURFACE_VPP_STATUS
202     //! \brief  Ddi media surface vpp status
203     //!
204     struct _DDI_MEDIA_SURFACE_VPP_STATUS
205     {
206         uint32_t                   status;    // indicate latest vpp status for current surface.
207         uint32_t                   reserved;  // reserved.
208     } vpp;
209 } DDI_MEDIA_SURFACE_STATUS_REPORT, *PDDI_MEDIA_SURFACE_STATUS_REPORT;
210 //!
211 //! \struct DDI_MEDIA_CONTEXT
212 //! \brief  Ddi media context
213 //!
214 struct DDI_MEDIA_CONTEXT;
215 typedef struct DDI_MEDIA_CONTEXT *PDDI_MEDIA_CONTEXT;
216 
217 struct _DDI_MEDIA_BUFFER;
218 typedef struct _DDI_MEDIA_SURFACE
219 {
220     // for hwcomposer, remove this after we have a solution
221     uint32_t                base;
222     int32_t                 iWidth;
223     int32_t                 iHeight;             // allocate height after alignment
224     int32_t                 iRealHeight;         // real height before alignment
225     int32_t                 iPitch;
226     uint32_t                uiOffset;
227     DDI_MEDIA_FORMAT        format;
228     uint32_t                uiLockedBufID;
229     uint32_t                uiLockedImageID;
230     int32_t                 iRefCount;
231     uint8_t                *pData;
232     uint32_t                data_size;
233     uint32_t                isTiled;
234     uint32_t                TileType;
235     uint32_t                bMapped;
236     MOS_LINUX_BO           *bo;
237     uint32_t                name;
238     uint32_t                surfaceUsageHint;
239     PDDI_MEDIA_SURFACE_DESCRIPTOR pSurfDesc;          // nullptr means surface was allocated by media driver
240                                                       // !nullptr means surface was allocated by Application
241     GMM_RESOURCE_INFO      *pGmmResourceInfo;   // GMM resource descriptor
242     uint32_t                frame_idx;
243     void                   *pDecCtx;
244     void                   *pVpCtx;
245 
246     uint32_t                            curCtxType;                // indicate current surface is using in which context type.
247     DDI_MEDIA_STATUS_REPORT_QUERY_STATE curStatusReportQueryState; // indicate status report is queried or not.
248     DDI_MEDIA_SURFACE_STATUS_REPORT     curStatusReport;           // union for both decode and vpp status.
249 
250     PDDI_MEDIA_CONTEXT      pMediaCtx; // Media driver Context
251     PMEDIA_SEM_T            pCurrentFrameSemaphore;   // to sync render target for hybrid decoding multi-threading mode
252     PMEDIA_SEM_T            pReferenceFrameSemaphore; // to sync reference frame surface. when this semaphore is posted, the surface is not used as reference frame, and safe to be destroied
253 
254     uint8_t                 *pSystemShadow;           // Shadow surface in system memory
255     _DDI_MEDIA_BUFFER       *pShadowBuffer;
256 
257     uint32_t                uiMapFlag;
258 
259     uint32_t                uiVariantFlag;
260     int                     memType;
261 } DDI_MEDIA_SURFACE, *PDDI_MEDIA_SURFACE;
262 
263 typedef struct _DDI_MEDIA_BUFFER
264 {
265     uint32_t               iSize             = 0;
266     uint32_t               uiWidth           = 0;
267     uint32_t               uiHeight          = 0;
268     uint32_t               uiPitch           = 0;
269     uint32_t               uiNumElements     = 0;
270     uint32_t               uiOffset          = 0;
271     // vaBuffer type
272     uint32_t               uiType            = 0;
273     DDI_MEDIA_FORMAT       format            = Media_Format_Count;
274     uint32_t               uiLockedBufID     = 0;
275     uint32_t               uiLockedImageID   = 0;
276     int32_t                iRefCount         = 0;
277     uint32_t               TileType          = 0;
278     uint8_t               *pData             = nullptr;
279     uint32_t               bMapped           = 0;
280     MOS_LINUX_BO          *bo                = nullptr;
281     uint32_t               name              = 0;
282     uint32_t               uiMemtype         = 0;
283     uint32_t               uiExportcount     = 0;
284     uintptr_t              handle            = 0;
285     bool                   bPostponedBufFree = false;
286 
287     bool                   bCFlushReq        = false; // No LLC between CPU & GPU, requries to call CPU Flush for CPU mapped buffer
288     bool                   bUseSysGfxMem     = false;
289     PDDI_MEDIA_SURFACE     pSurface          = nullptr;
290     GMM_RESOURCE_INFO     *pGmmResourceInfo  = nullptr; // GMM resource descriptor
291     PDDI_MEDIA_CONTEXT     pMediaCtx         = nullptr; // Media driver Context
292 } DDI_MEDIA_BUFFER, *PDDI_MEDIA_BUFFER;
293 
294 typedef struct _DDI_MEDIA_SURFACE_HEAP_ELEMENT
295 {
296     PDDI_MEDIA_SURFACE                      pSurface;
297     uint32_t                                uiVaSurfaceID;
298     struct _DDI_MEDIA_SURFACE_HEAP_ELEMENT *pNextFree;
299 }DDI_MEDIA_SURFACE_HEAP_ELEMENT, *PDDI_MEDIA_SURFACE_HEAP_ELEMENT;
300 
301 typedef struct _DDI_MEDIA_BUFFER_HEAP_ELEMENT
302 {
303     PDDI_MEDIA_BUFFER                       pBuffer;
304     void                                   *pCtx;
305     uint32_t                                uiCtxType;
306     uint32_t                                uiVaBufferID;
307     struct _DDI_MEDIA_BUFFER_HEAP_ELEMENT  *pNextFree;
308 }DDI_MEDIA_BUFFER_HEAP_ELEMENT, *PDDI_MEDIA_BUFFER_HEAP_ELEMENT;
309 
310 typedef struct _DDI_MEDIA_IMAGE_HEAP_ELEMENT
311 {
312     VAImage                                *pImage;
313     uint32_t                                uiVaImageID;
314     struct _DDI_MEDIA_IMAGE_HEAP_ELEMENT   *pNextFree;
315 }DDI_MEDIA_IMAGE_HEAP_ELEMENT, *PDDI_MEDIA_IMAGE_HEAP_ELEMENT;
316 
317 typedef struct _DDI_MEDIA_VACONTEXT_HEAP_ELEMENT
318 {
319     void                                       *pVaContext;
320     uint32_t                                    uiVaContextID;
321     struct _DDI_MEDIA_VACONTEXT_HEAP_ELEMENT   *pNextFree;
322 }DDI_MEDIA_VACONTEXT_HEAP_ELEMENT, *PDDI_MEDIA_VACONTEXT_HEAP_ELEMENT;
323 
324 typedef struct _DDI_MEDIA_HEAP
325 {
326     void               *pHeapBase;
327     uint32_t           uiHeapElementSize;
328     uint32_t           uiAllocatedHeapElements;
329     void               *pFirstFreeHeapElement;
330 }DDI_MEDIA_HEAP, *PDDI_MEDIA_HEAP;
331 
332 #ifndef ANDROID
333 typedef struct _DDI_X11_FUNC_TABLE
334 {
335     HMODULE pX11LibHandle;    // handle to dlopen libX11
336 
337     // 5 functions from libX11 used by vpgPutSurface (Linux) so far
338     void   *pfnDefaultVisual;
339     void   *pfnXCreateGC;
340     void   *pfnXFreeGC;
341     void   *pfnXCreateImage;
342     void   *pfnXDestroyImage;
343     void   *pfnXPutImage;
344 }DDI_X11_FUNC_TABLE, *PDDI_X11_FUNC_TABLE;
345 #endif
346 
347 #ifdef MEDIA_SOFTLET
348 
349 #include "media_interfaces_hwinfo.h"
350 class MediaLibvaCapsNext;
351 class OsContext;
352 class GpuContextMgr;
353 #include "ddi_media_functions.h"
354 #include "ddi_media_context.h"
355 
356 typedef struct DDI_MEDIA_CONTEXT *PDDI_MEDIA_CONTEXT;
357 
358 #else // MEDIA_SOFTLET
359 
360 #include "media_libva_common.h"
361 
362 #endif // MEDIA_SOFTLET
363 
GetMediaContext(VADriverContextP ctx)364 static __inline PDDI_MEDIA_CONTEXT GetMediaContext (VADriverContextP ctx)
365 {
366     return (PDDI_MEDIA_CONTEXT)ctx->pDriverData;
367 }
368 
369 #ifndef CONTEXT_PRIORITY_MAX
370 #define CONTEXT_PRIORITY_MAX 1024
371 #endif
372 
373 class MediaLibvaCommonNext
374 {
375 public:
376     //!
377     //! \brief  Get surface from VA surface ID
378     //!
379     //! \param  [in] mediaCtx
380     //!     Pointer to ddi media context
381     //! \param  [in] surfaceID
382     //!     VA surface ID
383     //!
384     //! \return DDI_MEDIA_SURFACE*
385     //!     Pointer to ddi media surface
386     //!
387     static DDI_MEDIA_SURFACE *GetSurfaceFromVASurfaceID(PDDI_MEDIA_CONTEXT mediaCtx, VASurfaceID surfaceID);
388 
389     //!
390     //! \brief  Get VA surface ID  from surface
391     //!
392     //! \param  [in] surface
393     //!     surface
394     //!
395     //! \return VASurfaceID
396     //!     VA Surface ID
397     //!
398     static VASurfaceID GetVASurfaceIDFromSurface(PDDI_MEDIA_SURFACE surface);
399 
400     //!
401     //! \brief  Replace the surface with given format
402     //!
403     //! \param  [in] surface
404     //!     Pointer to the old surface
405     //! \param  [in] expectedFormat
406     //!     VA surface ID
407     //!
408     //! \return DDI_MEDIA_SURFACE*
409     //!     Pointer to new ddi media surface
410     //!
411     static PDDI_MEDIA_SURFACE ReplaceSurfaceWithNewFormat(PDDI_MEDIA_SURFACE surface, DDI_MEDIA_FORMAT expectedFormat);
412 
413     //!
414     //! \brief  replace the surface with correlation variant format
415     //!
416     //! \param  [in] surface
417     //!     Pointer to the old surface
418     //!
419     //! \return DDI_MEDIA_SURFACE*
420     //!     Pointer to new ddi media surface
421     //!
422     static PDDI_MEDIA_SURFACE ReplaceSurfaceWithVariant(PDDI_MEDIA_SURFACE surface, VAEntrypoint entrypoint);
423 
424     //!
425     //! \brief  Get buffer from VA buffer ID
426     //!
427     //! \param  [in] mediaCtx
428     //!     Pointer to ddi media context
429     //! \param  [in] bufferID
430     //!     VA buffer ID
431     //!
432     //! \return DDI_MEDIA_BUFFER*
433     //!     Pointer to ddi media buffer
434     //!
435     static DDI_MEDIA_BUFFER* GetBufferFromVABufferID(
436         PDDI_MEDIA_CONTEXT mediaCtx,
437         VABufferID         bufferID);
438 
439     //!
440     //! \brief  Media buffer to mos resource
441     //!
442     //! \param  [in] mediaBuffer
443     //!     Ddi media buffer
444     //! \param  [in] mhalOsResource
445     //!     Mos resource
446     //!
447     static void MediaBufferToMosResource(DDI_MEDIA_BUFFER *mediaBuffer, MOS_RESOURCE *mhalOsResource);
448 
449     //!
450     //! \brief  Media surface to mos resource
451     //!
452     //! \param  [in] mediaSurface
453     //!     Ddi media surface
454     //! \param  [in] mhalOsResource
455     //!     Mos resource
456     //!
457     static void MediaSurfaceToMosResource(DDI_MEDIA_SURFACE *mediaSurface, MOS_RESOURCE *mhalOsResource);
458 
459     //!
460     //! \brief  Get PVA context from heap
461     //!
462     //! \param  [in] mediaHeap
463     //!         Pointer to ddi media heap
464     //! \param  [in] index
465     //!         the index
466     //! \param  [in] mutex
467     //!         the mutex
468     //!
469     static void* GetVaContextFromHeap(PDDI_MEDIA_HEAP mediaHeap, uint32_t index, PMOS_MUTEX mutex);
470 
471     //!
472     //! \brief  Get context from context ID
473     //!
474     //! \param  [in] ctx
475     //!     Pointer to VA driver context
476     //! \param  [in] vaCtxID
477     //!     VA context ID
478     //! \param  [in] ctxType
479     //!     Ctx type
480     //!
481     static void* GetContextFromContextID(VADriverContextP ctx, VAContextID vaCtxID, uint32_t *ctxType);
482 
483     //!
484     //! \brief  Get ctx type from VA buffer ID
485     //!
486     //! \param  [in] mediaCtx
487     //!         Pointer to ddi media context
488     //! \param  [in] bufferID
489     //!         VA buffer ID
490     //!
491     //! \return uint32_t
492     //1     Context type
493     //!
494     static uint32_t GetCtxTypeFromVABufferID (PDDI_MEDIA_CONTEXT mediaCtx, VABufferID bufferID);
495 
496     //!
497     //! \brief  Get ctx from VA buffer ID
498     //!
499     //! \param  [in] mediaCtx
500     //!         pddi media context
501     //! \param  [in] bufferID
502     //!         VA Buffer ID
503     //!
504     //! \return void*
505     //!     Pointer to buffer heap element context
506     //!
507     static void* GetCtxFromVABufferID (PDDI_MEDIA_CONTEXT mediaCtx, VABufferID bufferID);
508 
509     //!
510     //! \brief  Get gpu priority
511     //!
512     //! \param  [in] ctx
513     //!     Pointer to VA driver context
514     //! \param  [in] buffers
515     //!     VA buffer ID
516     //! \param  [in] numBuffers
517     //!     Number of buffers
518     //! \param  [out] updatePriority
519     //!     Update priority
520     //! \param  [out] priority
521     //!     Priority value
522     //! \return     int32_t
523     //!
524     static int32_t GetGpuPriority(VADriverContextP ctx, VABufferID *buffers, int32_t numBuffers, bool *updatePriority, int32_t *priority);
525 
526     //!
527     //! \brief  Move the priority bufferID to the end of buffers
528     //!
529     //! \param  [in] buffers
530     //!     VA buffer ID
531     //! \param  [in] priorityIndexInBuf
532     //!     the priority VA buffer ID
533     //! \param  [in] numBuffers
534     //!     Number of buffers
535     //!
536     static void MovePriorityBufferIdToEnd (VABufferID *buffers, int32_t priorityIndexInBuf, int32_t numBuffers);
537 MEDIA_CLASS_DEFINE_END(MediaLibvaCommonNext)
538 };
539 
540 #endif //__MEDIA_LIBVA_COMMON_NEXT_H__
541