[PATCH 3/3] DRI2: defer swap if relevant CRTC is in DMPS off state

Michel Dänzer michel at daenzer.net
Fri Dec 14 02:09:12 PST 2012


On Fre, 2012-12-14 at 10:55 +0100, Michel Dänzer wrote: 
> On Don, 2012-12-13 at 14:46 -0500, Ilija Hadzic wrote: 
> > @@ -1337,6 +1345,20 @@ static int radeon_dri2_schedule_swap(ClientPtr client, DrawablePtr draw,
> >          goto blit_fallback;
> >      }
> >  
> > +    nominal_vblank_period = crtc->mode.HTotal * crtc->mode.VTotal;
> > +    nominal_vblank_period /= crtc->mode.Clock;
> > +    /*
> > +     * CRTC is in DPMS off state, fallback to blit, but pace the
> > +     * application at the rate that roughly approximates the
> > +     * nominal frame rate of the relevant CRTC
> > +     */
> > +    if (!radeon_crtc_is_enabled(crtc)) {
> > +	TimerSet(NULL, 0, nominal_vblank_period, radeon_dri2_deferred_swap,
> > +		 swap_info);
> > +	*target_msc = 0;
> > +	return TRUE;
> > +    }
> 
> This will always wait for (at least) nominal_vblank_period milliseconds
> before performing the swap, but a significant part of that (or even more
> time) might have passed already since the last swap of the drawable. You
> could keep track of the previous swap time (from the event tv_(u)sec
> values or GetTimeInMillis()) in a drawable private and only wait for the
> amount of time actually necessary.

Also, this needs to take target_msc into account.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-driver-ati mailing list