On Fri, Feb 27, 2009 at 2:22 PM, Jesse Barnes <jbar...@virtuousgeek.org> wrote:
> On Thursday, February 26, 2009 1:31:03 pm Jesse Barnes wrote:
>> Add support to Mesa and the intel driver for the new DRI2 swapbuffers
>> interface.  Uses the new flush hook to make sure any outstanding rendering
>> is complete before sending the swapbuffers request.
>
> Need to update the FBconfigs too; we now support the exchange method.
>
> --
> Jesse Barnes, Intel Open Source Technology Center
>
> diff --git a/include/GL/internal/dri_interface.h 
> b/include/GL/internal/dri_interface.h
> index a726b93..b663028 100644
> --- a/include/GL/internal/dri_interface.h
> +++ b/include/GL/internal/dri_interface.h
> @@ -681,6 +681,9 @@ struct __DRIdri2ExtensionRec {
>                                      __DRIcontext *shared,
>                                      void *loaderPrivate);
>
> +    void (*setBuffers)(__DRIdrawable *drawable,
> +                      __DRIbuffer *buffers,
> +                      int count);
>  };

We don't need setBuffers, we can just require the flush extension.
When the flush entry point is called, mark the buffers as invalid
which will cause the dri driver to call getBuffers() before doing any
further rendering.

> @@ -223,8 +226,40 @@ static void dri2CopySubBuffer(__GLXDRIdrawable *pdraw,
>  static void dri2SwapBuffers(__GLXDRIdrawable *pdraw)
>  {
>     __GLXDRIdrawablePrivate *priv = (__GLXDRIdrawablePrivate *) pdraw;
> +    __GLXdisplayPrivate *dpyPriv = __glXInitialize(priv->base.psc->dpy);
> +    __GLXDRIdisplayPrivate *pdp =
> +       (__GLXDRIdisplayPrivate *)dpyPriv->dri2Display;
> +    __GLXscreenConfigs *psc = pdraw->psc;
> +    DRI2Buffer *buffers;
> +    int i, count;
> +
> +#ifdef __DRI2_FLUSH
> +    if (pdraw->psc->f)
> +       (*pdraw->psc->f->flush)(pdraw->driDrawable);
> +#endif
> +
> +    /* Old servers can't handle swapbuffers */
> +    if (!pdp->swapAvailable)
> +       return dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);
> +
> +    buffers = DRI2SwapBuffers(pdraw->psc->dpy, pdraw->drawable, &count);
> +    if (buffers == NULL || !count)
> +       return dri2CopySubBuffer(pdraw, 0, 0, priv->width, priv->height);

As for the AIGLX case, DRI2SwapBuffers should swap the buffers or
fallback to CopyRegion in the server.  This requires an extra round
trip in the fallback case and we have implement the fallback logic
everywhere we use DRI2SwapBuffers instead of just once in the server.

cheers,
Kristian

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to