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_vme.h 24 //! \brief Contains Class CmSurfaceVme definitions 25 //! 26 #pragma once 27 28 #include "cm_surface.h" 29 30 class CmSurfaceStateVME; 31 class CmExecutionAdv; 32 namespace CMRT_UMD 33 { 34 35 class CmSurfaceVme : public CmSurface 36 { 37 public: 38 static int32_t Create( 39 uint32_t index, 40 uint32_t indexFor2DCurrent, 41 uint32_t indexFor2DForward, 42 uint32_t indexFor2DBackward, 43 uint32_t indexForCurrent, 44 uint32_t indexForForward, 45 uint32_t indexForBackward, 46 CmSurfaceManager* surfaceManager, 47 CmSurfaceVme* &surface ); 48 49 static int32_t Create( 50 uint32_t index, 51 uint32_t indexFor2DCurSurface, 52 uint32_t *forwardSurface, 53 uint32_t *backwardSurface, 54 uint32_t currentIndex, 55 uint32_t *forwardCmIndex, 56 uint32_t *backwardCmIndex, 57 const uint32_t forwardSurfaceCount, 58 const uint32_t backSurfaceCount, 59 CmSurfaceManager* surfaceManager, 60 CmSurfaceVme* &surface ); 61 62 virtual int32_t GetIndex(SurfaceIndex*& index); 63 int32_t GetIndexCurrent( uint32_t& index ); 64 int32_t GetIndexForward( uint32_t& index ); 65 int32_t GetIndexBackward( uint32_t& index ); 66 int32_t GetIndexForwardArray( uint32_t*& index ); 67 int32_t GetIndexBackwardArray( uint32_t*& index ); 68 int32_t GetIndexForwardCount( uint32_t &count); 69 int32_t GetIndexBackwardCount( uint32_t & count); 70 71 int32_t GetCmIndexCurrent( uint16_t& index ); 72 int32_t GetCmIndexForward( uint16_t& index ); 73 int32_t GetCmIndexBackward( uint16_t& index ); 74 int32_t GetCmIndexForwardArray( uint32_t*& index ); 75 int32_t GetCmIndexBackwardArray( uint32_t*& index ); 76 77 int32_t GetSurfaceStateResolution(uint32_t& width, uint32_t& height); 78 virtual int32_t SetSurfaceStateResolution(uint32_t width, uint32_t height); 79 80 bool IsVmeSurfaceGen7_5(); 81 82 void SetSurfState(CmExecutionAdv *advExec, uint8_t *argValue, CmSurfaceStateVME *surfState); 83 GetSurfaceState()84 inline CmSurfaceStateVME *GetSurfaceState() { return m_surfState; } 85 Type()86 CM_ENUM_CLASS_TYPE Type() const {return CM_ENUM_CLASS_TYPE_CMSURFACEVME;}; 87 88 // calculate the size needed for the pValue 89 int32_t GetVmeCmArgSize(); 90 // return the surfaces number registered in a vme surface, including current, forward and backward 91 int32_t GetTotalSurfacesCount(); 92 93 void DumpContent(uint32_t kernelNumber, 94 char *kernelName, 95 int32_t taskId, 96 uint32_t argIndex, 97 uint32_t vectorIndex); 98 99 protected: 100 CmSurfaceVme( 101 uint32_t indexFor2DCurrent, 102 uint32_t indexFor2DForward, 103 uint32_t indexFor2DBackward, 104 uint32_t indexForCurrent, 105 uint32_t indexForForward, 106 uint32_t indexForBackward, 107 CmSurfaceManager* surfaceManager ); 108 109 CmSurfaceVme( 110 const uint32_t surfaceFCount, 111 const uint32_t surfaceBCount, 112 uint32_t indexFor2DCurSurface, 113 uint32_t *forwardSurface, 114 uint32_t *backwardSurface, 115 uint32_t currentIndex, 116 uint32_t *forwardCmIndex, 117 uint32_t *backwardCmIndex, 118 CmSurfaceManager* surfaceManager); 119 120 ~CmSurfaceVme( void ); 121 122 int32_t Initialize( uint32_t index ); 123 124 uint32_t m_indexFor2DCurrent; 125 uint32_t m_indexFor2DForward; 126 uint32_t m_indexFor2DBackward; 127 uint32_t *m_forwardSurfaceArray; 128 uint32_t *m_backwardSurfaceArray; 129 130 uint32_t m_cmIndexForCurrent; 131 uint32_t m_cmIndexForForward; 132 uint32_t m_cmIndexForBackward; 133 uint32_t *m_forwardCmIndexArray; 134 uint32_t *m_backwardCmIndexArray; 135 136 uint32_t m_surfaceFCount; 137 uint32_t m_surfaceBCount; 138 139 uint32_t m_surfStateWidth; 140 uint32_t m_surfStateHeight; 141 142 uint8_t *m_argValue; 143 CmSurfaceStateVME *m_surfState; 144 CmExecutionAdv *m_advExec; 145 146 bool m_isGen75; 147 148 private: 149 CmSurfaceVme(const CmSurfaceVme& other); 150 CmSurfaceVme& operator=(const CmSurfaceVme& other); 151 }; 152 }; //namespace 153