summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2012-05-15 18:09:01 -0300
committerDave Airlie <airlied@redhat.com>2012-05-17 11:11:13 +0100
commit7e3bdf4a6dca9eb153cc20d69d717308a68bec00 (patch)
tree48ae386340e926e9d84b7e5b750ac9f07da57392 /drivers/gpu/drm/drm_crtc.c
parentafea2ad53f1fef0b57d0e59fa062f54797158b14 (diff)
downloadblackbird-op-linux-7e3bdf4a6dca9eb153cc20d69d717308a68bec00.tar.gz
blackbird-op-linux-7e3bdf4a6dca9eb153cc20d69d717308a68bec00.zip
drm: create struct drm_object_properties and use it
For now, only connectors have it. In the future, all objects that need properties should use it. Since the structure is referenced inside struct drm_mode_object, we will be able to deal with object properties without knowing the real type of the object. Reviewed-by: Eugeni Dodonov <eugeni.dodonov@intel.com> Reviewed-by: Rob Clark <rob.clark@linaro.org> Tested-by: Rob Clark <rob.clark@linaro.org> Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c45
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 37bb7ab3cbb0..19a289f01234 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -483,6 +483,7 @@ int drm_connector_init(struct drm_device *dev,
if (ret)
goto out;
+ connector->base.properties = &connector->properties;
connector->dev = dev;
connector->funcs = funcs;
connector->connector_type = connector_type;
@@ -1424,8 +1425,8 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
}
connector = obj_to_connector(obj);
- for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
- if (connector->property_ids[i] != 0) {
+ for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
+ if (connector->properties.ids[i] != 0) {
props_count++;
}
}
@@ -1481,15 +1482,15 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
copied = 0;
prop_ptr = (uint32_t __user *)(unsigned long)(out_resp->props_ptr);
prop_values = (uint64_t __user *)(unsigned long)(out_resp->prop_values_ptr);
- for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
- if (connector->property_ids[i] != 0) {
- if (put_user(connector->property_ids[i],
+ for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
+ if (connector->properties.ids[i] != 0) {
+ if (put_user(connector->properties.ids[i],
prop_ptr + copied)) {
ret = -EFAULT;
goto out;
}
- if (put_user(connector->property_values[i],
+ if (put_user(connector->properties.values[i],
prop_values + copied)) {
ret = -EFAULT;
goto out;
@@ -2824,16 +2825,16 @@ void drm_connector_attach_property(struct drm_connector *connector,
{
int i;
- for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
- if (connector->property_ids[i] == 0) {
- connector->property_ids[i] = property->base.id;
- connector->property_values[i] = init_val;
+ 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_CONNECTOR_MAX_PROPERTY by 1 for each time you see this "
+ "DRM_OBJECT_MAX_PROPERTY by 1 for each time you see this "
"message\n");
}
EXPORT_SYMBOL(drm_connector_attach_property);
@@ -2843,14 +2844,14 @@ int drm_connector_property_set_value(struct drm_connector *connector,
{
int i;
- for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
- if (connector->property_ids[i] == property->base.id) {
- connector->property_values[i] = value;
+ 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_CONNECTOR_MAX_PROPERTY)
+ if (i == DRM_OBJECT_MAX_PROPERTY)
return -EINVAL;
return 0;
}
@@ -2861,14 +2862,14 @@ int drm_connector_property_get_value(struct drm_connector *connector,
{
int i;
- for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
- if (connector->property_ids[i] == property->base.id) {
- *val = connector->property_values[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_CONNECTOR_MAX_PROPERTY)
+ if (i == DRM_OBJECT_MAX_PROPERTY)
return -EINVAL;
return 0;
}
@@ -3113,12 +3114,12 @@ int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
}
connector = obj_to_connector(obj);
- for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) {
- if (connector->property_ids[i] == out_resp->prop_id)
+ for (i = 0; i < DRM_OBJECT_MAX_PROPERTY; i++) {
+ if (connector->properties.ids[i] == out_resp->prop_id)
break;
}
- if (i == DRM_CONNECTOR_MAX_PROPERTY) {
+ if (i == DRM_OBJECT_MAX_PROPERTY) {
goto out;
}
OpenPOWER on IntegriCloud