| 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_rt_umd.h |
| 24 | //! \brief Contains, indirectly, declarations of all CMRT API in UMD. Other |
| 25 | //! UMD components only need to include this file to call CMRT APIs. |
| 26 | //! |
| 27 | |
| 28 | #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMRT_H_ |
| 29 | #define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMRT_H_ |
| 30 | |
| 31 | #include "cm_buffer.h" |
| 32 | #include "cm_device.h" |
| 33 | #include "cm_event.h" |
| 34 | #include "cm_kernel.h" |
| 35 | #include "cm_queue.h" |
| 36 | #include "cm_sampler.h" |
| 37 | #include "cm_sampler8x8.h" |
| 38 | #include "cm_surface_2d.h" |
| 39 | #include "cm_surface_2d_up.h" |
| 40 | #include "cm_surface_3d.h" |
| 41 | #include "cm_task.h" |
| 42 | #include "cm_thread_space.h" |
| 43 | #include "cm_vebox.h" |
| 44 | #include "cm_type.h" |
| 45 | |
| 46 | using namespace CMRT_UMD; |
| 47 | |
| 48 | //! |
| 49 | //! \brief Creates a CmDevice from a MOS context. |
| 50 | //! \details If an existing CmDevice has already associated to the MOS context, |
| 51 | //! the existing CmDevice will be returned. Otherwise, a new CmDevice |
| 52 | //! instance will be created and associatied with that MOS context. |
| 53 | //! \param mosContext |
| 54 | //! [in] pointer to MOS conetext. |
| 55 | //! \param device |
| 56 | //! [in,out] reference to the pointer to the CmDevice. |
| 57 | //! \param devCreateOption |
| 58 | //! [in] option to customize CmDevice. |
| 59 | //! \param priority |
| 60 | //! [in] priority for queue. |
| 61 | //! \retval CM_SUCCESS if the CmDevice is successfully created. |
| 62 | //! \retval CM_NULL_POINTER if pMosContext is null. |
| 63 | //! \retval CM_FAILURE otherwise. |
| 64 | //! |
| 65 | CM_RT_API int32_t CreateCmDevice(MOS_CONTEXT *mosContext, |
| 66 | CmDevice *& device, |
| 67 | uint32_t devCreateOption, |
| 68 | uint8_t priority = CM_DEVICE_CREATE_PRIORITY_DEFAULT); |
| 69 | |
| 70 | //! |
| 71 | //! \brief Destroys the CmDevice. |
| 72 | //! \details This function also destroys surfaces, kernels, programs, samplers, |
| 73 | //! threadspaces, tasks and the queues that were created using this |
| 74 | //! device instance but haven't explicitly been destroyed by calling |
| 75 | //! respective destroy functions. |
| 76 | //! \param device |
| 77 | //! [in] reference to the pointer to the CmDevice. |
| 78 | //! \retval CM_SUCCESS if CmDevice is successfully destroyed. |
| 79 | //! \retval CM_FAILURE otherwise. |
| 80 | //! |
| 81 | CM_RT_API int32_t DestroyCmDevice(CMRT_UMD::CmDevice* &device); |
| 82 | |
| 83 | //! |
| 84 | //! \brief Returns the corresponding CM_RETURN_CODE error string. |
| 85 | //! \param [in] errCode |
| 86 | //! CM error code. |
| 87 | //! \return Corresponding error string if valid Code. \n |
| 88 | //! "Internal Error" if invalid. |
| 89 | //! |
| 90 | CM_RT_API const char* GetCmErrorString(int errCode); |
| 91 | |
| 92 | #endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMRT_H_ |