diff options
author | Scott Anderson <ascent12@hotmail.com> | 2017-09-30 22:01:59 +1300 |
---|---|---|
committer | Scott Anderson <ascent12@hotmail.com> | 2017-09-30 22:01:59 +1300 |
commit | ec5b95e08f7549fc3628d9790d62f22d8b975300 (patch) | |
tree | 68eb7d7a8d5e178bdc385b0697a6078777c92fd2 | |
parent | 096249a2a1dc604b062a6fef6c4ca56065724d79 (diff) |
Add pointer to backend from DRM outputs
-rw-r--r-- | backend/drm/drm.c | 38 | ||||
-rw-r--r-- | include/backend/drm/drm.h | 3 |
2 files changed, 15 insertions, 26 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 05a050e6..96feba15 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -175,14 +175,13 @@ void wlr_drm_resources_free(struct wlr_drm_backend *backend) { static void wlr_drm_output_make_current(struct wlr_output *_output) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - wlr_drm_surface_make_current(output->renderer, &output->crtc->primary->surf); + wlr_drm_surface_make_current(&output->drm->renderer, &output->crtc->primary->surf); } static void wlr_drm_output_swap_buffers(struct wlr_output *_output) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - struct wlr_drm_backend *backend = - wl_container_of(output->renderer, backend, renderer); - struct wlr_drm_renderer *renderer = output->renderer; + struct wlr_drm_backend *backend = output->drm; + struct wlr_drm_renderer *renderer = &backend->renderer; struct wlr_drm_crtc *crtc = output->crtc; struct wlr_drm_plane *plane = crtc->primary; @@ -200,8 +199,7 @@ static void wlr_drm_output_swap_buffers(struct wlr_output *_output) { static void wlr_drm_output_set_gamma(struct wlr_output *_output, uint16_t size, uint16_t *r, uint16_t *g, uint16_t *b) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - struct wlr_drm_backend *backend = - wl_container_of(output->renderer, backend, renderer); + struct wlr_drm_backend *backend = output->drm; drmModeCrtcSetGamma(backend->fd, output->crtc->id, size, r, g, b); } @@ -219,9 +217,8 @@ void wlr_drm_output_start_renderer(struct wlr_drm_output *output) { return; } - struct wlr_drm_backend *backend = - wl_container_of(output->renderer, backend, renderer); - struct wlr_drm_renderer *renderer = output->renderer; + struct wlr_drm_backend *backend = output->drm; + struct wlr_drm_renderer *renderer = &backend->renderer; struct wlr_drm_crtc *crtc = output->crtc; struct wlr_drm_plane *plane = crtc->primary; @@ -240,8 +237,7 @@ void wlr_drm_output_start_renderer(struct wlr_drm_output *output) { static void wlr_drm_output_enable(struct wlr_output *_output, bool enable) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - struct wlr_drm_backend *backend = - wl_container_of(output->renderer, backend, renderer); + struct wlr_drm_backend *backend = output->drm; if (output->state != WLR_DRM_OUTPUT_CONNECTED) { return; } @@ -367,8 +363,7 @@ static void realloc_crtcs(struct wlr_drm_backend *backend, static bool wlr_drm_output_set_mode(struct wlr_output *_output, struct wlr_output_mode *mode) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - struct wlr_drm_backend *backend - = wl_container_of(output->renderer, backend, renderer); + struct wlr_drm_backend *backend = output->drm; wlr_log(L_INFO, "Modesetting '%s' with '%ux%u@%u mHz'", output->output.name, mode->width, mode->height, mode->refresh); @@ -457,9 +452,8 @@ static void wlr_drm_output_transform(struct wlr_output *output, static bool wlr_drm_output_set_cursor(struct wlr_output *_output, const uint8_t *buf, int32_t stride, uint32_t width, uint32_t height) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - struct wlr_drm_backend *backend - = wl_container_of(output->renderer, backend, renderer); - struct wlr_drm_renderer *renderer = output->renderer; + struct wlr_drm_backend *backend = output->drm; + struct wlr_drm_renderer *renderer = &backend->renderer; struct wlr_drm_crtc *crtc = output->crtc; struct wlr_drm_plane *plane = crtc->cursor; @@ -560,8 +554,7 @@ static bool wlr_drm_output_set_cursor(struct wlr_output *_output, static bool wlr_drm_output_move_cursor(struct wlr_output *_output, int x, int y) { struct wlr_drm_output *output = (struct wlr_drm_output *)_output; - struct wlr_drm_backend *backend = - wl_container_of(output->renderer, backend, renderer); + struct wlr_drm_backend *backend = output->drm; int width, height, tmp; wlr_output_effective_resolution(_output, &width, &height); @@ -678,7 +671,6 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *backend) { output); - output->renderer = &backend->renderer; output->state = WLR_DRM_OUTPUT_DISCONNECTED; output->connector = conn->connector_id; @@ -784,8 +776,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *backend) { static void page_flip_handler(int fd, unsigned seq, unsigned tv_sec, unsigned tv_usec, void *user) { struct wlr_drm_output *output = user; - struct wlr_drm_backend *backend = - wl_container_of(output->renderer, backend, renderer); + struct wlr_drm_backend *backend = output->drm; output->pageflip_pending = false; if (output->state != WLR_DRM_OUTPUT_CONNECTED) { @@ -857,9 +848,8 @@ void wlr_drm_output_cleanup(struct wlr_drm_output *output) { return; } - struct wlr_drm_renderer *renderer = output->renderer; - struct wlr_drm_backend *backend = - wl_container_of(renderer, backend, renderer); + struct wlr_drm_backend *backend = output->drm; + struct wlr_drm_renderer *renderer = &backend->renderer; switch (output->state) { case WLR_DRM_OUTPUT_CONNECTED: diff --git a/include/backend/drm/drm.h b/include/backend/drm/drm.h index b13cb5e7..6f1abc00 100644 --- a/include/backend/drm/drm.h +++ b/include/backend/drm/drm.h @@ -121,6 +121,7 @@ struct wlr_drm_output_mode { struct wlr_drm_output { struct wlr_output output; + struct wlr_drm_backend *drm; enum wlr_drm_output_state state; uint32_t connector; @@ -135,8 +136,6 @@ struct wlr_drm_output { drmModeCrtc *old_crtc; - struct wlr_drm_renderer *renderer; - bool pageflip_pending; struct wl_event_source *retry_pageflip; }; |