Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307387
b: refs/heads/master
c: 26a3481
h: refs/heads/master
i:
  307385: 94d8048
  307383: 4dc9ef1
v: v3
  • Loading branch information
Paulo Zanoni authored and Dave Airlie committed May 17, 2012
1 parent c900124 commit 8803b67
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4ab2c7f15423f313187b310a48ee0ac631c414f1
refs/heads/master: 26a3481586eb1918a75d338e31c990deab06fb5b
39 changes: 19 additions & 20 deletions trunk/drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3074,6 +3074,24 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector,
}
EXPORT_SYMBOL(drm_mode_connector_update_edid_property);

static bool drm_property_change_is_valid(struct drm_property *property,
__u64 value)
{
if (property->flags & DRM_MODE_PROP_IMMUTABLE)
return false;
if (property->flags & DRM_MODE_PROP_RANGE) {
if (value < property->values[0] || value > property->values[1])
return false;
return true;
} else {
int i;
for (i = 0; i < property->num_values; i++)
if (property->values[i] == value)
return true;
return false;
}
}

int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
Expand Down Expand Up @@ -3110,28 +3128,9 @@ int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
}
property = obj_to_property(obj);

if (property->flags & DRM_MODE_PROP_IMMUTABLE)
if (!drm_property_change_is_valid(property, out_resp->value))
goto out;

if (property->flags & DRM_MODE_PROP_RANGE) {
if (out_resp->value < property->values[0])
goto out;

if (out_resp->value > property->values[1])
goto out;
} else {
int found = 0;
for (i = 0; i < property->num_values; i++) {
if (property->values[i] == out_resp->value) {
found = 1;
break;
}
}
if (!found) {
goto out;
}
}

/* Do DPMS ourselves */
if (property == connector->dev->mode_config.dpms_property) {
if (connector->funcs->dpms)
Expand Down

0 comments on commit 8803b67

Please sign in to comment.