⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fbmem.c

📁 Lido PXA270平台开发板的最新BSP,包括源代码
💻 C
字号:
/*!****************************************************************************
@File			fbmem.c

@Title			Framebuffer memory manager

@Author			Imagination Technologies

@date   		6th June 2002
 
@Copyright     	Copyright 2003-2004 by Imagination Technologies Limited.
                All rights reserved. No part of this software, either
                material or conceptual may be copied or distributed,
                transmitted, transcribed, stored in a retrieval system
                or translated into any human or computer language in any
                form by any means, electronic, mechanical, manual or
                other-wise, or disclosed to third parties without the
                express written permission of Imagination Technologies
                Limited, Unit 8, HomePark Industrial Estate,
                King's Langley, Hertfordshire, WD4 8LZ, U.K.

@Platform		generic

@Description	Functions relating to Framebuffer memory management

@DoxygenVer		

******************************************************************************/

/******************************************************************************
Modifications :-

$Log: fbmem.c $
*****************************************************************************/

#include "services_headers.h"
#include "fbmem.h"
#include "hash.h"
#include "ra.h"
#include "dual_buffer.h"

/*!
******************************************************************************

 @Function	AllocStaticFBMem
 
 @Description 
 
 Allocates a block of memory from the top of the FB heap

 @Input	psDevInfo -- which device the heap is on
 @Input	dwFlags -- 0 or FB_HEAP_NOT_SPLIT_PAGE
 @Input	dwSize -- size to allocate in bytes
 @Input	dwAlignment -- alignment on which to allocate (in bytes)
 @Output *ppvLinAddr -- pointer to PVOID to fill out with the linear address of the allocated block
 @Output pdwPhysAddr -- pointer to PDWORD to fill out with the physical addr of the allocated block

 @Return   Error status  : 

******************************************************************************/
PVRSRV_ERROR AllocStaticFBMem (PPVRSRV_DEV_INFO psDevInfo,
		  IMG_UINT32 ui32Flags,
		  IMG_UINT32 ui32Size,
		  IMG_UINT32 ui32Alignment,
		  IMG_CPU_VIRTADDR *pCpuVAddr,
		  IMG_DEV_VIRTADDR *pDevVAddr)
{
 	SYS_DATA *psSysData;

	if(SysAcquireData(&psSysData) != PVRSRV_OK)
		return PVRSRV_ERROR_OUT_OF_MEMORY;

	UNREFERENCED_PARAMETER(psDevInfo);
	UNREFERENCED_PARAMETER(ui32Flags);
	
	*pCpuVAddr = DB_Alloc (psSysData->db_state, (IMG_SIZE_T)ui32Size, (int)0, (unsigned)ui32Alignment, pDevVAddr);
  
	if (*pCpuVAddr==IMG_NULL)
	{
		PVR_DPF((PVR_DBG_ERROR,"ERROR: AllocStaticFBMem failed!"));
		return (PVRSRV_ERROR_OUT_OF_HSPACE);
	}
	
	return (PVRSRV_OK);
}

/*!
******************************************************************************

 @Function	FreeStaticFBMem
 
 @Description 
 
 Frees a block of memory allocated at the top of the heap

 @Input	psDevInfo -- which device the heap is on
 @Input	pvLinAddr -- linear address returned by KMAllocStaticFBMem

 @Return   Error status  : 
******************************************************************************/
PVRSRV_ERROR FreeStaticFBMem (PPVRSRV_DEV_INFO psDevInfo, IMG_VOID *pvLinAddr)
{
  	SYS_DATA *psSysData;

	if(SysAcquireData(&psSysData) != PVRSRV_OK)
		return PVRSRV_ERROR_OUT_OF_MEMORY;


	UNREFERENCED_PARAMETER(psDevInfo);
  
	DB_Free (psSysData->db_state, pvLinAddr);
  
	return PVRSRV_OK;
}


/*****************************************************************************
 End of file (fbmem.c)
*****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -