1 /* 2 * Copyright (c) 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_device_rt.h 24 //! \brief Contains CmDeviceRT declarations. 25 //! 26 27 #ifndef MEDIADRIVER_LINUX_COMMON_CM_CMDEVICERT_H_ 28 #define MEDIADRIVER_LINUX_COMMON_CM_CMDEVICERT_H_ 29 30 #include "cm_device_rt_base.h" 31 32 #include "cm_array.h" 33 #include "cm_csync.h" 34 #include "cm_hal.h" 35 #include "cm_log.h" 36 #include "cm_program.h" 37 #include "cm_notifier.h" 38 39 #if USE_EXTENSION_CODE 40 #include "cm_gtpin.h" 41 #endif 42 43 namespace CMRT_UMD 44 { 45 class CmQueueRT; 46 class CmSurfaceManager; 47 class CmSampler8x8State_RT; 48 49 //! \brief Class CmDeviceRT definitions for Linux 50 class CmDeviceRT: public CmDeviceRTBase 51 { 52 public: 53 static int32_t 54 Create(MOS_CONTEXT *umdContext, 55 CmDeviceRT* &device, 56 uint32_t options = CM_DEVICE_CREATE_OPTION_DEFAULT); 57 static int32_t Destroy(CmDeviceRT* &device); 58 59 CM_RT_API int32_t CreateSurface2D(VASurfaceID vaSurface, 60 VADriverContext *vaDriverCtx, 61 CmSurface2D* &surface); 62 63 CM_RT_API virtual int32_t CreateSurface2D(uint32_t width, 64 uint32_t height, 65 CM_SURFACE_FORMAT format, 66 CmSurface2D* & pSurface); 67 68 CM_RT_API virtual int32_t CreateSurface2D(PMOS_RESOURCE pMosResource, 69 CmSurface2D* & pSurface); 70 71 virtual int32_t GetJITCompileFnt(pJITCompile &jitCompile); 72 73 virtual int32_t GetJITCompileFntV2(pJITCompile_v2 &fJITCompile_v2); 74 75 virtual int32_t GetFreeBlockFnt(pFreeBlock &freeBlock); 76 77 virtual int32_t GetJITVersionFnt(pJITVersion &jitVersion); 78 79 virtual int32_t LoadJITDll(); 80 81 virtual int32_t CreateSurface2D(PMOS_RESOURCE pMosResource, 82 bool bIsCmCreated, 83 CmSurface2D* & pSurface); 84 85 int32_t SetVaCtxID(uint32_t vaCtxID); 86 87 int32_t GetVaCtxID(uint32_t &vaCtxID); 88 89 int32_t RegisterCallBack(pCallBackReleaseVaSurface callBack); 90 91 int32_t ReleaseVASurface(void *vaDisplay, void *vaSurfaceID); 92 93 protected: 94 95 virtual int32_t InitializeOSSpecific(MOS_CONTEXT *mosContext); 96 97 virtual void ConstructOSSpecific(uint32_t devCreateOption); 98 99 virtual CM_RETURN_CODE QueryGPUInfoInternal(PCM_QUERY_CAPS pQueryCaps); 100 101 virtual int32_t ReadVtuneProfilingFlag(); 102 103 virtual int32_t QuerySurface2DFormats(void *capValue, uint32_t &capValueSize); 104 105 virtual CM_RETURN_CODE QuerySurface2DFormatsInternal(PCM_QUERY_CAPS queryCaps); 106 107 int32_t CreateAuxDevice(MOS_CONTEXT *mosContext); 108 109 int32_t DestroyAuxDevice(); 110 111 CM_RETURN_CODE GetCapsInternalOSSpecific(PCM_QUERY_CAPS queryCaps); 112 113 CmDeviceRT(uint32_t option); 114 115 ~CmDeviceRT(); 116 IsMediaResetNeeded(uint32_t options)117 inline bool IsMediaResetNeeded(uint32_t options) 118 { 119 UNUSED(options); 120 return false; 121 } 122 QueryRegHandleInternal(PCM_HAL_STATE cmHalState)123 inline HANDLE QueryRegHandleInternal(PCM_HAL_STATE cmHalState) 124 { 125 UNUSED(cmHalState); 126 return (HANDLE)nullptr; 127 } 128 129 130 VAContextID m_vaCtxID; 131 pCallBackReleaseVaSurface m_pfnReleaseVaSurface; 132 133 private: 134 CmDeviceRT(const CmDeviceRT& other); 135 136 CmDeviceRT& operator= (const CmDeviceRT& other); 137 }; 138 }; //namespace 139 140 #endif // #ifndef MEDIADRIVER_LINUX_COMMON_CM_CMDEVICERT_H_ 141