Lines Matching refs:vblank

173 	struct drm_vblank_crtc *vblank = &dev->vblank[pipe];  in store_vblank()  local
177 vblank->last = last; in store_vblank()
179 write_seqlock(&vblank->seqlock); in store_vblank()
180 vblank->time = t_vblank; in store_vblank()
181 atomic64_add(vblank_count_inc, &vblank->count); in store_vblank()
182 write_sequnlock(&vblank->seqlock); in store_vblank()
187 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_max_vblank_count() local
189 return vblank->max_vblank_count ?: dev->max_vblank_count; in drm_max_vblank_count()
281 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_update_vblank_count() local
286 int framedur_ns = vblank->framedur_ns; in drm_update_vblank_count()
308 diff = (cur_vblank - vblank->last) & max_vblank_count; in drm_update_vblank_count()
310 u64 diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time)); in drm_update_vblank_count()
341 if (diff > 1 && (vblank->inmodeset & 0x2)) { in drm_update_vblank_count()
350 pipe, (unsigned long long)atomic64_read(&vblank->count), in drm_update_vblank_count()
351 diff, cur_vblank, vblank->last); in drm_update_vblank_count()
354 drm_WARN_ON_ONCE(dev, cur_vblank != vblank->last); in drm_update_vblank_count()
372 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_count() local
378 count = atomic64_read(&vblank->count); in drm_vblank_count()
407 u64 vblank; in drm_crtc_accurate_vblank_count() local
417 vblank = drm_vblank_count(dev, pipe); in drm_crtc_accurate_vblank_count()
421 return vblank; in drm_crtc_accurate_vblank_count()
451 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_disable_and_save() local
468 if (!vblank->enabled) in drm_vblank_disable_and_save()
479 vblank->enabled = false; in drm_vblank_disable_and_save()
487 struct drm_vblank_crtc *vblank = from_timer(vblank, t, disable_timer); in vblank_disable_fn() local
488 struct drm_device *dev = vblank->dev; in vblank_disable_fn()
489 unsigned int pipe = vblank->pipe; in vblank_disable_fn()
493 if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) { in vblank_disable_fn()
502 struct drm_vblank_crtc *vblank = ptr; in drm_vblank_init_release() local
504 drm_WARN_ON(dev, READ_ONCE(vblank->enabled) && in drm_vblank_init_release()
507 drm_vblank_destroy_worker(vblank); in drm_vblank_init_release()
508 del_timer_sync(&vblank->disable_timer); in drm_vblank_init_release()
531 dev->vblank = drmm_kcalloc(dev, num_crtcs, sizeof(*dev->vblank), GFP_KERNEL); in drm_vblank_init()
532 if (!dev->vblank) in drm_vblank_init()
538 struct drm_vblank_crtc *vblank = &dev->vblank[i]; in drm_vblank_init() local
540 vblank->dev = dev; in drm_vblank_init()
541 vblank->pipe = i; in drm_vblank_init()
542 init_waitqueue_head(&vblank->queue); in drm_vblank_init()
543 timer_setup(&vblank->disable_timer, vblank_disable_fn, 0); in drm_vblank_init()
544 seqlock_init(&vblank->seqlock); in drm_vblank_init()
547 vblank); in drm_vblank_init()
551 ret = drm_vblank_worker_init(vblank); in drm_vblank_init()
592 return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; in drm_crtc_vblank_waitqueue()
613 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_calc_timestamping_constants() local
645 vblank->linedur_ns = linedur_ns; in drm_calc_timestamping_constants()
646 vblank->framedur_ns = framedur_ns; in drm_calc_timestamping_constants()
647 vblank->hwmode = *mode; in drm_calc_timestamping_constants()
698 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_helper_get_vblank_timestamp_internal() local
718 mode = &vblank->hwmode; in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
938 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_count_and_time() local
948 seq = read_seqbegin(&vblank->seqlock); in drm_vblank_count_and_time()
949 vblank_count = atomic64_read(&vblank->count); in drm_vblank_count_and_time()
950 *vblanktime = vblank->time; in drm_vblank_count_and_time()
951 } while (read_seqretry(&vblank->seqlock, seq)); in drm_vblank_count_and_time()
1124 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_enable() local
1131 if (!vblank->enabled) { in drm_vblank_enable()
1143 atomic_dec(&vblank->refcount); in drm_vblank_enable()
1151 WRITE_ONCE(vblank->enabled, true); in drm_vblank_enable()
1162 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_get() local
1174 if (atomic_add_return(1, &vblank->refcount) == 1) { in drm_vblank_get()
1177 if (!vblank->enabled) { in drm_vblank_get()
1178 atomic_dec(&vblank->refcount); in drm_vblank_get()
1205 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_put() local
1210 if (drm_WARN_ON(dev, atomic_read(&vblank->refcount) == 0)) in drm_vblank_put()
1214 if (atomic_dec_and_test(&vblank->refcount)) { in drm_vblank_put()
1218 vblank_disable_fn(&vblank->disable_timer); in drm_vblank_put()
1220 mod_timer(&vblank->disable_timer, in drm_vblank_put()
1251 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_wait_one_vblank() local
1265 ret = wait_event_timeout(vblank->queue, in drm_wait_one_vblank()
1304 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_off() local
1320 pipe, vblank->enabled, vblank->inmodeset); in drm_crtc_vblank_off()
1324 if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset) in drm_crtc_vblank_off()
1327 wake_up(&vblank->queue); in drm_crtc_vblank_off()
1333 if (!vblank->inmodeset) { in drm_crtc_vblank_off()
1334 atomic_inc(&vblank->refcount); in drm_crtc_vblank_off()
1335 vblank->inmodeset = 1; in drm_crtc_vblank_off()
1354 drm_vblank_cancel_pending_works(vblank); in drm_crtc_vblank_off()
1360 vblank->hwmode.crtc_clock = 0; in drm_crtc_vblank_off()
1363 drm_vblank_flush_worker(vblank); in drm_crtc_vblank_off()
1383 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_reset() local
1390 if (!vblank->inmodeset) { in drm_crtc_vblank_reset()
1391 atomic_inc(&vblank->refcount); in drm_crtc_vblank_reset()
1392 vblank->inmodeset = 1; in drm_crtc_vblank_reset()
1397 drm_WARN_ON(dev, !list_empty(&vblank->pending_work)); in drm_crtc_vblank_reset()
1423 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_set_max_vblank_count() local
1426 drm_WARN_ON(dev, !READ_ONCE(vblank->inmodeset)); in drm_crtc_set_max_vblank_count()
1428 vblank->max_vblank_count = max_vblank_count; in drm_crtc_set_max_vblank_count()
1446 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_on() local
1453 pipe, vblank->enabled, vblank->inmodeset); in drm_crtc_vblank_on()
1456 if (vblank->inmodeset) { in drm_crtc_vblank_on()
1457 atomic_dec(&vblank->refcount); in drm_crtc_vblank_on()
1458 vblank->inmodeset = 0; in drm_crtc_vblank_on()
1467 if (atomic_read(&vblank->refcount) != 0 || drm_vblank_offdelay == 0) in drm_crtc_vblank_on()
1476 struct drm_vblank_crtc *vblank; in drm_vblank_restore() local
1489 vblank = &dev->vblank[pipe]; in drm_vblank_restore()
1491 drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns, in drm_vblank_restore()
1493 framedur_ns = vblank->framedur_ns; in drm_vblank_restore()
1500 diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time)); in drm_vblank_restore()
1507 diff, diff_ns, framedur_ns, cur_vblank - vblank->last); in drm_vblank_restore()
1508 vblank->last = (cur_vblank - diff) & max_vblank_count; in drm_vblank_restore()
1539 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_legacy_vblank_pre_modeset() local
1555 if (!vblank->inmodeset) { in drm_legacy_vblank_pre_modeset()
1556 vblank->inmodeset = 0x1; in drm_legacy_vblank_pre_modeset()
1558 vblank->inmodeset |= 0x2; in drm_legacy_vblank_pre_modeset()
1565 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_legacy_vblank_post_modeset() local
1574 if (vblank->inmodeset) { in drm_legacy_vblank_post_modeset()
1579 if (vblank->inmodeset & 0x2) in drm_legacy_vblank_post_modeset()
1582 vblank->inmodeset = 0; in drm_legacy_vblank_post_modeset()
1623 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_queue_vblank_event() local
1655 if (!READ_ONCE(vblank->enabled)) { in drm_queue_vblank_event()
1753 struct drm_vblank_crtc *vblank; in drm_wait_vblank_ioctl() local
1802 vblank = &dev->vblank[pipe]; in drm_wait_vblank_ioctl()
1809 READ_ONCE(vblank->enabled)) { in drm_wait_vblank_ioctl()
1856 wait = wait_event_interruptible_timeout(vblank->queue, in drm_wait_vblank_ioctl()
1858 !READ_ONCE(vblank->enabled), in drm_wait_vblank_ioctl()
1935 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_handle_vblank() local
1954 if (!vblank->enabled) { in drm_handle_vblank()
1964 wake_up(&vblank->queue); in drm_handle_vblank()
1973 !atomic_read(&vblank->refcount)); in drm_handle_vblank()
1976 drm_handle_vblank_works(vblank); in drm_handle_vblank()
1981 vblank_disable_fn(&vblank->disable_timer); in drm_handle_vblank()
2025 struct drm_vblank_crtc *vblank; in drm_crtc_get_sequence_ioctl() local
2044 vblank = &dev->vblank[pipe]; in drm_crtc_get_sequence_ioctl()
2045 vblank_enabled = dev->vblank_disable_immediate && READ_ONCE(vblank->enabled); in drm_crtc_get_sequence_ioctl()
2081 struct drm_vblank_crtc *vblank; in drm_crtc_queue_sequence_ioctl() local
2109 vblank = &dev->vblank[pipe]; in drm_crtc_queue_sequence_ioctl()
2145 if (!READ_ONCE(vblank->enabled)) { in drm_crtc_queue_sequence_ioctl()