mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2026-04-21 10:00:45 +02:00
DRI2: handle swapsPending better
Avoid a potential swapsPending underflow by incrementing it before
ScheduleSwap, which may complete it immediately. And be sure to
decrement it again in case the schedule failed.
Reported-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Reviewed-by: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
(cherry picked from commit b00d435ddf)
This commit is contained in:
parent
fcd76ddfc5
commit
5c54e7fa00
1 changed files with 2 additions and 1 deletions
|
|
@ -654,15 +654,16 @@ DRI2SwapBuffers(ClientPtr client, DrawablePtr pDraw, CARD64 target_msc,
|
|||
*swap_target = target_msc;
|
||||
}
|
||||
|
||||
pPriv->swapsPending++;
|
||||
ret = (*ds->ScheduleSwap)(client, pDraw, pDestBuffer, pSrcBuffer,
|
||||
swap_target, divisor, remainder, func, data);
|
||||
if (!ret) {
|
||||
pPriv->swapsPending--; /* didn't schedule */
|
||||
xf86DrvMsg(pScreen->myNum, X_ERROR,
|
||||
"[DRI2] %s: driver failed to schedule swap\n", __func__);
|
||||
return BadDrawable;
|
||||
}
|
||||
|
||||
pPriv->swapsPending++;
|
||||
pPriv->last_swap_target = *swap_target;
|
||||
|
||||
/* According to spec, return expected swapbuffers count SBC after this swap
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue