summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2007-12-07 09:41:47 +0100
committerMichel Dänzer <michel@tungstengraphics.com>2007-12-07 09:48:33 +0100
commitdf44f8380268c27d3978c4e91d736f093322b8b8 (patch)
tree2b2b388288e9ae57fcfbfca78ef9ac8dee0b176e
parent64ab1cdf343a9a69e7e9e64f0bba77c54a94e9d0 (diff)
radeon: Use gettimeofday instead of xf86getsecs.
-rw-r--r--src/radeon_driver.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/radeon_driver.c b/src/radeon_driver.c
index 3422b66..9bf46ef 100644
--- a/src/radeon_driver.c
+++ b/src/radeon_driver.c
@@ -90,7 +90,6 @@
/* X and server generic header files */
#include "xf86.h"
-#include "xf86_ansic.h" /* For xf86getsecs() */
#include "xf86_OSproc.h"
#include "xf86RAC.h"
#include "xf86RandR12.h"
@@ -805,8 +804,8 @@ static Bool RADEONProbePLLParameters(ScrnInfoPtr pScrn)
unsigned xclk, tmp, ref_div;
int hTotal, vTotal, num, denom, m, n;
float hz, prev_xtal, vclk, xtal, mpll, spll;
- long start_secs, start_usecs, stop_secs, stop_usecs, total_usecs;
- long to1_secs, to1_usecs, to2_secs, to2_usecs;
+ long total_usecs;
+ struct timeval start, stop, to1, to2;
unsigned int f1, f2, f3;
int tries = 0;
@@ -816,32 +815,32 @@ static Bool RADEONProbePLLParameters(ScrnInfoPtr pScrn)
if (++tries > 10)
goto failed;
- xf86getsecs(&to1_secs, &to1_usecs);
+ gettimeofday(&to1, NULL);
f1 = INREG(RADEON_CRTC_CRNT_FRAME);
for (;;) {
f2 = INREG(RADEON_CRTC_CRNT_FRAME);
if (f1 != f2)
break;
- xf86getsecs(&to2_secs, &to2_usecs);
- if ((to2_secs - to1_secs) > 1) {
+ gettimeofday(&to2, NULL);
+ if ((to2.tv_sec - to1.tv_sec) > 1) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Clock not counting...\n");
goto failed;
}
}
- xf86getsecs(&start_secs, &start_usecs);
+ gettimeofday(&start, NULL);
for(;;) {
f3 = INREG(RADEON_CRTC_CRNT_FRAME);
if (f3 != f2)
break;
- xf86getsecs(&to2_secs, &to2_usecs);
- if ((to2_secs - start_secs) > 1)
+ gettimeofday(&to2, NULL);
+ if ((to2.tv_sec - start.tv_sec) > 1)
goto failed;
}
- xf86getsecs(&stop_secs, &stop_usecs);
+ gettimeofday(&stop, NULL);
- if ((stop_secs - start_secs) != 0)
+ if ((stop.tv_sec - start.tv_sec) != 0)
goto again;
- total_usecs = abs(stop_usecs - start_usecs);
+ total_usecs = abs(stop.tv_usec - start.tv_usec);
if (total_usecs == 0)
goto again;
hz = 1000000.0/(float)total_usecs;