1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>drm_calc_vbltimestamp_from_scanoutpos</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux GPU Driver Developer's Guide"><link rel="up" href="drm-vertical-blank.html#id-1.3.4.11.10" title="Vertical Blanking and Interrupt Handling Functions Reference"><link rel="prev" href="API-drm-calc-timestamping-constants.html" title="drm_calc_timestamping_constants"><link rel="next" href="API-drm-vblank-count.html" title="drm_vblank_count"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">drm_calc_vbltimestamp_from_scanoutpos</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-drm-calc-timestamping-constants.html">Prev</a> </td><th width="60%" align="center">Vertical Blanking and Interrupt Handling Functions Reference</th><td width="20%" align="right"> <a accesskey="n" href="API-drm-vblank-count.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-drm-calc-vbltimestamp-from-scanoutpos"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>drm_calc_vbltimestamp_from_scanoutpos — 
2     precise vblank timestamp helper
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">drm_calc_vbltimestamp_from_scanoutpos </b>(</code></td><td>struct drm_device * <var class="pdparam">dev</var>, </td></tr><tr><td> </td><td>unsigned int <var class="pdparam">pipe</var>, </td></tr><tr><td> </td><td>int * <var class="pdparam">max_error</var>, </td></tr><tr><td> </td><td>struct timeval * <var class="pdparam">vblank_time</var>, </td></tr><tr><td> </td><td>unsigned <var class="pdparam">flags</var>, </td></tr><tr><td> </td><td>const struct drm_display_mode * <var class="pdparam">mode</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.3.4.11.10.7.5"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>dev</code></em></span></dt><dd><p>
4     DRM device
5    </p></dd><dt><span class="term"><em class="parameter"><code>pipe</code></em></span></dt><dd><p>
6     index of CRTC whose vblank timestamp to retrieve
7    </p></dd><dt><span class="term"><em class="parameter"><code>max_error</code></em></span></dt><dd><p>
8     Desired maximum allowable error in timestamps (nanosecs)
9     On return contains true maximum error of timestamp
10    </p></dd><dt><span class="term"><em class="parameter"><code>vblank_time</code></em></span></dt><dd><p>
11     Pointer to struct timeval which should receive the timestamp
12    </p></dd><dt><span class="term"><em class="parameter"><code>flags</code></em></span></dt><dd><p>
13     Flags to pass to driver:
14     0 = Default,
15     DRM_CALLED_FROM_VBLIRQ = If function is called from vbl IRQ handler
16    </p></dd><dt><span class="term"><em class="parameter"><code>mode</code></em></span></dt><dd><p>
17     mode which defines the scanout timings
18    </p></dd></dl></div></div><div class="refsect1"><a name="id-1.3.4.11.10.7.6"></a><h2>Description</h2><p>
19   Implements calculation of exact vblank timestamps from given drm_display_mode
20   timings and current video scanout position of a CRTC. This can be called from
21   within <code class="function">get_vblank_timestamp</code> implementation of a kms driver to implement the
22   actual timestamping.
23   </p><p>
24
25   Should return timestamps conforming to the OML_sync_control OpenML
26   extension specification. The timestamp corresponds to the end of
27   the vblank interval, aka start of scanout of topmost-leftmost display
28   pixel in the following video frame.
29   </p><p>
30
31   Requires support for optional dev-&gt;driver-&gt;<code class="function">get_scanout_position</code>
32   in kms driver, plus a bit of setup code to provide a drm_display_mode
33   that corresponds to the true scanout timing.
34   </p><p>
35
36   The current implementation only handles standard video modes. It
37   returns as no operation if a doublescan or interlaced video mode is
38   active. Higher level code is expected to handle this.
39</p></div><div class="refsect1"><a name="id-1.3.4.11.10.7.7"></a><h2>Returns</h2><p>
40   Negative value on error, failure or if not supported in current
41</p></div><div class="refsect1"><a name="id-1.3.4.11.10.7.8"></a><h2>video mode</h2><p>
42   </p><p>
43
44   -EINVAL   - Invalid CRTC.
45   -EAGAIN   - Temporary unavailable, e.g., called before initial modeset.
46   -ENOTSUPP - Function not supported in current display mode.
47   -EIO      - Failed, e.g., due to failed scanout position query.
48   </p><p>
49
50   Returns or'ed positive status flags on success:
51   </p><p>
52
53   DRM_VBLANKTIME_SCANOUTPOS_METHOD - Signal this method used for timestamping.
54   DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval.
55</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-drm-calc-timestamping-constants.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="drm-vertical-blank.html#id-1.3.4.11.10">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-drm-vblank-count.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">drm_calc_timestamping_constants</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">drm_vblank_count</span></td></tr></table></div></body></html>
56