diff options
Diffstat (limited to 'libdrm')
-rw-r--r-- | libdrm/xf86drmMode.c | 33 | ||||
-rw-r--r-- | libdrm/xf86drmMode.h | 16 |
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); |