1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
|
/*
* Copyright (c) 2017, Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
//!
//! \file cm_task.h
//! \brief Contains CmTask declatation.
//!
#ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMTASK_H_
#define MEDIADRIVER_AGNOSTIC_COMMON_CM_CMTASK_H_
#include "cm_def.h"
enum CM_CONDITIONAL_END_OPERATOR_CODE
{
MAD_GREATER_THAN_IDD = 0,
MAD_GREATER_THAN_OR_EQUAL_IDD,
MAD_LESS_THAN_IDD,
MAD_LESS_THAN_OR_EQUAL_IDD,
MAD_EQUAL_IDD,
MAD_NOT_EQUAL_IDD
};
//!
//! \brief CM_CONDITIONAL_END_PARAM
//! \details
//! The parameters of conditional batch buffer end command, for platforms
//! till CNL, only opValue and opMask fields are used.
//!
struct CM_CONDITIONAL_END_PARAM
{
uint32_t opValue; //!< operand of comparing operation
CM_CONDITIONAL_END_OPERATOR_CODE opCode; //!< operation type
bool opMask; //!< mask of operand
bool opLevel; //!< batch buffer level to end
};
namespace CMRT_UMD
{
class CmKernel;
//! \brief CmTask Class to manage task parameters.
//! \details CmTask contains one or multiple CmKernels, optional
//! synchronization point between two consecutive kernels,
//! and some execution parameters. CmTask is the unit to
//! enqueue.
//! If there is no synchronization point. kernels will run
//! concurrently. If there is a synchronization point, kernels
//! after the synchronization point will not start until kernels
//! before the synchronization point finishes.
class CmTask
{
public:
//!
//! \brief Add a CmKernel pointer to CmTask.
//! \details Same kernel can appear in the task multiple times as long
//! as all the value of its arguments are the same for multiple
//! copies of the kernel.
//! \param [in] kernel
//! A pointer to CmKernel object.
//! \retval CM_SUCCESS if kernel is added.
//! \retval CM_EXCEED_MAX_KERNEL_PER_ENQUEUE trying to add more kernels
//! than CAP_KERNEL_COUNT_PER_TASK.
//! \retval CM_INVALID_ARG_VALUE if kernel is NULL.
//!
CM_RT_API virtual int32_t AddKernel(CmKernel *kernel) = 0;
//!
//! \brief Resets a CmTask object
//! \details All contents contained in CmTask get reset. Application need
//! add kernel, optional synchronization points, etc. again to
//! the CmTask. This function is to reuse CmTask for diffrent
//! contents so CmTask creation/destroy overhead can be avoided.
//! \returns CM_SUCCESS.
//!
CM_RT_API virtual int32_t Reset() = 0;
//!
//! \brief Inserts a synchronization point among kernels.
//! \details Kernels after the synchronization point will not start
//! execution untill kernels before the synchronization
//! point finishes execution. A CmTask can have multiple
//! synchronization points.
//! \returns CM_SUCCESS.
//!
CM_RT_API virtual int32_t AddSync() = 0;
//!
//! \brief Set a per-task based power option to current task.
//! \details The power option includes the hardware configuration of
//! slice, subslice and EU number. The setting takes effect
//! only for current task; the value needs to be set again if
//! user wants it to take effect for the next task.
//! \param [in] powerOption
//! A pointer to CM_POWER_OPTION struct
//! \retval CM_SUCCESS.
//! \retval CM_EXCEED_MAX_POWER_OPTION_FOR_ PLATFORM if the any of the
//! settings exceeds the limit of current platform
//! configuration.
//!
CM_RT_API virtual int32_t
SetPowerOption(PCM_POWER_OPTION powerOption) = 0;
//!
//! \brief This API is used for the conditional end feature.
//! \details It adds a conditional batch buffer end command between two
//! kernels in a task. The conditionalSurface + offset is the
//! address storing its data against the dword value provided in
//! conditionalParam. If the data at the compare memory address is
//! greater than the dword set in conditionalParam, the execution of
//! the command buffer will continue. If not, the remaining
//! kernels in the task will be skipped. The user can call this
//! API multiple times to insert multiple conditional ends
//! between different kernels. When opMask in conditionalParam is 1,
//! the actual comparison value is the result of bitwise-and of
//! the value in memory and mask.
//! \param [in] conditionalSurfaceIndex
//! Pointer to the surface used to store comparison
//! dword by kernel.
//! \param [in] offset
//! The offset pointered by pSurface where stores comparison
//! dword value, and mask if opMask in conditionalParam is set to 1.
//! \param [in] conditionalParam
//! Pointer to the parameters of conditional batch buffer end
//! command, for platforms till CNL, only opValue and opMask fields are
//! used.
//! \retval CM_SUCCESS if successfully add a conditional batch buffer
//! end.
//! \retval CM_FAILURE otherwise.
//!
CM_RT_API virtual int32_t
AddConditionalEnd(SurfaceIndex* conditionalSurfaceIndex,
uint32_t offset,
CM_CONDITIONAL_END_PARAM *conditionalParam) = 0;
//!
//! \brief Expose bitfield for task related property.
//! \details Currently this function can be used to expose the
//! bitfield for turbo boost.
//! \param [out] taskConfig
//! specify which bitfield will be exposed.
//! \returns CM_SUCCESS.
//!
CM_RT_API virtual int32_t SetProperty(const CM_TASK_CONFIG &taskConfig) = 0;
//!
//! \brief Add a CmKernel pointer to CmTask with customized execution
//! configure.
//! \details Same kernel can appear in the task multiple times as long
//! as all the value of its arguments are the same for multiple
//! copies of the kernel.
//! \param [in] kernel
//! A pointer to CmKernel object.
//! \param [in] config
//! A Pointer to customized kernel execution configure.
//! \retval CM_SUCCESS if kernel is added.
//! \retval CM_EXCEED_MAX_KERNEL_PER_ENQUEUE trying to add more kernels
//! than CAP_KERNEL_COUNT_PER_TASK.
//! \retval CM_INVALID_ARG_VALUE if kernel is NULL.
//!
CM_RT_API virtual int32_t AddKernelWithConfig( CmKernel *pKernel, const CM_EXECUTION_CONFIG *config ) = 0;
};
}; //namespace
#endif // #ifndef MEDIADRIVER_AGNOSTIC_COMMON_CM_CMTASK_H_
|