[Mesa-dev] [PATCH 1/3] dri2: Implement a throttle dri extension.

Michel Dänzer michel at daenzer.net
Tue Oct 11 08:29:46 PDT 2011


On Die, 2011-10-11 at 15:44 +0200, Thomas Hellstrom wrote: 
> The X server has limited throttle support on the server side,
> but doing this in the client has some benefits:
> 
> 1) X server throttling is per client. Client side throttling can be done
> per drawable.
> 
> 2) It's easier to control the throttling based on what client is run,
> for example using "driconf".
> 
> 3) X server throttling requires drm swap complete events.
> 
> So implement a dri2 throttling extension intended to be used by direct
> rendering clients.

I'm on the fence about whether it's better to add a new extension for
this or to add anything missing to the flush extension instead, as the
callsites are basically the same.


> @@ -390,6 +393,15 @@ dri2CopySubBuffer(__GLXDRIdrawable *pdraw, int x, int y, int width, int height)
>        (*psc->f->flush) (priv->driDrawable);
>  #endif
>  
> +   if (psc->throttle) {
> +      struct glx_context *gc = __glXGetCurrentContext();
> +      struct dri2_context *dri2Ctx = (struct dri2_context *)gc;
> +      __DRIcontext *ctx =
> +	 (dri2Ctx) ? dri2Ctx->driContext : NULL;
> +
> +      psc->throttle->throttle(ctx, priv->driDrawable, reason);
> +   }
> +

Either way though, these blocks should probably be refactored into a
helper function.


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


More information about the mesa-dev mailing list