[PATCH r128] Remove overuse of COMPOSITE_SETUP()

Michel Dänzer michel at daenzer.net
Mon Mar 3 17:34:14 PST 2014


On Mon, 2014-03-03 at 10:42 -0800, Connor Behan wrote:
> On 03/03/14 01:05 AM, Michel Dänzer wrote:
> > 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 way I wrote COMPOSITE_SETUP() in r128_exa_render.c already accounts
> for this. If composite_setup is false, the macro will be called every
> time until there are no more 3D windows. COMPOSITE_SETUP() only sets
> composite_setup to true when have3DWindows == 0.

Ah, but then you're still calling COMPOSITE_SETUP() more often than
necessary: between R128EnterServer() and R128LeaveServer(), you're
holding the DRI hardware lock, and nothing else can mess with the 3D
register state. But R128CCEPrepareComposite() can be called any number
of times between them.


-- 
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-driver-ati/attachments/20140304/74b9c2c7/attachment.pgp>


More information about the xorg-driver-ati mailing list