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,
173 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
185 static u32 drm_max_vblank_count(struct drm_device *dev, unsigned int pipe)
187 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
196 static u32 drm_vblank_no_hw_counter(struct drm_device *dev, unsigned int pipe)
198 drm_WARN_ON_ONCE(dev, drm_max_vblank_count(dev, pipe) != 0);
202 static u32 __get_vblank_counter(struct drm_device *dev, unsigned int pipe)
205 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
215 return dev->driver->get_vblank_counter(dev, pipe);
219 return drm_vblank_no_hw_counter(dev, pipe);
231 static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe)
245 cur_vblank = __get_vblank_counter(dev, pipe);
246 rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false);
247 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
261 store_vblank(dev, pipe, 1, t_vblank, cur_vblank);
268 * (specified by @pipe). Deal with wraparound, if it occurred, and
278 static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
281 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
287 u32 max_vblank_count = drm_max_vblank_count(dev, pipe);
302 cur_vblank = __get_vblank_counter(dev, pipe);
303 rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, in_vblank_irq);
304 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
320 pipe, (long long)diff_ns, framedur_ns);
326 pipe);
344 " due to pre-modeset.\n", pipe, diff);
350 pipe, (unsigned long long)atomic64_read(&vblank->count),
367 store_vblank(dev, pipe, diff, t_vblank, cur_vblank);
370 u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe)
372 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
375 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
406 unsigned int pipe = drm_crtc_index(crtc);
416 drm_update_vblank_count(dev, pipe, false);
417 vblank = drm_vblank_count(dev, pipe);
425 static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
428 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
438 dev->driver->disable_vblank(dev, pipe);
449 void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
451 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
477 drm_update_vblank_count(dev, pipe, false);
478 __disable_vblank(dev, pipe);
489 unsigned int pipe = vblank->pipe;
494 drm_dbg_core(dev, "disabling vblank on crtc %u\n", pipe);
495 drm_vblank_disable_and_save(dev, pipe);
541 vblank->pipe = i;
612 unsigned int pipe = drm_crtc_index(crtc);
613 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
620 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
697 unsigned int pipe = crtc->index;
698 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
706 if (pipe >= dev->num_crtcs) {
707 drm_err(dev, "Invalid crtc %u\n", pipe);
727 pipe);
753 pipe);
769 pipe, duration_ns / 1000, *max_error / 1000, i);
795 pipe, hpos, vpos,
891 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
894 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
930 * @pipe: index of CRTC whose counter to retrieve
940 static u64 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
943 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
947 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) {
998 unsigned int pipe = drm_crtc_index(crtc);
1006 vblank = &crtc->dev->vblank[pipe];
1049 trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq);
1102 unsigned int pipe = drm_crtc_index(crtc);
1106 e->pipe = pipe;
1128 unsigned int pipe = drm_crtc_index(crtc);
1132 seq = drm_vblank_count_and_time(dev, pipe, &now);
1138 e->pipe = pipe;
1143 static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
1146 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
1156 return dev->driver->enable_vblank(dev, pipe);
1163 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
1165 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1180 ret = __enable_vblank(dev, pipe);
1182 pipe, ret);
1186 drm_update_vblank_count(dev, pipe, 0);
1201 int drm_vblank_get(struct drm_device *dev, unsigned int pipe)
1203 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1210 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1216 ret = drm_vblank_enable(dev, pipe);
1244 void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
1246 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1248 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1282 * @pipe: CRTC index
1284 * This waits for one vblank to pass on @pipe, using the irq driver interfaces.
1285 * It is a failure to call this when the vblank irq for @pipe is disabled, e.g.
1290 void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
1292 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1296 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1299 ret = drm_vblank_get(dev, pipe);
1301 pipe, ret))
1304 last = drm_vblank_count(dev, pipe);
1307 last != drm_vblank_count(dev, pipe),
1310 drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
1312 drm_vblank_put(dev, pipe);
1344 unsigned int pipe = drm_crtc_index(crtc);
1345 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1350 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1361 pipe, vblank->enabled, vblank->inmodeset);
1366 drm_vblank_disable_and_save(dev, pipe);
1381 seq = drm_vblank_count_and_time(dev, pipe, &now);
1384 if (e->pipe != pipe)
1390 drm_vblank_put(dev, pipe);
1423 unsigned int pipe = drm_crtc_index(crtc);
1424 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1463 unsigned int pipe = drm_crtc_index(crtc);
1464 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1486 unsigned int pipe = drm_crtc_index(crtc);
1487 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1489 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1494 pipe, vblank->enabled, vblank->inmodeset);
1502 drm_reset_vblank_timestamp(dev, pipe);
1509 drm_WARN_ON(dev, drm_vblank_enable(dev, pipe));
1514 static void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
1522 u32 max_vblank_count = drm_max_vblank_count(dev, pipe);
1524 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1530 vblank = &dev->vblank[pipe];
1537 cur_vblank = __get_vblank_counter(dev, pipe);
1538 drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false);
1539 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
1578 unsigned int pipe)
1580 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1586 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1598 if (drm_vblank_get(dev, pipe) == 0)
1604 unsigned int pipe)
1606 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1612 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1617 drm_reset_vblank_timestamp(dev, pipe);
1621 drm_vblank_put(dev, pipe);
1631 unsigned int pipe;
1641 pipe = modeset->crtc;
1642 if (pipe >= dev->num_crtcs)
1647 drm_legacy_vblank_pre_modeset(dev, pipe);
1650 drm_legacy_vblank_post_modeset(dev, pipe);
1659 static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
1664 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1676 e->pipe = pipe;
1682 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
1707 seq = drm_vblank_count_and_time(dev, pipe, &now);
1710 req_seq, seq, pipe);
1712 trace_drm_vblank_event_queued(file_priv, pipe, req_seq);
1716 drm_vblank_put(dev, pipe);
1733 drm_vblank_put(dev, pipe);
1764 static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
1775 reply->sequence = drm_vblank_count_and_time(dev, pipe, &now);
1799 unsigned int flags, pipe, high_pipe;
1827 pipe = 0;
1834 pipe++;
1837 pipe = pipe_index;
1840 if (pipe >= dev->num_crtcs)
1843 vblank = &dev->vblank[pipe];
1851 drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
1855 ret = drm_vblank_get(dev, pipe);
1859 pipe, ret);
1862 seq = drm_vblank_count(dev, pipe);
1889 return drm_queue_vblank_event(dev, pipe, req_seq, vblwait, file_priv);
1896 req_seq, pipe);
1898 drm_vblank_passed(drm_vblank_count(dev, pipe), req_seq) ||
1918 drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
1921 pipe, vblwait->reply.sequence);
1924 pipe);
1928 drm_vblank_put(dev, pipe);
1932 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
1934 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
1942 seq = drm_vblank_count_and_time(dev, pipe, &now);
1945 if (e->pipe != pipe)
1954 drm_vblank_put(dev, pipe);
1961 trace_drm_vblank_event(pipe, seq, now, high_prec);
1967 * @pipe: index of CRTC where this event occurred
1974 bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
1976 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1983 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
2001 drm_update_vblank_count(dev, pipe, true);
2016 drm_handle_vblank_events(dev, pipe);
2067 int pipe;
2083 pipe = drm_crtc_index(crtc);
2085 vblank = &dev->vblank[pipe];
2093 pipe, ret);
2103 get_seq->sequence = drm_vblank_count_and_time(dev, pipe, &now);
2123 int pipe;
2148 pipe = drm_crtc_index(crtc);
2150 vblank = &dev->vblank[pipe];
2160 pipe, ret);
2164 seq = drm_vblank_count_and_time(dev, pipe, &now);
2173 e->pipe = pipe;