mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
drm: store property instead of id in obj attachment
Keep property pointer, instead of id, in per mode-object attachments. This will simplify things in later patches. Signed-off-by: Rob Clark <robdclark@gmail.com> Reviewed-by: Sean Paul <seanpaul@chromium.org> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
3843e71f98
commit
b17cd757a3
2 changed files with 14 additions and 10 deletions
|
@ -2105,12 +2105,11 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
|
||||||
prop_ptr = (uint32_t __user *)(unsigned long)(out_resp->props_ptr);
|
prop_ptr = (uint32_t __user *)(unsigned long)(out_resp->props_ptr);
|
||||||
prop_values = (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr);
|
prop_values = (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr);
|
||||||
for (i = 0; i < connector->properties.count; i++) {
|
for (i = 0; i < connector->properties.count; i++) {
|
||||||
if (put_user(connector->properties.ids[i],
|
struct drm_property *prop = connector->properties.properties[i];
|
||||||
prop_ptr + copied)) {
|
if (put_user(prop->base.id, prop_ptr + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (put_user(connector->properties.values[i],
|
if (put_user(connector->properties.values[i],
|
||||||
prop_values + copied)) {
|
prop_values + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
|
@ -3822,7 +3821,7 @@ void drm_object_attach_property(struct drm_mode_object *obj,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj->properties->ids[count] = property->base.id;
|
obj->properties->properties[count] = property;
|
||||||
obj->properties->values[count] = init_val;
|
obj->properties->values[count] = init_val;
|
||||||
obj->properties->count++;
|
obj->properties->count++;
|
||||||
}
|
}
|
||||||
|
@ -3847,7 +3846,7 @@ int drm_object_property_set_value(struct drm_mode_object *obj,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < obj->properties->count; i++) {
|
for (i = 0; i < obj->properties->count; i++) {
|
||||||
if (obj->properties->ids[i] == property->base.id) {
|
if (obj->properties->properties[i] == property) {
|
||||||
obj->properties->values[i] = val;
|
obj->properties->values[i] = val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -3877,7 +3876,7 @@ int drm_object_property_get_value(struct drm_mode_object *obj,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < obj->properties->count; i++) {
|
for (i = 0; i < obj->properties->count; i++) {
|
||||||
if (obj->properties->ids[i] == property->base.id) {
|
if (obj->properties->properties[i] == property) {
|
||||||
*val = obj->properties->values[i];
|
*val = obj->properties->values[i];
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -4413,8 +4412,8 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
|
||||||
prop_values_ptr = (uint64_t __user *)(unsigned long)
|
prop_values_ptr = (uint64_t __user *)(unsigned long)
|
||||||
(arg->prop_values_ptr);
|
(arg->prop_values_ptr);
|
||||||
for (i = 0; i < props_count; i++) {
|
for (i = 0; i < props_count; i++) {
|
||||||
if (put_user(obj->properties->ids[i],
|
struct drm_property *prop = obj->properties->properties[i];
|
||||||
props_ptr + copied)) {
|
if (put_user(prop->base.id, props_ptr + copied)) {
|
||||||
ret = -EFAULT;
|
ret = -EFAULT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -4472,7 +4471,7 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
for (i = 0; i < arg_obj->properties->count; i++)
|
for (i = 0; i < arg_obj->properties->count; i++)
|
||||||
if (arg_obj->properties->ids[i] == arg->prop_id)
|
if (arg_obj->properties->properties[i]->base.id == arg->prop_id)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (i == arg_obj->properties->count)
|
if (i == arg_obj->properties->count)
|
||||||
|
|
|
@ -64,7 +64,12 @@ struct drm_mode_object {
|
||||||
#define DRM_OBJECT_MAX_PROPERTY 24
|
#define DRM_OBJECT_MAX_PROPERTY 24
|
||||||
struct drm_object_properties {
|
struct drm_object_properties {
|
||||||
int count;
|
int count;
|
||||||
uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
|
/* NOTE: if we ever start dynamically destroying properties (ie.
|
||||||
|
* not at drm_mode_config_cleanup() time), then we'd have to do
|
||||||
|
* a better job of detaching property from mode objects to avoid
|
||||||
|
* dangling property pointers:
|
||||||
|
*/
|
||||||
|
struct drm_property *properties[DRM_OBJECT_MAX_PROPERTY];
|
||||||
uint64_t values[DRM_OBJECT_MAX_PROPERTY];
|
uint64_t values[DRM_OBJECT_MAX_PROPERTY];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue