summaryrefslogtreecommitdiff
path: root/libdrm/xf86drmMode.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-05-30 12:10:01 +1000
committerDave Airlie <airlied@redhat.com>2008-05-30 12:10:01 +1000
commit16a8f824face8067029ef6f3d10f1723d87b23f6 (patch)
tree6319ae8b3d5cbddc38fca82d8cb50e1029867071 /libdrm/xf86drmMode.c
parent8ae82f3a2feb8b8fe56214c4c9e806bf1f87cbf8 (diff)
libdrm: add encoder retrival
Diffstat (limited to 'libdrm/xf86drmMode.c')
-rw-r--r--libdrm/xf86drmMode.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c
index ae15fd65..e5798f96 100644
--- a/libdrm/xf86drmMode.c
+++ b/libdrm/xf86drmMode.c
@@ -139,6 +139,8 @@ drmModeResPtr drmModeGetResources(int fd)
res.crtc_id_ptr = VOID2U64(drmMalloc(res.count_crtcs*sizeof(uint32_t)));
if (res.count_outputs)
res.output_id_ptr = VOID2U64(drmMalloc(res.count_outputs*sizeof(uint32_t)));
+ if (res.count_encoders)
+ res.encoder_id_ptr = VOID2U64(drmMalloc(res.count_encoders*sizeof(uint32_t)));
if (ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
r = NULL;
@@ -164,11 +166,13 @@ drmModeResPtr drmModeGetResources(int fd)
r->fbs = drmAllocCpy(U642VOID(res.fb_id_ptr), res.count_fbs, sizeof(uint32_t));
r->crtcs = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
r->outputs = drmAllocCpy(U642VOID(res.output_id_ptr), res.count_outputs, sizeof(uint32_t));
+ r->encoders = drmAllocCpy(U642VOID(res.encoder_id_ptr), res.count_encoders, sizeof(uint32_t));
err_allocs:
drmFree(U642VOID(res.fb_id_ptr));
drmFree(U642VOID(res.crtc_id_ptr));
drmFree(U642VOID(res.output_id_ptr));
+ drmFree(U642VOID(res.encoder_id_ptr));
return r;
}
@@ -334,6 +338,29 @@ int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y)
}
/*
+ * Encoder get
+ */
+drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id)
+{
+ struct drm_mode_get_encoder enc;
+ drmModeEncoderPtr r = NULL;
+
+ enc.encoder_id = encoder_id;
+ enc.encoder_type = 0;
+ enc.crtcs = 0;
+ enc.clones = 0;
+
+ if (ioctl(fd, DRM_IOCTL_MODE_GETENCODER, &enc))
+ return 0;
+
+ r->encoder_type = enc.encoder_type;
+ r->crtcs = enc.crtcs;
+ r->clones = enc.clones;
+
+ return r;
+}
+
+/*
* Output manipulation
*/