aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_irq.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2013-10-04 07:53:36 -0400
committerDave Airlie <airlied@redhat.com>2013-10-09 01:55:31 -0400
commit5380e9293b865d88de04de6e5324726d8c5b53c9 (patch)
tree5d28c8a6a1cf43a3b2a76f16bd9c59a7fd424c39 /drivers/gpu/drm/drm_irq.c
parentbf507d90cf0eecf5495f66f21dbb66e35e9131ae (diff)
drm: Collect per-crtc vblank stuff to a struct
drm_vblank_init() is too ugly. Make it a bit easier on the eye by collecting all the per-crtc vblank counters, timestamps etc. to a structure and just allocate an array of those. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_irq.c')
-rw-r--r--drivers/gpu/drm/drm_irq.c138
1 files changed, 47 insertions, 91 deletions
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 49680a8ab96a..dea859f20035 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -43,9 +43,8 @@
43#include <linux/export.h> 43#include <linux/export.h>
44 44
45/* Access macro for slots in vblank timestamp ringbuffer. */ 45/* Access macro for slots in vblank timestamp ringbuffer. */
46#define vblanktimestamp(dev, crtc, count) ( \ 46#define vblanktimestamp(dev, crtc, count) \
47 (dev)->_vblank_time[(crtc) * DRM_VBLANKTIME_RBSIZE + \ 47 ((dev)->vblank[crtc].time[(count) % DRM_VBLANKTIME_RBSIZE])
48 ((count) % DRM_VBLANKTIME_RBSIZE)])
49 48
50/* Retry timestamp calculation up to 3 times to satisfy 49/* Retry timestamp calculation up to 3 times to satisfy
51 * drm_timestamp_precision before giving up. 50 * drm_timestamp_precision before giving up.
@@ -89,8 +88,7 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
89 */ 88 */
90static void clear_vblank_timestamps(struct drm_device *dev, int crtc) 89static void clear_vblank_timestamps(struct drm_device *dev, int crtc)
91{ 90{
92 memset(&dev->_vblank_time[crtc * DRM_VBLANKTIME_RBSIZE], 0, 91 memset(dev->vblank[crtc].time, 0, sizeof(dev->vblank[crtc].time));
93 DRM_VBLANKTIME_RBSIZE * sizeof(struct timeval));
94} 92}
95 93
96/* 94/*
@@ -115,7 +113,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
115 spin_lock_irqsave(&dev->vblank_time_lock, irqflags); 113 spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
116 114
117 dev->driver->disable_vblank(dev, crtc); 115 dev->driver->disable_vblank(dev, crtc);
118 dev->vblank_enabled[crtc] = false; 116 dev->vblank[crtc].enabled = false;
119 117
120 /* No further vblank irq's will be processed after 118 /* No further vblank irq's will be processed after
121 * this point. Get current hardware vblank count and 119 * this point. Get current hardware vblank count and
@@ -130,9 +128,9 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
130 * delayed gpu counter increment. 128 * delayed gpu counter increment.
131 */ 129 */
132 do { 130 do {
133 dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc); 131 dev->vblank[crtc].last = dev->driver->get_vblank_counter(dev, crtc);
134 vblrc = drm_get_last_vbltimestamp(dev, crtc, &tvblank, 0); 132 vblrc = drm_get_last_vbltimestamp(dev, crtc, &tvblank, 0);
135 } while (dev->last_vblank[crtc] != dev->driver->get_vblank_counter(dev, crtc) && (--count) && vblrc); 133 } while (dev->vblank[crtc].last != dev->driver->get_vblank_counter(dev, crtc) && (--count) && vblrc);
136 134
137 if (!count) 135 if (!count)
138 vblrc = 0; 136 vblrc = 0;
@@ -140,7 +138,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
140 /* Compute time difference to stored timestamp of last vblank 138 /* Compute time difference to stored timestamp of last vblank
141 * as updated by last invocation of drm_handle_vblank() in vblank irq. 139 * as updated by last invocation of drm_handle_vblank() in vblank irq.
142 */ 140 */
143 vblcount = atomic_read(&dev->_vblank_count[crtc]); 141 vblcount = atomic_read(&dev->vblank[crtc].count);
144 diff_ns = timeval_to_ns(&tvblank) - 142 diff_ns = timeval_to_ns(&tvblank) -
145 timeval_to_ns(&vblanktimestamp(dev, crtc, vblcount)); 143 timeval_to_ns(&vblanktimestamp(dev, crtc, vblcount));
146 144
@@ -157,7 +155,7 @@ static void vblank_disable_and_save(struct drm_device *dev, int crtc)
157 * hope for the best. 155 * hope for the best.
158 */ 156 */
159 if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) { 157 if ((vblrc > 0) && (abs64(diff_ns) > 1000000)) {
160 atomic_inc(&dev->_vblank_count[crtc]); 158 atomic_inc(&dev->vblank[crtc].count);
161 smp_mb__after_atomic_inc(); 159 smp_mb__after_atomic_inc();
162 } 160 }
163 161
@@ -178,8 +176,8 @@ static void vblank_disable_fn(unsigned long arg)
178 176
179 for (i = 0; i < dev->num_crtcs; i++) { 177 for (i = 0; i < dev->num_crtcs; i++) {
180 spin_lock_irqsave(&dev->vbl_lock, irqflags); 178 spin_lock_irqsave(&dev->vbl_lock, irqflags);
181 if (atomic_read(&dev->vblank_refcount[i]) == 0 && 179 if (atomic_read(&dev->vblank[i].refcount) == 0 &&
182 dev->vblank_enabled[i]) { 180 dev->vblank[i].enabled) {
183 DRM_DEBUG("disabling vblank on crtc %d\n", i); 181 DRM_DEBUG("disabling vblank on crtc %d\n", i);
184 vblank_disable_and_save(dev, i); 182 vblank_disable_and_save(dev, i);
185 } 183 }
@@ -197,14 +195,7 @@ void drm_vblank_cleanup(struct drm_device *dev)
197 195
198 vblank_disable_fn((unsigned long)dev); 196 vblank_disable_fn((unsigned long)dev);
199 197
200 kfree(dev->vbl_queue); 198 kfree(dev->vblank);
201 kfree(dev->_vblank_count);
202 kfree(dev->vblank_refcount);
203 kfree(dev->vblank_enabled);
204 kfree(dev->last_vblank);
205 kfree(dev->last_vblank_wait);
206 kfree(dev->vblank_inmodeset);
207 kfree(dev->_vblank_time);
208 199
209 dev->num_crtcs = 0; 200 dev->num_crtcs = 0;
210} 201}
@@ -221,40 +212,12 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
221 212
222 dev->num_crtcs = num_crtcs; 213 dev->num_crtcs = num_crtcs;
223 214
224 dev->vbl_queue = kmalloc(sizeof(wait_queue_head_t) * num_crtcs, 215 dev->vblank = kcalloc(num_crtcs, sizeof(*dev->vblank), GFP_KERNEL);
225 GFP_KERNEL); 216 if (!dev->vblank)
226 if (!dev->vbl_queue)
227 goto err; 217 goto err;
228 218
229 dev->_vblank_count = kmalloc(sizeof(atomic_t) * num_crtcs, GFP_KERNEL); 219 for (i = 0; i < num_crtcs; i++)
230 if (!dev->_vblank_count) 220 init_waitqueue_head(&dev->vblank[i].queue);
231 goto err;
232
233 dev->vblank_refcount = kmalloc(sizeof(atomic_t) * num_crtcs,
234 GFP_KERNEL);
235 if (!dev->vblank_refcount)
236 goto err;
237
238 dev->vblank_enabled = kcalloc(num_crtcs, sizeof(bool), GFP_KERNEL);
239 if (!dev->vblank_enabled)
240 goto err;
241
242 dev->last_vblank = kcalloc(num_crtcs, sizeof(u32), GFP_KERNEL);
243 if (!dev->last_vblank)
244 goto err;
245
246 dev->last_vblank_wait = kcalloc(num_crtcs, sizeof(u32), GFP_KERNEL);
247 if (!dev->last_vblank_wait)
248 goto err;
249
250 dev->vblank_inmodeset = kcalloc(num_crtcs, sizeof(int), GFP_KERNEL);
251 if (!dev->vblank_inmodeset)
252 goto err;
253
254 dev->_vblank_time = kcalloc(num_crtcs * DRM_VBLANKTIME_RBSIZE,
255 sizeof(struct timeval), GFP_KERNEL);
256 if (!dev->_vblank_time)
257 goto err;
258 221
259 DRM_INFO("Supports vblank timestamp caching Rev 1 (10.10.2010).\n"); 222 DRM_INFO("Supports vblank timestamp caching Rev 1 (10.10.2010).\n");
260 223
@@ -264,13 +227,6 @@ int drm_vblank_init(struct drm_device *dev, int num_crtcs)
264 else 227 else
265 DRM_INFO("No driver support for vblank timestamp query.\n"); 228 DRM_INFO("No driver support for vblank timestamp query.\n");
266 229
267 /* Zero per-crtc vblank stuff */
268 for (i = 0; i < num_crtcs; i++) {
269 init_waitqueue_head(&dev->vbl_queue[i]);
270 atomic_set(&dev->_vblank_count[i], 0);
271 atomic_set(&dev->vblank_refcount[i], 0);
272 }
273
274 dev->vblank_disable_allowed = false; 230 dev->vblank_disable_allowed = false;
275 231
276 return 0; 232 return 0;
@@ -411,9 +367,9 @@ int drm_irq_uninstall(struct drm_device *dev)
411 if (dev->num_crtcs) { 367 if (dev->num_crtcs) {
412 spin_lock_irqsave(&dev->vbl_lock, irqflags); 368 spin_lock_irqsave(&dev->vbl_lock, irqflags);
413 for (i = 0; i < dev->num_crtcs; i++) { 369 for (i = 0; i < dev->num_crtcs; i++) {
414 DRM_WAKEUP(&dev->vbl_queue[i]); 370 DRM_WAKEUP(&dev->vblank[i].queue);
415 dev->vblank_enabled[i] = false; 371 dev->vblank[i].enabled = false;
416 dev->last_vblank[i] = 372 dev->vblank[i].last =
417 dev->driver->get_vblank_counter(dev, i); 373 dev->driver->get_vblank_counter(dev, i);
418 } 374 }
419 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 375 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
@@ -796,7 +752,7 @@ EXPORT_SYMBOL(drm_get_last_vbltimestamp);
796 */ 752 */
797u32 drm_vblank_count(struct drm_device *dev, int crtc) 753u32 drm_vblank_count(struct drm_device *dev, int crtc)
798{ 754{
799 return atomic_read(&dev->_vblank_count[crtc]); 755 return atomic_read(&dev->vblank[crtc].count);
800} 756}
801EXPORT_SYMBOL(drm_vblank_count); 757EXPORT_SYMBOL(drm_vblank_count);
802 758
@@ -825,10 +781,10 @@ u32 drm_vblank_count_and_time(struct drm_device *dev, int crtc,
825 * a seqlock. 781 * a seqlock.
826 */ 782 */
827 do { 783 do {
828 cur_vblank = atomic_read(&dev->_vblank_count[crtc]); 784 cur_vblank = atomic_read(&dev->vblank[crtc].count);
829 *vblanktime = vblanktimestamp(dev, crtc, cur_vblank); 785 *vblanktime = vblanktimestamp(dev, crtc, cur_vblank);
830 smp_rmb(); 786 smp_rmb();
831 } while (cur_vblank != atomic_read(&dev->_vblank_count[crtc])); 787 } while (cur_vblank != atomic_read(&dev->vblank[crtc].count));
832 788
833 return cur_vblank; 789 return cur_vblank;
834} 790}
@@ -915,12 +871,12 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
915 } while (cur_vblank != dev->driver->get_vblank_counter(dev, crtc)); 871 } while (cur_vblank != dev->driver->get_vblank_counter(dev, crtc));
916 872
917 /* Deal with counter wrap */ 873 /* Deal with counter wrap */
918 diff = cur_vblank - dev->last_vblank[crtc]; 874 diff = cur_vblank - dev->vblank[crtc].last;
919 if (cur_vblank < dev->last_vblank[crtc]) { 875 if (cur_vblank < dev->vblank[crtc].last) {
920 diff += dev->max_vblank_count; 876 diff += dev->max_vblank_count;
921 877
922 DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n", 878 DRM_DEBUG("last_vblank[%d]=0x%x, cur_vblank=0x%x => diff=0x%x\n",
923 crtc, dev->last_vblank[crtc], cur_vblank, diff); 879 crtc, dev->vblank[crtc].last, cur_vblank, diff);
924 } 880 }
925 881
926 DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n", 882 DRM_DEBUG("enabling vblank interrupts on crtc %d, missed %d\n",
@@ -931,12 +887,12 @@ static void drm_update_vblank_count(struct drm_device *dev, int crtc)
931 * reinitialize delayed at next vblank interrupt in that case. 887 * reinitialize delayed at next vblank interrupt in that case.
932 */ 888 */
933 if (rc) { 889 if (rc) {
934 tslot = atomic_read(&dev->_vblank_count[crtc]) + diff; 890 tslot = atomic_read(&dev->vblank[crtc].count) + diff;
935 vblanktimestamp(dev, crtc, tslot) = t_vblank; 891 vblanktimestamp(dev, crtc, tslot) = t_vblank;
936 } 892 }
937 893
938 smp_mb__before_atomic_inc(); 894 smp_mb__before_atomic_inc();
939 atomic_add(diff, &dev->_vblank_count[crtc]); 895 atomic_add(diff, &dev->vblank[crtc].count);
940 smp_mb__after_atomic_inc(); 896 smp_mb__after_atomic_inc();
941} 897}
942 898
@@ -958,9 +914,9 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
958 914
959 spin_lock_irqsave(&dev->vbl_lock, irqflags); 915 spin_lock_irqsave(&dev->vbl_lock, irqflags);
960 /* Going from 0->1 means we have to enable interrupts again */ 916 /* Going from 0->1 means we have to enable interrupts again */
961 if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) { 917 if (atomic_add_return(1, &dev->vblank[crtc].refcount) == 1) {
962 spin_lock_irqsave(&dev->vblank_time_lock, irqflags2); 918 spin_lock_irqsave(&dev->vblank_time_lock, irqflags2);
963 if (!dev->vblank_enabled[crtc]) { 919 if (!dev->vblank[crtc].enabled) {
964 /* Enable vblank irqs under vblank_time_lock protection. 920 /* Enable vblank irqs under vblank_time_lock protection.
965 * All vblank count & timestamp updates are held off 921 * All vblank count & timestamp updates are held off
966 * until we are done reinitializing master counter and 922 * until we are done reinitializing master counter and
@@ -971,16 +927,16 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
971 DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", 927 DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n",
972 crtc, ret); 928 crtc, ret);
973 if (ret) 929 if (ret)
974 atomic_dec(&dev->vblank_refcount[crtc]); 930 atomic_dec(&dev->vblank[crtc].refcount);
975 else { 931 else {
976 dev->vblank_enabled[crtc] = true; 932 dev->vblank[crtc].enabled = true;
977 drm_update_vblank_count(dev, crtc); 933 drm_update_vblank_count(dev, crtc);
978 } 934 }
979 } 935 }
980 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags2); 936 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags2);
981 } else { 937 } else {
982 if (!dev->vblank_enabled[crtc]) { 938 if (!dev->vblank[crtc].enabled) {
983 atomic_dec(&dev->vblank_refcount[crtc]); 939 atomic_dec(&dev->vblank[crtc].refcount);
984 ret = -EINVAL; 940 ret = -EINVAL;
985 } 941 }
986 } 942 }
@@ -1000,10 +956,10 @@ EXPORT_SYMBOL(drm_vblank_get);
1000 */ 956 */
1001void drm_vblank_put(struct drm_device *dev, int crtc) 957void drm_vblank_put(struct drm_device *dev, int crtc)
1002{ 958{
1003 BUG_ON(atomic_read(&dev->vblank_refcount[crtc]) == 0); 959 BUG_ON(atomic_read(&dev->vblank[crtc].refcount) == 0);
1004 960
1005 /* Last user schedules interrupt disable */ 961 /* Last user schedules interrupt disable */
1006 if (atomic_dec_and_test(&dev->vblank_refcount[crtc]) && 962 if (atomic_dec_and_test(&dev->vblank[crtc].refcount) &&
1007 (drm_vblank_offdelay > 0)) 963 (drm_vblank_offdelay > 0))
1008 mod_timer(&dev->vblank_disable_timer, 964 mod_timer(&dev->vblank_disable_timer,
1009 jiffies + ((drm_vblank_offdelay * DRM_HZ)/1000)); 965 jiffies + ((drm_vblank_offdelay * DRM_HZ)/1000));
@@ -1026,7 +982,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)
1026 982
1027 spin_lock_irqsave(&dev->vbl_lock, irqflags); 983 spin_lock_irqsave(&dev->vbl_lock, irqflags);
1028 vblank_disable_and_save(dev, crtc); 984 vblank_disable_and_save(dev, crtc);
1029 DRM_WAKEUP(&dev->vbl_queue[crtc]); 985 DRM_WAKEUP(&dev->vblank[crtc].queue);
1030 986
1031 /* Send any queued vblank events, lest the natives grow disquiet */ 987 /* Send any queued vblank events, lest the natives grow disquiet */
1032 seq = drm_vblank_count_and_time(dev, crtc, &now); 988 seq = drm_vblank_count_and_time(dev, crtc, &now);
@@ -1068,10 +1024,10 @@ void drm_vblank_pre_modeset(struct drm_device *dev, int crtc)
1068 * to avoid corrupting the count if multiple, mismatch calls occur), 1024 * to avoid corrupting the count if multiple, mismatch calls occur),
1069 * so that interrupts remain enabled in the interim. 1025 * so that interrupts remain enabled in the interim.
1070 */ 1026 */
1071 if (!dev->vblank_inmodeset[crtc]) { 1027 if (!dev->vblank[crtc].inmodeset) {
1072 dev->vblank_inmodeset[crtc] = 0x1; 1028 dev->vblank[crtc].inmodeset = 0x1;
1073 if (drm_vblank_get(dev, crtc) == 0) 1029 if (drm_vblank_get(dev, crtc) == 0)
1074 dev->vblank_inmodeset[crtc] |= 0x2; 1030 dev->vblank[crtc].inmodeset |= 0x2;
1075 } 1031 }
1076} 1032}
1077EXPORT_SYMBOL(drm_vblank_pre_modeset); 1033EXPORT_SYMBOL(drm_vblank_pre_modeset);
@@ -1084,15 +1040,15 @@ void drm_vblank_post_modeset(struct drm_device *dev, int crtc)
1084 if (!dev->num_crtcs) 1040 if (!dev->num_crtcs)
1085 return; 1041 return;
1086 1042
1087 if (dev->vblank_inmodeset[crtc]) { 1043 if (dev->vblank[crtc].inmodeset) {
1088 spin_lock_irqsave(&dev->vbl_lock, irqflags); 1044 spin_lock_irqsave(&dev->vbl_lock, irqflags);
1089 dev->vblank_disable_allowed = true; 1045 dev->vblank_disable_allowed = true;
1090 spin_unlock_irqrestore(&dev->vbl_lock, irqflags); 1046 spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
1091 1047
1092 if (dev->vblank_inmodeset[crtc] & 0x2) 1048 if (dev->vblank[crtc].inmodeset & 0x2)
1093 drm_vblank_put(dev, crtc); 1049 drm_vblank_put(dev, crtc);
1094 1050
1095 dev->vblank_inmodeset[crtc] = 0; 1051 dev->vblank[crtc].inmodeset = 0;
1096 } 1052 }
1097} 1053}
1098EXPORT_SYMBOL(drm_vblank_post_modeset); 1054EXPORT_SYMBOL(drm_vblank_post_modeset);
@@ -1289,8 +1245,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
1289 1245
1290 DRM_DEBUG("waiting on vblank count %d, crtc %d\n", 1246 DRM_DEBUG("waiting on vblank count %d, crtc %d\n",
1291 vblwait->request.sequence, crtc); 1247 vblwait->request.sequence, crtc);
1292 dev->last_vblank_wait[crtc] = vblwait->request.sequence; 1248 dev->vblank[crtc].last_wait = vblwait->request.sequence;
1293 DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ, 1249 DRM_WAIT_ON(ret, dev->vblank[crtc].queue, 3 * DRM_HZ,
1294 (((drm_vblank_count(dev, crtc) - 1250 (((drm_vblank_count(dev, crtc) -
1295 vblwait->request.sequence) <= (1 << 23)) || 1251 vblwait->request.sequence) <= (1 << 23)) ||
1296 !dev->irq_enabled)); 1252 !dev->irq_enabled));
@@ -1368,7 +1324,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
1368 spin_lock_irqsave(&dev->vblank_time_lock, irqflags); 1324 spin_lock_irqsave(&dev->vblank_time_lock, irqflags);
1369 1325
1370 /* Vblank irq handling disabled. Nothing to do. */ 1326 /* Vblank irq handling disabled. Nothing to do. */
1371 if (!dev->vblank_enabled[crtc]) { 1327 if (!dev->vblank[crtc].enabled) {
1372 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); 1328 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);
1373 return false; 1329 return false;
1374 } 1330 }
@@ -1378,7 +1334,7 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
1378 */ 1334 */
1379 1335
1380 /* Get current timestamp and count. */ 1336 /* Get current timestamp and count. */
1381 vblcount = atomic_read(&dev->_vblank_count[crtc]); 1337 vblcount = atomic_read(&dev->vblank[crtc].count);
1382 drm_get_last_vbltimestamp(dev, crtc, &tvblank, DRM_CALLED_FROM_VBLIRQ); 1338 drm_get_last_vbltimestamp(dev, crtc, &tvblank, DRM_CALLED_FROM_VBLIRQ);
1383 1339
1384 /* Compute time difference to timestamp of last vblank */ 1340 /* Compute time difference to timestamp of last vblank */
@@ -1402,14 +1358,14 @@ bool drm_handle_vblank(struct drm_device *dev, int crtc)
1402 * the timestamp computed above. 1358 * the timestamp computed above.
1403 */ 1359 */
1404 smp_mb__before_atomic_inc(); 1360 smp_mb__before_atomic_inc();
1405 atomic_inc(&dev->_vblank_count[crtc]); 1361 atomic_inc(&dev->vblank[crtc].count);
1406 smp_mb__after_atomic_inc(); 1362 smp_mb__after_atomic_inc();
1407 } else { 1363 } else {
1408 DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n", 1364 DRM_DEBUG("crtc %d: Redundant vblirq ignored. diff_ns = %d\n",
1409 crtc, (int) diff_ns); 1365 crtc, (int) diff_ns);
1410 } 1366 }
1411 1367
1412 DRM_WAKEUP(&dev->vbl_queue[crtc]); 1368 DRM_WAKEUP(&dev->vblank[crtc].queue);
1413 drm_handle_vblank_events(dev, crtc); 1369 drm_handle_vblank_events(dev, crtc);
1414 1370
1415 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags); 1371 spin_unlock_irqrestore(&dev->vblank_time_lock, irqflags);