| 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_2d_up.h |
| 24 |
//! \brief Contains CmSurface2DUPRT declarations. |
| 25 |
//! |
| 26 |
|
| 27 |
#ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE2DUPRT_H_ |
| 28 |
#define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE2DUPRT_H_ |
| 29 |
|
| 30 |
#include "cm_surface_2d_up.h" |
| 31 |
#include "cm_surface.h" |
| 32 |
|
| 33 |
namespace CMRT_UMD |
| 34 |
{ |
| 35 |
class CmSurface2DUPRT: public CmSurface, public CmSurface2DUP |
| 36 |
{ |
| 37 |
public: |
| 38 |
static int32_t Create(uint32_t index, |
| 39 |
uint32_t handle, |
| 40 |
uint32_t width, |
| 41 |
uint32_t height, |
| 42 |
CM_SURFACE_FORMAT format, |
| 43 |
void *sysMem, |
| 44 |
CmSurfaceManager *surfaceManager, |
| 45 |
CmSurface2DUPRT* &surface); |
| 46 |
|
| 47 |
CM_RT_API int32_t GetIndex(SurfaceIndex* &index); |
| 48 |
|
| 49 |
virtual int32_t GetHandle(uint32_t &handle); |
| 50 |
|
| 51 |
//NOT depend on RTTI::dynamic_cast |
| 52 |
CM_ENUM_CLASS_TYPE Type() const |
| 53 |
{ return CM_ENUM_CLASS_TYPE_CMSURFACE2DUP; } |
| 54 |
|
| 55 |
int32_t SetMemoryObjectControl(MEMORY_OBJECT_CONTROL memCtrl, |
| 56 |
MEMORY_TYPE memType, |
| 57 |
uint32_t age); |
| 58 |
|
| 59 |
CM_RT_API virtual int32_t GetSurfaceDesc(uint32_t &width, |
| 60 |
uint32_t &height, |
| 61 |
CM_SURFACE_FORMAT &format, |
| 62 |
uint32_t &sizeperpixel); |
| 63 |
|
| 64 |
CM_RT_API int32_t |
| 65 |
SelectMemoryObjectControlSetting(MEMORY_OBJECT_CONTROL memCtrl); |
| 66 |
|
| 67 |
CM_RT_API int32_t SetProperty(CM_FRAME_TYPE frameType); |
| 68 |
|
| 69 |
CMRT_UMD_API int32_t SetResourceUsage(const MOS_HW_RESOURCE_DEF mosUsage); |
| 70 |
|
| 71 |
void Log(std::ostringstream &oss); |
| 72 |
|
| 73 |
void DumpContent(uint32_t kernelNumber, |
| 74 |
char *kernelName, |
| 75 |
int32_t taskId, |
| 76 |
uint32_t argIndex, |
| 77 |
uint32_t vectorIndex); |
| 78 |
|
| 79 |
protected: |
| 80 |
CmSurface2DUPRT(uint32_t handle, |
| 81 |
uint32_t width, |
| 82 |
uint32_t height, |
| 83 |
CM_SURFACE_FORMAT format, |
| 84 |
void *sysMem, |
| 85 |
CmSurfaceManager *surfaceManager); |
| 86 |
|
| 87 |
~CmSurface2DUPRT(); |
| 88 |
|
| 89 |
int32_t Initialize(uint32_t index); |
| 90 |
|
| 91 |
uint32_t m_handle; |
| 92 |
uint32_t m_width; |
| 93 |
uint32_t m_height; |
| 94 |
CM_FRAME_TYPE m_frameType; |
| 95 |
CM_SURFACE_FORMAT m_format; |
| 96 |
void *m_sysMem; |
| 97 |
|
| 98 |
private: |
| 99 |
CmSurface2DUPRT(const CmSurface2DUPRT& other); |
| 100 |
CmSurface2DUPRT& operator=(const CmSurface2DUPRT& other); |
| 101 |
}; |
| 102 |
}; //namespace |
| 103 |
|
| 104 |
#endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE2DUPRT_H_ |