1
0
Fork 0
mirror of https://github.com/yshui/picom.git synced 2025-04-14 17:53:25 -04:00

vblank: be more defensive against NVIDIA

There is a bug in the NVIDIA driver that it sometimes does not store msc
into the pointer we passed to glXWaitVideoSyncSGI, leaving `last_msc`
uninitialized.

This change makes sure `last_msc` is always initialized regardless of
this bug.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-10-17 16:47:41 +01:00
parent e65ebd7d53
commit 01b6766519
No known key found for this signature in database
GPG key ID: D3A4405BE6CC17F4

View file

@ -214,6 +214,8 @@ static void *sgi_video_sync_thread(void *data) {
pthread_cond_signal(&args->start_cnd);
pthread_mutex_unlock(&args->start_mtx);
unsigned int last_msc = 0;
pthread_mutex_lock(&self->vblank_requested_mtx);
while (self->running) {
if (!self->vblank_requested) {
@ -223,10 +225,9 @@ static void *sgi_video_sync_thread(void *data) {
}
pthread_mutex_unlock(&self->vblank_requested_mtx);
unsigned int last_msc;
glXWaitVideoSyncSGI(1, 0, &last_msc);
struct timespec now;
struct timespec now = {};
clock_gettime(CLOCK_MONOTONIC, &now);
atomic_store(&self->current_msc, last_msc);
atomic_store(&self->current_ust,