From 16a8f824face8067029ef6f3d10f1723d87b23f6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 12:10:01 +1000 Subject: libdrm: add encoder retrival --- libdrm/xf86drmMode.c | 27 +++++++++++++++++++++++++++ libdrm/xf86drmMode.h | 15 +++++++++++++++ 2 files changed, 42 insertions(+) (limited to 'libdrm') 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; } @@ -333,6 +337,29 @@ int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y) return ioctl(fd, DRM_IOCTL_MODE_CURSOR, &arg); } +/* + * 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 */ diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index 5171b592..a5ecd099 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -63,6 +63,9 @@ typedef struct _drmModeRes { int count_outputs; uint32_t *outputs; + int count_encoders; + uint32_t *encoders; + uint32_t min_width, max_width; uint32_t min_height, max_height; } drmModeRes, *drmModeResPtr; @@ -106,6 +109,13 @@ typedef struct _drmModeCrtc { } drmModeCrtc, *drmModeCrtcPtr; +typedef struct _drmModeEncoder { + unsigned int encoder_id; + unsigned int encoder_type; + uint32_t crtcs; + uint32_t clones; +} drmModeEncoder, *drmModeEncoderPtr; + typedef enum { DRM_MODE_CONNECTED = 1, DRM_MODE_DISCONNECTED = 2, @@ -221,6 +231,11 @@ int drmModeSetCursor(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width */ int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y); +/** + * Encoder functions + */ +drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id); + /* * Output manipulation */ -- cgit v1.2.3 From fae2c17b313e2838652c32ea4a576172b4063639 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 12:14:44 +1000 Subject: drm: add more encoder interfaces --- libdrm/xf86drmMode.c | 8 ++++++++ libdrm/xf86drmMode.h | 2 ++ 2 files changed, 10 insertions(+) (limited to 'libdrm') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index e5798f96..672a5e2a 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -381,6 +381,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id) out.count_props = 0; out.props_ptr = 0; out.prop_values_ptr = 0; + out.count_encoders = 0; + out.encoders_ptr = 0; if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out)) return 0; @@ -393,6 +395,9 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id) if (out.count_modes) out.modes_ptr = VOID2U64(drmMalloc(out.count_modes*sizeof(struct drm_mode_modeinfo))); + if (out.count_encoders) + out.encoders_ptr = VOID2U64(drmMalloc(out.count_encoders*sizeof(uint32_t))); + if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out)) goto err_allocs; @@ -416,6 +421,8 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id) r->props = drmAllocCpy(U642VOID(out.props_ptr), out.count_props, sizeof(uint32_t)); r->prop_values = drmAllocCpy(U642VOID(out.prop_values_ptr), out.count_props, sizeof(uint64_t)); r->modes = drmAllocCpy(U642VOID(out.modes_ptr), out.count_modes, sizeof(struct drm_mode_modeinfo)); + r->count_encoders = out.count_encoders; + r->encoders = drmAllocCpy(U642VOID(out.encoders_ptr), out.count_encoders, sizeof(uint32_t)); r->output_type = out.output_type; r->output_type_id = out.output_type_id; @@ -423,6 +430,7 @@ err_allocs: drmFree(U642VOID(out.prop_values_ptr)); drmFree(U642VOID(out.props_ptr)); drmFree(U642VOID(out.modes_ptr)); + drmFree(U642VOID(out.encoders_ptr)); return r; } diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index a5ecd099..601a6460 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -154,6 +154,8 @@ typedef struct _drmModeOutput { uint32_t *props; /**< List of property ids */ uint64_t *prop_values; /**< List of property values */ + int count_encoders; + uint32_t *encoders; /**< List of encoder ids */ } drmModeOutput, *drmModeOutputPtr; -- cgit v1.2.3 From 514147e3f3180b46d3e9e6e906580fe232d4ad26 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 12:29:45 +1000 Subject: drm: add encoder free function --- libdrm/xf86drmMode.c | 5 +++++ libdrm/xf86drmMode.h | 1 + 2 files changed, 6 insertions(+) (limited to 'libdrm') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index 672a5e2a..78efe827 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -119,6 +119,11 @@ void drmModeFreeOutput(drmModeOutputPtr ptr) } +void drmModeFreeEncoder(drmModeEncoderPtr ptr) +{ + drmFree(ptr); +} + /* * ModeSetting functions. */ diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index 601a6460..85e3d912 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -165,6 +165,7 @@ extern void drmModeFreeResources( drmModeResPtr ptr ); extern void drmModeFreeFB( drmModeFBPtr ptr ); extern void drmModeFreeCrtc( drmModeCrtcPtr ptr ); extern void drmModeFreeOutput( drmModeOutputPtr ptr ); +extern void drmModeFreeEncoder( drmModeEncoderPtr ptr ); /** * Retrives all of the resources associated with a card. -- cgit v1.2.3 From 1c4b25a2b1c31df190eab173128702d1b5871906 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 13:49:39 +1000 Subject: drm: fix a couple of bugs in the encoder return to userspace --- libdrm/xf86drmMode.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'libdrm') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index 78efe827..0824ec3f 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -167,6 +167,7 @@ drmModeResPtr drmModeGetResources(int fd) r->count_fbs = res.count_fbs; r->count_crtcs = res.count_crtcs; r->count_outputs = res.count_outputs; + r->count_encoders = res.count_encoders; /* TODO we realy should test if these allocs fails. */ 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)); @@ -358,6 +359,9 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id) if (ioctl(fd, DRM_IOCTL_MODE_GETENCODER, &enc)) return 0; + if (!(r = drmMalloc(sizeof(*r)))) + return 0; + r->encoder_type = enc.encoder_type; r->crtcs = enc.crtcs; r->clones = enc.clones; -- cgit v1.2.3 From 9d38448ed33aaff324cc4bbe1e0878593e97d07d Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 15:03:12 +1000 Subject: modesetting: the great renaming. Okay we have crtc, encoder and connectors. No more outputs exposed beyond driver internals I've broken intel tv connector stuff. Really for TV we should have one TV connector, with a sub property for the type of signal been driven over it --- libdrm/xf86drmMode.c | 148 +++++++++++++++++++++++++-------------------------- libdrm/xf86drmMode.h | 42 +++++++-------- 2 files changed, 95 insertions(+), 95 deletions(-) (limited to 'libdrm') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index 0824ec3f..a18c4290 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -109,7 +109,7 @@ void drmModeFreeCrtc(drmModeCrtcPtr ptr) } -void drmModeFreeOutput(drmModeOutputPtr ptr) +void drmModeFreeConnector(drmModeConnectorPtr ptr) { if (!ptr) return; @@ -142,8 +142,8 @@ drmModeResPtr drmModeGetResources(int fd) res.fb_id_ptr = VOID2U64(drmMalloc(res.count_fbs*sizeof(uint32_t))); if (res.count_crtcs) 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_connectors) + res.connector_id_ptr = VOID2U64(drmMalloc(res.count_connectors*sizeof(uint32_t))); if (res.count_encoders) res.encoder_id_ptr = VOID2U64(drmMalloc(res.count_encoders*sizeof(uint32_t))); @@ -166,18 +166,18 @@ drmModeResPtr drmModeGetResources(int fd) r->max_height = res.max_height; r->count_fbs = res.count_fbs; r->count_crtcs = res.count_crtcs; - r->count_outputs = res.count_outputs; + r->count_connectors = res.count_connectors; r->count_encoders = res.count_encoders; /* TODO we realy should test if these allocs fails. */ 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->connectors = drmAllocCpy(U642VOID(res.connector_id_ptr), res.count_connectors, 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.connector_id_ptr)); drmFree(U642VOID(res.encoder_id_ptr)); return r; @@ -254,8 +254,8 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId) struct drm_mode_crtc crtc; drmModeCrtcPtr r; - crtc.count_outputs = 0; - crtc.outputs = 0; + crtc.count_connectors = 0; + crtc.connectors = 0; crtc.count_possibles = 0; crtc.possibles = 0; crtc.crtc_id = crtcId; @@ -278,10 +278,10 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId) memcpy(&r->mode, &crtc.mode, sizeof(struct drm_mode_modeinfo)); r->buffer_id = crtc.fb_id; r->gamma_size = crtc.gamma_size; - r->count_outputs = crtc.count_outputs; + r->count_connectors = crtc.count_connectors; r->count_possibles = crtc.count_possibles; /* TODO we realy should test if these alloc & cpy fails. */ - r->outputs = crtc.outputs; + r->connectors = crtc.connectors; r->possibles = crtc.possibles; return r; @@ -289,13 +289,13 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId) int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, - uint32_t x, uint32_t y, uint32_t *outputs, int count, + uint32_t x, uint32_t y, uint32_t *connectors, int count, struct drm_mode_modeinfo *mode) { struct drm_mode_crtc crtc; - crtc.count_outputs = 0; - crtc.outputs = 0; + crtc.count_connectors = 0; + crtc.connectors = 0; crtc.count_possibles = 0; crtc.possibles = 0; @@ -303,8 +303,8 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, crtc.y = y; crtc.crtc_id = crtcId; crtc.fb_id = bufferId; - crtc.set_outputs_ptr = VOID2U64(outputs); - crtc.count_outputs = count; + crtc.set_connectors_ptr = VOID2U64(connectors); + crtc.count_connectors = count; if (mode) { memcpy(&crtc.mode, mode, sizeof(struct drm_mode_modeinfo)); crtc.mode_valid = 1; @@ -370,96 +370,96 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id) } /* - * Output manipulation + * Connector manipulation */ -drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id) +drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) { - struct drm_mode_get_output out; - drmModeOutputPtr r = NULL; - - out.output = output_id; - out.output_type_id = 0; - out.output_type = 0; - out.count_crtcs = 0; - out.crtcs = 0; - out.count_clones = 0; - out.clones = 0; - out.count_modes = 0; - out.modes_ptr = 0; - out.count_props = 0; - out.props_ptr = 0; - out.prop_values_ptr = 0; - out.count_encoders = 0; - out.encoders_ptr = 0; - - if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out)) + struct drm_mode_get_connector conn; + drmModeConnectorPtr r = NULL; + + conn.connector = connector_id; + conn.connector_type_id = 0; + conn.connector_type = 0; + conn.count_crtcs = 0; + conn.crtcs = 0; + conn.count_clones = 0; + conn.clones = 0; + conn.count_modes = 0; + conn.modes_ptr = 0; + conn.count_props = 0; + conn.props_ptr = 0; + conn.prop_values_ptr = 0; + conn.count_encoders = 0; + conn.encoders_ptr = 0; + + if (ioctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn)) return 0; - if (out.count_props) { - out.props_ptr = VOID2U64(drmMalloc(out.count_props*sizeof(uint32_t))); - out.prop_values_ptr = VOID2U64(drmMalloc(out.count_props*sizeof(uint64_t))); + if (conn.count_props) { + conn.props_ptr = VOID2U64(drmMalloc(conn.count_props*sizeof(uint32_t))); + conn.prop_values_ptr = VOID2U64(drmMalloc(conn.count_props*sizeof(uint64_t))); } - if (out.count_modes) - out.modes_ptr = VOID2U64(drmMalloc(out.count_modes*sizeof(struct drm_mode_modeinfo))); + if (conn.count_modes) + conn.modes_ptr = VOID2U64(drmMalloc(conn.count_modes*sizeof(struct drm_mode_modeinfo))); - if (out.count_encoders) - out.encoders_ptr = VOID2U64(drmMalloc(out.count_encoders*sizeof(uint32_t))); + if (conn.count_encoders) + conn.encoders_ptr = VOID2U64(drmMalloc(conn.count_encoders*sizeof(uint32_t))); - if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out)) + if (ioctl(fd, DRM_IOCTL_MODE_GETCONNECTOR, &conn)) goto err_allocs; if(!(r = drmMalloc(sizeof(*r)))) { goto err_allocs; } - r->output_id = out.output; - r->crtc = out.crtc; - r->connection = out.connection; - r->mmWidth = out.mm_width; - r->mmHeight = out.mm_height; - r->subpixel = out.subpixel; - r->count_crtcs = out.count_crtcs; - r->count_clones = out.count_clones; - r->count_modes = out.count_modes; + r->connector_id = conn.connector; + r->crtc = conn.crtc; + r->connection = conn.connection; + r->mmWidth = conn.mm_width; + r->mmHeight = conn.mm_height; + r->subpixel = conn.subpixel; + r->count_crtcs = conn.count_crtcs; + r->count_clones = conn.count_clones; + r->count_modes = conn.count_modes; /* TODO we should test if these alloc & cpy fails. */ - r->crtcs = out.crtcs; - r->clones = out.clones; - r->count_props = out.count_props; - r->props = drmAllocCpy(U642VOID(out.props_ptr), out.count_props, sizeof(uint32_t)); - r->prop_values = drmAllocCpy(U642VOID(out.prop_values_ptr), out.count_props, sizeof(uint64_t)); - r->modes = drmAllocCpy(U642VOID(out.modes_ptr), out.count_modes, sizeof(struct drm_mode_modeinfo)); - r->count_encoders = out.count_encoders; - r->encoders = drmAllocCpy(U642VOID(out.encoders_ptr), out.count_encoders, sizeof(uint32_t)); - r->output_type = out.output_type; - r->output_type_id = out.output_type_id; + r->crtcs = conn.crtcs; + r->clones = conn.clones; + r->count_props = conn.count_props; + r->props = drmAllocCpy(U642VOID(conn.props_ptr), conn.count_props, sizeof(uint32_t)); + r->prop_values = drmAllocCpy(U642VOID(conn.prop_values_ptr), conn.count_props, sizeof(uint64_t)); + r->modes = drmAllocCpy(U642VOID(conn.modes_ptr), conn.count_modes, sizeof(struct drm_mode_modeinfo)); + r->count_encoders = conn.count_encoders; + r->encoders = drmAllocCpy(U642VOID(conn.encoders_ptr), conn.count_encoders, sizeof(uint32_t)); + r->connector_type = conn.connector_type; + r->connector_type_id = conn.connector_type_id; err_allocs: - drmFree(U642VOID(out.prop_values_ptr)); - drmFree(U642VOID(out.props_ptr)); - drmFree(U642VOID(out.modes_ptr)); - drmFree(U642VOID(out.encoders_ptr)); + drmFree(U642VOID(conn.prop_values_ptr)); + drmFree(U642VOID(conn.props_ptr)); + drmFree(U642VOID(conn.modes_ptr)); + drmFree(U642VOID(conn.encoders_ptr)); return r; } -int drmModeAttachMode(int fd, uint32_t output_id, struct drm_mode_modeinfo *mode_info) +int drmModeAttachMode(int fd, uint32_t connector_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.connector_id = connector_id; return ioctl(fd, DRM_IOCTL_MODE_ATTACHMODE, &res); } -int drmModeDetachMode(int fd, uint32_t output_id, struct drm_mode_modeinfo *mode_info) +int drmModeDetachMode(int fd, uint32_t connector_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.connector_id = connector_id; return ioctl(fd, DRM_IOCTL_MODE_DETACHMODE, &res); } @@ -574,13 +574,13 @@ void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr) drmFree(ptr); } -int drmModeOutputSetProperty(int fd, uint32_t output_id, uint32_t property_id, +int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id, uint64_t value) { - struct drm_mode_output_set_property osp; + struct drm_mode_connector_set_property osp; int ret; - osp.output_id = output_id; + osp.connector_id = connector_id; osp.prop_id = property_id; osp.value = value; diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index 85e3d912..03268b10 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -60,8 +60,8 @@ typedef struct _drmModeRes { int count_crtcs; uint32_t *crtcs; - int count_outputs; - uint32_t *outputs; + int count_connectors; + uint32_t *connectors; int count_encoders; uint32_t *encoders; @@ -99,11 +99,11 @@ typedef struct _drmModeCrtc { int mode_valid; struct drm_mode_modeinfo mode; - int count_outputs; - uint32_t outputs; /**< Outputs that are connected */ + int count_connectors; + uint32_t connectors; /**< Connectors that are connected */ int count_possibles; - uint32_t possibles; /**< Outputs that can be connected */ + uint32_t possibles; /**< Connectors that can be connected */ int gamma_size; /**< Number of gamma stops */ @@ -131,12 +131,12 @@ typedef enum { DRM_MODE_SUBPIXEL_NONE = 6 } drmModeSubPixel; -typedef struct _drmModeOutput { - unsigned int output_id; +typedef struct _drmModeConnector { + unsigned int connector_id; unsigned int crtc; /**< Crtc currently connected to */ - unsigned int output_type; - unsigned int output_type_id; + unsigned int connector_type; + unsigned int connector_type_id; drmModeConnection connection; uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ drmModeSubPixel subpixel; @@ -156,7 +156,7 @@ typedef struct _drmModeOutput { int count_encoders; uint32_t *encoders; /**< List of encoder ids */ -} drmModeOutput, *drmModeOutputPtr; +} drmModeConnector, *drmModeConnectorPtr; @@ -164,7 +164,7 @@ extern void drmModeFreeModeInfo( struct drm_mode_modeinfo *ptr ); extern void drmModeFreeResources( drmModeResPtr ptr ); extern void drmModeFreeFB( drmModeFBPtr ptr ); extern void drmModeFreeCrtc( drmModeCrtcPtr ptr ); -extern void drmModeFreeOutput( drmModeOutputPtr ptr ); +extern void drmModeFreeConnector( drmModeConnectorPtr ptr ); extern void drmModeFreeEncoder( drmModeEncoderPtr ptr ); /** @@ -217,7 +217,7 @@ extern drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId); * Set the mode on a crtc crtcId with the given mode modeId. */ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, - uint32_t x, uint32_t y, uint32_t *outputs, int count, + uint32_t x, uint32_t y, uint32_t *connectors, int count, struct drm_mode_modeinfo *mode); /* @@ -240,31 +240,31 @@ int drmModeMoveCursor(int fd, uint32_t crtcId, int x, int y); drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id); /* - * Output manipulation + * Connector manipulation */ /** - * Retrive information about the output outputId. + * Retrive information about the connector connectorId. */ -extern drmModeOutputPtr drmModeGetOutput(int fd, - uint32_t outputId); +extern drmModeConnectorPtr drmModeGetConnector(int fd, + uint32_t connectorId); /** - * Attaches the given mode to an output. + * Attaches the given mode to an connector. */ -extern int drmModeAttachMode(int fd, uint32_t outputId, struct drm_mode_modeinfo *mode_info); +extern int drmModeAttachMode(int fd, uint32_t connectorId, struct drm_mode_modeinfo *mode_info); /** - * Detaches a mode from the output + * Detaches a mode from the connector * must be unused, by the given mode. */ -extern int drmModeDetachMode(int fd, uint32_t outputId, struct drm_mode_modeinfo *mode_info); +extern int drmModeDetachMode(int fd, uint32_t connectorId, struct drm_mode_modeinfo *mode_info); extern drmModePropertyPtr drmModeGetProperty(int fd, uint32_t propertyId); extern void drmModeFreeProperty(drmModePropertyPtr ptr); extern drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id); extern void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr); -extern int drmModeOutputSetProperty(int fd, uint32_t output_id, uint32_t property_id, +extern int drmModeConnectorSetProperty(int fd, uint32_t connector_id, uint32_t property_id, uint64_t value); extern int drmCheckModesettingSupported(const char *busid); -- cgit v1.2.3 From 5d47185eb69d73dd7e6ee3ddde4d0c7642c2d5b7 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 30 May 2008 15:32:58 +1000 Subject: drm: switch possible crtc/clones over to encoders --- libdrm/xf86drmMode.c | 8 -------- libdrm/xf86drmMode.h | 6 ------ 2 files changed, 14 deletions(-) (limited to 'libdrm') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index a18c4290..8b7f2bcf 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -381,10 +381,6 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) conn.connector = connector_id; conn.connector_type_id = 0; conn.connector_type = 0; - conn.count_crtcs = 0; - conn.crtcs = 0; - conn.count_clones = 0; - conn.clones = 0; conn.count_modes = 0; conn.modes_ptr = 0; conn.count_props = 0; @@ -420,12 +416,8 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) r->mmWidth = conn.mm_width; r->mmHeight = conn.mm_height; r->subpixel = conn.subpixel; - r->count_crtcs = conn.count_crtcs; - r->count_clones = conn.count_clones; r->count_modes = conn.count_modes; /* TODO we should test if these alloc & cpy fails. */ - r->crtcs = conn.crtcs; - r->clones = conn.clones; r->count_props = conn.count_props; r->props = drmAllocCpy(U642VOID(conn.props_ptr), conn.count_props, sizeof(uint32_t)); r->prop_values = drmAllocCpy(U642VOID(conn.prop_values_ptr), conn.count_props, sizeof(uint64_t)); diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index 03268b10..ceaa9abc 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -141,12 +141,6 @@ typedef struct _drmModeConnector { uint32_t mmWidth, mmHeight; /**< HxW in millimeters */ drmModeSubPixel subpixel; - int count_crtcs; - uint32_t crtcs; /**< Possible crtc to connect to */ - - int count_clones; - uint32_t clones; /**< Mask of clones */ - int count_modes; struct drm_mode_modeinfo *modes; -- cgit v1.2.3 From dba95ec34315d62934ff0e493e085aa6a03cde7c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 2 Jun 2008 10:41:12 +1000 Subject: drm: fixup some interfaces so test code works again --- libdrm/xf86drmMode.c | 14 +++----------- libdrm/xf86drmMode.h | 3 ++- 2 files changed, 5 insertions(+), 12 deletions(-) (limited to 'libdrm') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index 8b7f2bcf..d11fc12e 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -254,10 +254,6 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId) struct drm_mode_crtc crtc; drmModeCrtcPtr r; - crtc.count_connectors = 0; - crtc.connectors = 0; - crtc.count_possibles = 0; - crtc.possibles = 0; crtc.crtc_id = crtcId; if (ioctl(fd, DRM_IOCTL_MODE_GETCRTC, &crtc)) @@ -278,12 +274,6 @@ drmModeCrtcPtr drmModeGetCrtc(int fd, uint32_t crtcId) memcpy(&r->mode, &crtc.mode, sizeof(struct drm_mode_modeinfo)); r->buffer_id = crtc.fb_id; r->gamma_size = crtc.gamma_size; - r->count_connectors = crtc.count_connectors; - r->count_possibles = crtc.count_possibles; - /* TODO we realy should test if these alloc & cpy fails. */ - r->connectors = crtc.connectors; - r->possibles = crtc.possibles; - return r; } @@ -362,6 +352,8 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id) if (!(r = drmMalloc(sizeof(*r)))) return 0; + r->encoder_id = enc.encoder_id; + r->crtc = enc.crtc; r->encoder_type = enc.encoder_type; r->crtcs = enc.crtcs; r->clones = enc.clones; @@ -411,7 +403,7 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) } r->connector_id = conn.connector; - r->crtc = conn.crtc; + r->encoder = conn.encoder; r->connection = conn.connection; r->mmWidth = conn.mm_width; r->mmHeight = conn.mm_height; diff --git a/libdrm/xf86drmMode.h b/libdrm/xf86drmMode.h index ceaa9abc..2f3a8f74 100644 --- a/libdrm/xf86drmMode.h +++ b/libdrm/xf86drmMode.h @@ -112,6 +112,7 @@ typedef struct _drmModeCrtc { typedef struct _drmModeEncoder { unsigned int encoder_id; unsigned int encoder_type; + uint32_t crtc; uint32_t crtcs; uint32_t clones; } drmModeEncoder, *drmModeEncoderPtr; @@ -134,7 +135,7 @@ typedef enum { typedef struct _drmModeConnector { unsigned int connector_id; - unsigned int crtc; /**< Crtc currently connected to */ + unsigned int encoder; /**< Crtc currently connected to */ unsigned int connector_type; unsigned int connector_type_id; drmModeConnection connection; -- cgit v1.2.3