diff options
Diffstat (limited to 'drivers/gpu/pvr/bridged_support.c')
-rw-r--r-- | drivers/gpu/pvr/bridged_support.c | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/drivers/gpu/pvr/bridged_support.c b/drivers/gpu/pvr/bridged_support.c new file mode 100644 index 00000000000..e10e577121f --- /dev/null +++ b/drivers/gpu/pvr/bridged_support.c | |||
@@ -0,0 +1,85 @@ | |||
1 | /********************************************************************** | ||
2 | * | ||
3 | * Copyright(c) 2008 Imagination Technologies Ltd. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful but, except | ||
10 | * as otherwise stated in writing, without any warranty; without even the | ||
11 | * implied warranty of merchantability or fitness for a particular purpose. | ||
12 | * See the GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | * The full GNU General Public License is included in this distribution in | ||
19 | * the file called "COPYING". | ||
20 | * | ||
21 | * Contact Information: | ||
22 | * Imagination Technologies Ltd. <gpl-support@imgtec.com> | ||
23 | * Home Park Estate, Kings Langley, Herts, WD4 8LZ, UK | ||
24 | * | ||
25 | ******************************************************************************/ | ||
26 | |||
27 | #include "img_defs.h" | ||
28 | #include "servicesint.h" | ||
29 | #include "bridged_support.h" | ||
30 | |||
31 | |||
32 | PVRSRV_ERROR | ||
33 | PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_HANDLE hMHandle) | ||
34 | { | ||
35 | IMG_HANDLE hMHandleInt; | ||
36 | PVRSRV_HANDLE_TYPE eHandleType; | ||
37 | PVRSRV_ERROR eError; | ||
38 | |||
39 | |||
40 | eError = PVRSRVLookupHandleAnyType(psHandleBase, &hMHandleInt, | ||
41 | &eHandleType, | ||
42 | hMHandle); | ||
43 | if(eError != PVRSRV_OK) | ||
44 | { | ||
45 | return eError; | ||
46 | } | ||
47 | |||
48 | switch(eHandleType) | ||
49 | { | ||
50 | #if defined(PVR_SECURE_HANDLES) | ||
51 | case PVRSRV_HANDLE_TYPE_MEM_INFO: | ||
52 | case PVRSRV_HANDLE_TYPE_MEM_INFO_REF: | ||
53 | case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO: | ||
54 | { | ||
55 | PVRSRV_KERNEL_MEM_INFO *psMemInfo = (PVRSRV_KERNEL_MEM_INFO *)hMHandleInt; | ||
56 | |||
57 | *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle; | ||
58 | |||
59 | break; | ||
60 | } | ||
61 | case PVRSRV_HANDLE_TYPE_SYNC_INFO: | ||
62 | { | ||
63 | PVRSRV_KERNEL_SYNC_INFO *psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)hMHandleInt; | ||
64 | PVRSRV_KERNEL_MEM_INFO *psMemInfo = psSyncInfo->psSyncDataMemInfoKM; | ||
65 | |||
66 | *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle; | ||
67 | |||
68 | break; | ||
69 | } | ||
70 | case PVRSRV_HANDLE_TYPE_SOC_TIMER: | ||
71 | { | ||
72 | *phOSMemHandle = (IMG_VOID *)hMHandleInt; | ||
73 | break; | ||
74 | } | ||
75 | #else | ||
76 | case PVRSRV_HANDLE_TYPE_NONE: | ||
77 | *phOSMemHandle = (IMG_VOID *)hMHandleInt; | ||
78 | break; | ||
79 | #endif | ||
80 | default: | ||
81 | return PVRSRV_ERROR_BAD_MAPPING; | ||
82 | } | ||
83 | |||
84 | return PVRSRV_OK; | ||
85 | } | ||