summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoram Park <boram1288.park@samsung.com>2018-03-15 14:19:21 +0900
committerBoram Park <boram1288.park@samsung.com>2018-03-15 16:29:56 +0900
commit38baad72cdc0900302e4a68ac5cf21d9a25d934c (patch)
tree3b10fba9069cd6b04a5f112b93bf8d3ddf7b56bd
parent341eaf1f850daba7439a7116c3a99f895ae0bca1 (diff)
downloadlibtdm-drm-38baad72cdc0900302e4a68ac5cf21d9a25d934c.tar.gz
libtdm-drm-38baad72cdc0900302e4a68ac5cf21d9a25d934c.tar.bz2
libtdm-drm-38baad72cdc0900302e4a68ac5cf21d9a25d934c.zip
fix prop's index
Change-Id: I35e8782c1340c56086b73c047563bd340a7fb8c0
-rw-r--r--src/tdm_drm_display.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tdm_drm_display.c b/src/tdm_drm_display.c
index 6978d05..c3ee0af 100644
--- a/src/tdm_drm_display.c
+++ b/src/tdm_drm_display.c
@@ -1120,20 +1120,21 @@ drm_output_get_capability(tdm_output *output, tdm_caps_output *caps)
goto failed_get;
}
- caps->prop_count = props->count_props;
- caps->props = calloc(1, sizeof(tdm_prop) * caps->prop_count);
+ caps->props = calloc(1, sizeof(tdm_prop) * props->count_props);
if (!caps->props) {
ret = TDM_ERROR_OUT_OF_MEMORY;
TDM_ERR("alloc failed\n");
goto failed_get;
}
- for (i = 0; i < caps->prop_count; i++) {
+ caps->prop_count = 0;
+ for (i = 0; i < props->count_props; i++) {
drmModePropertyPtr prop = drmModeGetProperty(drm_data->drm_fd, props->props[i]);
if (!prop)
continue;
- snprintf(caps->props[i].name, TDM_NAME_LEN, "%s", prop->name);
- caps->props[i].id = props->props[i];
+ snprintf(caps->props[caps->prop_count].name, TDM_NAME_LEN, "%s", prop->name);
+ caps->props[caps->prop_count].id = props->props[i];
+ caps->prop_count++;
drmModeFreeProperty(prop);
}
@@ -1553,8 +1554,8 @@ drm_layer_get_capability(tdm_layer *layer, tdm_caps_layer *caps)
drmModeFreeProperty(prop);
continue;
}
- snprintf(caps->props[i].name, TDM_NAME_LEN, "%s", prop->name);
- caps->props[i].id = props->props[i];
+ snprintf(caps->props[caps->prop_count].name, TDM_NAME_LEN, "%s", prop->name);
+ caps->props[caps->prop_count].id = props->props[i];
caps->prop_count++;
drmModeFreeProperty(prop);
}