Lines Matching +full:ati +full:- +full:mode

41 	(dev)->_vblank_time[(crtc) * DRM_VBLANKTIME_RBSIZE + \
72 if (!dev->driver->bus->irq_by_busid) in drm_irq_by_busid()
73 return -EINVAL; in drm_irq_by_busid()
76 return -EINVAL; in drm_irq_by_busid()
78 return dev->driver->bus->irq_by_busid(dev, p); in drm_irq_by_busid()
86 memset(&dev->_vblank_time[crtc * DRM_VBLANKTIME_RBSIZE], 0, in clear_vblank_timestamps()
108 mtx_lock(&dev->vblank_time_lock); in vblank_disable_and_save()
110 dev->driver->disable_vblank(dev, crtc); in vblank_disable_and_save()
111 dev->vblank_enabled[crtc] = 0; in vblank_disable_and_save()
118 * drm_update_vblank_count() which can cause off-by-one in vblank_disable_and_save()
126 dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc); in vblank_disable_and_save()
128 …} while (dev->last_vblank[crtc] != dev->driver->get_vblank_counter(dev, crtc) && (--count) && vblr… in vblank_disable_and_save()
136 vblcount = atomic_read(&dev->_vblank_count[crtc]); in vblank_disable_and_save()
137 diff_ns = timeval_to_ns(&tvblank) - in vblank_disable_and_save()
153 atomic_inc(&dev->_vblank_count[crtc]); in vblank_disable_and_save()
160 mtx_unlock(&dev->vblank_time_lock); in vblank_disable_and_save()
168 if (!dev->vblank_disable_allowed) in vblank_disable_fn()
171 for (i = 0; i < dev->num_crtcs; i++) { in vblank_disable_fn()
172 mtx_lock(&dev->vbl_lock); in vblank_disable_fn()
173 if (atomic_read(&dev->vblank_refcount[i]) == 0 && in vblank_disable_fn()
174 dev->vblank_enabled[i]) { in vblank_disable_fn()
178 mtx_unlock(&dev->vbl_lock); in vblank_disable_fn()
185 if (dev->num_crtcs == 0) in drm_vblank_cleanup()
188 callout_stop(&dev->vblank_disable_callout); in drm_vblank_cleanup()
192 free(dev->_vblank_count, DRM_MEM_VBLANK); in drm_vblank_cleanup()
193 free(dev->vblank_refcount, DRM_MEM_VBLANK); in drm_vblank_cleanup()
194 free(dev->vblank_enabled, DRM_MEM_VBLANK); in drm_vblank_cleanup()
195 free(dev->last_vblank, DRM_MEM_VBLANK); in drm_vblank_cleanup()
196 free(dev->last_vblank_wait, DRM_MEM_VBLANK); in drm_vblank_cleanup()
197 free(dev->vblank_inmodeset, DRM_MEM_VBLANK); in drm_vblank_cleanup()
198 free(dev->_vblank_time, DRM_MEM_VBLANK); in drm_vblank_cleanup()
200 mtx_destroy(&dev->vbl_lock); in drm_vblank_cleanup()
201 mtx_destroy(&dev->vblank_time_lock); in drm_vblank_cleanup()
203 dev->num_crtcs = 0; in drm_vblank_cleanup()
209 int i, ret = -ENOMEM; in drm_vblank_init()
211 callout_init(&dev->vblank_disable_callout, 1); in drm_vblank_init()
212 mtx_init(&dev->vbl_lock, "drmvbl", NULL, MTX_DEF); in drm_vblank_init()
213 mtx_init(&dev->vblank_time_lock, "drmvtl", NULL, MTX_DEF); in drm_vblank_init()
215 dev->num_crtcs = num_crtcs; in drm_vblank_init()
217 dev->_vblank_count = malloc(sizeof(atomic_t) * num_crtcs, in drm_vblank_init()
219 if (!dev->_vblank_count) in drm_vblank_init()
222 dev->vblank_refcount = malloc(sizeof(atomic_t) * num_crtcs, in drm_vblank_init()
224 if (!dev->vblank_refcount) in drm_vblank_init()
227 dev->vblank_enabled = malloc(num_crtcs * sizeof(int), in drm_vblank_init()
229 if (!dev->vblank_enabled) in drm_vblank_init()
232 dev->last_vblank = malloc(num_crtcs * sizeof(u32), in drm_vblank_init()
234 if (!dev->last_vblank) in drm_vblank_init()
237 dev->last_vblank_wait = malloc(num_crtcs * sizeof(u32), in drm_vblank_init()
239 if (!dev->last_vblank_wait) in drm_vblank_init()
242 dev->vblank_inmodeset = malloc(num_crtcs * sizeof(int), in drm_vblank_init()
244 if (!dev->vblank_inmodeset) in drm_vblank_init()
247 dev->_vblank_time = malloc(num_crtcs * DRM_VBLANKTIME_RBSIZE * in drm_vblank_init()
249 if (!dev->_vblank_time) in drm_vblank_init()
254 /* Driver specific high-precision vblank timestamping supported? */ in drm_vblank_init()
255 if (dev->driver->get_vblank_timestamp) in drm_vblank_init()
260 /* Zero per-crtc vblank stuff */ in drm_vblank_init()
262 atomic_set(&dev->_vblank_count[i], 0); in drm_vblank_init()
263 atomic_set(&dev->vblank_refcount[i], 0); in drm_vblank_init()
266 dev->vblank_disable_allowed = 0; in drm_vblank_init()
290 return -EINVAL; in drm_irq_install()
293 return -EINVAL; in drm_irq_install()
298 if (!dev->dev_private) { in drm_irq_install()
300 return -EINVAL; in drm_irq_install()
303 if (dev->irq_enabled) { in drm_irq_install()
305 return -EBUSY; in drm_irq_install()
307 dev->irq_enabled = 1; in drm_irq_install()
313 if (dev->driver->irq_preinstall) in drm_irq_install()
314 dev->driver->irq_preinstall(dev); in drm_irq_install()
320 * FIXME Linux<->FreeBSD: This seems to make in drm_irq_install()
329 ret = -bus_setup_intr(dev->dev, dev->irqr, sh_flags, NULL, in drm_irq_install()
330 dev->driver->irq_handler, dev, &dev->irqh); in drm_irq_install()
333 device_printf(dev->dev, "Error setting interrupt: %d\n", -ret); in drm_irq_install()
335 dev->irq_enabled = 0; in drm_irq_install()
341 if (dev->driver->irq_postinstall) in drm_irq_install()
342 ret = dev->driver->irq_postinstall(dev); in drm_irq_install()
346 dev->irq_enabled = 0; in drm_irq_install()
348 bus_teardown_intr(dev->dev, dev->irqr, dev->irqh); in drm_irq_install()
349 dev->driver->bus->free_irq(dev); in drm_irq_install()
368 return -EINVAL; in drm_irq_uninstall()
371 irq_enabled = dev->irq_enabled; in drm_irq_uninstall()
372 dev->irq_enabled = 0; in drm_irq_uninstall()
378 if (dev->num_crtcs) { in drm_irq_uninstall()
379 mtx_lock(&dev->vbl_lock); in drm_irq_uninstall()
380 for (i = 0; i < dev->num_crtcs; i++) { in drm_irq_uninstall()
381 DRM_WAKEUP(&dev->_vblank_count[i]); in drm_irq_uninstall()
382 dev->vblank_enabled[i] = 0; in drm_irq_uninstall()
383 dev->last_vblank[i] = in drm_irq_uninstall()
384 dev->driver->get_vblank_counter(dev, i); in drm_irq_uninstall()
386 mtx_unlock(&dev->vbl_lock); in drm_irq_uninstall()
390 return -EINVAL; in drm_irq_uninstall()
394 if (dev->driver->irq_uninstall) in drm_irq_uninstall()
395 dev->driver->irq_uninstall(dev); in drm_irq_uninstall()
397 bus_teardown_intr(dev->dev, dev->irqr, dev->irqh); in drm_irq_uninstall()
398 dev->driver->bus->free_irq(dev); in drm_irq_uninstall()
420 /* if we haven't irq we fallback for compatibility reasons - in drm_control()
425 switch (ctl->func) { in drm_control()
431 if (dev->if_version < DRM_IF_VERSION(1, 2) && in drm_control()
432 ctl->irq != drm_dev_to_irq(dev)) in drm_control()
433 return -EINVAL; in drm_control()
442 return -EINVAL; in drm_control()
447 * drm_calc_timestamping_constants - Calculate and
449 * vblank and swap-completion timestamping, e.g, by
464 dotclock = (u64) crtc->hwmode.clock * 1000; in drm_calc_timestamping_constants()
467 * Double the dotclock to get halve the frame-/line-/pixelduration. in drm_calc_timestamping_constants()
469 if (crtc->hwmode.flags & DRM_MODE_FLAG_INTERLACE) in drm_calc_timestamping_constants()
479 linedur_ns = (s64) div64_u64(((u64) crtc->hwmode.crtc_htotal * in drm_calc_timestamping_constants()
481 framedur_ns = (s64) crtc->hwmode.crtc_vtotal * linedur_ns; in drm_calc_timestamping_constants()
484 crtc->base.id); in drm_calc_timestamping_constants()
486 crtc->pixeldur_ns = pixeldur_ns; in drm_calc_timestamping_constants()
487 crtc->linedur_ns = linedur_ns; in drm_calc_timestamping_constants()
488 crtc->framedur_ns = framedur_ns; in drm_calc_timestamping_constants()
491 crtc->base.id, crtc->hwmode.crtc_htotal, in drm_calc_timestamping_constants()
492 crtc->hwmode.crtc_vtotal, crtc->hwmode.crtc_vdisplay); in drm_calc_timestamping_constants()
494 crtc->base.id, (int) dotclock/1000, (int) framedur_ns, in drm_calc_timestamping_constants()
500 * drm_calc_vbltimestamp_from_scanoutpos - helper routine for kms
508 * the vblank interval, aka start of scanout of topmost-leftmost display
511 * Requires support for optional dev->driver->get_scanout_position()
516 * returns as no operation if a doublescan or interlaced video mode is
530 * video mode:
532 * -EINVAL - Invalid crtc.
533 * -EAGAIN - Temporary unavailable, e.g., called before initial modeset.
534 * -ENOTSUPP - Function not supported in current display mode.
535 * -EIO - Failed, e.g., due to failed scanout position query.
539 * DRM_VBLANKTIME_SCANOUTPOS_METHOD - Signal this method used for timestamping.
540 * DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval.
550 struct drm_display_mode *mode; in drm_calc_vbltimestamp_from_scanoutpos() local
556 if (crtc < 0 || crtc >= dev->num_crtcs) { in drm_calc_vbltimestamp_from_scanoutpos()
558 return -EINVAL; in drm_calc_vbltimestamp_from_scanoutpos()
562 if (!dev->driver->get_scanout_position) { in drm_calc_vbltimestamp_from_scanoutpos()
564 return -EIO; in drm_calc_vbltimestamp_from_scanoutpos()
567 mode = &refcrtc->hwmode; in drm_calc_vbltimestamp_from_scanoutpos()
568 vtotal = mode->crtc_vtotal; in drm_calc_vbltimestamp_from_scanoutpos()
569 vdisplay = mode->crtc_vdisplay; in drm_calc_vbltimestamp_from_scanoutpos()
572 framedur_ns = refcrtc->framedur_ns; in drm_calc_vbltimestamp_from_scanoutpos()
573 linedur_ns = refcrtc->linedur_ns; in drm_calc_vbltimestamp_from_scanoutpos()
574 pixeldur_ns = refcrtc->pixeldur_ns; in drm_calc_vbltimestamp_from_scanoutpos()
576 /* If mode timing undefined, just return as no-op: in drm_calc_vbltimestamp_from_scanoutpos()
580 DRM_DEBUG("crtc %d: Noop due to uninitialized mode.\n", crtc); in drm_calc_vbltimestamp_from_scanoutpos()
581 return -EAGAIN; in drm_calc_vbltimestamp_from_scanoutpos()
601 vbl_status = dev->driver->get_scanout_position(dev, crtc, &vpos, &hpos); in drm_calc_vbltimestamp_from_scanoutpos()
612 /* Return as no-op if scanout query unsupported or failed. */ in drm_calc_vbltimestamp_from_scanoutpos()
616 return -EIO; in drm_calc_vbltimestamp_from_scanoutpos()
619 duration_ns = timeval_to_ns(&raw_time) - timeval_to_ns(&stime); in drm_calc_vbltimestamp_from_scanoutpos()
654 * Happens, e.g., on ATI R500, R600. in drm_calc_vbltimestamp_from_scanoutpos()
659 ((vdisplay - vpos) < vtotal / 100)) { in drm_calc_vbltimestamp_from_scanoutpos()
660 delta_ns = delta_ns - framedur_ns; in drm_calc_vbltimestamp_from_scanoutpos()
676 *vblank_time = ns_to_timeval(timeval_to_ns(&raw_time) - delta_ns); in drm_calc_vbltimestamp_from_scanoutpos()
678 DRM_DEBUG("crtc %d : v %d p(%d,%d)@ %jd.%jd -> %jd.%jd [e %d us, %d rep]\n", in drm_calc_vbltimestamp_from_scanoutpos()
680 (uintmax_t)raw_time.tv_usec, (uintmax_t)vblank_time->tv_sec, in drm_calc_vbltimestamp_from_scanoutpos()
681 (uintmax_t)vblank_time->tv_usec, (int)duration_ns/1000, i); in drm_calc_vbltimestamp_from_scanoutpos()
705 * drm_get_last_vbltimestamp - retrieve raw timestamp for the most recent
716 * vblank interval on specified crtc. May call into kms-driver to
717 * compute the timestamp with a high-precision GPU specific method.
722 * Returns non-zero if timestamp is considered to be very precise.
733 if (dev->driver->get_vblank_timestamp && (max_error > 0)) { in drm_get_last_vbltimestamp()
734 ret = dev->driver->get_vblank_timestamp(dev, crtc, &max_error, in drm_get_last_vbltimestamp()
750 * drm_vblank_count - retrieve "cooked" vblank counter value
760 return atomic_read(&dev->_vblank_count[crtc]); in drm_vblank_count()
765 * drm_vblank_count_and_time - retrieve "cooked" vblank counter value
789 cur_vblank = atomic_read(&dev->_vblank_count[crtc]); in drm_vblank_count_and_time()
792 } while (cur_vblank != atomic_read(&dev->_vblank_count[crtc])); in drm_vblank_count_and_time()
802 WARN_ON_SMP(!mtx_owned(&dev->event_lock)); in send_vblank_event()
803 e->event.sequence = seq; in send_vblank_event()
804 e->event.tv_sec = now->tv_sec; in send_vblank_event()
805 e->event.tv_usec = now->tv_usec; in send_vblank_event()
807 list_add_tail(&e->base.link, in send_vblank_event()
808 &e->base.file_priv->event_list); in send_vblank_event()
809 drm_event_wakeup(&e->base); in send_vblank_event()
811 e->base.pid, e->pipe, e->event.sequence); in send_vblank_event()
815 * drm_send_vblank_event - helper to send vblank event after pageflip
840 * drm_update_vblank_count - update the master vblank counter
849 * Only necessary when going from off->on, to account for frames we
852 * Note: caller must hold dev->vbl_lock since this reads & writes
863 * NOTE! It's possible we lost a full dev->max_vblank_count events in drm_update_vblank_count()
873 cur_vblank = dev->driver->get_vblank_counter(dev, crtc); in drm_update_vblank_count()
875 } while (cur_vblank != dev->driver->get_vblank_counter(dev, crtc)); in drm_update_vblank_count()
878 diff = cur_vblank - dev->last_vblank[crtc]; in drm_update_vblank_count()
879 if (cur_vblank < dev->last_vblank[crtc]) { in drm_update_vblank_count()
880 diff += dev->max_vblank_count; in drm_update_vblank_count()
883 crtc, dev->last_vblank[crtc], cur_vblank, diff); in drm_update_vblank_count()
889 /* Reinitialize corresponding vblank timestamp if high-precision query in drm_update_vblank_count()
894 tslot = atomic_read(&dev->_vblank_count[crtc]) + diff; in drm_update_vblank_count()
899 atomic_add(diff, &dev->_vblank_count[crtc]); in drm_update_vblank_count()
904 * drm_vblank_get - get a reference count on vblank events
918 mtx_lock(&dev->vbl_lock); in drm_vblank_get()
919 /* Going from 0->1 means we have to enable interrupts again */ in drm_vblank_get()
920 if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) { in drm_vblank_get()
921 mtx_lock(&dev->vblank_time_lock); in drm_vblank_get()
922 if (!dev->vblank_enabled[crtc]) { in drm_vblank_get()
927 * prevent double-accounting of same vblank interval. in drm_vblank_get()
929 ret = dev->driver->enable_vblank(dev, crtc); in drm_vblank_get()
933 atomic_dec(&dev->vblank_refcount[crtc]); in drm_vblank_get()
935 dev->vblank_enabled[crtc] = 1; in drm_vblank_get()
939 mtx_unlock(&dev->vblank_time_lock); in drm_vblank_get()
941 if (!dev->vblank_enabled[crtc]) { in drm_vblank_get()
942 atomic_dec(&dev->vblank_refcount[crtc]); in drm_vblank_get()
943 ret = -EINVAL; in drm_vblank_get()
946 mtx_unlock(&dev->vbl_lock); in drm_vblank_get()
953 * drm_vblank_put - give up ownership of vblank events
962 BUG_ON(atomic_read(&dev->vblank_refcount[crtc]) == 0); in drm_vblank_put()
965 if (atomic_dec_and_test(&dev->vblank_refcount[crtc]) && in drm_vblank_put()
967 callout_reset(&dev->vblank_disable_callout, in drm_vblank_put()
974 * drm_vblank_off - disable vblank events on a CRTC
986 mtx_lock(&dev->vbl_lock); in drm_vblank_off()
988 DRM_WAKEUP(&dev->_vblank_count[crtc]); in drm_vblank_off()
993 mtx_lock(&dev->event_lock); in drm_vblank_off()
994 list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { in drm_vblank_off()
995 if (e->pipe != crtc) in drm_vblank_off()
999 e->event.sequence, seq); in drm_vblank_off()
1000 list_del(&e->base.link); in drm_vblank_off()
1001 drm_vblank_put(dev, e->pipe); in drm_vblank_off()
1004 mtx_unlock(&dev->event_lock); in drm_vblank_off()
1006 mtx_unlock(&dev->vbl_lock); in drm_vblank_off()
1011 * drm_vblank_pre_modeset - account for vblanks across mode sets
1015 * Account for vblank events across mode setting events, which will likely
1021 if (!dev->num_crtcs) in drm_vblank_pre_modeset()
1030 if (!dev->vblank_inmodeset[crtc]) { in drm_vblank_pre_modeset()
1031 dev->vblank_inmodeset[crtc] = 0x1; in drm_vblank_pre_modeset()
1033 dev->vblank_inmodeset[crtc] |= 0x2; in drm_vblank_pre_modeset()
1041 if (!dev->num_crtcs) in drm_vblank_post_modeset()
1044 if (dev->vblank_inmodeset[crtc]) { in drm_vblank_post_modeset()
1045 mtx_lock(&dev->vbl_lock); in drm_vblank_post_modeset()
1046 dev->vblank_disable_allowed = 1; in drm_vblank_post_modeset()
1047 mtx_unlock(&dev->vbl_lock); in drm_vblank_post_modeset()
1049 if (dev->vblank_inmodeset[crtc] & 0x2) in drm_vblank_post_modeset()
1052 dev->vblank_inmodeset[crtc] = 0; in drm_vblank_post_modeset()
1058 * drm_modeset_ctl - handle vblank event counter changes across mode switch
1064 * Generally the counter will reset across mode sets. If interrupts are
1074 /* If drm_vblank_init() hasn't been called yet, just no-op */ in drm_modeset_ctl()
1075 if (!dev->num_crtcs) in drm_modeset_ctl()
1082 crtc = modeset->crtc; in drm_modeset_ctl()
1083 if (crtc >= dev->num_crtcs) in drm_modeset_ctl()
1084 return -EINVAL; in drm_modeset_ctl()
1086 switch (modeset->cmd) { in drm_modeset_ctl()
1094 return -EINVAL; in drm_modeset_ctl()
1118 ret = -ENOMEM; in drm_queue_vblank_event()
1122 e->pipe = pipe; in drm_queue_vblank_event()
1123 e->base.pid = curproc->p_pid; in drm_queue_vblank_event()
1124 e->event.base.type = DRM_EVENT_VBLANK; in drm_queue_vblank_event()
1125 e->event.base.length = sizeof e->event; in drm_queue_vblank_event()
1126 e->event.user_data = vblwait->request.signal; in drm_queue_vblank_event()
1127 e->base.event = &e->event.base; in drm_queue_vblank_event()
1128 e->base.file_priv = file_priv; in drm_queue_vblank_event()
1129 e->base.destroy = drm_vblank_event_destroy; in drm_queue_vblank_event()
1131 mtx_lock(&dev->event_lock); in drm_queue_vblank_event()
1133 if (file_priv->event_space < sizeof e->event) { in drm_queue_vblank_event()
1134 ret = -EBUSY; in drm_queue_vblank_event()
1138 file_priv->event_space -= sizeof e->event; in drm_queue_vblank_event()
1141 if ((vblwait->request.type & _DRM_VBLANK_NEXTONMISS) && in drm_queue_vblank_event()
1142 (seq - vblwait->request.sequence) <= (1 << 23)) { in drm_queue_vblank_event()
1143 vblwait->request.sequence = seq + 1; in drm_queue_vblank_event()
1144 vblwait->reply.sequence = vblwait->request.sequence; in drm_queue_vblank_event()
1148 vblwait->request.sequence, seq, pipe); in drm_queue_vblank_event()
1150 CTR4(KTR_DRM, "vblank_event_queued %d %d rt %x %d", curproc->p_pid, pipe, in drm_queue_vblank_event()
1151 vblwait->request.type, vblwait->request.sequence); in drm_queue_vblank_event()
1153 e->event.sequence = vblwait->request.sequence; in drm_queue_vblank_event()
1154 if ((seq - vblwait->request.sequence) <= (1 << 23)) { in drm_queue_vblank_event()
1157 vblwait->reply.sequence = seq; in drm_queue_vblank_event()
1160 list_add_tail(&e->base.link, &dev->vblank_event_list); in drm_queue_vblank_event()
1161 vblwait->reply.sequence = vblwait->request.sequence; in drm_queue_vblank_event()
1164 mtx_unlock(&dev->event_lock); in drm_queue_vblank_event()
1169 mtx_unlock(&dev->event_lock); in drm_queue_vblank_event()
1197 if (/*(!drm_dev_to_irq(dev)) || */(!dev->irq_enabled)) in drm_wait_vblank()
1198 return -EINVAL; in drm_wait_vblank()
1200 if (vblwait->request.type & _DRM_VBLANK_SIGNAL) in drm_wait_vblank()
1201 return -EINVAL; in drm_wait_vblank()
1203 if (vblwait->request.type & in drm_wait_vblank()
1207 vblwait->request.type, in drm_wait_vblank()
1210 return -EINVAL; in drm_wait_vblank()
1213 flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK; in drm_wait_vblank()
1214 high_crtc = (vblwait->request.type & _DRM_VBLANK_HIGH_CRTC_MASK); in drm_wait_vblank()
1219 if (crtc >= dev->num_crtcs) in drm_wait_vblank()
1220 return -EINVAL; in drm_wait_vblank()
1229 switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) { in drm_wait_vblank()
1231 vblwait->request.sequence += seq; in drm_wait_vblank()
1232 vblwait->request.type &= ~_DRM_VBLANK_RELATIVE; in drm_wait_vblank()
1236 ret = -EINVAL; in drm_wait_vblank()
1248 (seq - vblwait->request.sequence) <= (1<<23)) { in drm_wait_vblank()
1249 vblwait->request.sequence = seq + 1; in drm_wait_vblank()
1253 vblwait->request.sequence, crtc); in drm_wait_vblank()
1254 dev->last_vblank_wait[crtc] = vblwait->request.sequence; in drm_wait_vblank()
1255 mtx_lock(&dev->vblank_time_lock); in drm_wait_vblank()
1256 while (((drm_vblank_count(dev, crtc) - vblwait->request.sequence) > in drm_wait_vblank()
1257 (1 << 23)) && dev->irq_enabled) { in drm_wait_vblank()
1266 ret = -msleep(&dev->_vblank_count[crtc], &dev->vblank_time_lock, in drm_wait_vblank()
1268 if (ret == -ERESTART) in drm_wait_vblank()
1269 ret = -ERESTARTSYS; in drm_wait_vblank()
1273 mtx_unlock(&dev->vblank_time_lock); in drm_wait_vblank()
1274 if (ret != -EINTR) { in drm_wait_vblank()
1280 curproc->p_pid, crtc, vblwait->request.type, in drm_wait_vblank()
1281 vblwait->request.sequence, reply_seq); in drm_wait_vblank()
1283 vblwait->reply.sequence = reply_seq; in drm_wait_vblank()
1284 vblwait->reply.tval_sec = now.tv_sec; in drm_wait_vblank()
1285 vblwait->reply.tval_usec = now.tv_usec; in drm_wait_vblank()
1288 vblwait->reply.sequence); in drm_wait_vblank()
1291 curproc->p_pid, crtc, vblwait->request.type, ret, in drm_wait_vblank()
1292 vblwait->request.sequence); in drm_wait_vblank()
1310 mtx_lock(&dev->event_lock); in drm_handle_vblank_events()
1312 list_for_each_entry_safe(e, t, &dev->vblank_event_list, base.link) { in drm_handle_vblank_events()
1313 if (e->pipe != crtc) in drm_handle_vblank_events()
1315 if ((seq - e->event.sequence) > (1<<23)) in drm_handle_vblank_events()
1319 e->event.sequence, seq); in drm_handle_vblank_events()
1321 list_del(&e->base.link); in drm_handle_vblank_events()
1322 drm_vblank_put(dev, e->pipe); in drm_handle_vblank_events()
1326 mtx_unlock(&dev->event_lock); in drm_handle_vblank_events()
1332 * drm_handle_vblank - handle a vblank event
1345 if (!dev->num_crtcs) in drm_handle_vblank()
1352 mtx_lock(&dev->vblank_time_lock); in drm_handle_vblank()
1355 if (!dev->vblank_enabled[crtc]) { in drm_handle_vblank()
1356 mtx_unlock(&dev->vblank_time_lock); in drm_handle_vblank()
1365 vblcount = atomic_read(&dev->_vblank_count[crtc]); in drm_handle_vblank()
1369 diff_ns = timeval_to_ns(&tvblank) - in drm_handle_vblank()
1389 atomic_inc(&dev->_vblank_count[crtc]); in drm_handle_vblank()
1396 DRM_WAKEUP(&dev->_vblank_count[crtc]); in drm_handle_vblank()
1399 mtx_unlock(&dev->vblank_time_lock); in drm_handle_vblank()