[PATCH weston v9 35/62] compositor-drm: Add blob_id member to drm_mode
Daniel Stone
daniels at collabora.com
Fri Mar 3 23:05:46 UTC 2017
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.
Differential Revision: https://phabricator.freedesktop.org/D1504
Signed-off-by: Daniel Stone <daniels at collabora.com>
---
libweston/compositor-drm.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index 0eb3cfc..9aa2ed8 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -242,6 +242,7 @@ struct drm_backend {
struct drm_mode {
struct weston_mode base;
drmModeModeInfo mode_info;
+ uint32_t blob_id;
};
enum drm_fb_type {
@@ -3196,6 +3197,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;
@@ -3205,6 +3207,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)
{
@@ -4074,6 +4088,7 @@ static void
drm_output_destroy(struct weston_output *base)
{
struct drm_output *output = to_drm_output(base);
+ struct drm_backend *b = to_drm_backend(base->compositor);
struct drm_mode *drm_mode, *next;
if (output->page_flip_pending || output->vblank_pending) {
@@ -4086,10 +4101,8 @@ drm_output_destroy(struct weston_output *base)
drm_output_deinit(&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);
weston_output_destroy(&output->base);
--
2.9.3
More information about the wayland-devel
mailing list