/drivers/gpu/pvr/bridged_support.c
C | 89 lines | 53 code | 11 blank | 25 comment | 3 complexity | 83e9445e519cec956b7473df3f2e658d MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
1/**********************************************************************
2 *
3 * Copyright (C) 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
32PVRSRV_ERROR
33#if defined (SUPPORT_SID_INTERFACE)
34PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_SID hMHandle)
35#else
36PVRSRVLookupOSMemHandle(PVRSRV_HANDLE_BASE *psHandleBase, IMG_HANDLE *phOSMemHandle, IMG_HANDLE hMHandle)
37#endif
38{
39 IMG_HANDLE hMHandleInt;
40 PVRSRV_HANDLE_TYPE eHandleType;
41 PVRSRV_ERROR eError;
42
43
44 eError = PVRSRVLookupHandleAnyType(psHandleBase, &hMHandleInt,
45 &eHandleType,
46 hMHandle);
47 if(eError != PVRSRV_OK)
48 {
49 return eError;
50 }
51
52 switch(eHandleType)
53 {
54#if defined(PVR_SECURE_HANDLES) || defined (SUPPORT_SID_INTERFACE)
55 case PVRSRV_HANDLE_TYPE_MEM_INFO:
56 case PVRSRV_HANDLE_TYPE_MEM_INFO_REF:
57 case PVRSRV_HANDLE_TYPE_SHARED_SYS_MEM_INFO:
58 {
59 PVRSRV_KERNEL_MEM_INFO *psMemInfo = (PVRSRV_KERNEL_MEM_INFO *)hMHandleInt;
60
61 *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
62
63 break;
64 }
65 case PVRSRV_HANDLE_TYPE_SYNC_INFO:
66 {
67 PVRSRV_KERNEL_SYNC_INFO *psSyncInfo = (PVRSRV_KERNEL_SYNC_INFO *)hMHandleInt;
68 PVRSRV_KERNEL_MEM_INFO *psMemInfo = psSyncInfo->psSyncDataMemInfoKM;
69
70 *phOSMemHandle = psMemInfo->sMemBlk.hOSMemHandle;
71
72 break;
73 }
74 case PVRSRV_HANDLE_TYPE_SOC_TIMER:
75 {
76 *phOSMemHandle = (IMG_VOID *)hMHandleInt;
77 break;
78 }
79#else
80 case PVRSRV_HANDLE_TYPE_NONE:
81 *phOSMemHandle = (IMG_VOID *)hMHandleInt;
82 break;
83#endif
84 default:
85 return PVRSRV_ERROR_BAD_MAPPING;
86 }
87
88 return PVRSRV_OK;
89}