From: Paulo Zanoni <przanoni@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Subject: [PATCH 3/8] drm: create struct drm_object_properties and use it
Date: Thu, 29 Mar 2012 18:27:21 -0300 [thread overview]
Message-ID: <1333056446-3383-3-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>
For now, only connectors have it. In the future, all objects that need
properties should use it. Since the strucutre is referenced inside
struct drm_mode_object, we will be able to deal with object properties
without knowing the real type of the object.
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
---
drivers/gpu/drm/drm_crtc.c | 43 ++++++++++++++++++++++---------------------
include/drm/drm_crtc.h | 16 +++++++++++-----
2 files changed, 33 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index e3a5b0e..8800830 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -481,6 +481,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;
@@ -1422,8 +1423,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++;
}
}
@@ -1479,15 +1480,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;
@@ -2783,10 +2784,10 @@ 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;
}
}
@@ -2800,14 +2801,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;
}
@@ -2818,14 +2819,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;
}
@@ -3072,12 +3073,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;
}
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index c3d429a..84880a7 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -36,6 +36,8 @@
struct drm_device;
struct drm_mode_set;
struct drm_framebuffer;
+struct drm_property;
+struct drm_object_properties;
#define DRM_MODE_OBJECT_CRTC 0xcccccccc
@@ -50,6 +52,13 @@ struct drm_framebuffer;
struct drm_mode_object {
uint32_t id;
uint32_t type;
+ struct drm_object_properties *properties;
+};
+
+#define DRM_OBJECT_MAX_PROPERTY 16
+struct drm_object_properties {
+ uint32_t ids[DRM_OBJECT_MAX_PROPERTY];
+ uint64_t values[DRM_OBJECT_MAX_PROPERTY];
};
/*
@@ -451,7 +460,6 @@ struct drm_encoder_funcs {
};
#define DRM_CONNECTOR_MAX_UMODES 16
-#define DRM_CONNECTOR_MAX_PROPERTY 16
#define DRM_CONNECTOR_LEN 32
#define DRM_CONNECTOR_MAX_ENCODER 3
@@ -520,8 +528,7 @@ enum drm_connector_force {
* @funcs: connector control functions
* @user_modes: user added mode list
* @edid_blob_ptr: DRM property containing EDID if present
- * @property_ids: property tracking for this connector
- * @property_values: value pointers or data for properties
+ * @properties: property tracking for this connector
* @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling
* @dpms: current dpms state
* @helper_private: mid-layer private data
@@ -565,8 +572,7 @@ struct drm_connector {
struct list_head user_modes;
struct drm_property_blob *edid_blob_ptr;
- u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
- uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
+ struct drm_object_properties properties;
uint8_t polled; /* DRM_CONNECTOR_POLL_* */
--
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 ` Paulo Zanoni [this message]
2012-03-30 2:41 ` [PATCH 3/8] drm: create struct drm_object_properties and use it 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 ` [PATCH 5/8] drm: make the connector properties code use the object properties code Paulo Zanoni
2012-03-30 2:49 ` 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-3-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