[PATCH r128] Remove overuse of COMPOSITE_SETUP()

Michel Dänzer michel at daenzer.net
Mon Mar 3 01:05:41 PST 2014


On Mon, 2014-03-03 at 00:30 -0800, Connor Behan wrote:
> Some expensive register writes must be done in COMPOSITE_SETUP() for
> render ops to work. They only needed to be written again if the 3D
> driver uses them or if there is a VT switch. Resetting the
> composite_setup variable was mistakenly put in R128EnterServer. This
> causes the registers to be written for every render op even if there are
> no 3D windows because the server context is re-entered every time the
> indirect buffer is submitted to the kernel. R128DRITransitionTo3d should
> be used instead.
> 
> Signed-off-by: Connor Behan <connor.behan at gmail.com>
> ---
>  src/r128_dri.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/r128_dri.c b/src/r128_dri.c
> index ff7bbc2..f03147a 100644
> --- a/src/r128_dri.c
> +++ b/src/r128_dri.c
> @@ -308,7 +308,6 @@ static void R128EnterServer(ScreenPtr pScreen)
>  #endif
>  #ifdef USE_EXA
>      if (info->ExaDriver) exaMarkSync(pScreen);
> -    info->state_2d.composite_setup = FALSE;
>  #endif
>  }
>  
> @@ -1521,6 +1520,9 @@ static void R128DRITransitionTo3d(ScreenPtr pScreen)
>      R128EnablePageFlip(pScreen);
>  
>      info->have3DWindows = 1;
> +#ifdef USE_EXA
> +    info->state_2d.composite_setup = FALSE;
> +#endif

I'm afraid this is incorrect. TransitionTo3d() is only called when the
first 3D context starts, so this patch will result in the X driver never
writing to these registers as long as any 3D contexts are active.

The only minor optimization that might be possible is to only reset
info->state_2d.composite_setup in R128EnterServer() if
info->have3DWindows == 1. But I don't remember offhand if
R128EnterServer() will be called in the first place otherwise.


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



More information about the xorg-driver-ati mailing list