Lines Matching refs:pipe

157 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
169 static void store_vblank(struct drm_device *dev, unsigned int pipe, in store_vblank() argument
173 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in store_vblank()
185 static u32 drm_max_vblank_count(struct drm_device *dev, unsigned int pipe) in drm_max_vblank_count() argument
187 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_max_vblank_count()
196 static u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe) in drm_vblank_no_hw_counter() argument
198 drm_WARN_ON_ONCE(dev, drm_max_vblank_count(dev, pipe) != 0); in drm_vblank_no_hw_counter()
202 static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe) in __get_vblank_counter() argument
205 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in __get_vblank_counter()
215 return dev->driver->get_vblank_counter(dev, pipe); in __get_vblank_counter()
219 return drm_vblank_no_hw_counter(dev, pipe); in __get_vblank_counter()
231 static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe) in drm_reset_vblank_timestamp() argument
245 cur_vblank = __get_vblank_counter(dev, pipe); in drm_reset_vblank_timestamp()
246 rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false); in drm_reset_vblank_timestamp()
247 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0); in drm_reset_vblank_timestamp()
261 store_vblank(dev, pipe, 1, t_vblank, cur_vblank); in drm_reset_vblank_timestamp()
278 static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe, in drm_update_vblank_count() argument
281 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_update_vblank_count()
287 u32 max_vblank_count = drm_max_vblank_count(dev, pipe); in drm_update_vblank_count()
302 cur_vblank = __get_vblank_counter(dev, pipe); in drm_update_vblank_count()
303 rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, in_vblank_irq); in drm_update_vblank_count()
304 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0); in drm_update_vblank_count()
320 pipe, (long long)diff_ns, framedur_ns); in drm_update_vblank_count()
326 pipe); in drm_update_vblank_count()
344 " due to pre-modeset.\n", pipe, diff); in drm_update_vblank_count()
350 pipe, (unsigned long long)atomic64_read(&vblank->count), in drm_update_vblank_count()
367 store_vblank(dev, pipe, diff, t_vblank, cur_vblank); in drm_update_vblank_count()
370 u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe) in drm_vblank_count() argument
372 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_count()
375 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_vblank_count()
406 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_accurate_vblank_count() local
416 drm_update_vblank_count(dev, pipe, false); in drm_crtc_accurate_vblank_count()
417 vblank = drm_vblank_count(dev, pipe); in drm_crtc_accurate_vblank_count()
425 static void __disable_vblank(struct drm_device *dev, unsigned int pipe) in __disable_vblank() argument
428 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in __disable_vblank()
438 dev->driver->disable_vblank(dev, pipe); in __disable_vblank()
449 void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe) in drm_vblank_disable_and_save() argument
451 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_disable_and_save()
477 drm_update_vblank_count(dev, pipe, false); in drm_vblank_disable_and_save()
478 __disable_vblank(dev, pipe); in drm_vblank_disable_and_save()
489 unsigned int pipe = vblank->pipe; in vblank_disable_fn() local
494 drm_dbg_core(dev, "disabling vblank on crtc %u\n", pipe); in vblank_disable_fn()
495 drm_vblank_disable_and_save(dev, pipe); in vblank_disable_fn()
541 vblank->pipe = i; in drm_vblank_init()
612 unsigned int pipe = drm_crtc_index(crtc); in drm_calc_timestamping_constants() local
613 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_calc_timestamping_constants()
620 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_calc_timestamping_constants()
697 unsigned int pipe = crtc->index; in drm_crtc_vblank_helper_get_vblank_timestamp_internal() local
698 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
706 if (pipe >= dev->num_crtcs) { in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
707 drm_err(dev, "Invalid crtc %u\n", pipe); in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
727 pipe); in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
753 pipe); in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
769 pipe, duration_ns / 1000, *max_error / 1000, i); in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
795 pipe, hpos, vpos, in drm_crtc_vblank_helper_get_vblank_timestamp_internal()
868 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe, in drm_get_last_vbltimestamp() argument
871 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in drm_get_last_vbltimestamp()
879 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in drm_get_last_vbltimestamp()
935 static u64 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe, in drm_vblank_count_and_time() argument
938 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_count_and_time()
942 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) { in drm_vblank_count_and_time()
1008 trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq); in send_vblank_event()
1061 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_arm_vblank_event() local
1065 e->pipe = pipe; in drm_crtc_arm_vblank_event()
1087 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_send_vblank_event() local
1091 seq = drm_vblank_count_and_time(dev, pipe, &now); in drm_crtc_send_vblank_event()
1097 e->pipe = pipe; in drm_crtc_send_vblank_event()
1102 static int __enable_vblank(struct drm_device *dev, unsigned int pipe) in __enable_vblank() argument
1105 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in __enable_vblank()
1115 return dev->driver->enable_vblank(dev, pipe); in __enable_vblank()
1122 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe) in drm_vblank_enable() argument
1124 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_enable()
1139 ret = __enable_vblank(dev, pipe); in drm_vblank_enable()
1141 pipe, ret); in drm_vblank_enable()
1145 drm_update_vblank_count(dev, pipe, 0); in drm_vblank_enable()
1160 int drm_vblank_get(struct drm_device *dev, unsigned int pipe) in drm_vblank_get() argument
1162 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_get()
1169 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_vblank_get()
1175 ret = drm_vblank_enable(dev, pipe); in drm_vblank_get()
1203 void drm_vblank_put(struct drm_device *dev, unsigned int pipe) in drm_vblank_put() argument
1205 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_vblank_put()
1207 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_vblank_put()
1249 void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe) in drm_wait_one_vblank() argument
1251 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_wait_one_vblank()
1255 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_wait_one_vblank()
1258 ret = drm_vblank_get(dev, pipe); in drm_wait_one_vblank()
1260 pipe, ret)) in drm_wait_one_vblank()
1263 last = drm_vblank_count(dev, pipe); in drm_wait_one_vblank()
1266 last != drm_vblank_count(dev, pipe), in drm_wait_one_vblank()
1269 drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe); in drm_wait_one_vblank()
1271 drm_vblank_put(dev, pipe); in drm_wait_one_vblank()
1303 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_vblank_off() local
1304 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_off()
1309 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_crtc_vblank_off()
1320 pipe, vblank->enabled, vblank->inmodeset); in drm_crtc_vblank_off()
1325 drm_vblank_disable_and_save(dev, pipe); in drm_crtc_vblank_off()
1340 seq = drm_vblank_count_and_time(dev, pipe, &now); in drm_crtc_vblank_off()
1343 if (e->pipe != pipe) in drm_crtc_vblank_off()
1349 drm_vblank_put(dev, pipe); in drm_crtc_vblank_off()
1382 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_vblank_reset() local
1383 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_reset()
1422 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_set_max_vblank_count() local
1423 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_set_max_vblank_count()
1445 unsigned int pipe = drm_crtc_index(crtc); in drm_crtc_vblank_on() local
1446 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_crtc_vblank_on()
1448 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_crtc_vblank_on()
1453 pipe, vblank->enabled, vblank->inmodeset); in drm_crtc_vblank_on()
1461 drm_reset_vblank_timestamp(dev, pipe); in drm_crtc_vblank_on()
1468 drm_WARN_ON(dev, drm_vblank_enable(dev, pipe)); in drm_crtc_vblank_on()
1473 static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe) in drm_vblank_restore() argument
1481 u32 max_vblank_count = drm_max_vblank_count(dev, pipe); in drm_vblank_restore()
1483 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_vblank_restore()
1489 vblank = &dev->vblank[pipe]; in drm_vblank_restore()
1496 cur_vblank = __get_vblank_counter(dev, pipe); in drm_vblank_restore()
1497 drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false); in drm_vblank_restore()
1498 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0); in drm_vblank_restore()
1537 unsigned int pipe) in drm_legacy_vblank_pre_modeset() argument
1539 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_legacy_vblank_pre_modeset()
1545 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_legacy_vblank_pre_modeset()
1557 if (drm_vblank_get(dev, pipe) == 0) in drm_legacy_vblank_pre_modeset()
1563 unsigned int pipe) in drm_legacy_vblank_post_modeset() argument
1565 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_legacy_vblank_post_modeset()
1571 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_legacy_vblank_post_modeset()
1576 drm_reset_vblank_timestamp(dev, pipe); in drm_legacy_vblank_post_modeset()
1580 drm_vblank_put(dev, pipe); in drm_legacy_vblank_post_modeset()
1590 unsigned int pipe; in drm_legacy_modeset_ctl_ioctl() local
1600 pipe = modeset->crtc; in drm_legacy_modeset_ctl_ioctl()
1601 if (pipe >= dev->num_crtcs) in drm_legacy_modeset_ctl_ioctl()
1606 drm_legacy_vblank_pre_modeset(dev, pipe); in drm_legacy_modeset_ctl_ioctl()
1609 drm_legacy_vblank_post_modeset(dev, pipe); in drm_legacy_modeset_ctl_ioctl()
1618 static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe, in drm_queue_vblank_event() argument
1623 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_queue_vblank_event()
1635 e->pipe = pipe; in drm_queue_vblank_event()
1641 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in drm_queue_vblank_event()
1666 seq = drm_vblank_count_and_time(dev, pipe, &now); in drm_queue_vblank_event()
1669 req_seq, seq, pipe); in drm_queue_vblank_event()
1671 trace_drm_vblank_event_queued(file_priv, pipe, req_seq); in drm_queue_vblank_event()
1675 drm_vblank_put(dev, pipe); in drm_queue_vblank_event()
1692 drm_vblank_put(dev, pipe); in drm_queue_vblank_event()
1723 static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe, in drm_wait_vblank_reply() argument
1734 reply->sequence = drm_vblank_count_and_time(dev, pipe, &now); in drm_wait_vblank_reply()
1758 unsigned int flags, pipe, high_pipe; in drm_wait_vblank_ioctl() local
1786 pipe = 0; in drm_wait_vblank_ioctl()
1793 pipe++; in drm_wait_vblank_ioctl()
1796 pipe = pipe_index; in drm_wait_vblank_ioctl()
1799 if (pipe >= dev->num_crtcs) in drm_wait_vblank_ioctl()
1802 vblank = &dev->vblank[pipe]; in drm_wait_vblank_ioctl()
1810 drm_wait_vblank_reply(dev, pipe, &vblwait->reply); in drm_wait_vblank_ioctl()
1814 ret = drm_vblank_get(dev, pipe); in drm_wait_vblank_ioctl()
1818 pipe, ret); in drm_wait_vblank_ioctl()
1821 seq = drm_vblank_count(dev, pipe); in drm_wait_vblank_ioctl()
1848 return drm_queue_vblank_event(dev, pipe, req_seq, vblwait, file_priv); in drm_wait_vblank_ioctl()
1855 req_seq, pipe); in drm_wait_vblank_ioctl()
1857 drm_vblank_passed(drm_vblank_count(dev, pipe), req_seq) || in drm_wait_vblank_ioctl()
1877 drm_wait_vblank_reply(dev, pipe, &vblwait->reply); in drm_wait_vblank_ioctl()
1880 pipe, vblwait->reply.sequence); in drm_wait_vblank_ioctl()
1883 pipe); in drm_wait_vblank_ioctl()
1887 drm_vblank_put(dev, pipe); in drm_wait_vblank_ioctl()
1891 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe) in drm_handle_vblank_events() argument
1893 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe); in drm_handle_vblank_events()
1901 seq = drm_vblank_count_and_time(dev, pipe, &now); in drm_handle_vblank_events()
1904 if (e->pipe != pipe) in drm_handle_vblank_events()
1913 drm_vblank_put(dev, pipe); in drm_handle_vblank_events()
1920 trace_drm_vblank_event(pipe, seq, now, high_prec); in drm_handle_vblank_events()
1933 bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe) in drm_handle_vblank() argument
1935 struct drm_vblank_crtc *vblank = &dev->vblank[pipe]; in drm_handle_vblank()
1942 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) in drm_handle_vblank()
1960 drm_update_vblank_count(dev, pipe, true); in drm_handle_vblank()
1975 drm_handle_vblank_events(dev, pipe); in drm_handle_vblank()
2026 int pipe; in drm_crtc_get_sequence_ioctl() local
2042 pipe = drm_crtc_index(crtc); in drm_crtc_get_sequence_ioctl()
2044 vblank = &dev->vblank[pipe]; in drm_crtc_get_sequence_ioctl()
2052 pipe, ret); in drm_crtc_get_sequence_ioctl()
2062 get_seq->sequence = drm_vblank_count_and_time(dev, pipe, &now); in drm_crtc_get_sequence_ioctl()
2082 int pipe; in drm_crtc_queue_sequence_ioctl() local
2107 pipe = drm_crtc_index(crtc); in drm_crtc_queue_sequence_ioctl()
2109 vblank = &dev->vblank[pipe]; in drm_crtc_queue_sequence_ioctl()
2119 pipe, ret); in drm_crtc_queue_sequence_ioctl()
2123 seq = drm_vblank_count_and_time(dev, pipe, &now); in drm_crtc_queue_sequence_ioctl()
2132 e->pipe = pipe; in drm_crtc_queue_sequence_ioctl()