summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shared-core/radeon_drv.h3
-rw-r--r--shared-core/radeon_irq.c12
2 files changed, 10 insertions, 5 deletions
diff --git a/shared-core/radeon_drv.h b/shared-core/radeon_drv.h
index bb69c106..418b6e78 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_t *dev, DRMFILE filp,
#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 d7f10f93..4ff8a5c3 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 * dev, int swi_nr)
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.