Lines Matching refs:vblank
172 return &dev->vblank[pipe]; in drm_vblank_crtc()
186 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in store_vblank() local
190 vblank->last = last; in store_vblank()
192 write_seqlock(&vblank->seqlock); in store_vblank()
193 vblank->time = t_vblank; in store_vblank()
194 atomic64_add(vblank_count_inc, &vblank->count); in store_vblank()
195 write_sequnlock(&vblank->seqlock); in store_vblank()
200 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_max_vblank_count() local
202 return vblank->max_vblank_count ?: dev->max_vblank_count; in drm_max_vblank_count()
289 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_update_vblank_count() local
294 int framedur_ns = vblank->framedur_ns; in drm_update_vblank_count()
316 diff = (cur_vblank - vblank->last) & max_vblank_count; in drm_update_vblank_count()
318 u64 diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time)); in drm_update_vblank_count()
349 if (diff > 1 && (vblank->inmodeset & 0x2)) { in drm_update_vblank_count()
358 pipe, (unsigned long long)atomic64_read(&vblank->count), in drm_update_vblank_count()
359 diff, cur_vblank, vblank->last); in drm_update_vblank_count()
362 drm_WARN_ON_ONCE(dev, cur_vblank != vblank->last); in drm_update_vblank_count()
380 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_count() local
386 count = atomic64_read(&vblank->count); in drm_vblank_count()
415 u64 vblank; in drm_crtc_accurate_vblank_count() local
425 vblank = drm_vblank_count(dev, pipe); in drm_crtc_accurate_vblank_count()
429 return vblank; in drm_crtc_accurate_vblank_count()
454 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_disable_and_save() local
471 if (!vblank->enabled) in drm_vblank_disable_and_save()
482 vblank->enabled = false; in drm_vblank_disable_and_save()
490 struct drm_vblank_crtc *vblank = from_timer(vblank, t, disable_timer); in vblank_disable_fn() local
491 struct drm_device *dev = vblank->dev; in vblank_disable_fn()
492 unsigned int pipe = vblank->pipe; in vblank_disable_fn()
496 if (atomic_read(&vblank->refcount) == 0 && vblank->enabled) { in vblank_disable_fn()
505 struct drm_vblank_crtc *vblank = ptr; in drm_vblank_init_release() local
507 drm_WARN_ON(dev, READ_ONCE(vblank->enabled) && in drm_vblank_init_release()
510 drm_vblank_destroy_worker(vblank); in drm_vblank_init_release()
511 del_timer_sync(&vblank->disable_timer); in drm_vblank_init_release()
534 dev->vblank = drmm_kcalloc(dev, num_crtcs, sizeof(*dev->vblank), GFP_KERNEL); in drm_vblank_init()
535 if (!dev->vblank) in drm_vblank_init()
541 struct drm_vblank_crtc *vblank = &dev->vblank[i]; in drm_vblank_init() local
543 vblank->dev = dev; in drm_vblank_init()
544 vblank->pipe = i; in drm_vblank_init()
545 init_waitqueue_head(&vblank->queue); in drm_vblank_init()
546 timer_setup(&vblank->disable_timer, vblank_disable_fn, 0); in drm_vblank_init()
547 seqlock_init(&vblank->seqlock); in drm_vblank_init()
550 vblank); in drm_vblank_init()
554 ret = drm_vblank_worker_init(vblank); in drm_vblank_init()
595 return &crtc->dev->vblank[drm_crtc_index(crtc)].queue; in drm_crtc_vblank_waitqueue()
616 struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); in drm_calc_timestamping_constants() local
648 vblank->linedur_ns = linedur_ns; in drm_calc_timestamping_constants()
649 vblank->framedur_ns = framedur_ns; in drm_calc_timestamping_constants()
650 drm_mode_copy(&vblank->hwmode, mode); in drm_calc_timestamping_constants()
700 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_helper_get_vblank_timestamp_internal() local
720 mode = &vblank->hwmode; in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
944 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_count_and_time() local
954 seq = read_seqbegin(&vblank->seqlock); in drm_vblank_count_and_time()
955 vblank_count = atomic64_read(&vblank->count); in drm_vblank_count_and_time()
956 *vblanktime = vblank->time; in drm_vblank_count_and_time()
957 } while (read_seqretry(&vblank->seqlock, seq)); in drm_vblank_count_and_time()
999 struct drm_vblank_crtc *vblank; in drm_crtc_next_vblank_start() local
1006 vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_next_vblank_start()
1007 mode = &vblank->hwmode; in drm_crtc_next_vblank_start()
1009 if (!vblank->framedur_ns || !vblank->linedur_ns) in drm_crtc_next_vblank_start()
1016 (u64)vblank->framedur_ns * mode->crtc_vblank_start, in drm_crtc_next_vblank_start()
1160 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_enable() local
1167 if (!vblank->enabled) { in drm_vblank_enable()
1179 atomic_dec(&vblank->refcount); in drm_vblank_enable()
1187 WRITE_ONCE(vblank->enabled, true); in drm_vblank_enable()
1198 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_get() local
1210 if (atomic_add_return(1, &vblank->refcount) == 1) { in drm_vblank_get()
1213 if (!vblank->enabled) { in drm_vblank_get()
1214 atomic_dec(&vblank->refcount); in drm_vblank_get()
1241 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_put() local
1242 int vblank_offdelay = vblank->config.offdelay_ms; in drm_vblank_put()
1247 if (drm_WARN_ON(dev, atomic_read(&vblank->refcount) == 0)) in drm_vblank_put()
1251 if (atomic_dec_and_test(&vblank->refcount)) { in drm_vblank_put()
1255 vblank_disable_fn(&vblank->disable_timer); in drm_vblank_put()
1256 else if (!vblank->config.disable_immediate) in drm_vblank_put()
1257 mod_timer(&vblank->disable_timer, in drm_vblank_put()
1289 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_wait_one_vblank() local
1303 ret = wait_event_timeout(vblank->queue, in drm_wait_one_vblank()
1342 struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_vblank_off() local
1358 pipe, vblank->enabled, vblank->inmodeset); in drm_crtc_vblank_off()
1362 if (drm_core_check_feature(dev, DRIVER_ATOMIC) || !vblank->inmodeset) in drm_crtc_vblank_off()
1365 wake_up(&vblank->queue); in drm_crtc_vblank_off()
1371 if (!vblank->inmodeset) { in drm_crtc_vblank_off()
1372 atomic_inc(&vblank->refcount); in drm_crtc_vblank_off()
1373 vblank->inmodeset = 1; in drm_crtc_vblank_off()
1392 drm_vblank_cancel_pending_works(vblank); in drm_crtc_vblank_off()
1398 vblank->hwmode.crtc_clock = 0; in drm_crtc_vblank_off()
1401 drm_vblank_flush_worker(vblank); in drm_crtc_vblank_off()
1420 struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_vblank_reset() local
1427 if (!vblank->inmodeset) { in drm_crtc_vblank_reset()
1428 atomic_inc(&vblank->refcount); in drm_crtc_vblank_reset()
1429 vblank->inmodeset = 1; in drm_crtc_vblank_reset()
1434 drm_WARN_ON(dev, !list_empty(&vblank->pending_work)); in drm_crtc_vblank_reset()
1459 struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_set_max_vblank_count() local
1462 drm_WARN_ON(dev, !READ_ONCE(vblank->inmodeset)); in drm_crtc_set_max_vblank_count()
1464 vblank->max_vblank_count = max_vblank_count; in drm_crtc_set_max_vblank_count()
1486 struct drm_vblank_crtc *vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_vblank_on_config() local
1493 pipe, vblank->enabled, vblank->inmodeset); in drm_crtc_vblank_on_config()
1495 vblank->config = *config; in drm_crtc_vblank_on_config()
1498 if (vblank->inmodeset) { in drm_crtc_vblank_on_config()
1499 atomic_dec(&vblank->refcount); in drm_crtc_vblank_on_config()
1500 vblank->inmodeset = 0; in drm_crtc_vblank_on_config()
1509 if (atomic_read(&vblank->refcount) != 0 || !vblank->config.offdelay_ms) in drm_crtc_vblank_on_config()
1541 struct drm_vblank_crtc *vblank; in drm_vblank_restore() local
1554 vblank = drm_vblank_crtc(dev, pipe); in drm_vblank_restore()
1556 drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns, in drm_vblank_restore()
1558 framedur_ns = vblank->framedur_ns; in drm_vblank_restore()
1565 diff_ns = ktime_to_ns(ktime_sub(t_vblank, vblank->time)); in drm_vblank_restore()
1572 diff, diff_ns, framedur_ns, cur_vblank - vblank->last); in drm_vblank_restore()
1573 vblank->last = (cur_vblank - diff) & max_vblank_count; in drm_vblank_restore()
1596 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_crtc_vblank_restore() local
1599 drm_WARN_ON_ONCE(dev, vblank->inmodeset); in drm_crtc_vblank_restore()
1600 drm_WARN_ON_ONCE(dev, !vblank->config.disable_immediate); in drm_crtc_vblank_restore()
1611 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_queue_vblank_event() local
1643 if (!READ_ONCE(vblank->enabled)) { in drm_queue_vblank_event()
1737 struct drm_vblank_crtc *vblank; in drm_wait_vblank_ioctl() local
1786 vblank = &dev->vblank[pipe]; in drm_wait_vblank_ioctl()
1791 if (vblank->config.disable_immediate && in drm_wait_vblank_ioctl()
1793 READ_ONCE(vblank->enabled)) { in drm_wait_vblank_ioctl()
1840 wait = wait_event_interruptible_timeout(vblank->queue, in drm_wait_vblank_ioctl()
1842 !READ_ONCE(vblank->enabled), in drm_wait_vblank_ioctl()
1919 struct drm_vblank_crtc *vblank = drm_vblank_crtc(dev, pipe); in drm_handle_vblank() local
1938 if (!vblank->enabled) { in drm_handle_vblank()
1948 wake_up(&vblank->queue); in drm_handle_vblank()
1955 disable_irq = (vblank->config.disable_immediate && in drm_handle_vblank()
1956 vblank->config.offdelay_ms > 0 && in drm_handle_vblank()
1957 !atomic_read(&vblank->refcount)); in drm_handle_vblank()
1960 drm_handle_vblank_works(vblank); in drm_handle_vblank()
1965 vblank_disable_fn(&vblank->disable_timer); in drm_handle_vblank()
2009 struct drm_vblank_crtc *vblank; in drm_crtc_get_sequence_ioctl() local
2028 vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_get_sequence_ioctl()
2029 vblank_enabled = READ_ONCE(vblank->config.disable_immediate) && in drm_crtc_get_sequence_ioctl()
2030 READ_ONCE(vblank->enabled); in drm_crtc_get_sequence_ioctl()
2066 struct drm_vblank_crtc *vblank; in drm_crtc_queue_sequence_ioctl() local
2094 vblank = drm_crtc_vblank_crtc(crtc); in drm_crtc_queue_sequence_ioctl()
2130 if (!READ_ONCE(vblank->enabled)) { in drm_crtc_queue_sequence_ioctl()