예제 #1
0
파일: vidmem.c 프로젝트: L3oV1nc3/VMGL
void
xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
{
	VidMapPtr vp;
	MappingPtr mp;

	if (!vidMemInfo.initialised || !vidMemInfo.unmapMem) {
		xf86DrvMsg(ScreenNum, X_WARNING,
		  "xf86UnMapVidMem() called before xf86MapVidMem()\n");
		return;
	}

	vp = getVidMapRec(ScreenNum);
	mp = findMapping(vp, Base, Size);
	if (!mp) {
		xf86DrvMsg(ScreenNum, X_WARNING,
		  "xf86UnMapVidMem: cannot find region for [%p,0x%lx]\n",
		  Base, Size);
		return;
	}
	if (vp->mtrrEnabled && vidMemInfo.undoWC && mp)
		vidMemInfo.undoWC(ScreenNum, mp->mtrrInfo);

	vidMemInfo.unmapMem(ScreenNum, Base, Size);
	removeMapping(vp, mp);
}
예제 #2
0
파일: vidmem.c 프로젝트: 4eremuxa/xserver
void
xf86MakeNewMapping(int ScreenNum, int Flags, unsigned long Base, unsigned long Size, pointer Vbase)
{
	VidMapPtr vp;
	MappingPtr mp;

	vp = getVidMapRec(ScreenNum);
	mp = newMapping(vp);
	mp->size = Size;
	mp->virtBase = Vbase;
}
예제 #3
0
파일: vidmem.c 프로젝트: L3oV1nc3/VMGL
Bool
xf86CheckMTRR(int ScreenNum)
{
	VidMapPtr vp = getVidMapRec(ScreenNum);

	/*
	 * Check the "mtrr" option even when MTRR isn't supported to avoid
	 * warnings about unrecognised options.
	 */
	checkMtrrOption(vp);

	if (vp->mtrrEnabled && vidMemInfo.setWC)
		return TRUE;
		
	return FALSE;
}
예제 #4
0
파일: vidmem.c 프로젝트: L3oV1nc3/VMGL
pointer
xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size)
{
	pointer vbase = NULL;
	VidMapPtr vp;
	MappingPtr mp;

	if (((Flags & VIDMEM_FRAMEBUFFER) &&
	     (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))))
	    FatalError("Mapping memory with more than one type\n");
	    
	xf86InitVidMem();
	if (!vidMemInfo.initialised || !vidMemInfo.mapMem)
		return NULL;

	vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags);

	if (!vbase || vbase == (pointer)-1)
		return NULL;

	vp = getVidMapRec(ScreenNum);
	mp = newMapping(vp);
	mp->physBase = Base;
	mp->size = Size;
	mp->virtBase = vbase;
	mp->flags = Flags;

	/*
	 * Check the "mtrr" option even when MTRR isn't supported to avoid
	 * warnings about unrecognised options.
	 */
	checkMtrrOption(vp);

	if (vp->mtrrEnabled && vidMemInfo.setWC) {
		if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT))
			mp->mtrrInfo =
				vidMemInfo.setWC(ScreenNum, Base, Size, FALSE,
						 vp->mtrrFrom);
		else if (Flags & VIDMEM_FRAMEBUFFER)
			mp->mtrrInfo =
				vidMemInfo.setWC(ScreenNum, Base, Size, TRUE,
						 vp->mtrrFrom);
	}
	return vbase;
}