diff options
author | Daniel Stone <daniels@collabora.com> | 2016-11-16 10:54:10 +0000 |
---|---|---|
committer | Daniel Stone <daniels@collabora.com> | 2018-02-06 13:55:13 +0000 |
commit | d5526cb974af4b2b56116d9026fa96b2394997f6 (patch) | |
tree | 155fdfe1d0a354474f573d61d47044fc61e0d5db | |
parent | cd011a6e96f9527f98228cf021e3555736c184fe (diff) |
compositor-drm: Add blob_id member to drm_mode
For atomic modesetting support, the mode is identified by a blob
property ID, rather than being passed inline. Add a blob_id member to
drm_mode to handle this, including refactoring mode destruction into a
helper function.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
-rw-r--r-- | libweston/compositor-drm.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c index 7545bad7..282ab684 100644 --- a/libweston/compositor-drm.c +++ b/libweston/compositor-drm.c @@ -234,6 +234,7 @@ struct drm_backend { struct drm_mode { struct weston_mode base; drmModeModeInfo mode_info; + uint32_t blob_id; }; enum drm_fb_type { @@ -3368,6 +3369,7 @@ drm_output_add_mode(struct drm_output *output, const drmModeModeInfo *info) mode->base.refresh = refresh; mode->mode_info = *info; + mode->blob_id = 0; if (info->type & DRM_MODE_TYPE_PREFERRED) mode->base.flags |= WL_OUTPUT_MODE_PREFERRED; @@ -3377,6 +3379,18 @@ drm_output_add_mode(struct drm_output *output, const drmModeModeInfo *info) return mode; } +/** + * Destroys a mode, and removes it from the list. + */ +static void +drm_output_destroy_mode(struct drm_backend *backend, struct drm_mode *mode) +{ + if (mode->blob_id) + drmModeDestroyPropertyBlob(backend->drm.fd, mode->blob_id); + wl_list_remove(&mode->base.link); + free(mode); +} + static int drm_subpixel_to_wayland(int drm_value) { @@ -4332,10 +4346,8 @@ drm_output_destroy(struct weston_output *base) } wl_list_for_each_safe(drm_mode, next, &output->base.mode_list, - base.link) { - wl_list_remove(&drm_mode->base.link); - free(drm_mode); - } + base.link) + drm_output_destroy_mode(b, drm_mode); if (output->pageflip_timer) wl_event_source_remove(output->pageflip_timer); |