From f9dad8cc22994e0e4671d14b3ee721e4b5777a68 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Mon, 23 Jun 2008 21:15:54 +0200 Subject: libdrm: check for allocation failure --- libdrm/xf86drmMode.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libdrm/xf86drmMode.c') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index a393f965..df865415 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -419,6 +419,9 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) r->connector_type = conn.connector_type; r->connector_type_id = conn.connector_type_id; + if (!r->props || !r->prop_values || !r->modes || !r->encoders) + goto err_allocs; + err_allocs: drmFree(U642VOID(conn.prop_values_ptr)); drmFree(U642VOID(conn.props_ptr)); -- cgit v1.2.3 From 9f28da80f6cc8e45670b217a2483983f2838095d Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Fri, 27 Jun 2008 18:45:08 +0200 Subject: Change some obviously wrong things about property blobs, still broken though. - I do not fully understand these blobs, so i'm leaving it at this for the moment. --- libdrm/xf86drmMode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdrm/xf86drmMode.c') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index df865415..ca21a961 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -495,7 +495,7 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id) if (prop.flags & DRM_MODE_PROP_ENUM) { r->count_enums = prop.count_enum_blobs; r->enums = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(struct drm_mode_property_enum)); - } else if (prop.flags & DRM_MODE_PROP_ENUM) { + } else if (prop.flags & DRM_MODE_PROP_BLOB) { r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_enum_blobs, sizeof(uint32_t)); r->blob_ids = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(uint32_t)); r->count_blobs = prop.count_enum_blobs; -- cgit v1.2.3 From 7cbc5f6145046f3775e3b3ca2862bfb71831ec44 Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sat, 5 Jul 2008 12:04:07 +0200 Subject: modesetting-101: Make the interface variable names a little more consistent + modeprint changes. - All things are now called _id when they are id's. - modeprint now accepts driver name as first argument. --- libdrm/xf86drmMode.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'libdrm/xf86drmMode.c') diff --git a/libdrm/xf86drmMode.c b/libdrm/xf86drmMode.c index ca21a961..c3921ee9 100644 --- a/libdrm/xf86drmMode.c +++ b/libdrm/xf86drmMode.c @@ -284,11 +284,6 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId, { struct drm_mode_crtc crtc; - crtc.count_connectors = 0; - crtc.connectors = 0; - crtc.count_possibles = 0; - crtc.possibles = 0; - crtc.x = x; crtc.y = y; crtc.crtc_id = crtcId; @@ -343,8 +338,8 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id) enc.encoder_id = encoder_id; enc.encoder_type = 0; - enc.crtcs = 0; - enc.clones = 0; + enc.possible_crtcs = 0; + enc.possible_clones = 0; if (ioctl(fd, DRM_IOCTL_MODE_GETENCODER, &enc)) return 0; @@ -353,10 +348,10 @@ drmModeEncoderPtr drmModeGetEncoder(int fd, uint32_t encoder_id) return 0; r->encoder_id = enc.encoder_id; - r->crtc = enc.crtc; + r->crtc_id = enc.crtc_id; r->encoder_type = enc.encoder_type; - r->crtcs = enc.crtcs; - r->clones = enc.clones; + r->possible_crtcs = enc.possible_crtcs; + r->possible_clones = enc.possible_clones; return r; } @@ -370,7 +365,7 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) struct drm_mode_get_connector conn; drmModeConnectorPtr r = NULL; - conn.connector = connector_id; + conn.connector_id = connector_id; conn.connector_type_id = 0; conn.connector_type = 0; conn.count_modes = 0; @@ -402,8 +397,8 @@ drmModeConnectorPtr drmModeGetConnector(int fd, uint32_t connector_id) goto err_allocs; } - r->connector_id = conn.connector; - r->encoder = conn.encoder; + r->connector_id = conn.connector_id; + r->encoder_id = conn.encoder_id; r->connection = conn.connection; r->mmWidth = conn.mm_width; r->mmHeight = conn.mm_height; -- cgit v1.2.3