summaryrefslogtreecommitdiff
path: root/libdrm
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2007-12-03 13:42:32 +1000
committerDave Airlie <airlied@redhat.com>2007-12-03 15:30:05 +1000
commit96df9b11ad8974d7a2a0a589114cbbb04a584f18 (patch)
tree1d1abe533919afcdc3530a214eb43fcf78e51dbf /libdrm
parent91cd3e3c097d581ea75ec4bcbc1ba8d23b471a2e (diff)
finish of mode add/remove, just have attach/detach modes
Diffstat (limited to 'libdrm')
-rw-r--r--libdrm/xf86drmMode.c24
-rw-r--r--libdrm/xf86drmMode.h15
2 files changed, 6 insertions, 33 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index 8b701381..cf596730 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -372,38 +372,22 @@ err_allocs:
return r;
}
-#if 0
-uint32_t drmModeAddMode(int fd, struct drm_mode_modeinfo *mode_info)
+int drmModeAttachMode(int fd, uint32_t output_id, struct drm_mode_modeinfo *mode_info)
{
- if (ioctl(fd, DRM_IOCTL_MODE_ADDMODE, mode_info))
- return 0;
-
- return mode_info->id;
-}
-
-int drmModeRmMode(int fd, uint32_t mode_id)
-{
- return ioctl(fd, DRM_IOCTL_MODE_RMMODE, &mode_id);
-}
-#endif
-
-int drmModeAttachMode(int fd, uint32_t output_id, uint32_t mode_id)
-{
-
struct drm_mode_mode_cmd res;
+ memcpy(&res.mode, mode_info, sizeof(struct drm_mode_modeinfo));
res.output_id = output_id;
- res.mode_id = mode_id;
return ioctl(fd, DRM_IOCTL_MODE_ATTACHMODE, &res);
}
-int drmModeDetachMode(int fd, uint32_t output_id, uint32_t mode_id)
+int drmModeDetachMode(int fd, uint32_t output_id, struct drm_mode_modeinfo *mode_info)
{
struct drm_mode_mode_cmd res;
+ memcpy(&res.mode, mode_info, sizeof(struct drm_mode_modeinfo));
res.output_id = output_id;
- res.mode_id = mode_id;
return ioctl(fd, DRM_IOCTL_MODE_DETACHMODE, &res);
}
diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h
index 0777c596..a1d717f9 100644
--- a/libdrm/xf86drmMode.h
+++ b/libdrm/xf86drmMode.h
@@ -199,26 +199,15 @@ extern drmModeOutputPtr drmModeGetOutput(int fd,
uint32_t outputId);
/**
- * Adds a new mode from the given mode info.
- * Name must be unique.
- */
-extern uint32_t drmModeAddMode(int fd, struct drm_mode_modeinfo *modeInfo);
-
-/**
- * Removes a mode created with AddMode, must be unused.
- */
-extern int drmModeRmMode(int fd, uint32_t modeId);
-
-/**
* Attaches the given mode to an output.
*/
-extern int drmModeAttachMode(int fd, uint32_t outputId, uint32_t modeId);
+extern int drmModeAttachMode(int fd, uint32_t outputId, struct drm_mode_modeinfo *mode_info);
/**
* Detaches a mode from the output
* must be unused, by the given mode.
*/
-extern int drmModeDetachMode(int fd, uint32_t outputId, uint32_t modeId);
+extern int drmModeDetachMode(int fd, uint32_t outputId, struct drm_mode_modeinfo *mode_info);
extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId);
extern void drmModeFreeProperty(drmModePropertyPtr ptr);