Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307391
b: refs/heads/master
c: 0057d8d
h: refs/heads/master
i:
  307389: 79ed100
  307387: 8803b67
  307383: 4dc9ef1
  307375: fd7f0a3
  307359: 952a69c
  307327: 1444833
v: v3
  • Loading branch information
Paulo Zanoni authored and Dave Airlie committed May 17, 2012
1 parent bf25797 commit 176b22e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 87 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: c543188afb7a83e66161c026dc6fd5eb38dc0b63
refs/heads/master: 0057d8dd8d378bf88f75736496d779f3c9454b5f
98 changes: 12 additions & 86 deletions trunk/drivers/gpu/drm/drm_crtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2823,55 +2823,21 @@ EXPORT_SYMBOL(drm_property_destroy);
void drm_connector_attach_property(struct drm_connector *connector,
struct drm_property *property, uint64_t init_val)
{
int i;

for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
if (connector->properties.ids[i] == 0) {
connector->properties.ids[i] = property->base.id;
connector->properties.values[i] = init_val;
return;
}
}

WARN(1, "Failed to attach connector property. Please increase "
"DRM_OBJECT_MAX_PROPERTY by 1 for each time you see this "
"message\n");
drm_object_attach_property(&connector->base, property, init_val);
}
EXPORT_SYMBOL(drm_connector_attach_property);

int drm_connector_property_set_value(struct drm_connector *connector,
struct drm_property *property, uint64_t value)
{
int i;

for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
if (connector->properties.ids[i] == property->base.id) {
connector->properties.values[i] = value;
break;
}
}

if (i == DRM_OBJECT_MAX_PROPERTY)
return -EINVAL;
return 0;
return drm_object_property_set_value(&connector->base, property, value);
}
EXPORT_SYMBOL(drm_connector_property_set_value);

int drm_connector_property_get_value(struct drm_connector *connector,
struct drm_property *property, uint64_t *val)
{
int i;

for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
if (connector->properties.ids[i] == property->base.id) {
*val = connector->properties.values[i];
break;
}
}

if (i == DRM_OBJECT_MAX_PROPERTY)
return -EINVAL;
return 0;
return drm_object_property_get_value(&connector->base, property, val);
}
EXPORT_SYMBOL(drm_connector_property_get_value);

Expand Down Expand Up @@ -3148,56 +3114,16 @@ static bool drm_property_change_is_valid(struct drm_property *property,
int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
void *data, struct drm_file *file_priv)
{
struct drm_mode_connector_set_property *out_resp = data;
struct drm_mode_object *obj;
struct drm_property *property;
struct drm_connector *connector;
int ret = -EINVAL;
int i;

if (!drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;

mutex_lock(&dev->mode_config.mutex);

obj = drm_mode_object_find(dev, out_resp->connector_id, DRM_MODE_OBJECT_CONNECTOR);
if (!obj) {
goto out;
}
connector = obj_to_connector(obj);

for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
if (connector->properties.ids[i] == out_resp->prop_id)
break;
}

if (i == DRM_OBJECT_MAX_PROPERTY) {
goto out;
}

obj = drm_mode_object_find(dev, out_resp->prop_id, DRM_MODE_OBJECT_PROPERTY);
if (!obj) {
goto out;
}
property = obj_to_property(obj);
struct drm_mode_connector_set_property *conn_set_prop = data;
struct drm_mode_obj_set_property obj_set_prop = {
.value = conn_set_prop->value,
.prop_id = conn_set_prop->prop_id,
.obj_id = conn_set_prop->connector_id,
.obj_type = DRM_MODE_OBJECT_CONNECTOR
};

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

/* Do DPMS ourselves */
if (property == connector->dev->mode_config.dpms_property) {
if (connector->funcs->dpms)
(*connector->funcs->dpms)(connector, (int) out_resp->value);
ret = 0;
} else if (connector->funcs->set_property)
ret = connector->funcs->set_property(connector, property, out_resp->value);

/* store the property value if successful */
if (!ret)
drm_connector_property_set_value(connector, property, out_resp->value);
out:
mutex_unlock(&dev->mode_config.mutex);
return ret;
/* It does all the locking and checking we need */
return drm_mode_obj_set_property_ioctl(dev, &obj_set_prop, file_priv);
}

static int drm_mode_connector_set_obj_prop(struct drm_mode_object *obj,
Expand Down

0 comments on commit 176b22e

Please sign in to comment.