[PATCH] DRI2: fixup handling of last_swap_target
Jesse Barnes
jbarnes at virtuousgeek.org
Thu Mar 4 10:06:44 PST 2010
Yeah, I'll try to apply your series on top and re-post it.
I know this one affects some of the things we discussed, since it makes
offscreen drawing vs. swap interval even more broken than before (i.e.
swap interval and throttling will both be broken when a drawable isn't
being displayed), but on the other hand it'll prevent hangs, so that's
good.
Thanks,
Jesse
On Thu, 4 Mar 2010 19:03:15 +0100
Mario Kleiner <mario.kleiner at tuebingen.mpg.de> wrote:
> Jesse,
>
> i think this patch breaks the patch series i sent out a week ago, the
> one we discussed in length offlist and which you reviewed and
> recommended for inclusion.
>
> How to proceed? Could you try to merge my patches to your tree, then
> reapply your slightly modified patch again? That seems to require
> less shuffling around of code and less time to check everything's
> still sane.
>
> My patch already breaks stuff up similar to yours, you'd only need to
> move a block of setup code fro last_swap_target out of
> DRI2SwapBuffers and into DRI2CreateDrawable again.
>
> -mario
>
>
> On Mar 4, 2010, at 6:23 PM, Jesse Barnes wrote:
>
> > [Sorry for the resend, forgot to cc Keith]
> >
> > We need to initialize the swap target, which is passed to the
> > driver to
> > schedule events. Rather than using -1 to indicate that the field is
> > uninitialized, just make sure we initialize it at drawable creation
> > time.
> >
> > Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>
> >
> > diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
> > index cd69ca0..301f4fd 100644
> > --- a/hw/xfree86/dri2/dri2.c
> > +++ b/hw/xfree86/dri2/dri2.c
> > @@ -116,9 +116,12 @@ DRI2GetDrawable(DrawablePtr pDraw)
> > int
> > DRI2CreateDrawable(DrawablePtr pDraw)
> > {
> > + DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
> > WindowPtr pWin;
> > PixmapPtr pPixmap;
> > DRI2DrawablePtr pPriv;
> > + CARD64 ust;
> > + int ret;
> >
> > pPriv = DRI2GetDrawable(pDraw);
> > if (pPriv != NULL)
> > @@ -141,7 +144,10 @@ DRI2CreateDrawable(DrawablePtr pDraw)
> > pPriv->swap_count = 0;
> > pPriv->target_sbc = -1;
> > pPriv->swap_interval = 1;
> > - pPriv->last_swap_target = -1;
> > + ret = (*ds->GetMSC)(pDraw, &ust, &pPriv->last_swap_target);
> > + if (!ret)
> > + pPriv->last_swap_target = 0;
> > +
> > pPriv->swap_limit = 1; /* default to double buffering */
> >
> > if (pDraw->type == DRAWABLE_WINDOW)
> > @@ -575,7 +581,6 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr
> > pDraw, CARD64 target_msc,
> > DRI2ScreenPtr ds = DRI2GetScreen(pDraw->pScreen);
> > DRI2DrawablePtr pPriv;
> > DRI2BufferPtr pDestBuffer = NULL, pSrcBuffer = NULL;
> > - CARD64 ust;
> > int ret, i;
> >
> > pPriv = DRI2GetDrawable(pDraw);
> > @@ -617,27 +622,6 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr
> > pDraw, CARD64 target_msc,
> > }
> >
> > /*
> > - * In the simple glXSwapBuffers case, all params will be 0,
> > and we just
> > - * need to schedule a swap for the last swap target + the swap
> > interval.
> > - * If the last swap target hasn't been set yet, call into the
> > driver
> > - * to get the current count.
> > - */
> > - if (target_msc == 0 && divisor == 0 && remainder == 0 &&
> > - pPriv->last_swap_target < 0) {
> > - ret = (*ds->GetMSC)(pDraw, &ust, &target_msc);
> > - if (!ret) {
> > - xf86DrvMsg(pScreen->myNum, X_ERROR,
> > - "[DRI2] %s: driver failed to return current MSC\n",
> > - __func__);
> > - return BadDrawable;
> > - }
> > - }
> > -
> > - /* First swap needs to initialize last_swap_target */
> > - if (pPriv->last_swap_target < 0)
> > - pPriv->last_swap_target = target_msc;
> > -
> > - /*
> > * Swap target for this swap is last swap target + swap
> > interval since
> > * we have to account for the current swap count, interval,
> > and the
> > * number of pending swaps.
> > _______________________________________________
> > xorg-devel mailing list
> > xorg-devel at lists.x.org
> > http://lists.x.org/mailman/listinfo/xorg-devel
>
> *********************************************************************
> Mario Kleiner
> Max Planck Institute for Biological Cybernetics
> Spemannstr. 38
> 72076 Tuebingen
> Germany
>
> e-mail: mario.kleiner at tuebingen.mpg.de
> office: +49 (0)7071/601-1623
> fax: +49 (0)7071/601-616
> www: http://www.kyb.tuebingen.mpg.de/~kleinerm
> *********************************************************************
> "For a successful technology, reality must take precedence
> over public relations, for Nature cannot be fooled."
> (Richard Feynman)
>
>
--
Jesse Barnes, Intel Open Source Technology Center
More information about the xorg-devel
mailing list