From bf32f4739c6ef7f41cde6cc409d42e00462402fb Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 19 Jul 2005 20:51:46 +0000 Subject: programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h //bugs.freedesktop.org/show_bug.cgi?id=3164> Add xf86DeallocateGARTMemory() function call (Austin Yuan) --- hw/xfree86/loader/xf86sym.c | 1 + hw/xfree86/os-support/linux/lnx_agp.c | 21 +++++++++++++++++++++ hw/xfree86/os-support/shared/agp_noop.c | 5 +++++ hw/xfree86/os-support/xf86_OSproc.h | 1 + 4 files changed, 28 insertions(+) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 70aec096b..a2d0af919 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -295,6 +295,7 @@ LOOKUP xfree86LookupTab[] = { SYMFUNC(xf86AcquireGART) SYMFUNC(xf86ReleaseGART) SYMFUNC(xf86AllocateGARTMemory) + SYMFUNC(xf86DeallocateGARTMemory) SYMFUNC(xf86BindGARTMemory) SYMFUNC(xf86UnbindGARTMemory) SYMFUNC(xf86EnableAGP) diff --git a/hw/xfree86/os-support/linux/lnx_agp.c b/hw/xfree86/os-support/linux/lnx_agp.c index 7a2b0606b..5fca1f7fa 100644 --- a/hw/xfree86/os-support/linux/lnx_agp.c +++ b/hw/xfree86/os-support/linux/lnx_agp.c @@ -248,6 +248,27 @@ xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, return alloc.key; } +Bool +xf86DeallocateGARTMemory(int screenNum, int key) +{ + if (!GARTInit(screenNum) || acquiredScreen != screenNum) + return FALSE; + + if (acquiredScreen != screenNum) { + xf86DrvMsg(screenNum, X_ERROR, + "xf86UnbindGARTMemory: AGP not acquired by this screen\n"); + return FALSE; + } + + if (ioctl(gartFd, AGPIOC_DEALLOCATE, (char *)&key) != 0) { + xf86DrvMsg(screenNum, X_WARNING,"xf86DeAllocateGARTMemory: " + "deallocation gart memory with key %d failed\n\t(%s)\n", + key, strerror(errno)); + return FALSE; + } + + return TRUE; +} /* Bind GART memory with "key" at "offset" */ Bool diff --git a/hw/xfree86/os-support/shared/agp_noop.c b/hw/xfree86/os-support/shared/agp_noop.c index dc176fec9..c13b29c38 100644 --- a/hw/xfree86/os-support/shared/agp_noop.c +++ b/hw/xfree86/os-support/shared/agp_noop.c @@ -81,6 +81,11 @@ xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, return -1; } +Bool +xf86DeallocateGARTMemory(int screenNum, int key) +{ + return FALSE; +} Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset) diff --git a/hw/xfree86/os-support/xf86_OSproc.h b/hw/xfree86/os-support/xf86_OSproc.h index 391baebc6..555e7eef1 100644 --- a/hw/xfree86/os-support/xf86_OSproc.h +++ b/hw/xfree86/os-support/xf86_OSproc.h @@ -198,6 +198,7 @@ extern Bool xf86AcquireGART(int screenNum); extern Bool xf86ReleaseGART(int screenNum); extern int xf86AllocateGARTMemory(int screenNum, unsigned long size, int type, unsigned long *physical); +extern Bool xf86DeallocateGARTMemory(int screenNum, int key); extern Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset); extern Bool xf86UnbindGARTMemory(int screenNum, int key); extern Bool xf86EnableAGP(int screenNum, CARD32 mode); -- cgit v1.2.3