aboutsummaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-07-07 08:58:17 -0700
committerGitHub <noreply@github.com>2018-07-07 08:58:17 -0700
commitbe54278207f5099b77a538e3043758aa59e5c998 (patch)
tree8e322b1c600afa6fd56a325d20e00d0ec054e85b /backend
parent7c6588d7ae0b260aedc61da58eb6bf153b35ca94 (diff)
parent60a83e99f4dc930d7d4ed5999f49967a72b7df32 (diff)
Merge pull request #1095 from agx/output-add-mode
Allow to add additional modes to outputs
Diffstat (limited to 'backend')
-rw-r--r--backend/drm/drm.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index ae462568..05d3d1bd 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -566,6 +566,33 @@ error_conn:
return false;
}
+bool wlr_drm_connector_add_mode(struct wlr_output *output,
+ const drmModeModeInfo *modeinfo) {
+ struct wlr_drm_connector *conn = (struct wlr_drm_connector *)output;
+
+ assert(modeinfo);
+ if (modeinfo->type != DRM_MODE_TYPE_USERDEF) {
+ return false;
+ }
+
+ struct wlr_drm_mode *mode = calloc(1, sizeof(*mode));
+ if (!mode) {
+ return false;
+ }
+ memcpy(&mode->drm_mode, modeinfo, sizeof(*modeinfo));
+
+ mode->wlr_mode.width = mode->drm_mode.hdisplay;
+ mode->wlr_mode.height = mode->drm_mode.vdisplay;
+ mode->wlr_mode.refresh = mode->drm_mode.vrefresh;
+
+ wlr_log(L_INFO, "Registered custom mode "
+ "%"PRId32"x%"PRId32"@%"PRId32,
+ mode->wlr_mode.width, mode->wlr_mode.height,
+ mode->wlr_mode.refresh);
+ wl_list_insert(&conn->output.modes, &mode->wlr_mode.link);
+ return true;
+}
+
static void drm_connector_transform(struct wlr_output *output,
enum wl_output_transform transform) {
output->transform = transform;