Lines Matching defs: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);
213 return dev->driver->get_vblank_counter(dev, pipe);
216 return drm_vblank_no_hw_counter(dev, pipe);
228 static void drm_reset_vblank_timestamp(struct drm_device *dev, unsigned int pipe)
242 cur_vblank = __get_vblank_counter(dev, pipe);
243 rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false);
244 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
258 store_vblank(dev, pipe, 1, t_vblank, cur_vblank);
265 * (specified by @pipe). Deal with wraparound, if it occurred, and
275 static void drm_update_vblank_count(struct drm_device *dev, unsigned int pipe,
278 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
284 u32 max_vblank_count = drm_max_vblank_count(dev, pipe);
299 cur_vblank = __get_vblank_counter(dev, pipe);
300 rc = drm_get_last_vbltimestamp(dev, pipe, &t_vblank, in_vblank_irq);
301 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
317 pipe, (long long)diff_ns, framedur_ns);
323 pipe);
341 " due to pre-modeset.\n", pipe, diff);
347 pipe, (unsigned long long)atomic64_read(&vblank->count),
364 store_vblank(dev, pipe, diff, t_vblank, cur_vblank);
367 u64 drm_vblank_count(struct drm_device *dev, unsigned int pipe)
369 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
372 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
403 unsigned int pipe = drm_crtc_index(crtc);
413 drm_update_vblank_count(dev, pipe, false);
414 vblank = drm_vblank_count(dev, pipe);
422 static void __disable_vblank(struct drm_device *dev, unsigned int pipe)
425 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
433 dev->driver->disable_vblank(dev, pipe);
443 void drm_vblank_disable_and_save(struct drm_device *dev, unsigned int pipe)
445 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
471 drm_update_vblank_count(dev, pipe, false);
472 __disable_vblank(dev, pipe);
483 unsigned int pipe = vblank->pipe;
488 drm_dbg_core(dev, "disabling vblank on crtc %u\n", pipe);
489 drm_vblank_disable_and_save(dev, pipe);
535 vblank->pipe = i;
606 unsigned int pipe = drm_crtc_index(crtc);
607 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
614 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
691 unsigned int pipe = crtc->index;
692 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
700 if (pipe >= dev->num_crtcs) {
701 drm_err(dev, "Invalid crtc %u\n", pipe);
721 pipe);
747 pipe);
763 pipe, duration_ns / 1000, *max_error / 1000, i);
789 pipe, hpos, vpos,
844 * @pipe: index of CRTC whose vblank timestamp to retrieve
862 drm_get_last_vbltimestamp(struct drm_device *dev, unsigned int pipe,
865 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
873 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
919 * @pipe: index of CRTC whose counter to retrieve
929 static u64 drm_vblank_count_and_time(struct drm_device *dev, unsigned int pipe,
932 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
936 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs)) {
1002 trace_drm_vblank_event_delivered(e->base.file_priv, e->pipe, seq);
1048 unsigned int pipe = drm_crtc_index(crtc);
1052 e->pipe = pipe;
1074 unsigned int pipe = drm_crtc_index(crtc);
1078 seq = drm_vblank_count_and_time(dev, pipe, &now);
1084 e->pipe = pipe;
1089 static int __enable_vblank(struct drm_device *dev, unsigned int pipe)
1092 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
1100 return dev->driver->enable_vblank(dev, pipe);
1106 static int drm_vblank_enable(struct drm_device *dev, unsigned int pipe)
1108 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1123 ret = __enable_vblank(dev, pipe);
1125 pipe, ret);
1129 drm_update_vblank_count(dev, pipe, 0);
1144 int drm_vblank_get(struct drm_device *dev, unsigned int pipe)
1146 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1153 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1159 ret = drm_vblank_enable(dev, pipe);
1187 void drm_vblank_put(struct drm_device *dev, unsigned int pipe)
1189 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1191 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1225 * @pipe: CRTC index
1227 * This waits for one vblank to pass on @pipe, using the irq driver interfaces.
1228 * It is a failure to call this when the vblank irq for @pipe is disabled, e.g.
1233 void drm_wait_one_vblank(struct drm_device *dev, unsigned int pipe)
1235 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1239 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1242 ret = drm_vblank_get(dev, pipe);
1244 pipe, ret))
1247 last = drm_vblank_count(dev, pipe);
1250 last != drm_vblank_count(dev, pipe),
1253 drm_WARN(dev, ret == 0, "vblank wait timed out on crtc %i\n", pipe);
1255 drm_vblank_put(dev, pipe);
1287 unsigned int pipe = drm_crtc_index(crtc);
1288 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1293 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1304 pipe, vblank->enabled, vblank->inmodeset);
1309 drm_vblank_disable_and_save(dev, pipe);
1324 seq = drm_vblank_count_and_time(dev, pipe, &now);
1327 if (e->pipe != pipe)
1333 drm_vblank_put(dev, pipe);
1366 unsigned int pipe = drm_crtc_index(crtc);
1367 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1406 unsigned int pipe = drm_crtc_index(crtc);
1407 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1429 unsigned int pipe = drm_crtc_index(crtc);
1430 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1432 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1437 pipe, vblank->enabled, vblank->inmodeset);
1445 drm_reset_vblank_timestamp(dev, pipe);
1452 drm_WARN_ON(dev, drm_vblank_enable(dev, pipe));
1460 * @pipe: CRTC index
1470 void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
1479 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1485 vblank = &dev->vblank[pipe];
1492 cur_vblank = __get_vblank_counter(dev, pipe);
1493 drm_get_last_vbltimestamp(dev, pipe, &t_vblank, false);
1494 } while (cur_vblank != __get_vblank_counter(dev, pipe) && --count > 0);
1504 store_vblank(dev, pipe, diff, t_vblank, cur_vblank);
1525 unsigned int pipe)
1527 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1533 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1545 if (drm_vblank_get(dev, pipe) == 0)
1551 unsigned int pipe)
1553 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1559 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1564 drm_reset_vblank_timestamp(dev, pipe);
1568 drm_vblank_put(dev, pipe);
1578 unsigned int pipe;
1588 pipe = modeset->crtc;
1589 if (pipe >= dev->num_crtcs)
1594 drm_legacy_vblank_pre_modeset(dev, pipe);
1597 drm_legacy_vblank_post_modeset(dev, pipe);
1606 static int drm_queue_vblank_event(struct drm_device *dev, unsigned int pipe,
1611 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1623 e->pipe = pipe;
1629 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
1654 seq = drm_vblank_count_and_time(dev, pipe, &now);
1657 req_seq, seq, pipe);
1659 trace_drm_vblank_event_queued(file_priv, pipe, req_seq);
1663 drm_vblank_put(dev, pipe);
1680 drm_vblank_put(dev, pipe);
1711 static void drm_wait_vblank_reply(struct drm_device *dev, unsigned int pipe,
1722 reply->sequence = drm_vblank_count_and_time(dev, pipe, &now);
1737 unsigned int flags, pipe, high_pipe;
1765 pipe = 0;
1772 pipe++;
1775 pipe = pipe_index;
1778 if (pipe >= dev->num_crtcs)
1781 vblank = &dev->vblank[pipe];
1789 drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
1793 ret = drm_vblank_get(dev, pipe);
1797 pipe, ret);
1800 seq = drm_vblank_count(dev, pipe);
1827 return drm_queue_vblank_event(dev, pipe, req_seq, vblwait, file_priv);
1834 req_seq, pipe);
1836 drm_vblank_passed(drm_vblank_count(dev, pipe), req_seq) ||
1856 drm_wait_vblank_reply(dev, pipe, &vblwait->reply);
1859 pipe, vblwait->reply.sequence);
1862 pipe);
1866 drm_vblank_put(dev, pipe);
1870 static void drm_handle_vblank_events(struct drm_device *dev, unsigned int pipe)
1872 struct drm_crtc *crtc = drm_crtc_from_index(dev, pipe);
1880 seq = drm_vblank_count_and_time(dev, pipe, &now);
1883 if (e->pipe != pipe)
1892 drm_vblank_put(dev, pipe);
1899 trace_drm_vblank_event(pipe, seq, now, high_prec);
1905 * @pipe: index of CRTC where this event occurred
1912 bool drm_handle_vblank(struct drm_device *dev, unsigned int pipe)
1914 struct drm_vblank_crtc *vblank = &dev->vblank[pipe];
1921 if (drm_WARN_ON(dev, pipe >= dev->num_crtcs))
1939 drm_update_vblank_count(dev, pipe, true);
1954 drm_handle_vblank_events(dev, pipe);
2005 int pipe;
2021 pipe = drm_crtc_index(crtc);
2023 vblank = &dev->vblank[pipe];
2031 pipe, ret);
2041 get_seq->sequence = drm_vblank_count_and_time(dev, pipe, &now);
2061 int pipe;
2086 pipe = drm_crtc_index(crtc);
2088 vblank = &dev->vblank[pipe];
2098 pipe, ret);
2102 seq = drm_vblank_count_and_time(dev, pipe, &now);
2111 e->pipe = pipe;