<div dir="ltr"><br>
<blockquote cite="mid:CAHofq8MHrbki1XtXeMZGSDSABnu4LUkZDfbYWCvU5Nng0AjM5g@mail.gmail.com" type="cite">
  <div dir="ltr"><div class="gmail_quote">
Add a mechanism by which we can evade the leading edge of vblank. This<br>

guarantees that no two sprite register writes will straddle on either<br>
side of the vblank start, and that means all the writes will be latched<br>
together in one atomic operation.<br></div></div>
</blockquote>
Here only one sprite update followed by the primary enable/disable can be<br>
achieved atomically. But I feel update of all planes are to be considered, i.e<br>
update of planes per pipe basis to achieve atomicity.<br>
<blockquote cite="mid:CAHofq8MHrbki1XtXeMZGSDSABnu4LUkZDfbYWCvU5Nng0AjM5g@mail.gmail.com" type="cite">
  <div dir="ltr">
    <div class="gmail_quote">
<br>
We do the vblank evade by checking the scanline counter, and if it's too<br>
close to the start of vblank (too close has been hardcoded to 100usec<br>
for now), we will wait for the vblank start to pass. In order to<br>
eliminate random delayes from the rest of the system, we operate with<br>
interrupts disabled, except when waiting for the vblank obviously.<br></div>
  </div>
</blockquote>
This can be achieved easily by checking the previous vblank time in<br>
drm_get_last_vblanktimestamp(), using this the next vblank time cab be<br>
predicted. Using these with the hardcoded value 100usec, a check can be<br>
made to continue or to wait for a vblank. For waiting for a vblank instead<br>
of adding new function just use the available intel_wait_for_vblank().<br>
<br>
last_vblank = drm_get_last_vblanktimestamp();<br>
curr_time = do_getttimeofday();<br>
if ((last_vblank +  VBLANK_TIME_INTERVAL) - curr_time.tv_usec > 100)<br>
    /* acquire lock and proceed*/<br>
else<br>
    /* wait for one vblank, acquire lock and proceed */<br>
<br>
Thanks and Regards,<br>
Arun R Murthy<br>
-------------------</div>