sna/dri2: Assert signal is unset before setting

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-10-02 15:24:02 +01:00
parent 2579d34713
commit d9a32dc657
3 changed files with 22 additions and 3 deletions

View File

@ -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];

View File

@ -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;
}

View File

@ -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);