| 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 Class CmSurface2DUP declarations. |
| 25 | //! |
| 26 | |
| 27 | #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE2DUP_H_ |
| 28 | #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE2DUP_H_ |
| 29 | |
| 30 | #include "cm_def.h" |
| 31 | |
| 32 | namespace CMRT_UMD |
| 33 | { |
| 34 | |
| 35 | //! \brief CmSurface2DUP Class to manage 2D surface created upon user |
| 36 | //! provided system memory. |
| 37 | //! \details Each CmSurface2DUP object is associated with a SurfaceIndex |
| 38 | //! object containing a unique index value the surface is mapped to |
| 39 | //! when created by the CmDevice. The CmDevice keeps the mapping b/w |
| 40 | //! index and CmSurface2DUP. The SurfaceIndex is passed to CM kernel |
| 41 | //! function (genx_main) as argument to indicate the surface. CPU can |
| 42 | //! access the system memory through the memory point. GPU can access |
| 43 | //! the 2D surface through SurfaceIndex in kernel. It is application's |
| 44 | //! responsibility to make sure the accesses from both sides are not |
| 45 | //! overlapped. |
| 46 | class CmSurface2DUP |
| 47 | { |
| 48 | public: |
| 49 | //! |
| 50 | //! \brief This function returns the SurfaceIndex object associated |
| 51 | //! with the surface. |
| 52 | //! \param [out] index |
| 53 | //! Reference to the pointer to SurfaceIndex. |
| 54 | //! \returns CM_SUCCESS. |
| 55 | //! |
| 56 | CM_RT_API virtual int32_t GetIndex(SurfaceIndex* &index) = 0; |
| 57 | |
| 58 | //! |
| 59 | //! \brief Selects one of the pre-defined memory object control |
| 60 | //! settings for this surface. |
| 61 | //! \details This API is platform related for SKL and plus platforms. |
| 62 | //! \param [in] memCtrl |
| 63 | //! The selected pre-defined memory object control setting. |
| 64 | //! \retval CM_SUCCESS if the memory object control is set successfully. |
| 65 | //! \retval CM_FAILURE if the memory object control is not set |
| 66 | //! correctly. |
| 67 | //! \note This function is only implemented for hardware and simulation mode, . |
| 68 | //! |
| 69 | CM_RT_API virtual int32_t |
| 70 | SelectMemoryObjectControlSetting(MEMORY_OBJECT_CONTROL memCtrl) = 0; |
| 71 | |
| 72 | //! |
| 73 | //! \brief Set surface property for interlace usage. |
| 74 | //! \details A surface can be set as top filed, bottom filed for |
| 75 | //! interlace usage. |
| 76 | //! \param [in] frameType |
| 77 | //! It specifies type for surface, it has three |
| 78 | //! types:CM_FRAME,CM_TOP_FIELD, CM_BOTTOM_FIELD. |
| 79 | //! \returns CM_SUCCESS. |
| 80 | //! \note By default, the surface property is CM_FRAME type which means |
| 81 | //! its content is progressive data, not interleave data. |
| 82 | //! |
| 83 | CM_RT_API virtual int32_t SetProperty(CM_FRAME_TYPE frameType) = 0; |
| 84 | |
| 85 | //! |
| 86 | //! \brief Selects one of the pre-defined MOS resource usage settings for this surface. |
| 87 | //! \note This function works on Gen9+ paltforms. |
| 88 | //! \param [in] mosUsage |
| 89 | //! The selected pre-defined MOS resource usage for memory object control setting. |
| 90 | //! \retval CM_SUCCESS if the given parameter is valid |
| 91 | //! \retval CM_FAILURE otherwise. |
| 92 | //! |
| 93 | CMRT_UMD_API virtual int32_t |
| 94 | SetResourceUsage(MOS_HW_RESOURCE_DEF mosUsage) = 0; |
| 95 | }; |
| 96 | }; //namespace |
| 97 | |
| 98 | #endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMSURFACE2DUP_H_ |