diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-02 15:24:02 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-10-04 12:55:07 +0100 |
commit | d9a32dc657d6359d19427f5c610be54d15ebb1a9 (patch) | |
tree | 87c1b161bb64161c2cd12cb832d40c70df3fb75f | |
parent | 2579d34713033c75deed3628a50dfcb164028310 (diff) |
sna/dri2: Assert signal is unset before setting
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/sna_display.c | 5 | ||||
-rw-r--r-- | src/sna/sna_dri2.c | 5 | ||||
-rw-r--r-- | test/dri2-race.c | 15 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index cde4ca23..43fe4db4 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1540,7 +1540,8 @@ static void defer_event(struct sna *sna, struct drm_event *base) memcpy(&sna->mode.shadow_events[sna->mode.shadow_nevent++], base, sizeof(struct drm_event_vblank)); - DBG(("%s: deferring event count=%d\n", sna->mode.shadow_nevent)); + DBG(("%s: deferring event count=%d\n", + __func__, sna->mode.shadow_nevent)); } static void flush_events(struct sna *sna) @@ -1550,7 +1551,7 @@ static void flush_events(struct sna *sna) if (!sna->mode.shadow_nevent) return; - DBG(("%s: flushing %d events=%d\n", sna->mode.shadow_nevent)); + DBG(("%s: flushing %d events=%d\n", __func__, sna->mode.shadow_nevent)); for (n = 0; n < sna->mode.shadow_nevent; n++) { struct drm_event_vblank *vb = &sna->mode.shadow_events[n]; diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c index 0c697dda..72cb1280 100644 --- a/src/sna/sna_dri2.c +++ b/src/sna/sna_dri2.c @@ -2697,6 +2697,7 @@ void sna_dri2_vblank_handler(struct drm_event_vblank *event) get_private(info->front)->bo->handle, info->front->name, get_private(info->front)->bo->active_scanout)); assert(info->draw); + assert(!info->signal); info->keepalive++; info->signal = true; } @@ -2847,6 +2848,9 @@ sna_dri2_flip_continue(struct sna_dri2_event *info) if (info->draw == NULL) return false; + assert(!info->signal); + info->signal = info->type == FLIP_THROTTLE; + if (info->sna->mode.front_active == 0) return false; @@ -2863,7 +2867,6 @@ sna_dri2_flip_continue(struct sna_dri2_event *info) info->sna->dri2.flip_pending = info; info->queued = true; assert(info->draw); - info->signal = info->type == FLIP_THROTTLE; return true; } diff --git a/test/dri2-race.c b/test/dri2-race.c index 79dc9c49..ece624f6 100644 --- a/test/dri2-race.c +++ b/test/dri2-race.c @@ -144,6 +144,7 @@ static void race_window(Display *dpy, int width, int height, for (n = 0; n < N_DIVISORS; n++) { loop = 256 >> ffs(divisors[n]); printf("DRI2SwapBuffers(divisor=%d), loop=%d", divisors[n], loop); + fflush(stdout); do { win = XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0, width, height, 0, @@ -174,6 +175,7 @@ static void race_window(Display *dpy, int width, int height, for (n = 0; n < N_DIVISORS; n++) { loop = 256 >> ffs(divisors[n]); printf("xcb_dri2_swap_buffers(divisor=%d), loops=%d", divisors[n], loop); + fflush(stdout); do { win = XCreateWindow(dpy, DefaultRootWindow(dpy), 0, 0, width, height, 0, @@ -204,6 +206,7 @@ static void race_window(Display *dpy, int width, int height, for (n = 0; n < N_DIVISORS; n++) { loop = 256 >> ffs(divisors[n]); printf("DRI2WaitMsc(divisor=%d), loop=%d", divisors[n], loop); + fflush(stdout); do { uint64_t ignore, msc; xcb_connection_t *c = XGetXCBConnection(dpy); @@ -276,6 +279,7 @@ static void race_resize(Display *dpy, int width, int height, loop = 256 >> ffs(divisors[n]); printf("DRI2SwapBuffers(divisor=%d), loop=%d", divisors[n], loop); + fflush(stdout); do { int w, h; @@ -310,6 +314,7 @@ static void race_resize(Display *dpy, int width, int height, loop = 256 >> ffs(divisors[n]); printf("xcb_dri2_swap_buffers(divisor=%d), loops=%d", divisors[n], loop); + fflush(stdout); do { int w, h; @@ -344,6 +349,7 @@ static void race_resize(Display *dpy, int width, int height, loop = 256 >> ffs(divisors[n]); printf("DRI2WaitMsc(divisor=%d), loop=%d", divisors[n], loop); + fflush(stdout); do { uint64_t ignore, msc; xcb_connection_t *c = XGetXCBConnection(dpy); @@ -393,6 +399,7 @@ static void race_manager(Display *dpy, int width, int height, attr.override_redirect = 1; for (n = 0; n < N_DIVISORS; n++) { printf("DRI2SwapBuffers(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { win = XCreateWindow(dpy, DefaultRootWindow(dpy), @@ -425,6 +432,7 @@ static void race_manager(Display *dpy, int width, int height, for (n = 0; n < N_DIVISORS; n++) { printf("xcb_dri2_swap_buffers(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { win = XCreateWindow(dpy, DefaultRootWindow(dpy), @@ -457,6 +465,7 @@ static void race_manager(Display *dpy, int width, int height, for (n = 0; n < N_DIVISORS; n++) { printf("DRI2WaitMsc(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { uint64_t ignore, msc; @@ -518,6 +527,7 @@ static void race_close(int width, int height, attr.override_redirect = 1; for (n = 0; n < N_DIVISORS; n++) { printf("DRI2SwapBuffers(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { Display *dpy = XOpenDisplay(NULL); @@ -547,6 +557,7 @@ static void race_close(int width, int height, for (n = 0; n < N_DIVISORS; n++) { printf("xcb_dri2_swap_buffers(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { Display *dpy = XOpenDisplay(NULL); @@ -576,6 +587,7 @@ static void race_close(int width, int height, for (n = 0; n < N_DIVISORS; n++) { printf("DRI2WaitMsc(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { uint64_t ignore, msc; @@ -629,6 +641,7 @@ static void race_client(int width, int height, attr.override_redirect = 1; for (n = 0; n < N_DIVISORS; n++) { printf("DRI2SwapBuffers(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { Display *dpy = XOpenDisplay(NULL); @@ -672,6 +685,7 @@ static void race_client(int width, int height, for (n = 0; n < N_DIVISORS; n++) { printf("xcb_dri2_swap_buffers(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { Display *dpy = XOpenDisplay(NULL); @@ -715,6 +729,7 @@ static void race_client(int width, int height, for (n = 0; n < N_DIVISORS; n++) { printf("DRI2WaitMsc(divisor=%d)", divisors[n]); + fflush(stdout); loop = 256 >> ffs(divisors[n]); do { Display *dpy = XOpenDisplay(NULL); |