Michel Dänzer <mic...@daenzer.net> writes:

> On Sat, 2010-01-16 at 23:00 +0100, Francisco Jerez wrote: 
>> It can be quite an expensive operation, so we're better off not doing
>> it unless it's totally required.
>> 
>> Signed-off-by: Francisco Jerez <curroje...@riseup.net>
>> ---
>>  hw/xfree86/dri2/dri2.c |    6 +++++-
>>  1 files changed, 5 insertions(+), 1 deletions(-)
>> 
>> diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
>> index 3db826e..3f4ed92 100644
>> --- a/hw/xfree86/dri2/dri2.c
>> +++ b/hw/xfree86/dri2/dri2.c
>> @@ -212,6 +212,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int 
>> *height,
>>      int have_fake_front = 0;
>>      int front_format = 0;
>>      int dimensions_match;
>> +    int buffers_changed;
>>      int i;
>>  
>>      if (!pPriv) {
>> @@ -224,6 +225,8 @@ do_get_buffers(DrawablePtr pDraw, int *width, int 
>> *height,
>>      dimensions_match = (pDraw->width == pPriv->width)
>>      && (pDraw->height == pPriv->height);
>>  
>> +    buffers_changed = (pPriv->buffers == NULL);
>> +
>>      buffers = xalloc((count + 1) * sizeof(buffers[0]));
>>  
>>      for (i = 0; i < count; i++) {
>> @@ -280,6 +283,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int 
>> *height,
>>      for (i = 0; i < pPriv->bufferCount; i++) {
>>          if (pPriv->buffers[i] != NULL) {
>>              (*ds->DestroyBuffer)(pDraw, pPriv->buffers[i]);
>> +            buffers_changed = 1;
>>          }
>>      }
>>  
>> @@ -298,7 +302,7 @@ do_get_buffers(DrawablePtr pDraw, int *width, int 
>> *height,
>>       * contents of the real front-buffer.  This ensures correct operation of
>>       * applications that call glXWaitX before calling glDrawBuffer.
>>       */
>> -    if (have_fake_front) {
>> +    if (have_fake_front && buffers_changed) {
>>      BoxRec box;
>>      RegionRec region;
>>  
>
>>From the comment, I think the intention is to do the copy iff there
> wasn't a fake front before but there is one afterwards. Is that what it
> does after your change? I'm having a hard time determining that. :}

I meant to make it do the copy iff it's the initial allocation or it's
being reallocated, but I admit this patch legibility could be
improved. I think I'll post a nicer one later today.

BTW, I'm considering to drop "dri2proto patch2" and "xserver
patch3". The plan was to save the subsequent GetBuffers round-trip when
the DDX implements SwapBuffers with some kind of blitter, but the DRI
driver can be made smart enough to make the slowdown almost unnoticeable
(benchmarked on nv17 with an app at ~600FPS, the FPS drop is less than
0.2%, so I guess it isn't worth the DRI2InfoRec ABI break).

Attachment: pgpBEqUnYlBpL.pgp
Description: PGP signature

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to