gpu: pvr: get rid of unnecessary hash lookups for the proc object
[sgx.git] / pvr / sgxutils.h
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 "perproc.h"
28
29 #define CCB_OFFSET_IS_VALID(type, psCCBMemInfo, psCCBKick, offset)      \
30         ((sizeof(type) <= (psCCBMemInfo)->ui32AllocSize) &&             \
31         ((psCCBKick)->offset <= (psCCBMemInfo)->ui32AllocSize - sizeof(type)))
32
33 #define CCB_DATA_FROM_OFFSET(type, psCCBMemInfo, psCCBKick, offset)     \
34         ((type *)(((char *)(psCCBMemInfo)->pvLinAddrKM) +               \
35                 (psCCBKick)->offset))
36
37 void SGXTestActivePowerEvent(struct PVRSRV_DEVICE_NODE *psDeviceNode);
38
39 enum PVRSRV_ERROR SGXScheduleCCBCommand(
40                                 struct PVRSRV_SGXDEV_INFO *psDevInfo,
41                                 enum SGXMKIF_COMMAND_TYPE eCommandType,
42                                 struct SGXMKIF_COMMAND *psCommandData,
43                                 u32 ui32CallerID, u32 ui32PDumpFlags);
44 enum PVRSRV_ERROR SGXScheduleCCBCommandKM(
45                                 struct PVRSRV_DEVICE_NODE *psDeviceNode,
46                                 enum SGXMKIF_COMMAND_TYPE eCommandType,
47                                 struct SGXMKIF_COMMAND *psCommandData,
48                                 u32 ui32CallerID, u32 ui32PDumpFlags);
49
50 enum PVRSRV_ERROR SGXScheduleProcessQueues(
51                                 struct PVRSRV_DEVICE_NODE *psDeviceNode);
52 enum PVRSRV_ERROR SGXScheduleProcessQueuesKM(
53                                 struct PVRSRV_DEVICE_NODE *psDeviceNode);
54
55 IMG_BOOL SGXIsDevicePowered(struct PVRSRV_DEVICE_NODE *psDeviceNode);
56
57 void *SGXRegisterHWRenderContextKM(void *psDeviceNode,
58                          struct IMG_DEV_VIRTADDR *psHWRenderContextDevVAddr,
59                          struct PVRSRV_PER_PROCESS_DATA *psPerProc);
60
61 void *SGXRegisterHWTransferContextKM(void *psDeviceNode,
62                          struct IMG_DEV_VIRTADDR *psHWTransferContextDevVAddr,
63                          struct PVRSRV_PER_PROCESS_DATA *psPerProc);
64
65 void SGXFlushHWRenderTargetKM(void *psSGXDevInfo,
66                          struct IMG_DEV_VIRTADDR psHWRTDataSetDevVAddr);
67
68 enum PVRSRV_ERROR SGXUnregisterHWRenderContextKM(void *hHWRenderContext);
69
70 enum PVRSRV_ERROR SGXUnregisterHWTransferContextKM(void *hHWTransferContext);
71
72 u32 SGXConvertTimeStamp(struct PVRSRV_SGXDEV_INFO *psDevInfo,
73                         u32 ui32TimeWraps, u32 ui32Time);
74
75 void SGXCleanupRequest(struct PVRSRV_DEVICE_NODE *psDeviceNode,
76                        struct IMG_DEV_VIRTADDR *psHWDataDevVAddr,
77                        u32 ui32ResManRequestFlag);
78