本文整理汇总了C++中drmFree函数的典型用法代码示例。如果您正苦于以下问题:C++ drmFree函数的具体用法?C++ drmFree怎么用?C++ drmFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了drmFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drmModeFreeObjectProperties
void drmModeFreeObjectProperties(drmModeObjectPropertiesPtr ptr)
{
if (!ptr)
return;
drmFree(ptr->props);
drmFree(ptr->prop_values);
drmFree(ptr);
}
示例2: drmModeFreePlane
void drmModeFreePlane(drmModePlanePtr ptr)
{
if (!ptr)
return;
drmFree(ptr->formats);
drmFree(ptr);
}
示例3: drmModeFreePropertyBlob
void drmModeFreePropertyBlob(drmModePropertyBlobPtr ptr)
{
if (!ptr)
return;
drmFree(ptr->data);
drmFree(ptr);
}
示例4: drmModeFreePlaneResources
void drmModeFreePlaneResources(drmModePlaneResPtr ptr)
{
if (!ptr)
return;
drmFree(ptr->planes);
drmFree(ptr);
}
示例5: drmModeFreeProperty
void drmModeFreeProperty(drmModePropertyPtr ptr)
{
if (!ptr)
return;
drmFree(ptr->values);
drmFree(ptr->enums);
drmFree(ptr);
}
示例6: drmModeFreeConnector
void drmModeFreeConnector(drmModeConnectorPtr ptr)
{
if (!ptr)
return;
drmFree(ptr->encoders);
drmFree(ptr->prop_values);
drmFree(ptr->props);
drmFree(ptr->modes);
drmFree(ptr);
}
示例7: drmModeFreeResources
void drmModeFreeResources(drmModeResPtr ptr)
{
if (!ptr)
return;
drmFree(ptr->fbs);
drmFree(ptr->crtcs);
drmFree(ptr->connectors);
drmFree(ptr->encoders);
drmFree(ptr);
}
示例8: drmModeGetResources
drmModeResPtr drmModeGetResources(int fd)
{
struct drm_mode_card_res res;
drmModeResPtr r = 0;
memset(&res, 0, sizeof(struct drm_mode_card_res));
if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res))
return 0;
if (res.count_fbs)
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_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)));
if (drmIoctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
r = NULL;
goto err_allocs;
}
/*
* return
*/
if (!(r = drmMalloc(sizeof(*r))))
return 0;
r->min_width = res.min_width;
r->max_width = res.max_width;
r->min_height = res.min_height;
r->max_height = res.max_height;
r->count_fbs = res.count_fbs;
r->count_crtcs = res.count_crtcs;
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->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.connector_id_ptr));
drmFree(U642VOID(res.encoder_id_ptr));
return r;
}
示例9: drmModeGetPlane
drmModePlanePtr drmModeGetPlane(int fd, uint32_t plane_id)
{
struct drm_mode_get_plane ovr, counts;
drmModePlanePtr r = 0;
retry:
memset(&ovr, 0, sizeof(struct drm_mode_get_plane));
ovr.plane_id = plane_id;
if (drmIoctl(fd, DRM_IOCTL_MODE_GETPLANE, &ovr))
return 0;
counts = ovr;
if (ovr.count_format_types) {
ovr.format_type_ptr = VOID2U64(drmMalloc(ovr.count_format_types *
sizeof(uint32_t)));
if (!ovr.format_type_ptr)
goto err_allocs;
}
if (drmIoctl(fd, DRM_IOCTL_MODE_GETPLANE, &ovr))
goto err_allocs;
if (counts.count_format_types < ovr.count_format_types) {
drmFree(U642VOID(ovr.format_type_ptr));
goto retry;
}
if (!(r = drmMalloc(sizeof(*r))))
goto err_allocs;
r->count_formats = ovr.count_format_types;
r->plane_id = ovr.plane_id;
r->crtc_id = ovr.crtc_id;
r->fb_id = ovr.fb_id;
r->possible_crtcs = ovr.possible_crtcs;
r->gamma_size = ovr.gamma_size;
r->formats = drmAllocCpy(U642VOID(ovr.format_type_ptr),
ovr.count_format_types, sizeof(uint32_t));
if (ovr.count_format_types && !r->formats) {
drmFree(r->formats);
drmFree(r);
r = 0;
}
err_allocs:
drmFree(U642VOID(ovr.format_type_ptr));
return r;
}
示例10: drmModeGetPropertyBlob
drmModePropertyBlobPtr drmModeGetPropertyBlob(int fd, uint32_t blob_id)
{
struct drm_mode_get_blob blob;
drmModePropertyBlobPtr r;
blob.length = 0;
blob.data = 0;
blob.blob_id = blob_id;
if (drmIoctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob))
return NULL;
if (blob.length)
blob.data = VOID2U64(drmMalloc(blob.length));
if (drmIoctl(fd, DRM_IOCTL_MODE_GETPROPBLOB, &blob)) {
r = NULL;
goto err_allocs;
}
if (!(r = drmMalloc(sizeof(*r))))
goto err_allocs;
r->id = blob.blob_id;
r->length = blob.length;
r->data = drmAllocCpy(U642VOID(blob.data), 1, blob.length);
err_allocs:
drmFree(U642VOID(blob.data));
return r;
}
示例11: drmModeFreeModeInfo
void drmModeFreeModeInfo(drmModeModeInfoPtr ptr)
{
if (!ptr)
return;
drmFree(ptr);
}
示例12: drmModeFreeCrtc
void drmModeFreeCrtc(drmModeCrtcPtr ptr)
{
if (!ptr)
return;
drmFree(ptr);
}
示例13: drmModeFreeResources
void drmModeFreeResources(drmModeResPtr ptr)
{
if (!ptr)
return;
drmFree(ptr);
}
示例14: drmModeFreeFB
void drmModeFreeFB(drmModeFBPtr ptr)
{
if (!ptr)
return;
/* we might add more frees later. */
drmFree(ptr);
}
示例15: drmModeObjectGetProperties
drmModeObjectPropertiesPtr drmModeObjectGetProperties(int fd,
uint32_t object_id,
uint32_t object_type)
{
struct drm_mode_obj_get_properties properties;
drmModeObjectPropertiesPtr ret = NULL;
uint32_t count;
retry:
memset(&properties, 0, sizeof(struct drm_mode_obj_get_properties));
properties.obj_id = object_id;
properties.obj_type = object_type;
if (drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES, &properties))
return 0;
count = properties.count_props;
if (count) {
properties.props_ptr = VOID2U64(drmMalloc(count *
sizeof(uint32_t)));
if (!properties.props_ptr)
goto err_allocs;
properties.prop_values_ptr = VOID2U64(drmMalloc(count *
sizeof(uint64_t)));
if (!properties.prop_values_ptr)
goto err_allocs;
}
if (drmIoctl(fd, DRM_IOCTL_MODE_OBJ_GETPROPERTIES, &properties))
goto err_allocs;
if (count < properties.count_props) {
drmFree(U642VOID(properties.props_ptr));
drmFree(U642VOID(properties.prop_values_ptr));
goto retry;
}
count = properties.count_props;
ret = drmMalloc(sizeof(*ret));
if (!ret)
goto err_allocs;
ret->count_props = count;
ret->props = drmAllocCpy(U642VOID(properties.props_ptr),
count, sizeof(uint32_t));
ret->prop_values = drmAllocCpy(U642VOID(properties.prop_values_ptr),
count, sizeof(uint64_t));
if (ret->count_props && (!ret->props || !ret->prop_values)) {
drmFree(ret->props);
drmFree(ret->prop_values);
drmFree(ret);
ret = NULL;
}
err_allocs:
drmFree(U642VOID(properties.props_ptr));
drmFree(U642VOID(properties.prop_values_ptr));
return ret;
}