[PATCH xf86-video-intel 2/2] Fix handling of target_msc, divisor, remainder in I830DRI2ScheduleSwap()

Mario Kleiner mario.kleiner at tuebingen.mpg.de
Sun Mar 7 00:15:46 PST 2010


On Mar 5, 2010, at 10:09 PM, Jesse Barnes wrote:

> I just fixed these up and pushed them into the tree along with another
> fix for handling offscreen drawables better.  Tests indicate that OML
> swap divisor/remainder stuff is working correctly now.


Thanks for doing that. But stuff got seriously garbled in  
I830ScheduleWaitMSC() inside src/i830_dri.c - this won't work  
correctly for any glXWaitForMscOML(target_msc, divisor, remainder)  
call, except for the special cases with divisor == 0!

This passage...

         /*
          * If divisor is zero, or current_msc is smaller than  
target_msc,
          * we just need to make sure target_msc passes  before  
waking up the
          * client.
          */
         if (divisor == 0) {
...

should read as...

         if (divisor == 0 ||  current_msc < target_msc) {

This passage ...

         /*
          * If the calculated  remainder and the condition isn't  
satisified, it
          * means we've passed the last point where seq % divisor ==  
remainder,
          * so we need to wait for the next time that will happen.
          */
         if ((current_msc % divisor) != remainder)
                 vbl.request.sequence += divisor;

... should be replaced by ...

     vbl.request.sequence = current_msc - (current_msc % divisor) +  
remainder;

     /*
      * If calculated remainder is larger than requested remainder,  
it means
      * we've passed the last point where seq % divisor == remainder,  
so we need
      * to wait for the next time that will happen.
      */
     if ((current_msc % divisor) > remainder)
        vbl.request.sequence += divisor;


Other than that, it's fine.

Oh and in I830DRI2ScheduleSwap() , this statement ...

                 if (pipe > 0)
                         vbl.request.type |= DRM_VBLANK_SECONDARY;

... accidentally got copied twice into the if () clause, which is not  
harmful, but a bit redundant :-)

best,
-mario


*********************************************************************
Mario Kleiner
Max Planck Institute for Biological Cybernetics
Spemannstr. 38
72076 Tuebingen
Germany

e-mail: mario.kleiner at tuebingen.mpg.de
office: +49 (0)7071/601-1623
fax:    +49 (0)7071/601-616
www:    http://www.kyb.tuebingen.mpg.de/~kleinerm
*********************************************************************
"For a successful technology, reality must take precedence
over public relations, for Nature cannot be fooled."
(Richard Feynman)



More information about the xorg-devel mailing list