2 * Copyright (c) 2009, Intel Corporation.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
19 #include "psb_pvr_glue.h"
22 * FIXME: should NOT use these file under env/linux directly
25 int psb_get_meminfo_by_handle(void *hKernelMemInfo
,
26 void **ppsKernelMemInfo
)
30 void *psKernelMemInfo
= IMG_NULL
;
31 PVRSRV_PER_PROCESS_DATA
*psPerProc
= IMG_NULL
;
34 psPerProc
= PVRSRVPerProcessData(task_tgid_nr(current
));
35 eError
= PVRSRVLookupHandle(psPerProc
->psHandleBase
,
36 (IMG_VOID
*)&psKernelMemInfo
,
38 PVRSRV_HANDLE_TYPE_MEM_INFO
);
39 if (eError
!= PVRSRV_OK
) {
40 DRM_ERROR("Cannot find kernel meminfo for handle 0x%x\n",
45 *ppsKernelMemInfo
= psKernelMemInfo
;
47 DRM_DEBUG("Got Kernel MemInfo for handle %lx\n",
53 int psb_get_pages_by_mem_handle(void *hOSMemHandle
, struct page
***pages
)
57 LinuxMemArea
*psLinuxMemArea
= (LinuxMemArea
*)hOSMemHandle
;
58 struct page
**page_list
;
59 if (psLinuxMemArea
->eAreaType
!= LINUX_MEM_AREA_ALLOC_PAGES
) {
60 DRM_ERROR("MemArea type is not LINUX_MEM_AREA_ALLOC_PAGES\n");
64 page_list
= psLinuxMemArea
->uData
.sPageList
.pvPageList
;
66 DRM_DEBUG("Page List is NULL\n");