aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2012-02-23 17:53:37 -0500
committerDave Airlie <airlied@redhat.com>2012-02-27 09:46:13 -0500
commit3ae19b750bdc09ce233e1504348320141593ffda (patch)
tree91698edc128672983f92e0c066f0b18ae1d72f72 /drivers/gpu/drm/radeon
parente5bcf23443740f741df8e5461ccdad0f10d1a75b (diff)
drm/radeon/kms: add wait_for_vblank asic callback
Required for future functionality. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Reviewed-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c19
-rw-r--r--drivers/gpu/drm/radeon/evergreen_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/r100.c34
-rw-r--r--drivers/gpu/drm/radeon/r500_reg.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c17
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h4
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h2
-rw-r--r--drivers/gpu/drm/radeon/rs600.c19
9 files changed, 100 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 1a816ea51226..c8dae3f9fa09 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -99,6 +99,25 @@ void evergreen_fix_pci_max_read_req_size(struct radeon_device *rdev)
99 } 99 }
100} 100}
101 101
102void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc)
103{
104 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
105 int i;
106
107 if (RREG32(EVERGREEN_CRTC_CONTROL + radeon_crtc->crtc_offset) & EVERGREEN_CRTC_MASTER_EN) {
108 for (i = 0; i < rdev->usec_timeout; i++) {
109 if (!(RREG32(EVERGREEN_CRTC_STATUS + radeon_crtc->crtc_offset) & EVERGREEN_CRTC_V_BLANK))
110 break;
111 udelay(1);
112 }
113 for (i = 0; i < rdev->usec_timeout; i++) {
114 if (RREG32(EVERGREEN_CRTC_STATUS + radeon_crtc->crtc_offset) & EVERGREEN_CRTC_V_BLANK)
115 break;
116 udelay(1);
117 }
118 }
119}
120
102void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) 121void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc)
103{ 122{
104 /* enable the pflip int */ 123 /* enable the pflip int */
diff --git a/drivers/gpu/drm/radeon/evergreen_reg.h b/drivers/gpu/drm/radeon/evergreen_reg.h
index 4215de95477e..96c10b3991aa 100644
--- a/drivers/gpu/drm/radeon/evergreen_reg.h
+++ b/drivers/gpu/drm/radeon/evergreen_reg.h
@@ -219,6 +219,7 @@
219# define EVERGREEN_CRTC_MASTER_EN (1 << 0) 219# define EVERGREEN_CRTC_MASTER_EN (1 << 0)
220# define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24) 220# define EVERGREEN_CRTC_DISP_READ_REQUEST_DISABLE (1 << 24)
221#define EVERGREEN_CRTC_STATUS 0x6e8c 221#define EVERGREEN_CRTC_STATUS 0x6e8c
222# define EVERGREEN_CRTC_V_BLANK (1 << 0)
222#define EVERGREEN_CRTC_STATUS_POSITION 0x6e90 223#define EVERGREEN_CRTC_STATUS_POSITION 0x6e90
223#define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8 224#define EVERGREEN_MASTER_UPDATE_MODE 0x6ef8
224#define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4 225#define EVERGREEN_CRTC_UPDATE_LOCK 0x6ed4
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 99bb00649357..65fe8e092a18 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -65,6 +65,40 @@ MODULE_FIRMWARE(FIRMWARE_R520);
65 65
66#include "r100_track.h" 66#include "r100_track.h"
67 67
68void r100_wait_for_vblank(struct radeon_device *rdev, int crtc)
69{
70 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
71 int i;
72
73 if (radeon_crtc->crtc_id == 0) {
74 if (RREG32(RADEON_CRTC_GEN_CNTL) & RADEON_CRTC_EN) {
75 for (i = 0; i < rdev->usec_timeout; i++) {
76 if (!(RREG32(RADEON_CRTC_STATUS) & RADEON_CRTC_VBLANK_CUR))
77 break;
78 udelay(1);
79 }
80 for (i = 0; i < rdev->usec_timeout; i++) {
81 if (RREG32(RADEON_CRTC_STATUS) & RADEON_CRTC_VBLANK_CUR)
82 break;
83 udelay(1);
84 }
85 }
86 } else {
87 if (RREG32(RADEON_CRTC2_GEN_CNTL) & RADEON_CRTC2_EN) {
88 for (i = 0; i < rdev->usec_timeout; i++) {
89 if (!(RREG32(RADEON_CRTC2_STATUS) & RADEON_CRTC2_VBLANK_CUR))
90 break;
91 udelay(1);
92 }
93 for (i = 0; i < rdev->usec_timeout; i++) {
94 if (RREG32(RADEON_CRTC2_STATUS) & RADEON_CRTC2_VBLANK_CUR)
95 break;
96 udelay(1);
97 }
98 }
99 }
100}
101
68/* This files gather functions specifics to: 102/* This files gather functions specifics to:
69 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280 103 * r100,rv100,rs100,rv200,rs200,r200,rv250,rs300,rv280
70 */ 104 */
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h
index 3bd8f1b1c606..ec576aaafb73 100644
--- a/drivers/gpu/drm/radeon/r500_reg.h
+++ b/drivers/gpu/drm/radeon/r500_reg.h
@@ -351,6 +351,8 @@
351#define AVIVO_D1CRTC_BLANK_CONTROL 0x6084 351#define AVIVO_D1CRTC_BLANK_CONTROL 0x6084
352#define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088 352#define AVIVO_D1CRTC_INTERLACE_CONTROL 0x6088
353#define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c 353#define AVIVO_D1CRTC_INTERLACE_STATUS 0x608c
354#define AVIVO_D1CRTC_STATUS 0x609c
355# define AVIVO_D1CRTC_V_BLANK (1 << 0)
354#define AVIVO_D1CRTC_STATUS_POSITION 0x60a0 356#define AVIVO_D1CRTC_STATUS_POSITION 0x60a0
355#define AVIVO_D1CRTC_FRAME_COUNT 0x60a4 357#define AVIVO_D1CRTC_FRAME_COUNT 0x60a4
356#define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4 358#define AVIVO_D1CRTC_STEREO_CONTROL 0x60c4
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 884e0d4b114f..e19a430d3443 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -1204,6 +1204,8 @@ struct radeon_asic {
1204 void (*pre_page_flip)(struct radeon_device *rdev, int crtc); 1204 void (*pre_page_flip)(struct radeon_device *rdev, int crtc);
1205 u32 (*page_flip)(struct radeon_device *rdev, int crtc, u64 crtc_base); 1205 u32 (*page_flip)(struct radeon_device *rdev, int crtc, u64 crtc_base);
1206 void (*post_page_flip)(struct radeon_device *rdev, int crtc); 1206 void (*post_page_flip)(struct radeon_device *rdev, int crtc);
1207 /* wait for vblank */
1208 void (*wait_for_vblank)(struct radeon_device *rdev, int crtc);
1207}; 1209};
1208 1210
1209/* 1211/*
@@ -1692,6 +1694,7 @@ void radeon_ring_write(struct radeon_ring *ring, uint32_t v);
1692#define radeon_pre_page_flip(rdev, crtc) rdev->asic->pre_page_flip((rdev), (crtc)) 1694#define radeon_pre_page_flip(rdev, crtc) rdev->asic->pre_page_flip((rdev), (crtc))
1693#define radeon_page_flip(rdev, crtc, base) rdev->asic->page_flip((rdev), (crtc), (base)) 1695#define radeon_page_flip(rdev, crtc, base) rdev->asic->page_flip((rdev), (crtc), (base))
1694#define radeon_post_page_flip(rdev, crtc) rdev->asic->post_page_flip((rdev), (crtc)) 1696#define radeon_post_page_flip(rdev, crtc) rdev->asic->post_page_flip((rdev), (crtc))
1697#define radeon_wait_for_vblank(rdev, crtc) rdev->asic->wait_for_vblank((rdev), (crtc))
1695 1698
1696/* Common functions */ 1699/* Common functions */
1697/* AGP */ 1700/* AGP */
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index 36a6192ce862..c66360859961 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -178,6 +178,7 @@ static struct radeon_asic r100_asic = {
178 .pre_page_flip = &r100_pre_page_flip, 178 .pre_page_flip = &r100_pre_page_flip,
179 .page_flip = &r100_page_flip, 179 .page_flip = &r100_page_flip,
180 .post_page_flip = &r100_post_page_flip, 180 .post_page_flip = &r100_post_page_flip,
181 .wait_for_vblank = &r100_wait_for_vblank,
181}; 182};
182 183
183static struct radeon_asic r200_asic = { 184static struct radeon_asic r200_asic = {
@@ -229,6 +230,7 @@ static struct radeon_asic r200_asic = {
229 .pre_page_flip = &r100_pre_page_flip, 230 .pre_page_flip = &r100_pre_page_flip,
230 .page_flip = &r100_page_flip, 231 .page_flip = &r100_page_flip,
231 .post_page_flip = &r100_post_page_flip, 232 .post_page_flip = &r100_post_page_flip,
233 .wait_for_vblank = &r100_wait_for_vblank,
232}; 234};
233 235
234static struct radeon_asic r300_asic = { 236static struct radeon_asic r300_asic = {
@@ -281,6 +283,7 @@ static struct radeon_asic r300_asic = {
281 .pre_page_flip = &r100_pre_page_flip, 283 .pre_page_flip = &r100_pre_page_flip,
282 .page_flip = &r100_page_flip, 284 .page_flip = &r100_page_flip,
283 .post_page_flip = &r100_post_page_flip, 285 .post_page_flip = &r100_post_page_flip,
286 .wait_for_vblank = &r100_wait_for_vblank,
284}; 287};
285 288
286static struct radeon_asic r300_asic_pcie = { 289static struct radeon_asic r300_asic_pcie = {
@@ -332,6 +335,7 @@ static struct radeon_asic r300_asic_pcie = {
332 .pre_page_flip = &r100_pre_page_flip, 335 .pre_page_flip = &r100_pre_page_flip,
333 .page_flip = &r100_page_flip, 336 .page_flip = &r100_page_flip,
334 .post_page_flip = &r100_post_page_flip, 337 .post_page_flip = &r100_post_page_flip,
338 .wait_for_vblank = &r100_wait_for_vblank,
335}; 339};
336 340
337static struct radeon_asic r420_asic = { 341static struct radeon_asic r420_asic = {
@@ -384,6 +388,7 @@ static struct radeon_asic r420_asic = {
384 .pre_page_flip = &r100_pre_page_flip, 388 .pre_page_flip = &r100_pre_page_flip,
385 .page_flip = &r100_page_flip, 389 .page_flip = &r100_page_flip,
386 .post_page_flip = &r100_post_page_flip, 390 .post_page_flip = &r100_post_page_flip,
391 .wait_for_vblank = &r100_wait_for_vblank,
387}; 392};
388 393
389static struct radeon_asic rs400_asic = { 394static struct radeon_asic rs400_asic = {
@@ -436,6 +441,7 @@ static struct radeon_asic rs400_asic = {
436 .pre_page_flip = &r100_pre_page_flip, 441 .pre_page_flip = &r100_pre_page_flip,
437 .page_flip = &r100_page_flip, 442 .page_flip = &r100_page_flip,
438 .post_page_flip = &r100_post_page_flip, 443 .post_page_flip = &r100_post_page_flip,
444 .wait_for_vblank = &r100_wait_for_vblank,
439}; 445};
440 446
441static struct radeon_asic rs600_asic = { 447static struct radeon_asic rs600_asic = {
@@ -488,6 +494,7 @@ static struct radeon_asic rs600_asic = {
488 .pre_page_flip = &rs600_pre_page_flip, 494 .pre_page_flip = &rs600_pre_page_flip,
489 .page_flip = &rs600_page_flip, 495 .page_flip = &rs600_page_flip,
490 .post_page_flip = &rs600_post_page_flip, 496 .post_page_flip = &rs600_post_page_flip,
497 .wait_for_vblank = &avivo_wait_for_vblank,
491}; 498};
492 499
493static struct radeon_asic rs690_asic = { 500static struct radeon_asic rs690_asic = {
@@ -540,6 +547,7 @@ static struct radeon_asic rs690_asic = {
540 .pre_page_flip = &rs600_pre_page_flip, 547 .pre_page_flip = &rs600_pre_page_flip,
541 .page_flip = &rs600_page_flip, 548 .page_flip = &rs600_page_flip,
542 .post_page_flip = &rs600_post_page_flip, 549 .post_page_flip = &rs600_post_page_flip,
550 .wait_for_vblank = &avivo_wait_for_vblank,
543}; 551};
544 552
545static struct radeon_asic rv515_asic = { 553static struct radeon_asic rv515_asic = {
@@ -592,6 +600,7 @@ static struct radeon_asic rv515_asic = {
592 .pre_page_flip = &rs600_pre_page_flip, 600 .pre_page_flip = &rs600_pre_page_flip,
593 .page_flip = &rs600_page_flip, 601 .page_flip = &rs600_page_flip,
594 .post_page_flip = &rs600_post_page_flip, 602 .post_page_flip = &rs600_post_page_flip,
603 .wait_for_vblank = &avivo_wait_for_vblank,
595}; 604};
596 605
597static struct radeon_asic r520_asic = { 606static struct radeon_asic r520_asic = {
@@ -644,6 +653,7 @@ static struct radeon_asic r520_asic = {
644 .pre_page_flip = &rs600_pre_page_flip, 653 .pre_page_flip = &rs600_pre_page_flip,
645 .page_flip = &rs600_page_flip, 654 .page_flip = &rs600_page_flip,
646 .post_page_flip = &rs600_post_page_flip, 655 .post_page_flip = &rs600_post_page_flip,
656 .wait_for_vblank = &avivo_wait_for_vblank,
647}; 657};
648 658
649static struct radeon_asic r600_asic = { 659static struct radeon_asic r600_asic = {
@@ -695,6 +705,7 @@ static struct radeon_asic r600_asic = {
695 .pre_page_flip = &rs600_pre_page_flip, 705 .pre_page_flip = &rs600_pre_page_flip,
696 .page_flip = &rs600_page_flip, 706 .page_flip = &rs600_page_flip,
697 .post_page_flip = &rs600_post_page_flip, 707 .post_page_flip = &rs600_post_page_flip,
708 .wait_for_vblank = &avivo_wait_for_vblank,
698}; 709};
699 710
700static struct radeon_asic rs780_asic = { 711static struct radeon_asic rs780_asic = {
@@ -746,6 +757,7 @@ static struct radeon_asic rs780_asic = {
746 .pre_page_flip = &rs600_pre_page_flip, 757 .pre_page_flip = &rs600_pre_page_flip,
747 .page_flip = &rs600_page_flip, 758 .page_flip = &rs600_page_flip,
748 .post_page_flip = &rs600_post_page_flip, 759 .post_page_flip = &rs600_post_page_flip,
760 .wait_for_vblank = &avivo_wait_for_vblank,
749}; 761};
750 762
751static struct radeon_asic rv770_asic = { 763static struct radeon_asic rv770_asic = {
@@ -797,6 +809,7 @@ static struct radeon_asic rv770_asic = {
797 .pre_page_flip = &rs600_pre_page_flip, 809 .pre_page_flip = &rs600_pre_page_flip,
798 .page_flip = &rv770_page_flip, 810 .page_flip = &rv770_page_flip,
799 .post_page_flip = &rs600_post_page_flip, 811 .post_page_flip = &rs600_post_page_flip,
812 .wait_for_vblank = &avivo_wait_for_vblank,
800}; 813};
801 814
802static struct radeon_asic evergreen_asic = { 815static struct radeon_asic evergreen_asic = {
@@ -848,6 +861,7 @@ static struct radeon_asic evergreen_asic = {
848 .pre_page_flip = &evergreen_pre_page_flip, 861 .pre_page_flip = &evergreen_pre_page_flip,
849 .page_flip = &evergreen_page_flip, 862 .page_flip = &evergreen_page_flip,
850 .post_page_flip = &evergreen_post_page_flip, 863 .post_page_flip = &evergreen_post_page_flip,
864 .wait_for_vblank = &dce4_wait_for_vblank,
851}; 865};
852 866
853static struct radeon_asic sumo_asic = { 867static struct radeon_asic sumo_asic = {
@@ -899,6 +913,7 @@ static struct radeon_asic sumo_asic = {
899 .pre_page_flip = &evergreen_pre_page_flip, 913 .pre_page_flip = &evergreen_pre_page_flip,
900 .page_flip = &evergreen_page_flip, 914 .page_flip = &evergreen_page_flip,
901 .post_page_flip = &evergreen_post_page_flip, 915 .post_page_flip = &evergreen_post_page_flip,
916 .wait_for_vblank = &dce4_wait_for_vblank,
902}; 917};
903 918
904static struct radeon_asic btc_asic = { 919static struct radeon_asic btc_asic = {
@@ -950,6 +965,7 @@ static struct radeon_asic btc_asic = {
950 .pre_page_flip = &evergreen_pre_page_flip, 965 .pre_page_flip = &evergreen_pre_page_flip,
951 .page_flip = &evergreen_page_flip, 966 .page_flip = &evergreen_page_flip,
952 .post_page_flip = &evergreen_post_page_flip, 967 .post_page_flip = &evergreen_post_page_flip,
968 .wait_for_vblank = &dce4_wait_for_vblank,
953}; 969};
954 970
955static const struct radeon_vm_funcs cayman_vm_funcs = { 971static const struct radeon_vm_funcs cayman_vm_funcs = {
@@ -1024,6 +1040,7 @@ static struct radeon_asic cayman_asic = {
1024 .pre_page_flip = &evergreen_pre_page_flip, 1040 .pre_page_flip = &evergreen_pre_page_flip,
1025 .page_flip = &evergreen_page_flip, 1041 .page_flip = &evergreen_page_flip,
1026 .post_page_flip = &evergreen_post_page_flip, 1042 .post_page_flip = &evergreen_post_page_flip,
1043 .wait_for_vblank = &dce4_wait_for_vblank,
1027}; 1044};
1028 1045
1029int radeon_asic_init(struct radeon_device *rdev) 1046int radeon_asic_init(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 6304aef0d9b2..d9df84f9ebb6 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -139,6 +139,7 @@ extern void r100_pm_get_dynpm_state(struct radeon_device *rdev);
139extern void r100_pre_page_flip(struct radeon_device *rdev, int crtc); 139extern void r100_pre_page_flip(struct radeon_device *rdev, int crtc);
140extern u32 r100_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base); 140extern u32 r100_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base);
141extern void r100_post_page_flip(struct radeon_device *rdev, int crtc); 141extern void r100_post_page_flip(struct radeon_device *rdev, int crtc);
142extern void r100_wait_for_vblank(struct radeon_device *rdev, int crtc);
142 143
143/* 144/*
144 * r200,rv250,rs300,rv280 145 * r200,rv250,rs300,rv280
@@ -236,7 +237,7 @@ extern void rs600_pre_page_flip(struct radeon_device *rdev, int crtc);
236extern u32 rs600_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base); 237extern u32 rs600_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base);
237extern void rs600_post_page_flip(struct radeon_device *rdev, int crtc); 238extern void rs600_post_page_flip(struct radeon_device *rdev, int crtc);
238void rs600_set_safe_registers(struct radeon_device *rdev); 239void rs600_set_safe_registers(struct radeon_device *rdev);
239 240extern void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc);
240 241
241/* 242/*
242 * rs690,rs740 243 * rs690,rs740
@@ -423,6 +424,7 @@ extern void sumo_pm_init_profile(struct radeon_device *rdev);
423extern void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc); 424extern void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc);
424extern u32 evergreen_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base); 425extern u32 evergreen_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base);
425extern void evergreen_post_page_flip(struct radeon_device *rdev, int crtc); 426extern void evergreen_post_page_flip(struct radeon_device *rdev, int crtc);
427extern void dce4_wait_for_vblank(struct radeon_device *rdev, int crtc);
426void evergreen_disable_interrupt_state(struct radeon_device *rdev); 428void evergreen_disable_interrupt_state(struct radeon_device *rdev);
427int evergreen_blit_init(struct radeon_device *rdev); 429int evergreen_blit_init(struct radeon_device *rdev);
428 430
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index b4ce86455707..509863411285 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -539,9 +539,11 @@
539 539
540#define RADEON_CRTC2_PITCH 0x032c 540#define RADEON_CRTC2_PITCH 0x032c
541#define RADEON_CRTC_STATUS 0x005c 541#define RADEON_CRTC_STATUS 0x005c
542# define RADEON_CRTC_VBLANK_CUR (1 << 0)
542# define RADEON_CRTC_VBLANK_SAVE (1 << 1) 543# define RADEON_CRTC_VBLANK_SAVE (1 << 1)
543# define RADEON_CRTC_VBLANK_SAVE_CLEAR (1 << 1) 544# define RADEON_CRTC_VBLANK_SAVE_CLEAR (1 << 1)
544#define RADEON_CRTC2_STATUS 0x03fc 545#define RADEON_CRTC2_STATUS 0x03fc
546# define RADEON_CRTC2_VBLANK_CUR (1 << 0)
545# define RADEON_CRTC2_VBLANK_SAVE (1 << 1) 547# define RADEON_CRTC2_VBLANK_SAVE (1 << 1)
546# define RADEON_CRTC2_VBLANK_SAVE_CLEAR (1 << 1) 548# define RADEON_CRTC2_VBLANK_SAVE_CLEAR (1 << 1)
547#define RADEON_CRTC_V_SYNC_STRT_WID 0x020c 549#define RADEON_CRTC_V_SYNC_STRT_WID 0x020c
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index ec46eb45e34c..fdb56b44dcd0 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -46,6 +46,25 @@
46void rs600_gpu_init(struct radeon_device *rdev); 46void rs600_gpu_init(struct radeon_device *rdev);
47int rs600_mc_wait_for_idle(struct radeon_device *rdev); 47int rs600_mc_wait_for_idle(struct radeon_device *rdev);
48 48
49void avivo_wait_for_vblank(struct radeon_device *rdev, int crtc)
50{
51 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
52 int i;
53
54 if (RREG32(AVIVO_D1CRTC_CONTROL + radeon_crtc->crtc_offset) & AVIVO_CRTC_EN) {
55 for (i = 0; i < rdev->usec_timeout; i++) {
56 if (!(RREG32(AVIVO_D1CRTC_STATUS + radeon_crtc->crtc_offset) & AVIVO_D1CRTC_V_BLANK))
57 break;
58 udelay(1);
59 }
60 for (i = 0; i < rdev->usec_timeout; i++) {
61 if (RREG32(AVIVO_D1CRTC_STATUS + radeon_crtc->crtc_offset) & AVIVO_D1CRTC_V_BLANK)
62 break;
63 udelay(1);
64 }
65 }
66}
67
49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc) 68void rs600_pre_page_flip(struct radeon_device *rdev, int crtc)
50{ 69{
51 /* enable the pflip int */ 70 /* enable the pflip int */