mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 02:38:04 +02:00
dri3: Stricter SBC wraparound handling
Prevents corrupting the upper 32 bits of draw->recv_sbc when
draw->send_sbc resets to 0 (which currently happens when the window is
unbound from a context and bound to one again), which in turn caused
loader_dri3_swap_buffers_msc to calculate target_msc with corrupted
upper 32 bits. This resulted in hangs with the Xorg modesetting driver
as of xserver 1.20 (older versions and other drivers ignored the upper
32 bits of the target MSC, which is why this wasn't noticed earlier).
Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/106351
Tested-by: Mike Lothian <mike@fireburn.co.uk>
(cherry picked from commit fe2edb25dd)
This commit is contained in:
parent
14689dccbf
commit
e4b86e96e8
1 changed files with 11 additions and 3 deletions
|
|
@ -370,9 +370,17 @@ dri3_handle_present_event(struct loader_dri3_drawable *draw,
|
|||
* checking for wrap.
|
||||
*/
|
||||
if (ce->kind == XCB_PRESENT_COMPLETE_KIND_PIXMAP) {
|
||||
draw->recv_sbc = (draw->send_sbc & 0xffffffff00000000LL) | ce->serial;
|
||||
if (draw->recv_sbc > draw->send_sbc)
|
||||
draw->recv_sbc -= 0x100000000;
|
||||
uint64_t recv_sbc = (draw->send_sbc & 0xffffffff00000000LL) | ce->serial;
|
||||
|
||||
/* Only assume wraparound if that results in exactly the previous
|
||||
* SBC + 1, otherwise ignore received SBC > sent SBC (those are
|
||||
* probably from a previous loader_dri3_drawable instance) to avoid
|
||||
* calculating bogus target MSC values in loader_dri3_swap_buffers_msc
|
||||
*/
|
||||
if (recv_sbc <= draw->send_sbc)
|
||||
draw->recv_sbc = recv_sbc;
|
||||
else if (recv_sbc == (draw->recv_sbc + 0x100000001ULL))
|
||||
draw->recv_sbc = recv_sbc - 0x100000000ULL;
|
||||
|
||||
/* When moving from flip to copy, we assume that we can allocate in
|
||||
* a more optimal way if we don't need to cater for the display
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue