[PATCH r128] Remove overuse of COMPOSITE_SETUP()

Connor Behan connor.behan at gmail.com
Mon Mar 3 10:42:35 PST 2014


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.
> 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.
>
This has the same effect when I try it. I can submit a patch that does
it this way if you like.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 555 bytes
Desc: OpenPGP digital signature
URL: <http://lists.x.org/archives/xorg-driver-ati/attachments/20140303/83dd3e14/attachment.pgp>


More information about the xorg-driver-ati mailing list