The attached patch is a work-around for the busy-wait in the
XDGASetViewport function in the "nv" driver.
Eliminating the busy-wait can make a significant difference when
for example playing video using DGA. (In my test setup, the
previous loop often required 20-40 % of wasted cpu cycles.)
The patch is ugly and made as a proof-of-concept. It uses the
/dev/rtc registers and is Linux specific.
I have some ideas on long-term solutions, but they all require
external (kernel) support of some kind.
Any thoughts?
Fredrik
--- xc.old/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c 2001-01-22
22:32:36.000000000 +0100
+++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c 2002-09-22 14:23:43.000000000
++0200
@@ -224,6 +224,9 @@
return pNv->DGAViewportStatus;
}
+#include <linux/rtc.h>
+#include <asm/ioctl.h>
+
static void
NV_SetViewport(
ScrnInfoPtr pScrn,
@@ -232,11 +235,23 @@
){
NVPtr pNv = NVPTR(pScrn);
- NVAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
+ unsigned long rtc;
+ int fd;
- while(pNv->riva.PCIO[0x3da] & 0x08);
- while(!(pNv->riva.PCIO[0x3da] & 0x08));
+ fd = open("/dev/rtc", O_RDONLY);
+ ioctl(fd, RTC_IRQP_SET, 8192);
+ ioctl(fd, RTC_PIE_ON, 0);
+
+ NVAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
+ while(pNv->riva.PCIO[0x3da] & 0x08)
+ read(fd, &rtc, sizeof(unsigned long));
+ while(!(pNv->riva.PCIO[0x3da] & 0x08))
+ read(fd, &rtc, sizeof(unsigned long));
+
+ ioctl(fd, RTC_PIE_OFF, 0);
+ close(fd);
+
pNv->DGAViewportStatus = 0;
}
_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert