/*************************************************************************/ /*!
@Title PVR Common Bridge Module (kernel side)
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description Receives calls from the user portion of services and
despatches them to functions in the kernel portion.
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
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.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) 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.
*/ /**************************************************************************/
#include <stddef.h>
#include "img_defs.h"
#include "services.h"
#include "pvr_bridge_km.h"
#include "pvr_debug.h"
#include "ra.h"
#include "pvr_bridge.h"
#if defined(SUPPORT_SGX)
#include "sgx_bridge.h"
#endif
#if defined(SUPPORT_VGX)
#include "vgx_bridge.h"
#endif
#if defined(SUPPORT_MSVDX)
#include "msvdx_bridge.h"
#endif
#include "perproc.h"
#include "device.h"
#include "buffer_manager.h"
#include "refcount.h"
#include "pdump_km.h"
#include "syscommon.h"
#include "bridged_pvr_bridge.h"
#if defined(SUPPORT_SGX)
#include "bridged_sgx_bridge.h"
#endif
#if defined(SUPPORT_VGX)
#include "bridged_vgx_bridge.h"
#endif
#if defined(SUPPORT_MSVDX)
#include "bridged_msvdx_bridge.h"
#endif
#include "env_data.h"
#if defined (__linux__) || defined(__QNXNTO__)
#include "mmap.h"
#endif
#include "srvkm.h"
/* FIXME: we should include an OS specific header here to allow configuration of
* which functions should be excluded (like the shared srvclient bridge code)
* so that ports may choose to override certain things. */
/* For the purpose of maintainability, it is intended that this file should not
* contain large amounts of OS specific #ifdefs. Headers are fine, and perhaps
* a few one liners, but for anything more, please find a way to add e.g.
* an osfunc.c abstraction or override the entire function in question within
* env,*,pvr_bridge_k.c
*/
PVRSRV_BRIDGE_DISPATCH_TABLE_ENTRY g_BridgeDispatchTable[BRIDGE_DISPATCH_TABLE_ENTRY_COUNT];
#if defined(DEBUG_BRIDGE_KM)
PVRSRV_BRIDGE_GLOBAL_STATS g_BridgeGlobalStats;
#endif
#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
static IMG_BOOL abSharedDeviceMemHeap[PVRSRV_MAX_CLIENT_HEAPS];
static IMG_BOOL *pbSharedDeviceMemHeap = abSharedDeviceMemHeap;
#else
static IMG_BOOL *pbSharedDeviceMemHeap = (IMG_BOOL*)IMG_NULL;
#endif
#if defined(DEBUG_BRIDGE_KM)
PVRSRV_ERROR
CopyFromUserWrapper(PVRSRV_PER_PROCESS_DATA *pProcData,
IMG_UINT32 ui32BridgeID,
IMG_VOID *pvDest,
IMG_VOID *pvSrc,
IMG_UINT32 ui32Size)
{
g_BridgeDispatchTable[ui32BridgeID].ui32CopyFromUserTotalBytes+=ui32Size;
g_BridgeGlobalStats.ui32TotalCopyFromUserBytes+=ui32Size;
return OSCopyFromUser(pProcData, pvDest, pvSrc, ui32Size);
}
PVRSRV_ERROR
CopyToUserWrapper(PVRSRV_PER_PROCESS_DATA *pProcData,
IMG_UINT32 ui32BridgeID,
IMG_VOID *pvDest,
IMG_VOID *pvSrc,
IMG_UINT32 ui32Size)
{
g_BridgeDispatchTable[ui32BridgeID].ui32CopyToUserTotalBytes+=ui32Size;
g_BridgeGlobalStats.ui32TotalCopyToUserBytes+=ui32Size;
return OSCopyToUser(pProcData, pvDest, pvSrc, ui32Size);
}
#endif
static IMG_INT
PVRSRVEnumerateDevicesBW(IMG_UINT32 ui32BridgeID,
IMG_VOID *psBridgeIn,
PVRSRV_BRIDGE_OUT_ENUMDEVICE *psEnumDeviceOUT,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_ENUM_DEVICES);
PVR_UNREFERENCED_PARAMETER(psPerProc);
PVR_UNREFERENCED_PARAMETER(psBridgeIn);
psEnumDeviceOUT->eError =
PVRSRVEnumerateDevicesKM(&psEnumDeviceOUT->ui32NumDevices,
psEnumDeviceOUT->asDeviceIdentifier);
return 0;
}
static IMG_INT
PVRSRVAcquireDeviceDataBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_ACQUIRE_DEVICEINFO *psAcquireDevInfoIN,
PVRSRV_BRIDGE_OUT_ACQUIRE_DEVICEINFO *psAcquireDevInfoOUT,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
IMG_HANDLE hDevCookieInt;
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_ACQUIRE_DEVICEINFO);
psAcquireDevInfoOUT->eError =
PVRSRVAcquireDeviceDataKM(psAcquireDevInfoIN->uiDevIndex,
psAcquireDevInfoIN->eDeviceType,
&hDevCookieInt);
if(psAcquireDevInfoOUT->eError != PVRSRV_OK)
{
return 0;
}
/*
* Handle is not allocated in batch mode, as there is no resource
* allocation to undo if the handle allocation fails.
*/
psAcquireDevInfoOUT->eError =
PVRSRVAllocHandle(psPerProc->psHandleBase,
&psAcquireDevInfoOUT->hDevCookie,
hDevCookieInt,
PVRSRV_HANDLE_TYPE_DEV_NODE,
PVRSRV_HANDLE_ALLOC_FLAG_SHARED);
return 0;
}
static IMG_INT
PVRSRVCreateDeviceMemContextBW(IMG_UINT32 ui32BridgeID,
PVRSRV_BRIDGE_IN_CREATE_DEVMEMCONTEXT *psCreateDevMemContextIN,
PVRSRV_BRIDGE_OUT_CREATE_DEVMEMCONTEXT *psCreateDevMemContextOUT,
PVRSRV_PER_PROCESS_DATA *psPerProc)
{
IMG_HANDLE hDevCookieInt;
IMG_HANDLE hDevMemContextInt;
IMG_UINT32 i;
IMG_BOOL bCreated;
#if defined (SUPPORT_SID_INTERFACE)
PVRSRV_HEAP_INFO_KM asHeapInfo[PVRSRV_MAX_CLIENT_HEAPS];
#endif
PVRSRV_BRIDGE_ASSERT_CMD(ui32BridgeID, PVRSRV_BRIDGE_CREATE_DEVMEMCONTEXT);
/*
* We potentially need one handle for the device memory context,
* and one handle for each client heap.
*/
NEW_HANDLE_BATCH_OR_ERROR(psCreateDevMemContextOUT->eError, psPerProc, PVRSRV_MAX_CLIENT_HEAPS + 1)
psCreateDevMemContextOUT->eError =
PVRSRVLookupHandle(psPerProc->psHandleBase, &hDevCookieInt,
psCreateDevMemContextIN->hDevCookie,
PVRSRV_HANDLE_TYPE_DEV_NODE);
if(psCreateDevMemContextOUT->eError != PVRSRV_OK)
{
return 0;
}
psCreateDevMemContextOUT->eError =
PVRSRVCreateDeviceMemContextKM(hDevCookieInt,
psPerProc,
&hDevMemContextInt,
&psCreateDevMemContextOUT->ui32ClientHeapCount,
#if defined (SUPPORT_SID_INTERFACE)
&asHeapInfo[0],
#else
&psCreateDevMemContextOUT->sHeapInfo[0],
#endif
&bCreated,
pbSharedDeviceMemHeap);
if(psCreateDevMemContextOUT->eError != PVRSRV_OK)
{
return 0;
}
/*
* Only allocate a handle if the device memory context was cre
am3352交叉编译工具 gcc
需积分: 25 187 浏览量
2018-11-19
17:51:11
上传
评论
收藏 167.66MB GZ 举报
iotcsdn
- 粉丝: 47
- 资源: 34
最新资源
- Ruby基于Ruby的MKS rebase脚本 Ruby语言基础
- 基于GPT+Pyhon开发的网页游戏,类似于最火的文字游戏《人生重开模拟器》源码
- 基于qt+C++实现u盘插拔检测.+源码(毕业设计&课程设计&项目开发)
- rust开发封装的windows gui源码
- checkpoint.zip
- 无人机姿态和轨迹跟踪控制-反步控制方法
- 基于Qt+opencv+C++实现图像旋转+自动&&手动+直线检测,角度计算+界面操作+源码(期末大作业&课程设计&项目开发)
- Object-CC++对象库,实现类似于Java的Object类的Object
- 基于servlet的简单游戏管理系统
- 广工基于Libero的数字逻辑设计仿真及验证实验报告
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈