2009/4/1 Ian Romanick <i...@freedesktop.org>: > This is part of the fix for DRI2 front-buffer rendering. > > Signed-off-by: Ian Romanick <ian.d.roman...@intel.com> > --- > 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. > 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 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. cheers, Kristian ------------------------------------------------------------------------------ _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev