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_surface_3d_rt.h 24 //! \brief Contains CmSurface3DRT declarations. 25 //! 26 27 #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE3DRT_H_ 28 #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE3DRT_H_ 29 30 #include "cm_surface_3d.h" 31 #include "cm_surface.h" 32 33 namespace CMRT_UMD 34 { 35 class CmSurface3DRT: public CmSurface, public CmSurface3D 36 { 37 public: 38 static int32_t Create(uint32_t index, 39 uint32_t handle, 40 uint32_t width, 41 uint32_t height, 42 uint32_t depth, 43 CM_SURFACE_FORMAT format, 44 CmSurfaceManager *surfaceManager, 45 CmSurface3DRT* &surface); 46 47 CM_RT_API int32_t ReadSurface(unsigned char *sysMem, 48 CmEvent *event, 49 uint64_t sysMemSize = 0xFFFFFFFFFFFFFFFFULL); 50 51 CM_RT_API int32_t WriteSurface(const unsigned char *sysMem, 52 CmEvent *event, 53 uint64_t sysMemSize = 0xFFFFFFFFFFFFFFFFULL); 54 55 CM_RT_API int32_t InitSurface(const uint32_t initValue, CmEvent *event); 56 57 CM_RT_API int32_t GetIndex(SurfaceIndex* &index); 58 59 virtual int32_t GetHandle(uint32_t &handle); 60 61 virtual int32_t GetProperties(uint32_t &width, 62 uint32_t &height, 63 uint32_t &depth, 64 CM_SURFACE_FORMAT &format); 65 66 int32_t SetProperties(uint32_t width, 67 uint32_t height, 68 uint32_t depth, 69 CM_SURFACE_FORMAT format); 70 71 //NOT depend on RTTI::dynamic_cast Type()72 CM_ENUM_CLASS_TYPE Type() const { return CM_ENUM_CLASS_TYPE_CMSURFACE3D; }; 73 74 int32_t SetMemoryObjectControl(MEMORY_OBJECT_CONTROL memCtrl, 75 MEMORY_TYPE memType, 76 uint32_t age); 77 78 CM_RT_API int32_t 79 SelectMemoryObjectControlSetting(MEMORY_OBJECT_CONTROL memCtrl); 80 81 CMRT_UMD_API int32_t SetResourceUsage(const MOS_HW_RESOURCE_DEF mosUsage); 82 83 void Log(std::ostringstream &oss); 84 85 void DumpContent(uint32_t kernelNumber, 86 char *kernelName, 87 int32_t taskId, 88 uint32_t argIndex, 89 uint32_t vectorIndex); 90 91 protected: 92 CmSurface3DRT(uint32_t handle, 93 uint32_t width, 94 uint32_t height, 95 uint32_t depth, 96 CM_SURFACE_FORMAT format, 97 CmSurfaceManager *surfaceManager); 98 99 ~CmSurface3DRT(); 100 101 int32_t Initialize(uint32_t index); 102 103 uint32_t m_handle; 104 uint32_t m_width; 105 uint32_t m_height; 106 uint32_t m_depth; 107 CM_SURFACE_FORMAT m_format; 108 109 private: 110 CmSurface3DRT(const CmSurface3DRT& other); 111 CmSurface3DRT& operator=(const CmSurface3DRT& other); 112 }; 113 }; //namespace 114 115 #endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE3DRT_H_ 116