For every mode which may be visible to userspace - either current on a CRTC as a result of setcrtc, or advertised through the connector's mode list - cache the drm_mode_modeinfo representation to send back to userspace.
Signed-off-by: Daniel Stone <daniels at collabora.com> --- drivers/gpu/drm/drm_modes.c | 2 ++ include/drm/drm_modes.h | 1 + 2 files changed, 3 insertions(+) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index bb46335..803e00a 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -969,6 +969,7 @@ struct drm_display_mode *drm_mode_new_from_umode(struct drm_device *dev, out->type = in->type; strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); out->name[DRM_DISPLAY_MODE_LEN-1] = 0; + out->umode = *in; out->status = drm_mode_validate_basic(out); if (out->status != MODE_OK) @@ -1282,6 +1283,7 @@ void drm_mode_connector_list_update(struct drm_connector *connector, } if (!found_it) { + drm_mode_convert_to_umode(&pmode->umode, pmode); list_move_tail(&pmode->head, &connector->modes); } } diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index ea2f0c2..e7eb727 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -100,6 +100,7 @@ struct drm_display_mode { /* Header */ struct list_head head; struct drm_mode_object base; + struct drm_mode_modeinfo umode; char name[DRM_DISPLAY_MODE_LEN]; -- 2.3.2