From 03c9b460346592c902920de2fe16a15dd72f71df Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 15:15:42 -0400 Subject: [PATCH 1/6] Have backend manage opengl context --- backend/drm/drm.c | 30 +++++++++++++++--------------- example/main.c | 8 +------- include/wlr/backend/drm.h | 3 --- 3 files changed, 16 insertions(+), 25 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index db75853dc..8ec27b80f 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -94,23 +94,21 @@ static uint32_t get_fb_for_bo(int fd, struct gbm_bo *bo) { return *id; } -void wlr_drm_output_begin(struct wlr_output *output) { - struct wlr_output_state *_output = output->state; - struct wlr_drm_renderer *renderer = _output->renderer; - eglMakeCurrent(renderer->egl.display, _output->egl, - _output->egl, renderer->egl.context); +static void wlr_drm_output_begin(struct wlr_output_state *output) { + struct wlr_drm_renderer *renderer = output->renderer; + eglMakeCurrent(renderer->egl.display, output->egl, + output->egl, renderer->egl.context); } -void wlr_drm_output_end(struct wlr_output *output) { - struct wlr_output_state *_output = output->state; - struct wlr_drm_renderer *renderer = _output->renderer; +static void wlr_drm_output_end(struct wlr_output_state *output) { + struct wlr_drm_renderer *renderer = output->renderer; - eglSwapBuffers(renderer->egl.display, _output->egl); - struct gbm_bo *bo = gbm_surface_lock_front_buffer(_output->gbm); + eglSwapBuffers(renderer->egl.display, output->egl); + struct gbm_bo *bo = gbm_surface_lock_front_buffer(output->gbm); uint32_t fb_id = get_fb_for_bo(renderer->fd, bo); - drmModePageFlip(renderer->fd, _output->crtc, fb_id, DRM_MODE_PAGE_FLIP_EVENT, _output); - gbm_surface_release_buffer(_output->gbm, bo); - _output->pageflip_pending = true; + drmModePageFlip(renderer->fd, output->crtc, fb_id, DRM_MODE_PAGE_FLIP_EVENT, output); + gbm_surface_release_buffer(output->gbm, bo); + output->pageflip_pending = true; } static bool display_init_renderer(struct wlr_drm_renderer *renderer, @@ -396,7 +394,9 @@ static void page_flip_handler(int fd, unsigned seq, output->pageflip_pending = false; if (output->state == DRM_OUTPUT_CONNECTED) { + wlr_drm_output_begin(output); wl_signal_emit(&output->wlr_output->events.frame, output->wlr_output); + wlr_drm_output_end(output); } } @@ -465,10 +465,10 @@ void wlr_drm_output_dpms(int fd, struct wlr_output_state *output, bool screen_on DRM_MODE_DPMS_ON); // Start rendering loop again by drawing a black frame - wlr_drm_output_begin(output->wlr_output); + wlr_drm_output_begin(output); glClearColor(0.0, 0.0, 0.0, 1.0); glClear(GL_COLOR_BUFFER_BIT); - wlr_drm_output_end(output->wlr_output); + wlr_drm_output_end(output); } else { drmModeConnectorSetProperty(fd, output->connector, output->props.dpms, DRM_MODE_DPMS_STANDBY); diff --git a/example/main.c b/example/main.c index ed9eac0bd..fb475ac8a 100644 --- a/example/main.c +++ b/example/main.c @@ -24,9 +24,7 @@ struct output_state { }; void output_frame(struct wl_listener *listener, void *data) { - struct wlr_output *output = data; - struct output_state *ostate = wl_container_of( - listener, ostate, frame); + struct output_state *ostate = wl_container_of(listener, ostate, frame); struct state *s = ostate->state; struct timespec now; @@ -48,12 +46,8 @@ void output_frame(struct wl_listener *listener, void *data) { s->last_frame = now; - wlr_drm_output_begin(output); - glClearColor(s->color[0], s->color[1], s->color[2], 1.0); glClear(GL_COLOR_BUFFER_BIT); - - wlr_drm_output_end(output); } void output_add(struct wl_listener *listener, void *data) { diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index c76d280a0..fecd65dd3 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -12,7 +12,4 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, void wlr_drm_backend_dpms(struct wlr_backend *backend, bool screen_on); -void wlr_drm_output_begin(struct wlr_output *out); -void wlr_drm_output_end(struct wlr_output *out); - #endif From fee409bd0af6f2e77116e7d8eddf99dd5225b1dc Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 15:38:26 -0400 Subject: [PATCH 2/6] Generalize DPMS, remove DRM refs from example --- backend/backend.c | 10 +++++++++ backend/drm/backend.c | 8 ------- backend/drm/drm.c | 43 ++++++++++++++++++++------------------ example/main.c | 38 ++++++++++++++++++++------------- include/backend/drm/drm.h | 1 - include/wayland.h | 2 +- include/wlr/backend.h | 4 +++- include/wlr/backend/drm.h | 4 ---- include/wlr/wayland.h | 1 + wayland/types/wlr_output.c | 4 ++++ 10 files changed, 65 insertions(+), 50 deletions(-) diff --git a/backend/backend.c b/backend/backend.c index 753bb3aed..c6afe9ed7 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -2,7 +2,9 @@ #include #include #include +#include #include "common/log.h" +#include "backend/drm/backend.h" #include "backend.h" struct wlr_backend *wlr_backend_create(const struct wlr_backend_impl *impl, @@ -34,3 +36,11 @@ void wlr_backend_destroy(struct wlr_backend *backend) { // TODO: free outputs free(backend); } + +struct wlr_backend *wlr_backend_autocreate(struct wl_display *display, + struct wlr_session *session) { + // TODO: Choose the most appropriate backend for the situation + struct wlr_backend *wlr; + wlr = wlr_drm_backend_create(display, session); + return wlr; +} diff --git a/backend/drm/backend.c b/backend/drm/backend.c index f202d4d6c..0da84745b 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -101,11 +101,3 @@ error_backend: free(backend); return NULL; } - -void wlr_drm_backend_dpms(struct wlr_backend *backend, bool screen_on) { - struct wlr_backend_state *state = backend->state; - for (size_t i = 0; i < state->outputs->length; ++i) { - struct wlr_output_state *output = state->outputs->items[i]; - wlr_drm_output_dpms(state->fd, output, screen_on); - } -} diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 8ec27b80f..e9af98991 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -236,6 +236,28 @@ error: return false; } +static void wlr_drm_output_enable(struct wlr_output_state *output, bool enable) { + struct wlr_backend_state *state = + wl_container_of(output->renderer, state, renderer); + if (output->state != DRM_OUTPUT_CONNECTED) { + return; + } + + if (enable) { + drmModeConnectorSetProperty(state->fd, output->connector, output->props.dpms, + DRM_MODE_DPMS_ON); + + // Start rendering loop again by drawing a black frame + wlr_drm_output_begin(output); + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + wlr_drm_output_end(output); + } else { + drmModeConnectorSetProperty(state->fd, output->connector, output->props.dpms, + DRM_MODE_DPMS_STANDBY); + } +} + static void wlr_drm_output_destroy(struct wlr_output_state *output) { wlr_drm_output_cleanup(output, true); wlr_drm_renderer_free(output->renderer); @@ -244,6 +266,7 @@ static void wlr_drm_output_destroy(struct wlr_output_state *output) { static struct wlr_output_impl output_impl = { .set_mode = wlr_drm_output_set_mode, + .enable = wlr_drm_output_enable, .destroy = wlr_drm_output_destroy, }; @@ -454,23 +477,3 @@ void wlr_drm_output_cleanup(struct wlr_output_state *output, bool restore) { } // TODO: free wlr_output } - -void wlr_drm_output_dpms(int fd, struct wlr_output_state *output, bool screen_on) { - if (output->state != DRM_OUTPUT_CONNECTED) { - return; - } - - if (screen_on) { - drmModeConnectorSetProperty(fd, output->connector, output->props.dpms, - DRM_MODE_DPMS_ON); - - // Start rendering loop again by drawing a black frame - wlr_drm_output_begin(output); - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - wlr_drm_output_end(output); - } else { - drmModeConnectorSetProperty(fd, output->connector, output->props.dpms, - DRM_MODE_DPMS_STANDBY); - } -} diff --git a/example/main.c b/example/main.c index fb475ac8a..6fd7010c9 100644 --- a/example/main.c +++ b/example/main.c @@ -4,8 +4,9 @@ #include #include #include -#include +#include #include +#include #include struct state { @@ -40,7 +41,6 @@ void output_frame(struct wl_listener *listener, void *data) { if (s->color[s->dec] < 0.0f) { s->color[inc] = 1.0f; s->color[s->dec] = 0.0f; - s->dec = inc; } @@ -75,15 +75,23 @@ int timer_done(void *data) { return 1; } -int dpms_on(void *data) { - struct wlr_backend *backend = data; - wlr_drm_backend_dpms(backend, false); +int enable_outputs(void *data) { + struct state *state = data; + for (size_t i = 0; i < state->outputs->length; ++i) { + struct output_state *ostate = state->outputs->items[i]; + struct wlr_output *output = ostate->output; + wlr_output_enable(output, true); + } return 1; } -int dpms_off(void *data) { - struct wlr_backend *backend = data; - wlr_drm_backend_dpms(backend, true); +int disable_outputs(void *data) { + struct state *state = data; + for (size_t i = 0; i < state->outputs->length; ++i) { + struct output_state *ostate = state->outputs->items[i]; + struct wlr_output *output = ostate->output; + wlr_output_enable(output, false); + } return 1; } @@ -116,7 +124,7 @@ int main() { return 1; } - struct wlr_backend *wlr = wlr_drm_backend_create(display, session); + struct wlr_backend *wlr = wlr_backend_autocreate(display, session); wl_signal_add(&wlr->events.output_add, &state.output_add); wl_signal_add(&wlr->events.output_remove, &state.output_remove); if (!wlr || !wlr_backend_init(wlr)) { @@ -126,14 +134,14 @@ int main() { bool done = false; struct wl_event_source *timer = wl_event_loop_add_timer(event_loop, timer_done, &done); - struct wl_event_source *timer_dpms_on = wl_event_loop_add_timer(event_loop, - dpms_on, wlr); - struct wl_event_source *timer_dpms_off = wl_event_loop_add_timer(event_loop, - dpms_off, wlr); + struct wl_event_source *timer_disable_outputs = + wl_event_loop_add_timer(event_loop, disable_outputs, &state); + struct wl_event_source *timer_enable_outputs = + wl_event_loop_add_timer(event_loop, enable_outputs, &state); wl_event_source_timer_update(timer, 20000); - wl_event_source_timer_update(timer_dpms_on, 5000); - wl_event_source_timer_update(timer_dpms_off, 10000); + wl_event_source_timer_update(timer_disable_outputs, 5000); + wl_event_source_timer_update(timer_enable_outputs, 10000); while (!done) { wl_event_loop_dispatch(event_loop, 0); diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index 93de4fb88..52ca65f0c 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -55,7 +55,6 @@ struct wlr_output_state { }; void wlr_drm_output_cleanup(struct wlr_output_state *output, bool restore); -void wlr_drm_output_dpms(int fd, struct wlr_output_state *output, bool screen_on); void wlr_drm_scan_connectors(struct wlr_backend_state *state); int wlr_drm_event(int fd, uint32_t mask, void *data); diff --git a/include/wayland.h b/include/wayland.h index 688179364..ca79fe33e 100644 --- a/include/wayland.h +++ b/include/wayland.h @@ -7,12 +7,12 @@ struct wlr_output_impl { bool (*set_mode)(struct wlr_output_state *state, struct wlr_output_mode *mode); + void (*enable)(struct wlr_output_state *state, bool enable); void (*destroy)(struct wlr_output_state *state); }; struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, struct wlr_output_state *state); - void wlr_output_free(struct wlr_output *output); #endif diff --git a/include/wlr/backend.h b/include/wlr/backend.h index b424c29f2..32d96a8d3 100644 --- a/include/wlr/backend.h +++ b/include/wlr/backend.h @@ -2,6 +2,7 @@ #define _WLR_BACKEND_H #include +#include struct wlr_backend_impl; struct wlr_backend_state; @@ -22,7 +23,8 @@ struct wlr_backend { } events; }; -struct wlr_backend *wlr_backend_autocreate(); +struct wlr_backend *wlr_backend_autocreate(struct wl_display *display, + struct wlr_session *session); bool wlr_backend_init(struct wlr_backend *backend); void wlr_backend_destroy(struct wlr_backend *backend); diff --git a/include/wlr/backend/drm.h b/include/wlr/backend/drm.h index fecd65dd3..2863f926b 100644 --- a/include/wlr/backend/drm.h +++ b/include/wlr/backend/drm.h @@ -4,12 +4,8 @@ #include #include #include -#include // drmModeModeInfo -#include struct wlr_backend *wlr_drm_backend_create(struct wl_display *display, struct wlr_session *session); -void wlr_drm_backend_dpms(struct wlr_backend *backend, bool screen_on); - #endif diff --git a/include/wlr/wayland.h b/include/wlr/wayland.h index 158acc33d..92bfa459b 100644 --- a/include/wlr/wayland.h +++ b/include/wlr/wayland.h @@ -40,5 +40,6 @@ struct wlr_output { }; bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); +void wlr_output_enable(struct wlr_output *output, bool enable); #endif diff --git a/wayland/types/wlr_output.c b/wayland/types/wlr_output.c index bc093c004..21ffa0784 100644 --- a/wayland/types/wlr_output.c +++ b/wayland/types/wlr_output.c @@ -29,3 +29,7 @@ void wlr_output_free(struct wlr_output *output) { bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode) { return output->impl->set_mode(output->state, mode); } + +void wlr_output_enable(struct wlr_output *output, bool enable) { + output->impl->enable(output->state, enable); +} From 579909a36857575ee23a39abc82d4e3b34096385 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 15:43:13 -0400 Subject: [PATCH 3/6] Promote types to a standalone subproject --- CMakeLists.txt | 2 +- backend/CMakeLists.txt | 2 +- {wayland => types}/CMakeLists.txt | 6 +++--- {wayland/types => types}/wlr_output.c | 0 4 files changed, 5 insertions(+), 5 deletions(-) rename {wayland => types}/CMakeLists.txt (59%) rename {wayland/types => types}/wlr_output.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 616a89115..efb741dfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ include_directories(include) add_subdirectory(backend) add_subdirectory(common) -add_subdirectory(wayland) +add_subdirectory(types) add_subdirectory(session) add_subdirectory(example) diff --git a/backend/CMakeLists.txt b/backend/CMakeLists.txt index fc1793cfb..ef612639f 100644 --- a/backend/CMakeLists.txt +++ b/backend/CMakeLists.txt @@ -18,7 +18,7 @@ add_library(wlr-backend target_link_libraries(wlr-backend wlr-common - wlr-wayland + wlr-types ${WAYLAND_LIBRARIES} ${DRM_LIBRARIES} ${GBM_LIBRARIES} diff --git a/wayland/CMakeLists.txt b/types/CMakeLists.txt similarity index 59% rename from wayland/CMakeLists.txt rename to types/CMakeLists.txt index 675a7bd29..eba92cc0a 100644 --- a/wayland/CMakeLists.txt +++ b/types/CMakeLists.txt @@ -3,11 +3,11 @@ include_directories( ${WAYLAND_INCLUDE_DIR} ) -add_library(wlr-wayland - types/wlr_output.c +add_library(wlr-types + wlr_output.c ) -target_link_libraries(wlr-wayland +target_link_libraries(wlr-types wlr-common ${WAYLAND_LIBRARIES} ) diff --git a/wayland/types/wlr_output.c b/types/wlr_output.c similarity index 100% rename from wayland/types/wlr_output.c rename to types/wlr_output.c From c7f6981d9cdbdb27c415071487ad7974e5b1a94a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 16:17:04 -0400 Subject: [PATCH 4/6] Clean up outputs on exit --- backend/backend.c | 1 - backend/drm/backend.c | 6 +++++- backend/drm/drm.c | 14 +++++++++++--- example/main.c | 17 +++++++++++++++-- include/wlr/wayland.h | 1 + types/wlr_output.c | 4 ++-- 6 files changed, 34 insertions(+), 9 deletions(-) diff --git a/backend/backend.c b/backend/backend.c index c6afe9ed7..e13f67ac8 100644 --- a/backend/backend.c +++ b/backend/backend.c @@ -33,7 +33,6 @@ bool wlr_backend_init(struct wlr_backend *backend) { void wlr_backend_destroy(struct wlr_backend *backend) { backend->impl->destroy(backend->state); - // TODO: free outputs free(backend); } diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 0da84745b..39f29da54 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -6,6 +6,7 @@ #include #include +#include #include #include "backend.h" @@ -23,7 +24,10 @@ static void wlr_drm_backend_destroy(struct wlr_backend_state *state) { if (!state) { return; } - // TODO: free outputs in shared backend code + for (size_t i = 0; state->outputs && i < state->outputs->length; ++i) { + struct wlr_output_state *output = state->outputs->items[i]; + wlr_output_destroy(output->wlr_output); + } wlr_drm_renderer_free(&state->renderer); wlr_udev_free(&state->udev); wlr_session_close_file(state->session, state->fd); diff --git a/backend/drm/drm.c b/backend/drm/drm.c index e9af98991..088539c87 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -103,8 +103,13 @@ static void wlr_drm_output_begin(struct wlr_output_state *output) { static void wlr_drm_output_end(struct wlr_output_state *output) { struct wlr_drm_renderer *renderer = output->renderer; - eglSwapBuffers(renderer->egl.display, output->egl); + if (!eglSwapBuffers(renderer->egl.display, output->egl)) { + return; + } struct gbm_bo *bo = gbm_surface_lock_front_buffer(output->gbm); + if (!bo) { + return; + } uint32_t fb_id = get_fb_for_bo(renderer->fd, bo); drmModePageFlip(renderer->fd, output->crtc, fb_id, DRM_MODE_PAGE_FLIP_EVENT, output); gbm_surface_release_buffer(output->gbm, bo); @@ -399,7 +404,6 @@ void wlr_drm_scan_connectors(struct wlr_backend_state *state) { conn->connection != DRM_MODE_CONNECTED) { wlr_log(L_INFO, "'%s' disconnected", output->name); - // TODO: Destroy wlr_drm_output_cleanup(output, false); } @@ -459,6 +463,11 @@ void wlr_drm_output_cleanup(struct wlr_output_state *output, bool restore) { switch (output->state) { case DRM_OUTPUT_CONNECTED: + output->state = DRM_OUTPUT_DISCONNECTED; + if (restore) { + restore_output(output, renderer->fd); + restore = false; + } eglDestroySurface(renderer->egl.display, output->egl); gbm_surface_destroy(output->gbm); output->egl = EGL_NO_SURFACE; @@ -475,5 +484,4 @@ void wlr_drm_output_cleanup(struct wlr_output_state *output, bool restore) { case DRM_OUTPUT_DISCONNECTED: break; } - // TODO: free wlr_output } diff --git a/example/main.c b/example/main.c index 6fd7010c9..33e77f5ee 100644 --- a/example/main.c +++ b/example/main.c @@ -66,8 +66,21 @@ void output_add(struct wl_listener *listener, void *data) { void output_remove(struct wl_listener *listener, void *data) { struct wlr_output *output = data; - fprintf(stderr, "Output '%s' removed\n", output->name); - // TODO: remove signal from state->output_frame + struct output_state *ostate = NULL; + struct state *state = wl_container_of(listener, state, output_remove); + size_t i; + for (i = 0; i < state->outputs->length; ++i) { + struct output_state *_ostate = state->outputs->items[i]; + if (_ostate->output == output) { + ostate = _ostate; + break; + } + } + if (!ostate) { + return; // We are unfamiliar with this output + } + list_del(state->outputs, i); + wl_list_remove(&ostate->frame.link); } int timer_done(void *data) { diff --git a/include/wlr/wayland.h b/include/wlr/wayland.h index 92bfa459b..4870b84c3 100644 --- a/include/wlr/wayland.h +++ b/include/wlr/wayland.h @@ -41,5 +41,6 @@ struct wlr_output { bool wlr_output_set_mode(struct wlr_output *output, struct wlr_output_mode *mode); void wlr_output_enable(struct wlr_output *output, bool enable); +void wlr_output_destroy(struct wlr_output *output); #endif diff --git a/types/wlr_output.c b/types/wlr_output.c index 21ffa0784..b424aaaf8 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -14,15 +14,15 @@ struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, return output; } -void wlr_output_free(struct wlr_output *output) { +void wlr_output_destroy(struct wlr_output *output) { if (!output) return; + output->impl->destroy(output->state); if (output->make) free(output->make); if (output->model) free(output->model); for (size_t i = 0; output->modes && i < output->modes->length; ++i) { free(output->modes->items[i]); } list_free(output->modes); - output->impl->destroy(output->state); free(output); } From e2ee67125e076af9be1f115051c680f6e3b69be5 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 16:24:32 -0400 Subject: [PATCH 5/6] s/wayland.h/types.h/g --- backend/drm/backend.c | 2 +- backend/drm/drm.c | 2 +- example/main.c | 2 +- include/{wayland.h => types.h} | 2 +- include/wlr/{wayland.h => types.h} | 0 types/wlr_output.c | 6 +++--- 6 files changed, 7 insertions(+), 7 deletions(-) rename include/{wayland.h => types.h} (95%) rename include/wlr/{wayland.h => types.h} (100%) diff --git a/backend/drm/backend.c b/backend/drm/backend.c index 39f29da54..a7e736bb6 100644 --- a/backend/drm/backend.c +++ b/backend/drm/backend.c @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include "backend.h" diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 088539c87..fa91745fa 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -13,7 +13,7 @@ #include #include -#include "wayland.h" +#include "types.h" #include "backend.h" #include "backend/drm/backend.h" #include "backend/drm/drm.h" diff --git a/example/main.c b/example/main.c index 33e77f5ee..ae6029039 100644 --- a/example/main.c +++ b/example/main.c @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include struct state { diff --git a/include/wayland.h b/include/types.h similarity index 95% rename from include/wayland.h rename to include/types.h index ca79fe33e..5513e9364 100644 --- a/include/wayland.h +++ b/include/types.h @@ -2,7 +2,7 @@ #define _WLR_WAYLAND_INTERNAL_H #include -#include +#include #include struct wlr_output_impl { diff --git a/include/wlr/wayland.h b/include/wlr/types.h similarity index 100% rename from include/wlr/wayland.h rename to include/wlr/types.h diff --git a/types/wlr_output.c b/types/wlr_output.c index b424aaaf8..826404a18 100644 --- a/types/wlr_output.c +++ b/types/wlr_output.c @@ -1,8 +1,8 @@ #include #include -#include "wlr/wayland.h" -#include "wlr/common/list.h" -#include "wayland.h" +#include +#include +#include "types.h" struct wlr_output *wlr_output_create(struct wlr_output_impl *impl, struct wlr_output_state *state) { From ae770043460cdfca496dd6caeab55f337f3db37b Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 31 May 2017 16:53:59 -0400 Subject: [PATCH 6/6] Add more logging around udev --- backend/drm/udev.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/drm/udev.c b/backend/drm/udev.c index e5470157f..79e303d66 100644 --- a/backend/drm/udev.c +++ b/backend/drm/udev.c @@ -147,12 +147,16 @@ static int udev_event(int fd, uint32_t mask, void *data) { return 1; } + const char *action = udev_device_get_action(dev); const char *path = udev_device_get_devnode(dev); + + wlr_log(L_DEBUG, "udev event for %s (%s)", + udev_device_get_sysname(dev), action); + if (!path || strcmp(path, udev->drm_path) != 0) { goto out; } - const char *action = udev_device_get_action(dev); if (!action || strcmp(action, "change") != 0) { goto out; } @@ -189,9 +193,8 @@ bool wlr_udev_init(struct wl_display *display, struct wlr_udev *udev) { wlr_log(L_ERROR, "Failed to create udev event source"); goto error_mon; } - - udev->drm_path = NULL; - + + wlr_log(L_DEBUG, "Successfully initialized udev"); return true; error_mon: