From: <da...@ke...> - 2007-07-06 07:53:04
|
shared-core/radeon_drv.h | 3 +++ shared-core/radeon_irq.c | 12 +++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) New commits: diff-tree 5b726b63906419ccb3de2e065f9bf7ae875ccdf3 (from 7f2a1cf2753c0c97b1290469a15322f7549f78ae) Author: Michel Dänzer <mi...@tu...> Date: Fri Jul 6 09:50:50 2007 +0200 radeon: Improve vblank counter. The frame counter seems to increase only at the end of vertical blank, so we need to add 1 while in vertical blank. diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h index bb69c10..418b6e7 100644 --- a/shared-core/radeon_drv.h +++ b/shared-core/radeon_drv.h @@ -512,6 +512,9 @@ extern int r300_do_cp_cmdbuf(drm_device_ #define RADEON_CRTC_CRNT_FRAME 0x0214 #define RADEON_CRTC2_CRNT_FRAME 0x0314 +#define RADEON_CRTC_STATUS 0x005c +#define RADEON_CRTC2_STATUS 0x03fc + #define RADEON_GEN_INT_CNTL 0x0040 # define RADEON_CRTC_VBLANK_MASK (1 << 0) # define RADEON_CRTC2_VBLANK_MASK (1 << 9) diff --git a/shared-core/radeon_irq.c b/shared-core/radeon_irq.c index d7f10f9..4ff8a5c 100644 --- a/shared-core/radeon_irq.c +++ b/shared-core/radeon_irq.c @@ -178,16 +178,18 @@ static int radeon_wait_irq(drm_device_t u32 radeon_get_vblank_counter(drm_device_t *dev, int crtc) { drm_radeon_private_t *dev_priv = dev->dev_private; - u32 crtc_cnt_reg; + u32 crtc_cnt_reg, crtc_status_reg; - if (crtc == 0) + if (crtc == 0) { crtc_cnt_reg = RADEON_CRTC_CRNT_FRAME; - else if (crtc == 1) + crtc_status_reg = RADEON_CRTC_STATUS; + } else if (crtc == 1) { crtc_cnt_reg = RADEON_CRTC2_CRNT_FRAME; - else + crtc_status_reg = RADEON_CRTC2_STATUS; + } else return 0; - return RADEON_READ(crtc_cnt_reg); + return RADEON_READ(crtc_cnt_reg) + (RADEON_READ(crtc_status_reg) & 1); } /* Needs the lock as it touches the ring. |