On Don, 2012-12-13 at 14:46 -0500, Ilija Hadzic wrote: > From: Ilija Hadzic <[email protected]> > > If drawable is displayed on a CRTC with a valid mode and > relevant CRTC is in DPMS off state, calculate the nominal > vblank period and defer the swap until the calulated time
'calculated' > elapses. > > This patch fixes a bug that cuased an application to render 'caused' > at uncontrolled rate when CRTC goes into DPMS "off" state, > thus thrashing the GPU and CPU and likely offseting the 'offsetting' > power savings achieved by shutting off the display. > > Signed-off-by: Ilija Hadzic <[email protected]> [...] > @@ -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. The first two patches look good to me. -- Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Debian, X and DRI developer _______________________________________________ xorg-driver-ati mailing list [email protected] http://lists.x.org/mailman/listinfo/xorg-driver-ati
