1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><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 DRM Developer's Guide"><link rel="up" href="drm-vertical-blank.html#idp1127382092" 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>int <var class="pdparam">crtc</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_crtc * <var class="pdparam">refcrtc</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="idp1127435692"></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>crtc</code></em></span></dt><dd><p> 6 Which CRTC's 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>refcrtc</code></em></span></dt><dd><p> 17 CRTC which defines scanout timing 18 </p></dd><dt><span class="term"><em class="parameter"><code>mode</code></em></span></dt><dd><p> 19 mode which defines the scanout timings 20 </p></dd></dl></div></div><div class="refsect1"><a name="idp1127443708"></a><h2>Description</h2><p> 21 Implements calculation of exact vblank timestamps from given drm_display_mode 22 timings and current video scanout position of a CRTC. This can be called from 23 within <code class="function">get_vblank_timestamp</code> implementation of a kms driver to implement the 24 actual timestamping. 25 </p><p> 26 27 Should return timestamps conforming to the OML_sync_control OpenML 28 extension specification. The timestamp corresponds to the end of 29 the vblank interval, aka start of scanout of topmost-leftmost display 30 pixel in the following video frame. 31 </p><p> 32 33 Requires support for optional dev->driver-><code class="function">get_scanout_position</code> 34 in kms driver, plus a bit of setup code to provide a drm_display_mode 35 that corresponds to the true scanout timing. 36 </p><p> 37 38 The current implementation only handles standard video modes. It 39 returns as no operation if a doublescan or interlaced video mode is 40 active. Higher level code is expected to handle this. 41</p></div><div class="refsect1"><a name="idp1127446372"></a><h2>Returns</h2><p> 42 Negative value on error, failure or if not supported in current 43</p></div><div class="refsect1"><a name="idp1127447044"></a><h2>video mode</h2><p> 44 </p><p> 45 46 -EINVAL - Invalid CRTC. 47 -EAGAIN - Temporary unavailable, e.g., called before initial modeset. 48 -ENOTSUPP - Function not supported in current display mode. 49 -EIO - Failed, e.g., due to failed scanout position query. 50 </p><p> 51 52 Returns or'ed positive status flags on success: 53 </p><p> 54 55 DRM_VBLANKTIME_SCANOUTPOS_METHOD - Signal this method used for timestamping. 56 DRM_VBLANKTIME_INVBL - Timestamp taken while scanout was in vblank interval. 57</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#idp1127382092">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> 58