summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-05-01 13:16:29 +1000
committerDave Airlie <airlied@linux.ie>2007-05-01 13:16:29 +1000
commit89231953d108e74ee7b0eb99494ead1dd795d640 (patch)
treef53136e928b85ac55f2fabd586def709b0bcb7b9 /libdrm
parent8e8e37515eafbd75b971f57f767ef01344361256 (diff)
Add support for user defined modes
This allows userspace to specify modes and add them to the modesetting system and attach modes to outputs
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drmMode.c33
-rw-r--r--libdrm/xf86drmMode.h16
2 files changed, 25 insertions, 24 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index b695467b..93b0af76 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -376,37 +376,38 @@ err_allocs:
return 0;
}
-#if 0
-uint32_t drmModeNewMode(int fd, struct drm_mode_modeinfo *modeInfo)
+uint32_t drmModeAddMode(int fd, struct drm_mode_modeinfo *mode_info)
{
- /* TODO impl */
+ if (ioctl(fd, DRM_IOCTL_MODE_ADDMODE, mode_info))
+ return 0;
+
+ return mode_info->id;
}
-int drmModeDesMode(int fd, uint32_t modeId)
+int drmModeRmMode(int fd, uint32_t mode_id)
{
- // return ioctl(fd, DRM_IOCTL_MODE_DESMODE, modeId);
+ return ioctl(fd, DRM_IOCTL_MODE_RMMODE, mode_id);
}
-int drmModeAddMode(int fd, uint32_t outputId, uint32_t modeId)
+int drmModeAttachMode(int fd, uint32_t output_id, uint32_t mode_id)
{
- drm_mode_outputmode_t res;
+ struct drm_mode_mode_cmd res;
- res.outputId = outputId;
- res.modeId = modeId;
+ res.output_id = output_id;
+ res.mode_id = mode_id;
- // return ioctl(fd, DRM_IOCTL_MODE_ADDMODE, &res);
+ return ioctl(fd, DRM_IOCTL_MODE_ATTACHMODE, &res);
}
-int drmModeDelMode(int fd, uint32_t outputId, uint32_t modeId)
+int drmModeDetachMode(int fd, uint32_t output_id, uint32_t mode_id)
{
- drm_mode_outputmode_t res;
+ struct drm_mode_mode_cmd res;
- res.outputId = outputId;
- res.modeId = modeId;
+ res.output_id = output_id;
+ res.mode_id = mode_id;
- // return ioctl(fd, DRM_IOCTL_MODE_DELMODE, &res);
+ return ioctl(fd, DRM_IOCTL_MODE_DETACHMODE, &res);
}
-#endif
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index 6aa104a9..60e919ae 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -261,24 +261,24 @@ extern drmModeOutputPtr drmModeGetOutput(int fd,
uint32_t outputId);
/**
- * Creates a new mode from the given mode info.
+ * Adds a new mode from the given mode info.
* Name must be unique.
*/
-extern uint32_t drmModeNewMode(int fd, struct drm_mode_modeinfo *modeInfo);
+extern uint32_t drmModeAddMode(int fd, struct drm_mode_modeinfo *modeInfo);
/**
- * Destroys a mode created with CreateMode, must be unused.
+ * Removes a mode created with AddMode, must be unused.
*/
-extern int drmModeDesMode(int fd, uint32_t modeId);
+extern int drmModeRmMode(int fd, uint32_t modeId);
/**
- * Adds the given mode to an output.
+ * Attaches the given mode to an output.
*/
-extern int drmModeAddMode(int fd, uint32_t outputId, uint32_t modeId);
+extern int drmModeAttachMode(int fd, uint32_t outputId, uint32_t modeId);
/**
- * Deletes a mode Added with AddOutputMode from the output,
+ * Detaches a mode from the output
* must be unused, by the given mode.
*/
-extern int drmModeDelMode(int fd, uint32_t outputId, uint32_t modeId);
+extern int drmModeDetachMode(int fd, uint32_t outputId, uint32_t modeId);