-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kristian Høgsberg wrote:
> 2009/4/1 Ian Romanick <[email protected]>:
>> This is part of the fix for DRI2 front-buffer rendering.
>>
>> Signed-off-by: Ian Romanick <[email protected]>
>> ---
>>  src/mesa/drivers/dri/intel/intel_context.c |   10 ++++++++--
>>  1 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
>> b/src/mesa/drivers/dri/intel/intel_context.c
>> index 2e76e93..0aa1c18 100644
>> --- a/src/mesa/drivers/dri/intel/intel_context.c
>> +++ b/src/mesa/drivers/dri/intel/intel_context.c
>> @@ -223,8 +223,10 @@ intel_update_renderbuffers(__DRIcontext *context, 
>> __DRIdrawable *drawable)
>>    screen = intel->intelScreen->driScrnPriv;
>>
>>    i = 0;
>> -   if (intel_fb->color_rb[0])
>> +   if (intel_fb->color_rb[0]) {
>> +      attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT;
>>       attachments[i++] = __DRI_BUFFER_FRONT_LEFT;
>> +   }
> 
> This will allocate an extra color buffer for double buffered rendering
> where we don't need it.  We need to ask for
> __DRI_BUFFER_FAKE_FRONT_LEFT and __DRI_BUFFER_FRONT_LEFT when we're
> single buffered and __DRI_BUFFER_FRONT_LEFT and __DRI_BUFFER_BACK_LEFT
> when we're double buffered.

So what happens when an application has a double buffered visual but is
rendering to the front buffer?  If I change glxgears to do a
glDrawBuffer(GL_FRONT) during init and replace the glXSwapBuffers with
glFlush, it should just work.

>>    if (intel_fb->color_rb[1])
>>       attachments[i++] = __DRI_BUFFER_BACK_LEFT;
>>    if (intel_get_renderbuffer(&intel_fb->Base, BUFFER_DEPTH))
>> @@ -261,8 +263,12 @@ intel_update_renderbuffers(__DRIcontext *context, 
>> __DRIdrawable *drawable)
>>    for (i = 0; i < count; i++) {
>>        switch (buffers[i].attachment) {
>>        case __DRI_BUFFER_FRONT_LEFT:
>> +          rb = NULL;
>> +          break;
>> +
>> +       case __DRI_BUFFER_FAKE_FRONT_LEFT:
>>           rb = intel_fb->color_rb[0];
>> -          region_name = "dri2 front buffer";
>> +          region_name = "dri2 fake front buffer";
>>           break;
> 
> color_rb[0] should always correspond to __DRI_BUFFER_FRONT_LEFT so
> GLX_tfp works.  And uhm, I'm just realizing that we don't want the
> fake front buffer for single buffered rendering to pixmaps (or
> pbuffers), where we can render directly to the underlying pixmap.  So
> what I'm thinking is that we shouldn't ask for the fake frontbuffer in
> the dri driver but handle it in the loader.  The dri driver doesn't
> know whether the drawable is a pixmap or a window, so it doesn't know
> whether it should render the the real front or the fake front.
> 
> So my suggestion is to handle this in glxdri2c:dri2GetBuffers().  If
> the driver doesn't ask for a back buffer and we're rendering to a
> window, ask the server for fake and real front buffers, store the real
> front buffer data in the loader drawable private and pass the fake

I think we always have to ask for the real and fake front buffers for
windows.  Other than that, those changes sound reasonable.

> front buffer to the driver as the front buffer.  In fact, it may make
> sense to never pass the real front buffer to the driver except for
> pixmaps, which would stop the driver from being able to scribble to
> the front buffer.

Good thinking.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAknVG/YACgkQX1gOwKyEAw/HnACeNN/yOei3rt2rFZx9yqFxBBL1
hW0Anjs1UHQOxq8ikN8ZxEWLOSN5aTR9
=r8Sk
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to