mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-21 08:40:10 +01:00
arrgggh.. make all ioctl structs 32/64-bit compatible hopefully.
This also starts to add blob property support. someone needs to check this work for other things like ppc/x86 alignment diffs
This commit is contained in:
parent
f7432d187e
commit
1a6c95ef71
7 changed files with 222 additions and 116 deletions
|
|
@ -42,6 +42,9 @@
|
||||||
#include <drm.h>
|
#include <drm.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define U642VOID(x) ((void *)(unsigned long)(x))
|
||||||
|
#define VOID2U64(x) ((uint64_t)(unsigned long)(x))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Util functions
|
* Util functions
|
||||||
*/
|
*/
|
||||||
|
|
@ -149,11 +152,11 @@ drmModeResPtr drmModeGetResources(int fd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (res.count_fbs)
|
if (res.count_fbs)
|
||||||
res.fb_id = drmMalloc(res.count_fbs*sizeof(uint32_t));
|
res.fb_id_ptr = VOID2U64(drmMalloc(res.count_fbs*sizeof(uint32_t)));
|
||||||
if (res.count_crtcs)
|
if (res.count_crtcs)
|
||||||
res.crtc_id = drmMalloc(res.count_crtcs*sizeof(uint32_t));
|
res.crtc_id_ptr = VOID2U64(drmMalloc(res.count_crtcs*sizeof(uint32_t)));
|
||||||
if (res.count_outputs)
|
if (res.count_outputs)
|
||||||
res.output_id = drmMalloc(res.count_outputs*sizeof(uint32_t));
|
res.output_id_ptr = VOID2U64(drmMalloc(res.count_outputs*sizeof(uint32_t)));
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
|
if (ioctl(fd, DRM_IOCTL_MODE_GETRESOURCES, &res)) {
|
||||||
r = NULL;
|
r = NULL;
|
||||||
|
|
@ -168,18 +171,22 @@ drmModeResPtr drmModeGetResources(int fd)
|
||||||
if (!(r = drmMalloc(sizeof(*r))))
|
if (!(r = drmMalloc(sizeof(*r))))
|
||||||
return 0;
|
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_fbs = res.count_fbs;
|
||||||
r->count_crtcs = res.count_crtcs;
|
r->count_crtcs = res.count_crtcs;
|
||||||
r->count_outputs = res.count_outputs;
|
r->count_outputs = res.count_outputs;
|
||||||
/* TODO we realy should test if these allocs fails. */
|
/* TODO we realy should test if these allocs fails. */
|
||||||
r->fbs = drmAllocCpy(res.fb_id, res.count_fbs, sizeof(uint32_t));
|
r->fbs = drmAllocCpy(U642VOID(res.fb_id_ptr), res.count_fbs, sizeof(uint32_t));
|
||||||
r->crtcs = drmAllocCpy(res.crtc_id, res.count_crtcs, sizeof(uint32_t));
|
r->crtcs = drmAllocCpy(U642VOID(res.crtc_id_ptr), res.count_crtcs, sizeof(uint32_t));
|
||||||
r->outputs = drmAllocCpy(res.output_id, res.count_outputs, sizeof(uint32_t));
|
r->outputs = drmAllocCpy(U642VOID(res.output_id_ptr), res.count_outputs, sizeof(uint32_t));
|
||||||
|
|
||||||
err_allocs:
|
err_allocs:
|
||||||
drmFree(res.fb_id);
|
drmFree(U642VOID(res.fb_id_ptr));
|
||||||
drmFree(res.crtc_id);
|
drmFree(U642VOID(res.crtc_id_ptr));
|
||||||
drmFree(res.output_id);
|
drmFree(U642VOID(res.output_id_ptr));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
@ -297,7 +304,7 @@ int drmModeSetCrtc(int fd, uint32_t crtcId, uint32_t bufferId,
|
||||||
crtc.y = y;
|
crtc.y = y;
|
||||||
crtc.crtc_id = crtcId;
|
crtc.crtc_id = crtcId;
|
||||||
crtc.fb_id = bufferId;
|
crtc.fb_id = bufferId;
|
||||||
crtc.set_outputs = outputs;
|
crtc.set_outputs_ptr = VOID2U64(outputs);
|
||||||
crtc.count_outputs = count;
|
crtc.count_outputs = count;
|
||||||
if (mode) {
|
if (mode) {
|
||||||
memcpy(&crtc.mode, mode, sizeof(struct drm_mode_modeinfo));
|
memcpy(&crtc.mode, mode, sizeof(struct drm_mode_modeinfo));
|
||||||
|
|
@ -324,21 +331,21 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
|
||||||
out.count_clones = 0;
|
out.count_clones = 0;
|
||||||
out.clones = 0;
|
out.clones = 0;
|
||||||
out.count_modes = 0;
|
out.count_modes = 0;
|
||||||
out.modes = 0;
|
out.modes_ptr = 0;
|
||||||
out.count_props = 0;
|
out.count_props = 0;
|
||||||
out.props = NULL;
|
out.props_ptr = 0;
|
||||||
out.prop_values = NULL;
|
out.prop_values_ptr = 0;
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out))
|
if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (out.count_props) {
|
if (out.count_props) {
|
||||||
out.props = drmMalloc(out.count_props*sizeof(uint32_t));
|
out.props_ptr = VOID2U64(drmMalloc(out.count_props*sizeof(uint32_t)));
|
||||||
out.prop_values = drmMalloc(out.count_props*sizeof(uint32_t));
|
out.prop_values_ptr = VOID2U64(drmMalloc(out.count_props*sizeof(uint64_t)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (out.count_modes)
|
if (out.count_modes)
|
||||||
out.modes = drmMalloc(out.count_modes*sizeof(struct drm_mode_modeinfo));
|
out.modes_ptr = VOID2U64(drmMalloc(out.count_modes*sizeof(struct drm_mode_modeinfo)));
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out))
|
if (ioctl(fd, DRM_IOCTL_MODE_GETOUTPUT, &out))
|
||||||
goto err_allocs;
|
goto err_allocs;
|
||||||
|
|
@ -360,16 +367,16 @@ drmModeOutputPtr drmModeGetOutput(int fd, uint32_t output_id)
|
||||||
r->crtcs = out.crtcs;
|
r->crtcs = out.crtcs;
|
||||||
r->clones = out.clones;
|
r->clones = out.clones;
|
||||||
r->count_props = out.count_props;
|
r->count_props = out.count_props;
|
||||||
r->props = drmAllocCpy(out.props, out.count_props, sizeof(uint32_t));
|
r->props = drmAllocCpy(U642VOID(out.props_ptr), out.count_props, sizeof(uint32_t));
|
||||||
r->prop_values = drmAllocCpy(out.prop_values, out.count_props, sizeof(uint32_t));
|
r->prop_values = drmAllocCpy(U642VOID(out.prop_values_ptr), out.count_props, sizeof(uint64_t));
|
||||||
r->modes = drmAllocCpy(out.modes, out.count_modes, sizeof(struct drm_mode_modeinfo));
|
r->modes = drmAllocCpy(U642VOID(out.modes_ptr), out.count_modes, sizeof(struct drm_mode_modeinfo));
|
||||||
strncpy(r->name, out.name, DRM_OUTPUT_NAME_LEN);
|
strncpy(r->name, out.name, DRM_OUTPUT_NAME_LEN);
|
||||||
r->name[DRM_OUTPUT_NAME_LEN-1] = 0;
|
r->name[DRM_OUTPUT_NAME_LEN-1] = 0;
|
||||||
|
|
||||||
err_allocs:
|
err_allocs:
|
||||||
drmFree(out.prop_values);
|
drmFree(U642VOID(out.prop_values_ptr));
|
||||||
drmFree(out.props);
|
drmFree(U642VOID(out.props_ptr));
|
||||||
drmFree(out.modes);
|
drmFree(U642VOID(out.modes_ptr));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
@ -401,20 +408,20 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
|
||||||
drmModePropertyPtr r;
|
drmModePropertyPtr r;
|
||||||
|
|
||||||
prop.prop_id = property_id;
|
prop.prop_id = property_id;
|
||||||
prop.count_enums = 0;
|
prop.count_enum_blobs = 0;
|
||||||
prop.count_values = 0;
|
prop.count_values = 0;
|
||||||
prop.flags = 0;
|
prop.flags = 0;
|
||||||
prop.enums = NULL;
|
prop.enum_blob_ptr = 0;
|
||||||
prop.values = NULL;
|
prop.values_ptr = 0;
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
|
if (ioctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (prop.count_values)
|
if (prop.count_values)
|
||||||
prop.values = drmMalloc(prop.count_values * sizeof(uint32_t));
|
prop.values_ptr = VOID2U64(drmMalloc(prop.count_values * sizeof(uint64_t)));
|
||||||
|
|
||||||
if (prop.count_enums)
|
if (prop.count_enum_blobs)
|
||||||
prop.enums = drmMalloc(prop.count_enums * sizeof(struct drm_mode_property_enum));
|
prop.enum_blob_ptr = VOID2U64(drmMalloc(prop.count_enum_blobs * sizeof(struct drm_mode_property_enum)));
|
||||||
|
|
||||||
if (ioctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop)) {
|
if (ioctl(fd, DRM_IOCTL_MODE_GETPROPERTY, &prop)) {
|
||||||
r = NULL;
|
r = NULL;
|
||||||
|
|
@ -426,16 +433,16 @@ drmModePropertyPtr drmModeGetProperty(int fd, uint32_t property_id)
|
||||||
|
|
||||||
r->prop_id = prop.prop_id;
|
r->prop_id = prop.prop_id;
|
||||||
r->count_values = prop.count_values;
|
r->count_values = prop.count_values;
|
||||||
r->count_enums = prop.count_enums;
|
r->count_enums = prop.count_enum_blobs;
|
||||||
|
r->flags = prop.flags;
|
||||||
r->values = drmAllocCpy(prop.values, prop.count_values, sizeof(uint32_t));
|
r->values = drmAllocCpy(U642VOID(prop.values_ptr), prop.count_values, sizeof(uint64_t));
|
||||||
r->enums = drmAllocCpy(prop.enums, prop.count_enums, sizeof(struct drm_mode_property_enum));
|
r->enums = drmAllocCpy(U642VOID(prop.enum_blob_ptr), prop.count_enum_blobs, sizeof(struct drm_mode_property_enum));
|
||||||
strncpy(r->name, prop.name, DRM_PROP_NAME_LEN);
|
strncpy(r->name, prop.name, DRM_PROP_NAME_LEN);
|
||||||
r->name[DRM_PROP_NAME_LEN-1] = 0;
|
r->name[DRM_PROP_NAME_LEN-1] = 0;
|
||||||
|
|
||||||
err_allocs:
|
err_allocs:
|
||||||
drmFree(prop.values);
|
drmFree(U642VOID(prop.values_ptr));
|
||||||
drmFree(prop.enums);
|
drmFree(U642VOID(prop.enum_blob_ptr));
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,8 @@ typedef struct _drmModeRes {
|
||||||
int count_outputs;
|
int count_outputs;
|
||||||
uint32_t *outputs;
|
uint32_t *outputs;
|
||||||
|
|
||||||
|
uint32_t min_width, max_width;
|
||||||
|
uint32_t min_height, max_height;
|
||||||
} drmModeRes, *drmModeResPtr;
|
} drmModeRes, *drmModeResPtr;
|
||||||
|
|
||||||
typedef struct drm_mode_fb_cmd drmModeFB, *drmModeFBPtr;
|
typedef struct drm_mode_fb_cmd drmModeFB, *drmModeFBPtr;
|
||||||
|
|
@ -72,7 +74,7 @@ typedef struct _drmModeProperty {
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned char name[DRM_PROP_NAME_LEN];
|
unsigned char name[DRM_PROP_NAME_LEN];
|
||||||
int count_values;
|
int count_values;
|
||||||
uint32_t *values;
|
uint64_t *values;
|
||||||
int count_enums;
|
int count_enums;
|
||||||
struct drm_mode_property_enum *enums;
|
struct drm_mode_property_enum *enums;
|
||||||
|
|
||||||
|
|
@ -132,7 +134,7 @@ typedef struct _drmModeOutput {
|
||||||
|
|
||||||
int count_props;
|
int count_props;
|
||||||
uint32_t *props; /**< List of property ids */
|
uint32_t *props; /**< List of property ids */
|
||||||
uint32_t *prop_values; /**< List of property values */
|
uint64_t *prop_values; /**< List of property values */
|
||||||
|
|
||||||
} drmModeOutput, *drmModeOutputPtr;
|
} drmModeOutput, *drmModeOutputPtr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -722,7 +722,11 @@ void drm_mode_config_init(struct drm_device *dev)
|
||||||
INIT_LIST_HEAD(&dev->mode_config.crtc_list);
|
INIT_LIST_HEAD(&dev->mode_config.crtc_list);
|
||||||
INIT_LIST_HEAD(&dev->mode_config.output_list);
|
INIT_LIST_HEAD(&dev->mode_config.output_list);
|
||||||
INIT_LIST_HEAD(&dev->mode_config.property_list);
|
INIT_LIST_HEAD(&dev->mode_config.property_list);
|
||||||
|
INIT_LIST_HEAD(&dev->mode_config.property_blob_list);
|
||||||
idr_init(&dev->mode_config.crtc_idr);
|
idr_init(&dev->mode_config.crtc_idr);
|
||||||
|
dev->mode_config.edid_property = drm_property_create(dev,
|
||||||
|
DRM_MODE_PROP_BLOB | DRM_MODE_PROP_IMMUTABLE,
|
||||||
|
"EDID", 0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_mode_config_init);
|
EXPORT_SYMBOL(drm_mode_config_init);
|
||||||
|
|
||||||
|
|
@ -1013,7 +1017,7 @@ int drm_crtc_set_config(struct drm_crtc *crtc, struct drm_mode_crtc *crtc_info,
|
||||||
if (crtc_info->x != crtc->x || crtc_info->y != crtc->y)
|
if (crtc_info->x != crtc->x || crtc_info->y != crtc->y)
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
if (new_mode && (crtc->mode.mode_id != new_mode->mode_id))
|
if (new_mode && !drm_mode_equal(new_mode, &crtc->mode))
|
||||||
changed = true;
|
changed = true;
|
||||||
|
|
||||||
list_for_each_entry(output, &dev->mode_config.output_list, head) {
|
list_for_each_entry(output, &dev->mode_config.output_list, head) {
|
||||||
|
|
@ -1152,6 +1156,9 @@ int drm_mode_getresources(struct drm_device *dev,
|
||||||
int crtc_count = 0;
|
int crtc_count = 0;
|
||||||
int fb_count = 0;
|
int fb_count = 0;
|
||||||
int copied = 0;
|
int copied = 0;
|
||||||
|
uint32_t __user *fb_id;
|
||||||
|
uint32_t __user *crtc_id;
|
||||||
|
uint32_t __user *output_id;
|
||||||
|
|
||||||
mutex_lock(&dev->mode_config.mutex);
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
|
|
||||||
|
|
@ -1164,12 +1171,18 @@ int drm_mode_getresources(struct drm_device *dev,
|
||||||
list_for_each(lh, &dev->mode_config.output_list)
|
list_for_each(lh, &dev->mode_config.output_list)
|
||||||
output_count++;
|
output_count++;
|
||||||
|
|
||||||
|
card_res->max_height = dev->mode_config.max_height;
|
||||||
|
card_res->min_height = dev->mode_config.min_height;
|
||||||
|
card_res->max_width = dev->mode_config.max_width;
|
||||||
|
card_res->min_width = dev->mode_config.min_width;
|
||||||
|
|
||||||
/* handle this in 4 parts */
|
/* handle this in 4 parts */
|
||||||
/* FBs */
|
/* FBs */
|
||||||
if (card_res->count_fbs >= fb_count) {
|
if (card_res->count_fbs >= fb_count) {
|
||||||
copied = 0;
|
copied = 0;
|
||||||
|
fb_id = (uint32_t *)(unsigned long)card_res->fb_id_ptr;
|
||||||
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
|
list_for_each_entry(fb, &dev->mode_config.fb_list, head) {
|
||||||
if (put_user(fb->id, card_res->fb_id + copied)) {
|
if (put_user(fb->id, fb_id + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -1181,9 +1194,10 @@ int drm_mode_getresources(struct drm_device *dev,
|
||||||
/* CRTCs */
|
/* CRTCs */
|
||||||
if (card_res->count_crtcs >= crtc_count) {
|
if (card_res->count_crtcs >= crtc_count) {
|
||||||
copied = 0;
|
copied = 0;
|
||||||
|
crtc_id = (uint32_t *)(unsigned long)card_res->crtc_id_ptr;
|
||||||
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head){
|
list_for_each_entry(crtc, &dev->mode_config.crtc_list, head){
|
||||||
DRM_DEBUG("CRTC ID is %d\n", crtc->id);
|
DRM_DEBUG("CRTC ID is %d\n", crtc->id);
|
||||||
if (put_user(crtc->id, card_res->crtc_id + copied)) {
|
if (put_user(crtc->id, crtc_id + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -1196,10 +1210,11 @@ int drm_mode_getresources(struct drm_device *dev,
|
||||||
/* Outputs */
|
/* Outputs */
|
||||||
if (card_res->count_outputs >= output_count) {
|
if (card_res->count_outputs >= output_count) {
|
||||||
copied = 0;
|
copied = 0;
|
||||||
|
output_id = (uint32_t *)(unsigned long)card_res->output_id_ptr;
|
||||||
list_for_each_entry(output, &dev->mode_config.output_list,
|
list_for_each_entry(output, &dev->mode_config.output_list,
|
||||||
head) {
|
head) {
|
||||||
DRM_DEBUG("OUTPUT ID is %d\n", output->id);
|
DRM_DEBUG("OUTPUT ID is %d\n", output->id);
|
||||||
if (put_user(output->id, card_res->output_id + copied)) {
|
if (put_user(output->id, output_id + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -1211,7 +1226,6 @@ int drm_mode_getresources(struct drm_device *dev,
|
||||||
DRM_DEBUG("Counted %d %d\n", card_res->count_crtcs,
|
DRM_DEBUG("Counted %d %d\n", card_res->count_crtcs,
|
||||||
card_res->count_outputs);
|
card_res->count_outputs);
|
||||||
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&dev->mode_config.mutex);
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -1307,6 +1321,9 @@ int drm_mode_getoutput(struct drm_device *dev,
|
||||||
int copied = 0;
|
int copied = 0;
|
||||||
int i;
|
int i;
|
||||||
struct drm_mode_modeinfo u_mode;
|
struct drm_mode_modeinfo u_mode;
|
||||||
|
struct drm_mode_modeinfo __user *mode_ptr;
|
||||||
|
uint32_t __user *prop_ptr;
|
||||||
|
uint64_t __user *prop_values;
|
||||||
|
|
||||||
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
|
memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
|
||||||
|
|
||||||
|
|
@ -1349,9 +1366,10 @@ int drm_mode_getoutput(struct drm_device *dev,
|
||||||
|
|
||||||
if ((out_resp->count_modes >= mode_count) && mode_count) {
|
if ((out_resp->count_modes >= mode_count) && mode_count) {
|
||||||
copied = 0;
|
copied = 0;
|
||||||
|
mode_ptr = (struct drm_mode_modeinfo *)(unsigned long)out_resp->modes_ptr;
|
||||||
list_for_each_entry(mode, &output->modes, head) {
|
list_for_each_entry(mode, &output->modes, head) {
|
||||||
drm_crtc_convert_to_umode(&u_mode, mode);
|
drm_crtc_convert_to_umode(&u_mode, mode);
|
||||||
if (copy_to_user(out_resp->modes + copied,
|
if (copy_to_user(mode_ptr + copied,
|
||||||
&u_mode, sizeof(u_mode))) {
|
&u_mode, sizeof(u_mode))) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -1364,14 +1382,16 @@ int drm_mode_getoutput(struct drm_device *dev,
|
||||||
|
|
||||||
if ((out_resp->count_props >= props_count) && props_count) {
|
if ((out_resp->count_props >= props_count) && props_count) {
|
||||||
copied = 0;
|
copied = 0;
|
||||||
|
prop_ptr = (uint32_t *)(unsigned long)(out_resp->props_ptr);
|
||||||
|
prop_values = (uint64_t *)(unsigned long)(out_resp->prop_values_ptr);
|
||||||
for (i = 0; i < DRM_OUTPUT_MAX_PROPERTY; i++) {
|
for (i = 0; i < DRM_OUTPUT_MAX_PROPERTY; i++) {
|
||||||
if (output->property_ids[i] != 0) {
|
if (output->property_ids[i] != 0) {
|
||||||
if (put_user(output->property_ids[i], out_resp->props + copied)) {
|
if (put_user(output->property_ids[i], prop_ptr + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (put_user(output->property_values[i], out_resp->prop_values + copied)) {
|
if (put_user(output->property_values[i], prop_values + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -1410,10 +1430,10 @@ int drm_mode_setcrtc(struct drm_device *dev,
|
||||||
struct drm_crtc *crtc;
|
struct drm_crtc *crtc;
|
||||||
struct drm_output **output_set = NULL, *output;
|
struct drm_output **output_set = NULL, *output;
|
||||||
struct drm_framebuffer *fb = NULL;
|
struct drm_framebuffer *fb = NULL;
|
||||||
struct drm_display_mode mode;
|
struct drm_display_mode *mode = NULL;
|
||||||
int mode_valid = 0;
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int i;
|
int i;
|
||||||
|
uint32_t __user *set_outputs_ptr;
|
||||||
|
|
||||||
mutex_lock(&dev->mode_config.mutex);
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
crtc = idr_find(&dev->mode_config.crtc_idr, crtc_req->crtc_id);
|
crtc = idr_find(&dev->mode_config.crtc_idr, crtc_req->crtc_id);
|
||||||
|
|
@ -1434,18 +1454,17 @@ int drm_mode_setcrtc(struct drm_device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mode_valid = 1;
|
mode = drm_mode_create(dev);
|
||||||
drm_crtc_convert_umode(&mode, &crtc_req->mode);
|
drm_crtc_convert_umode(mode, &crtc_req->mode);
|
||||||
} else
|
}
|
||||||
mode_valid = 0;
|
|
||||||
|
|
||||||
if (crtc_req->count_outputs == 0 && mode_valid) {
|
if (crtc_req->count_outputs == 0 && mode) {
|
||||||
DRM_DEBUG("Count outputs is 0 but mode set\n");
|
DRM_DEBUG("Count outputs is 0 but mode set\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crtc_req->count_outputs > 0 && !mode_valid && !fb) {
|
if (crtc_req->count_outputs > 0 && !mode && !fb) {
|
||||||
DRM_DEBUG("Count outputs is %d but no mode or fb set\n", crtc_req->count_outputs);
|
DRM_DEBUG("Count outputs is %d but no mode or fb set\n", crtc_req->count_outputs);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
@ -1461,7 +1480,8 @@ int drm_mode_setcrtc(struct drm_device *dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < crtc_req->count_outputs; i++) {
|
for (i = 0; i < crtc_req->count_outputs; i++) {
|
||||||
if (get_user(out_id, &crtc_req->set_outputs[i])) {
|
set_outputs_ptr = (uint32_t *)(unsigned long)crtc_req->set_outputs_ptr;
|
||||||
|
if (get_user(out_id, &set_outputs_ptr[i])) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
@ -1477,11 +1497,7 @@ int drm_mode_setcrtc(struct drm_device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode_valid) {
|
ret = drm_crtc_set_config(crtc, crtc_req, mode, output_set, fb);
|
||||||
ret = drm_crtc_set_config(crtc, crtc_req, &mode, output_set, fb);
|
|
||||||
} else {
|
|
||||||
ret = drm_crtc_set_config(crtc, crtc_req, NULL, output_set, fb);
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&dev->mode_config.mutex);
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
|
|
@ -1848,14 +1864,16 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
|
||||||
if (!property)
|
if (!property)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
property->values = kzalloc(sizeof(uint32_t)*num_values, GFP_KERNEL);
|
if (num_values) {
|
||||||
|
property->values = kzalloc(sizeof(uint64_t)*num_values, GFP_KERNEL);
|
||||||
if (!property->values)
|
if (!property->values)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
property->id = drm_idr_get(dev, property);
|
property->id = drm_idr_get(dev, property);
|
||||||
property->flags = flags;
|
property->flags = flags;
|
||||||
property->num_values = num_values;
|
property->num_values = num_values;
|
||||||
INIT_LIST_HEAD(&property->enum_list);
|
INIT_LIST_HEAD(&property->enum_blob_list);
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
strncpy(property->name, name, DRM_PROP_NAME_LEN);
|
strncpy(property->name, name, DRM_PROP_NAME_LEN);
|
||||||
|
|
@ -1869,15 +1887,15 @@ fail:
|
||||||
EXPORT_SYMBOL(drm_property_create);
|
EXPORT_SYMBOL(drm_property_create);
|
||||||
|
|
||||||
int drm_property_add_enum(struct drm_property *property, int index,
|
int drm_property_add_enum(struct drm_property *property, int index,
|
||||||
uint32_t value, const char *name)
|
uint64_t value, const char *name)
|
||||||
{
|
{
|
||||||
struct drm_property_enum *prop_enum;
|
struct drm_property_enum *prop_enum;
|
||||||
|
|
||||||
if (!(property->flags & DRM_MODE_PROP_ENUM))
|
if (!(property->flags & DRM_MODE_PROP_ENUM))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (!list_empty(&property->enum_list)) {
|
if (!list_empty(&property->enum_blob_list)) {
|
||||||
list_for_each_entry(prop_enum, &property->enum_list, head) {
|
list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
|
||||||
if (prop_enum->value == value) {
|
if (prop_enum->value == value) {
|
||||||
strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
|
strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
|
||||||
prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
|
prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
|
||||||
|
|
@ -1895,7 +1913,7 @@ int drm_property_add_enum(struct drm_property *property, int index,
|
||||||
prop_enum->value = value;
|
prop_enum->value = value;
|
||||||
|
|
||||||
property->values[index] = value;
|
property->values[index] = value;
|
||||||
list_add_tail(&prop_enum->head, &property->enum_list);
|
list_add_tail(&prop_enum->head, &property->enum_blob_list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_property_add_enum);
|
EXPORT_SYMBOL(drm_property_add_enum);
|
||||||
|
|
@ -1904,11 +1922,12 @@ void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
|
||||||
{
|
{
|
||||||
struct drm_property_enum *prop_enum, *pt;
|
struct drm_property_enum *prop_enum, *pt;
|
||||||
|
|
||||||
list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
|
list_for_each_entry_safe(prop_enum, pt, &property->enum_blob_list, head) {
|
||||||
list_del(&prop_enum->head);
|
list_del(&prop_enum->head);
|
||||||
kfree(prop_enum);
|
kfree(prop_enum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property->num_values)
|
||||||
kfree(property->values);
|
kfree(property->values);
|
||||||
drm_idr_put(dev, property->id);
|
drm_idr_put(dev, property->id);
|
||||||
list_del(&property->head);
|
list_del(&property->head);
|
||||||
|
|
@ -1918,7 +1937,7 @@ EXPORT_SYMBOL(drm_property_destroy);
|
||||||
|
|
||||||
|
|
||||||
int drm_output_attach_property(struct drm_output *output,
|
int drm_output_attach_property(struct drm_output *output,
|
||||||
struct drm_property *property, int init_val)
|
struct drm_property *property, uint64_t init_val)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
@ -1942,10 +1961,14 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
|
||||||
struct drm_mode_get_property *out_resp = data;
|
struct drm_mode_get_property *out_resp = data;
|
||||||
struct drm_property *property;
|
struct drm_property *property;
|
||||||
int enum_count = 0;
|
int enum_count = 0;
|
||||||
|
int blob_count = 0;
|
||||||
int value_count = 0;
|
int value_count = 0;
|
||||||
int ret = 0, i;
|
int ret = 0, i;
|
||||||
int copied;
|
int copied;
|
||||||
struct drm_property_enum *prop_enum;
|
struct drm_property_enum *prop_enum;
|
||||||
|
struct drm_property_enum __user *enum_ptr;
|
||||||
|
struct drm_property_blob *prop_blob;
|
||||||
|
uint64_t __user *values_ptr;
|
||||||
|
|
||||||
mutex_lock(&dev->mode_config.mutex);
|
mutex_lock(&dev->mode_config.mutex);
|
||||||
property = idr_find(&dev->mode_config.crtc_idr, out_resp->prop_id);
|
property = idr_find(&dev->mode_config.crtc_idr, out_resp->prop_id);
|
||||||
|
|
@ -1954,9 +1977,13 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property->flags & DRM_MODE_PROP_ENUM) {
|
||||||
list_for_each_entry(prop_enum, &property->enum_list, head)
|
list_for_each_entry(prop_enum, &property->enum_blob_list, head)
|
||||||
enum_count++;
|
enum_count++;
|
||||||
|
} else if (property->flags & DRM_MODE_PROP_BLOB) {
|
||||||
|
list_for_each_entry(prop_blob, &property->enum_blob_list, head)
|
||||||
|
blob_count++;
|
||||||
|
}
|
||||||
|
|
||||||
value_count = property->num_values;
|
value_count = property->num_values;
|
||||||
|
|
||||||
|
|
@ -1965,8 +1992,9 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
|
||||||
out_resp->flags = property->flags;
|
out_resp->flags = property->flags;
|
||||||
|
|
||||||
if ((out_resp->count_values >= value_count) && value_count) {
|
if ((out_resp->count_values >= value_count) && value_count) {
|
||||||
|
values_ptr = (uint64_t *)(unsigned long)out_resp->values_ptr;
|
||||||
for (i = 0; i < value_count; i++) {
|
for (i = 0; i < value_count; i++) {
|
||||||
if (put_user(property->values[i], out_resp->values + i)) {
|
if (put_user(property->values[i], values_ptr + i)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -1974,10 +2002,30 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
|
||||||
}
|
}
|
||||||
out_resp->count_values = value_count;
|
out_resp->count_values = value_count;
|
||||||
|
|
||||||
if ((out_resp->count_enums >= enum_count) && enum_count) {
|
if ((out_resp->count_enum_blobs >= enum_count) && enum_count && (property->flags & DRM_MODE_PROP_ENUM)) {
|
||||||
copied = 0;
|
copied = 0;
|
||||||
list_for_each_entry(prop_enum, &property->enum_list, head) {
|
enum_ptr = (struct drm_property_enum *)(unsigned long)out_resp->enum_blob_ptr;
|
||||||
if (put_user(prop_enum->value, &out_resp->enums[copied].value)) {
|
list_for_each_entry(prop_enum, &property->enum_blob_list, head) {
|
||||||
|
if (put_user(prop_enum->value, &enum_ptr[copied].value)) {
|
||||||
|
ret = -EFAULT;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (copy_to_user(&enum_ptr[copied].name,
|
||||||
|
prop_enum->name, DRM_PROP_NAME_LEN)) {
|
||||||
|
ret = -EFAULT;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
copied++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
out_resp->count_enum_blobs = enum_count;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if ((out_resp->count_blobs >= enum_count) && blob_count && (property->flags & DRM_MODE_PROP_BLOB)) {
|
||||||
|
copied = 0;
|
||||||
|
list_for_each_entry(prop_blob, &property->enum_list, head) {
|
||||||
|
if (put_user(prop_enum->value, &out_resp->blobs[copied].value)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
@ -1991,8 +2039,39 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out_resp->count_enums = enum_count;
|
out_resp->count_enums = enum_count;
|
||||||
|
#endif
|
||||||
done:
|
done:
|
||||||
mutex_unlock(&dev->mode_config.mutex);
|
mutex_unlock(&dev->mode_config.mutex);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int drm_property_create_blob(struct drm_device *dev, int length,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
struct drm_property_blob *blob;
|
||||||
|
|
||||||
|
if (!length || !data)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
|
||||||
|
if (!blob)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
blob->data = (void *)((char *)blob + sizeof(struct drm_property_blob));
|
||||||
|
blob->length = length;
|
||||||
|
|
||||||
|
memcpy(blob->data, data, length);
|
||||||
|
|
||||||
|
blob->id = drm_idr_get(dev, blob);
|
||||||
|
|
||||||
|
list_add_tail(&blob->head, &dev->mode_config.property_blob_list);
|
||||||
|
return blob->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void drm_property_destroy_blob(struct drm_device *dev,
|
||||||
|
struct drm_property_blob *blob)
|
||||||
|
{
|
||||||
|
drm_idr_put(dev, blob->id);
|
||||||
|
list_del(&blob->head);
|
||||||
|
kfree(blob);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -234,9 +234,16 @@ struct drm_framebuffer {
|
||||||
struct list_head filp_head;
|
struct list_head filp_head;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct drm_property_blob {
|
||||||
|
struct list_head head;
|
||||||
|
unsigned int id;
|
||||||
|
unsigned int length;
|
||||||
|
void *data;
|
||||||
|
};
|
||||||
|
|
||||||
struct drm_property_enum {
|
struct drm_property_enum {
|
||||||
struct list_head head;
|
struct list_head head;
|
||||||
uint32_t value;
|
uint64_t value;
|
||||||
unsigned char name[DRM_PROP_NAME_LEN];
|
unsigned char name[DRM_PROP_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -246,9 +253,9 @@ struct drm_property {
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
char name[DRM_PROP_NAME_LEN];
|
char name[DRM_PROP_NAME_LEN];
|
||||||
uint32_t num_values;
|
uint32_t num_values;
|
||||||
uint32_t *values;
|
uint64_t *values;
|
||||||
|
|
||||||
struct list_head enum_list;
|
struct list_head enum_blob_list;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_crtc;
|
struct drm_crtc;
|
||||||
|
|
@ -451,7 +458,7 @@ struct drm_output {
|
||||||
struct list_head user_modes;
|
struct list_head user_modes;
|
||||||
|
|
||||||
u32 property_ids[DRM_OUTPUT_MAX_PROPERTY];
|
u32 property_ids[DRM_OUTPUT_MAX_PROPERTY];
|
||||||
u32 property_values[DRM_OUTPUT_MAX_PROPERTY];
|
uint64_t property_values[DRM_OUTPUT_MAX_PROPERTY];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -492,6 +499,10 @@ struct drm_mode_config {
|
||||||
/* DGA stuff? */
|
/* DGA stuff? */
|
||||||
struct drm_mode_config_funcs *funcs;
|
struct drm_mode_config_funcs *funcs;
|
||||||
unsigned long fb_base;
|
unsigned long fb_base;
|
||||||
|
|
||||||
|
/* pointers to standard properties */
|
||||||
|
struct list_head property_blob_list;
|
||||||
|
struct drm_property *edid_property;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_output *drm_output_create(struct drm_device *dev,
|
struct drm_output *drm_output_create(struct drm_device *dev,
|
||||||
|
|
@ -549,12 +560,12 @@ extern bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mo
|
||||||
int x, int y);
|
int x, int y);
|
||||||
|
|
||||||
extern int drm_output_attach_property(struct drm_output *output,
|
extern int drm_output_attach_property(struct drm_output *output,
|
||||||
struct drm_property *property, int init_val);
|
struct drm_property *property, uint64_t init_val);
|
||||||
extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
|
extern struct drm_property *drm_property_create(struct drm_device *dev, int flags,
|
||||||
const char *name, int num_values);
|
const char *name, int num_values);
|
||||||
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
|
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
|
||||||
extern int drm_property_add_enum(struct drm_property *property, int index,
|
extern int drm_property_add_enum(struct drm_property *property, int index,
|
||||||
uint32_t value, const char *name);
|
uint64_t value, const char *name);
|
||||||
|
|
||||||
/* IOCTLs */
|
/* IOCTLs */
|
||||||
extern int drm_mode_getresources(struct drm_device *dev,
|
extern int drm_mode_getresources(struct drm_device *dev,
|
||||||
|
|
|
||||||
|
|
@ -245,4 +245,6 @@ void intel_crt_init(struct drm_device *dev)
|
||||||
output->driver_private = intel_output;
|
output->driver_private = intel_output;
|
||||||
output->interlace_allowed = 0;
|
output->interlace_allowed = 0;
|
||||||
output->doublescan_allowed = 0;
|
output->doublescan_allowed = 0;
|
||||||
|
|
||||||
|
drm_output_attach_property(output, dev->mode_config.edid_property, 0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -920,18 +920,19 @@ struct drm_mode_modeinfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_mode_card_res {
|
struct drm_mode_card_res {
|
||||||
|
uint64_t fb_id_ptr;
|
||||||
|
uint64_t crtc_id_ptr;
|
||||||
|
uint64_t output_id_ptr;
|
||||||
int count_fbs;
|
int count_fbs;
|
||||||
unsigned int __user *fb_id;
|
|
||||||
|
|
||||||
int count_crtcs;
|
int count_crtcs;
|
||||||
unsigned int __user *crtc_id;
|
|
||||||
|
|
||||||
int count_outputs;
|
int count_outputs;
|
||||||
unsigned int __user *output_id;
|
int min_width, max_width;
|
||||||
|
int min_height, max_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_mode_crtc {
|
struct drm_mode_crtc {
|
||||||
|
uint64_t set_outputs_ptr;
|
||||||
|
|
||||||
unsigned int crtc_id; /**< Id */
|
unsigned int crtc_id; /**< Id */
|
||||||
unsigned int fb_id; /**< Id of framebuffer */
|
unsigned int fb_id; /**< Id of framebuffer */
|
||||||
|
|
||||||
|
|
@ -942,9 +943,6 @@ struct drm_mode_crtc {
|
||||||
|
|
||||||
int count_possibles;
|
int count_possibles;
|
||||||
unsigned int possibles; /**< Outputs that can be connected */
|
unsigned int possibles; /**< Outputs that can be connected */
|
||||||
|
|
||||||
unsigned int __user *set_outputs; /**< Outputs to be connected */
|
|
||||||
|
|
||||||
int gamma_size;
|
int gamma_size;
|
||||||
int mode_valid;
|
int mode_valid;
|
||||||
struct drm_mode_modeinfo mode;
|
struct drm_mode_modeinfo mode;
|
||||||
|
|
@ -952,6 +950,12 @@ struct drm_mode_crtc {
|
||||||
|
|
||||||
struct drm_mode_get_output {
|
struct drm_mode_get_output {
|
||||||
|
|
||||||
|
uint64_t modes_ptr;
|
||||||
|
uint64_t props_ptr;
|
||||||
|
uint64_t prop_values_ptr;
|
||||||
|
|
||||||
|
int count_modes;
|
||||||
|
int count_props;
|
||||||
unsigned int output; /**< Id */
|
unsigned int output; /**< Id */
|
||||||
unsigned int crtc; /**< Id of crtc */
|
unsigned int crtc; /**< Id of crtc */
|
||||||
unsigned char name[DRM_OUTPUT_NAME_LEN];
|
unsigned char name[DRM_OUTPUT_NAME_LEN];
|
||||||
|
|
@ -959,42 +963,37 @@ struct drm_mode_get_output {
|
||||||
unsigned int connection;
|
unsigned int connection;
|
||||||
unsigned int mm_width, mm_height; /**< HxW in millimeters */
|
unsigned int mm_width, mm_height; /**< HxW in millimeters */
|
||||||
unsigned int subpixel;
|
unsigned int subpixel;
|
||||||
|
|
||||||
int count_crtcs;
|
int count_crtcs;
|
||||||
unsigned int crtcs; /**< possible crtc to connect to */
|
|
||||||
|
|
||||||
int count_clones;
|
int count_clones;
|
||||||
|
unsigned int crtcs; /**< possible crtc to connect to */
|
||||||
unsigned int clones; /**< list of clones */
|
unsigned int clones; /**< list of clones */
|
||||||
|
|
||||||
int count_modes;
|
|
||||||
struct drm_mode_modeinfo *modes;
|
|
||||||
|
|
||||||
int count_props;
|
|
||||||
unsigned int __user *props;
|
|
||||||
unsigned int __user *prop_values;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DRM_MODE_PROP_PENDING (1<<0)
|
#define DRM_MODE_PROP_PENDING (1<<0)
|
||||||
#define DRM_MODE_PROP_RANGE (1<<1)
|
#define DRM_MODE_PROP_RANGE (1<<1)
|
||||||
#define DRM_MODE_PROP_IMMUTABLE (1<<2)
|
#define DRM_MODE_PROP_IMMUTABLE (1<<2)
|
||||||
#define DRM_MODE_PROP_ENUM (1<<3) // enumerated type with text strings
|
#define DRM_MODE_PROP_ENUM (1<<3) // enumerated type with text strings
|
||||||
|
#define DRM_MODE_PROP_BLOB (1<<4)
|
||||||
|
|
||||||
struct drm_mode_property_enum {
|
struct drm_mode_property_enum {
|
||||||
uint32_t value;
|
uint64_t value;
|
||||||
unsigned char name[DRM_PROP_NAME_LEN];
|
unsigned char name[DRM_PROP_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct drm_mode_property_blob {
|
||||||
|
uint32_t length;
|
||||||
|
};
|
||||||
|
|
||||||
struct drm_mode_get_property {
|
struct drm_mode_get_property {
|
||||||
|
uint64_t values_ptr;
|
||||||
|
uint64_t enum_blob_ptr;
|
||||||
|
|
||||||
unsigned int prop_id;
|
unsigned int prop_id;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
unsigned char name[DRM_PROP_NAME_LEN];
|
unsigned char name[DRM_PROP_NAME_LEN];
|
||||||
|
|
||||||
int count_values;
|
int count_values;
|
||||||
uint32_t __user *values;
|
int count_enum_blobs;
|
||||||
|
|
||||||
int count_enums;
|
|
||||||
struct drm_mode_property_enum *enums;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct drm_mode_fb_cmd {
|
struct drm_mode_fb_cmd {
|
||||||
|
|
@ -1111,6 +1110,7 @@ struct drm_mode_mode_cmd {
|
||||||
#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xA5, unsigned int)
|
#define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xA5, unsigned int)
|
||||||
#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xA6, struct drm_mode_fb_cmd)
|
#define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xA6, struct drm_mode_fb_cmd)
|
||||||
|
|
||||||
|
#define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xA8, struct drm_mode_get_propblob)
|
||||||
#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd)
|
#define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd)
|
||||||
#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xAA, struct drm_mode_mode_cmd)
|
#define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xAA, struct drm_mode_mode_cmd)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,10 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id)
|
||||||
|
|
||||||
printf("\n\tenums %d: \n", props->count_enums);
|
printf("\n\tenums %d: \n", props->count_enums);
|
||||||
|
|
||||||
|
if (prop->flags & DRM_MODE_PROP_BLOB) {
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
for (j = 0; j < props->count_enums; j++) {
|
for (j = 0; j < props->count_enums; j++) {
|
||||||
if (output->prop_values[i] == props->enums[j].value)
|
if (output->prop_values[i] == props->enums[j].value)
|
||||||
name = props->enums[j].name;
|
name = props->enums[j].name;
|
||||||
|
|
@ -87,6 +91,7 @@ int printOutput(int fd, drmModeResPtr res, drmModeOutputPtr output, uint32_t id)
|
||||||
} else {
|
} else {
|
||||||
printf("\toutput property id %s %i\n", props->name, output->prop_values[i]);
|
printf("\toutput property id %s %i\n", props->name, output->prop_values[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
drmModeFreeProperty(props);
|
drmModeFreeProperty(props);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue