<p dir="ltr">On Apr 23, 2014 1:36 PM, "Chad Versace" <<a href="mailto:chad.versace@linux.intel.com">chad.versace@linux.intel.com</a>> wrote:<br>
> On Tue, Apr 22, 2014 at 12:22:12PM -0700, Sarah Sharp wrote:<br>
> > On Fri, Apr 18, 2014 at 06:21:31PM -0700, Jamey Sharp wrote:<br>
> > > - I don't see that MSC has to change at all even after two<br>
> > > eglSwapBuffers calls, if SwapBuffers doesn't sync to vertical retrace.<br>
> ><br>
> > I looked at the EGL 1.5 spec with Chad, and if you look at the<br>
> > definition of eglSwapInterval, you'll see that the "minimum number of<br>
> > video frame periods per buffer swap" is set to 1 by default.  I think<br>
> > one frame period is the time between vertical retraces, but the spec<br>
> > isn't clear on that.<br>
><br>
> The spec is sadly ambiguous on that. It's also ambiguous on whether<br>
> eglSwapBuffers blocks or immediately returns false if too many<br>
> outstanding swaps are pending.<br>
><br>
> I think it's safe to assume that it blocks.  because that's what all EGL<br>
> implementations do that I've used: X11, Android, Wayland, and<br>
> (vacuously) GBM. (More below on why this it's vacuously true that GBM<br>
> implements the blocking behavior).</p>
<p dir="ltr">I'd just feel more comfortable, in a conformance test, if there were specification text you could point to instead of a de facto standard. I note you only mention Linux based GL implementations, after all.</p>

<p dir="ltr">Any day one can use a word like "vacuously" is a good day, though.</p>
<p dir="ltr">> As for eglSwapBuffers being synchronized to vertical retraces, again it<br>
> is on all platforms I've used.</p>
<p dir="ltr">Modulo bugs, presumably, since it certainly isn't reliably synchronized in X right now. :-) But I agree that it's intended to be, especially considering:</p>
<p dir="ltr">> Like Sarah said. If you set env vars that provide nonconformant<br>
> behavior, then your conformance testsuite may fail.</p>
<p dir="ltr">It wasn't obvious to me that that was non-conforming behavior. However, Theo has since pointed out this sentence in the OML_sync_control spec:</p>
<p dir="ltr">"If there are multiple outstanding swaps for the same window, at most one such swap can be satisfied per increment of MSC."</p>
<p dir="ltr">So I retract my first concern. :-)</p>
<p dir="ltr">(Technically this doesn't say the swap has to happen during vertical retrace, but for the purposes of Sarah's tests that doesn't matter.)</p>
<p dir="ltr">> I played with that test app on X11, Wayland, and GBM to discover exactly<br>
> how the swap interval behaves on each platform. Wayland was the<br>
> weirdest.</p>
<p dir="ltr">Out of curiosity, how was Wayland weird?</p>
<p dir="ltr">> I think the test should do this:<br>
><br>
>     Create the EGLConfig as it currently does. That is, do not specify<br>
>     EGL_[MIN|MAX]_SWAP_INTERVAL.  Then immediately query<br>
>     eglGetConfigAttrib(EGL_MIN_SWAP_INTERVAL) and<br>
>     eglGetConfigAttrib(EGL_MAX_SWAP_INTERVAL).<br>
><br>
>     If the max swap interval is 0, then eglSwapBuffers will not block.<br>
>     So report PIGLIT_RESULT_SKIP.<br>
><br>
>     Else, the EGL spec ensures that the surface's swap interval is<br>
>     EGL_MIN_SWAP_INTERVAL. Calculate the expected MSC and SBC from that.<br>
><br>
>     For bonus points, let the desired swap_interval be an input<br>
>     parameter to the test. The test will skip if and only if<br>
>     requested_swap_interval is outside of [EGL_MIN_SWAP_INTERVAL,<br>
>     EGL_MAX_SWAP_INTERVAL]. The test sets the surface's swap interval<br>
>     with eglSwapInterval(requested_swap_interval), calculates expected<br>
>     values of of MSC and SBC, and tests for them.<br>
><br>
> Why is GBM a special case? Because EGLConfigs on GBM have<br>
> EGL_MIN_SWAP_INTERVAL == EGL_MAX_SWAP_INTERVAL == 0. So eglSwapBuffers<br>
> never throttles.</p>
<p dir="ltr">This strikes me as a very satisfying way to handle it, my lingering concerns about unspecified throttling/blocking behavior notwithstanding.</p>
<p dir="ltr">Ooh, and does Mesa set EGL_MAX_SWAP_INTERVAL == 0 if vblank_mode is 0?</p>
<p dir="ltr">Jamey</p>