diff options
author | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2011-04-16 11:48:36 +0200 |
---|---|---|
committer | Benjamin Franzke <benjaminfranzke@googlemail.com> | 2012-02-28 08:31:49 +0100 |
commit | bbfe3a731191e5c18a0f3abb0f89620920ad54a4 (patch) | |
tree | d5cc9fa76abbb2db5cdecc9e5987e94065aecfd8 | |
parent | 457cae184d47d1068390284ed2fd93fd887a1260 (diff) |
wayland: Schedule writable iterations
Do not iterate writable in update_event_mask directly,
or client apis like EGL that need to flush write
may be blocked or get an unsolicited flags error.
Schedule write at the end of all function invoking wayland calls.
-rw-r--r-- | src/video/wayland/SDL_waylandevents.c | 2 | ||||
-rw-r--r-- | src/video/wayland/SDL_waylandopengl.c | 10 | ||||
-rw-r--r-- | src/video/wayland/SDL_waylandvideo.c | 7 | ||||
-rw-r--r-- | src/video/wayland/SDL_waylandvideo.h | 9 | ||||
-rw-r--r-- | src/video/wayland/SDL_waylandwindow.c | 5 |
5 files changed, 32 insertions, 1 deletions
diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 626d4cf0..5f078375 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -287,6 +287,8 @@ Wayland_display_add_input(SDL_WaylandData *d, uint32_t id) wl_input_device_add_listener(input->input_device, &input_device_listener, input); wl_input_device_set_user_data(input->input_device, input); + + wayland_schedule_write(d); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/wayland/SDL_waylandopengl.c b/src/video/wayland/SDL_waylandopengl.c index 163d2ed9..4919701d 100644 --- a/src/video/wayland/SDL_waylandopengl.c +++ b/src/video/wayland/SDL_waylandopengl.c @@ -33,6 +33,8 @@ Wayland_GL_SwapWindow(_THIS, SDL_Window * window) SDL_WaylandData *data = _this->driverdata; eglSwapBuffers(data->edpy, wind->esurf); + + wayland_schedule_write(data); } int @@ -79,6 +81,8 @@ Wayland_GL_LoadLibrary(_THIS, const char *path) } Wayland_PumpEvents(_this); + wayland_schedule_write(data); + return 0; } @@ -120,6 +124,8 @@ Wayland_GL_UnloadLibrary(_THIS) _this->gl_config.dll_handle = NULL; _this->gl_config.driver_loaded = 0; } + + wayland_schedule_write(data); } SDL_GLContext @@ -138,6 +144,8 @@ Wayland_GL_CreateContext(_THIS, SDL_Window * window) Wayland_GL_MakeCurrent(_this, window, NULL); + wayland_schedule_write(data); + return data->context; } @@ -155,6 +163,8 @@ Wayland_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context) return -1; } + wayland_schedule_write(data); + return 0; } diff --git a/src/video/wayland/SDL_waylandvideo.c b/src/video/wayland/SDL_waylandvideo.c index ea47b64c..c132d85a 100644 --- a/src/video/wayland/SDL_waylandvideo.c +++ b/src/video/wayland/SDL_waylandvideo.c @@ -167,7 +167,9 @@ static int update_event_mask(uint32_t mask, void *data) d->event_mask = mask; if (mask & WL_DISPLAY_WRITABLE) - wl_display_iterate(d->display, WL_DISPLAY_WRITABLE); + d->schedule_write = 1; + else + d->schedule_write = 0; return 0; } @@ -180,6 +182,7 @@ Wayland_VideoInit(_THIS) data = malloc(sizeof *data); if (data == NULL) return 0; + data->schedule_write = 0; _this->driverdata = data; @@ -214,6 +217,8 @@ Wayland_VideoInit(_THIS) display.driverdata = NULL; SDL_AddVideoDisplay(&display); + wayland_schedule_write(data); + return 0; } diff --git a/src/video/wayland/SDL_waylandvideo.h b/src/video/wayland/SDL_waylandvideo.h index 2247b824..77f47679 100644 --- a/src/video/wayland/SDL_waylandvideo.h +++ b/src/video/wayland/SDL_waylandvideo.h @@ -56,10 +56,19 @@ typedef struct int event_fd; int event_mask; + int schedule_write; + const SDL_Scancode *input_table; int input_table_size; } SDL_WaylandData; +static inline void +wayland_schedule_write(SDL_WaylandData *data) +{ + if (data->schedule_write) + wl_display_iterate(data->display, WL_DISPLAY_WRITABLE); +} + #endif /* _SDL_nullvideo_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/wayland/SDL_waylandwindow.c b/src/video/wayland/SDL_waylandwindow.c index 3cfb9c49..eecd7461 100644 --- a/src/video/wayland/SDL_waylandwindow.c +++ b/src/video/wayland/SDL_waylandwindow.c @@ -37,6 +37,8 @@ void Wayland_ShowWindow(_THIS, SDL_Window * window) window->x, window->y, window->w, window->h); */ + + wayland_schedule_write((SDL_WaylandData *) _this->driverdata); } @@ -88,6 +90,8 @@ int Wayland_CreateWindow(_THIS, SDL_Window * window) return -1; } + wayland_schedule_write(c); + printf("created window\n"); return 0; @@ -106,6 +110,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window * window) wl_egl_window_destroy(wind->egl_window); wl_surface_destroy(wind->surface); SDL_free(wind); + wayland_schedule_write(data); } printf("destroyed window\n"); |