[ubuntu-x] [Nouveau] [PATCH] dri2: Fix potential race and crash for swap at next vblank.

Maarten Lankhorst maarten.lankhorst at canonical.com
Mon Oct 22 11:20:29 UTC 2012

Op 09-10-12 09:06, Mario Kleiner schreef:
> This fixes a potential race + crash that wasn't properly
> handled by commit 248de8cdbd6d0bc062633b49896fa4791148cd3b
> and happened at least on one users machine.
> That commit wrongly assumed no special action would be needed
> for swaps at next vblank while triple-buffering is enabled on
> XOrg server 1.12 or later.
> Closer inspection of the x-server main dispatch loop shows
> it is possible that the client manages to get the server
> to dispatch a new DRI2GetBuffersWithFormat() call before
> the server calls the vblank event handler and executes
> the nouveau_dri2_finish_swap() routine. Such a race would
> cause a crash, as described in above commit.
> This commit handles the "swap at next vblank" case by
> calling nouveau_dri2_finish_swap() immediately without
> the roundtrip (queue vblank_event -> kernel -> deliver event
> -> x-server processes event -> nouveau vblank event handler),
> before control gets returned to the client.
> This avoids the race while retaining triple-buffering. As
> a bonus, time-critical swaps at next vblank get processed
> without roundtrip delay, increasing the chance of not
> skipping a frame due to vblank miss while sync to vblank is
> on.
> Thanks to Anssi for reporting this problem on the nouveau
> mailing list at 12th July 2012 and for testing this patch.
> Reported-by: Anssi Hannula <anssi.hannula at iki.fi>
> Tested-by: Anssi Hannula <anssi.hannula at iki.fi>
> Signed-off-by: Mario Kleiner <mario.kleiner at tuebingen.mpg.de>
It seems darktama didn't respond so I pushed this fix myself.


More information about the Ubuntu-x mailing list