From: Paulo Zanoni <przanoni@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 5/8] drm: make the connector properties code use the object properties code
Date: Thu, 29 Mar 2012 18:27:23 -0300 [thread overview]
Message-ID: <1333056446-3383-5-git-send-email-przanoni@gmail.com> (raw)
In-Reply-To: <1333056446-3383-1-git-send-email-przanoni@gmail.com>
From: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
drivers/gpu/drm/drm_crtc.c | 96 +++++--------------------------------------
1 files changed, 12 insertions(+), 84 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 12f93e4..b21bfcd 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2782,53 +2782,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\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);
@@ -3105,56 +3073,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,
--
1.7.9.1
next prev parent reply other threads:[~2012-03-29 21:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-29 21:27 [PATCH 1/8] drm: add drm_property_change_is_valid Paulo Zanoni
2012-03-29 21:27 ` [PATCH 2/8] drm: WARN() when drm_connector_attach_property fails Paulo Zanoni
2012-03-29 21:49 ` Chris Wilson
2012-03-29 21:27 ` [PATCH 3/8] drm: create struct drm_object_properties and use it Paulo Zanoni
2012-03-30 2:41 ` Eugeni Dodonov
2012-03-30 12:52 ` Ville Syrjälä
2012-03-29 21:27 ` [PATCH 4/8] drm: add generic ioctls to get/set properties on any object Paulo Zanoni
2012-03-30 2:47 ` Eugeni Dodonov
2012-03-30 13:04 ` Ville Syrjälä
2012-03-29 21:27 ` Paulo Zanoni [this message]
2012-03-30 2:49 ` [PATCH 5/8] drm: make the connector properties code use the object properties code Eugeni Dodonov
2012-03-29 21:27 ` [PATCH 6/8] drm: add CRTC properties Paulo Zanoni
2012-03-29 21:27 ` [PATCH RFC 7/8] drm/i915: add 'rotation' CRTC property Paulo Zanoni
2012-03-29 21:27 ` [PATCH 8/8] drm/i915: add overscan compensation CRTC properties Paulo Zanoni
2012-03-30 2:38 ` [PATCH 1/8] drm: add drm_property_change_is_valid Eugeni Dodonov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1333056446-3383-5-git-send-email-przanoni@gmail.com \
--to=przanoni@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=paulo.r.zanoni@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox