From c8c66191460387d9578b336d6ff624b0b10db698 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 14 Aug 2017 08:03:51 -0400 Subject: Refactor out wlr_output_mode_state --- backend/drm/drm.c | 22 +++++++++++----------- include/backend/drm.h | 4 ++-- include/wlr/types/wlr_output.h | 3 --- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index 13d5aa0b..424c7685 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -324,7 +324,9 @@ void wlr_drm_output_start_renderer(struct wlr_drm_output *output) { bo = plane->back; } - drmModeModeInfo *mode = &output->output.current_mode->state->mode; + struct wlr_drm_output_mode *_mode = + (struct wlr_drm_output_mode *)output->output.current_mode; + drmModeModeInfo *mode = &_mode->mode; backend->iface->crtc_pageflip(backend, output, crtc, get_fb_for_bo(bo), mode); output->pageflip_pending = true; } @@ -760,18 +762,16 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *backend) { wlr_log(L_INFO, "Detected modes:"); for (int i = 0; i < conn->count_modes; ++i) { - struct wlr_output_mode_state *_state = calloc(1, - sizeof(struct wlr_output_mode_state)); - _state->mode = conn->modes[i]; - struct wlr_output_mode *mode = calloc(1, - sizeof(struct wlr_output_mode)); - mode->width = _state->mode.hdisplay; - mode->height = _state->mode.vdisplay; - mode->refresh = calculate_refresh_rate(&_state->mode); - mode->state = _state; + struct wlr_drm_output_mode *mode = calloc(1, + sizeof(struct wlr_drm_output_mode)); + mode->mode = conn->modes[i]; + mode->wlr_mode.width = mode->mode.hdisplay; + mode->wlr_mode.height = mode->mode.vdisplay; + mode->wlr_mode.refresh = calculate_refresh_rate(&mode->mode); wlr_log(L_INFO, " %"PRId32"@%"PRId32"@%"PRId32, - mode->width, mode->height, mode->refresh); + mode->wlr_mode.width, mode->wlr_mode.height, + mode->wlr_mode.refresh); list_add(output->output.modes, mode); } diff --git a/include/backend/drm.h b/include/backend/drm.h index 858b4616..25bbd1f7 100644 --- a/include/backend/drm.h +++ b/include/backend/drm.h @@ -133,8 +133,8 @@ enum wlr_drm_output_state { WLR_DRM_OUTPUT_CONNECTED, }; -struct wlr_output_mode_state { - struct wlr_wl_output_mode *wlr_mode; +struct wlr_drm_output_mode { + struct wlr_output_mode wlr_mode; drmModeModeInfo mode; }; diff --git a/include/wlr/types/wlr_output.h b/include/wlr/types/wlr_output.h index a669e3bb..11160d33 100644 --- a/include/wlr/types/wlr_output.h +++ b/include/wlr/types/wlr_output.h @@ -4,10 +4,7 @@ #include #include -struct wlr_output_mode_state; - struct wlr_output_mode { - struct wlr_output_mode_state *state; uint32_t flags; // enum wl_output_mode int32_t width, height; int32_t refresh; // mHz -- cgit v1.2.3