Debian Codegraph @

media_driver/linux/common/cm/hal/cm_wrapper_os.h

raw
1 /*
2 * Copyright (c) 2007-2017, 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 //! \file cm_wrapper_os.h
24 //! \brief Contains various Linux-dependent data structures and functions
25 //! for executing commands from cmrtlib.
26 //!
27
28 #ifndef MEDIADRIVER_LINUX_COMMON_CM_CMWRAPPEROS_H_
29 #define MEDIADRIVER_LINUX_COMMON_CM_CMWRAPPEROS_H_
30
31 #include "cm_def.h"
32 #include "media_libva_common.h" // for VADriverContextP
33
34 #define CM_OSAL_SURFACE_FORMAT uint32_t
35 #define CM_SURFACE_FORMAT_R8U 62
36 #define CM_SURFACE_FORMAT_R16U 57
37
38 //////////////////////////////////////////////////////////////////////////////////////
39 // Thin CMRT definition -- START
40 //////////////////////////////////////////////////////////////////////////////////////
41
42 typedef struct _CM_CREATECMDEVICE_PARAM
43 {
44 uint32_t devCreateOption; // [in] Dev create option
45 pCallBackReleaseVaSurface callbackReleaseVaSurf; // [in] Function Pointer to free Libva surface
46 void *deviceHandle; // [out] pointer to handle in driver
47 uint32_t version; // [out] the Cm version
48 uint32_t driverStoreEnabled; // [out] DriverStoreEnable flag
49 int32_t returnValue; // [out] the return value from CMRT@UMD
50 }CM_CREATECMDEVICE_PARAM, *PCM_CREATECMDEVICE_PARAM;
51
52 typedef struct _CM_CREATESURFACE2D_PARAM
53 {
54 uint32_t width; // [in] width of 2D texture in pixel
55 uint32_t height; // [in] height of 2D texture in pixel
56 CM_OSAL_SURFACE_FORMAT format; // [in] 2D texture format in OS layer.
57
58 union
59 {
60 uint32_t indexInLookupTable; // [in] surface 2d's index in look up table.
61 uint32_t vaSurfaceID; // [in] libva-surface 2d's index in media driver
62 };
63
64 void *vaSurface; // [in] Pointer to Libva Surface
65 void *cmSurface2DHandle; // [out] pointer of CmSurface2D used in driver
66 bool isCmCreated; // [in] Is the 2D surface created by CM?
67 int32_t returnValue; // [out] the return value from driver
68
69 bool isLibvaCreated; // [in] if the surface created via libva
70 void *vaDisplay; // [in] VaDisplay used to free va sruface
71 }CM_CREATESURFACE2D_PARAM, *PCM_CREATESURFACE2D_PARAM;
72
73 #if defined(__cplusplus)
74 extern "C" {
75 #endif
76 int32_t CmThinExecute(VADriverContextP vaDriverCtx,
77 void *deviceHandle,
78 uint32_t inputFunctionId,
79 void *inputData,
80 uint32_t inputDataLen);
81 #if defined(__cplusplus)
82 };
83 #endif
84
85 int32_t CmFillMosResource(VASurfaceID vaSurfaceID,
86 VADriverContext *vaDriverCtx,
87 PMOS_RESOURCE osResource);
88
89 MOS_FORMAT CmOSFmtToMosFmt(CM_OSAL_SURFACE_FORMAT format);
90 CM_OSAL_SURFACE_FORMAT CmMosFmtToOSFmt(MOS_FORMAT format);
91
92 //*-----------------------------------------------------------------------------
93 //| Purpose: Convert GMM_RESROUCE_Format got by GetCaps to OSAL format
94 //| Return: Result of the operation.
95 //*-----------------------------------------------------------------------------
96 int32_t ConvertToOperatingSystemAbstractionLayerFormat(void *src, uint32_t numOfFormats);
97
98
99 #endif // #ifndef MEDIADRIVER_LINUX_COMMON_CM_CMWRAPPEROS_H_