From patchwork Thu Sep 13 03:49:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 11376 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 6E84A23E29 for ; Thu, 13 Sep 2012 03:51:11 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id B124934B8D54 for ; Thu, 13 Sep 2012 03:51:10 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so4067700iea.11 for ; Wed, 12 Sep 2012 20:51:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf :dkim-signature:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=BWzoHcUOYrNeColM3kt06LKwW/wGVb6KGiPjpfVTQUg=; b=XtLXPQnzZCbX8UbDHaeqa9qU0Y5RiODoyb0wvbKeN3+64TtvM5eo+p/VYolOzmObsa ZPS2qvWFutvBmW6odYxzTzngz1fM4AADbIcK14BUK9K5ed00/6IcyHhofgvBk6bj3guO RtXtsWkKtmTfgsab0rcNlworxlktVptGwF7RYfvEqcDTGJMk4TCet59jMxtFaYQ3UYaY Qk+3QqLkvxg2ys5frBus7hgdWKHs+osQfPtRtAAQr9ACllkTy3/qnlWz7TkTMoVB9h6d tvd/IGlowJ/cGcUvdbmkJH5HI+vmS8haec9PBe+1xpL5OMpGVkix90KrY+Ai0PZ6RqMR Z0VA== Received: by 10.50.89.164 with SMTP id bp4mr612961igb.28.1347508270505; Wed, 12 Sep 2012 20:51:10 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.184.232 with SMTP id ex8csp111071igc; Wed, 12 Sep 2012 20:51:10 -0700 (PDT) Received: by 10.60.30.168 with SMTP id t8mr491011oeh.89.1347508270069; Wed, 12 Sep 2012 20:51:10 -0700 (PDT) Received: from mail-ob0-f178.google.com (mail-ob0-f178.google.com [209.85.214.178]) by mx.google.com with ESMTPS id rp7si28188597obc.5.2012.09.12.20.51.09 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 20:51:10 -0700 (PDT) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) client-ip=209.85.214.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.214.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass header.i=@gmail.com Received: by mail-ob0-f178.google.com with SMTP id wd20so4595268obb.37 for ; Wed, 12 Sep 2012 20:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=BWzoHcUOYrNeColM3kt06LKwW/wGVb6KGiPjpfVTQUg=; b=NUp7GMEs8bumFxmoL/c3d80n5qUAJDHSrB2PbjpXx07OH0O9lOPmNgNO6XGMVsq/yw j69gGE7R0tbaDupdT7NMYqkTzQAjBtM9NMsaKZQ1kAC+AGK4vds5hYz42GmmDSkyX6R7 ObzV0tRBA1JIF+b3p4VUky38Uq1PY70BcqcuIAWDHCW12gtv0Et6RuLH70E5WsHOowiz e9+Emznaeb9GFZjAXx4AigJemXq5VC/YDMZ1z/NrJNJGhf5sq9YzNNfSXEeFEd+6GAjn fCmOyBKcovAXK2rohWNnJl25aRt2T0VuVMomikilh6YC7iaqtZUQk54xsDO1u7JqWkB3 cYCA== Received: by 10.182.37.41 with SMTP id v9mr519136obj.23.1347508269930; Wed, 12 Sep 2012 20:51:09 -0700 (PDT) Received: from localhost (ppp-70-129-131-42.dsl.rcsntx.swbell.net. [70.129.131.42]) by mx.google.com with ESMTPS id b5sm42162obd.18.2012.09.12.20.51.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 12 Sep 2012 20:51:09 -0700 (PDT) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, ville.syrjala@linux.intel.com, jbarnes@virtuousgeek.org, daniel.vetter@ffwll.ch, Rob Clark Subject: [RFC 05/11] drm: split property values out Date: Wed, 12 Sep 2012 22:49:51 -0500 Message-Id: <1347508195-14939-6-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1347508195-14939-1-git-send-email-rob.clark@linaro.org> References: <1347508195-14939-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQlSw8PdDdOqysUNPJQAkWSoQel2bX3FtRjDJcuMMHKknCs1TaIi2UZxXVOmw1LQLHdWbSd5 From: Rob Clark Split property values out into a different struct, so we can later move property values into state structs. This will allow the property values to stay in sync w/ the state updates which are either discarded or atomically committed. --- drivers/gpu/drm/drm_crtc.c | 27 ++++++++++++++++++--------- include/drm/drm_crtc.h | 10 +++++++++- 2 files changed, 27 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index e62ae6a..245c462 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -446,6 +446,7 @@ int drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, goto out; crtc->base.properties = &crtc->properties; + crtc->base.propvals = &crtc->propvals; list_add_tail(&crtc->head, &dev->mode_config.crtc_list); dev->mode_config.num_crtc++; @@ -547,6 +548,7 @@ int drm_connector_init(struct drm_device *dev, goto out; connector->base.properties = &connector->properties; + connector->base.propvals = &connector->propvals; connector->dev = dev; connector->funcs = funcs; connector->connector_type = connector_type; @@ -670,6 +672,7 @@ int drm_plane_init(struct drm_device *dev, struct drm_plane *plane, goto out; plane->base.properties = &plane->properties; + plane->base.propvals = &plane->propvals; plane->dev = dev; plane->funcs = funcs; plane->format_types = kmalloc(sizeof(uint32_t) * format_count, @@ -1549,7 +1552,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data, goto out; } - if (put_user(connector->properties.values[i], + if (put_user(connector->propvals.values[i], prop_values + copied)) { ret = -EFAULT; goto out; @@ -2944,7 +2947,8 @@ EXPORT_SYMBOL(drm_connector_attach_property); int drm_connector_property_set_value(struct drm_connector *connector, struct drm_property *property, uint64_t value) { - return drm_object_property_set_value(&connector->base, property, value); + return drm_object_property_set_value(&connector->base, + &connector->propvals, property, value); } EXPORT_SYMBOL(drm_connector_property_set_value); @@ -2970,19 +2974,20 @@ void drm_object_attach_property(struct drm_mode_object *obj, } obj->properties->ids[count] = property->base.id; - obj->properties->values[count] = init_val; + obj->propvals->values[count] = init_val; obj->properties->count++; } EXPORT_SYMBOL(drm_object_attach_property); int drm_object_property_set_value(struct drm_mode_object *obj, + struct drm_object_property_values *propvals, struct drm_property *property, uint64_t val) { int i; for (i = 0; i < obj->properties->count; i++) { if (obj->properties->ids[i] == property->base.id) { - obj->properties->values[i] = val; + propvals->values[i] = val; return 0; } } @@ -2998,7 +3003,7 @@ int drm_object_property_get_value(struct drm_mode_object *obj, for (i = 0; i < obj->properties->count; i++) { if (obj->properties->ids[i] == property->base.id) { - *val = obj->properties->values[i]; + *val = obj->propvals->values[i]; return 0; } } @@ -3273,7 +3278,9 @@ static int drm_mode_connector_set_obj_prop(struct drm_connector *connector, /* store the property value if successful */ if (!ret) - drm_object_property_set_value(&connector->base, property, value); + drm_object_property_set_value(&connector->base, + &connector->propvals, property, value); + return ret; } @@ -3286,7 +3293,8 @@ static int drm_mode_crtc_set_obj_prop(struct drm_crtc *crtc, if (crtc->funcs->set_property) ret = crtc->funcs->set_property(crtc, state, property, value); if (!ret) - drm_object_property_set_value(&crtc->base, property, value); + drm_object_property_set_value(&crtc->base, &crtc->propvals, + property, value); return ret; } @@ -3300,7 +3308,8 @@ static int drm_mode_plane_set_obj_prop(struct drm_plane *plane, if (plane->funcs->set_property) ret = plane->funcs->set_property(plane, state, property, value); if (!ret) - drm_object_property_set_value(&plane->base, property, value); + drm_object_property_set_value(&plane->base, &plane->propvals, + property, value); return ret; } @@ -3401,7 +3410,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data, ret = -EFAULT; goto out; } - if (put_user(obj->properties->values[i], + if (put_user(obj->propvals->values[i], prop_values_ptr + copied)) { ret = -EFAULT; goto out; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index dc67f5f..b5f71f8 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -37,7 +37,7 @@ struct drm_device; struct drm_mode_set; struct drm_framebuffer; struct drm_object_properties; - +struct drm_object_property_values; #define DRM_MODE_OBJECT_CRTC 0xcccccccc #define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 @@ -52,12 +52,16 @@ struct drm_mode_object { uint32_t id; uint32_t type; struct drm_object_properties *properties; + struct drm_object_property_values *propvals; }; #define DRM_OBJECT_MAX_PROPERTY 24 struct drm_object_properties { int count; uint32_t ids[DRM_OBJECT_MAX_PROPERTY]; +}; + +struct drm_object_property_values { uint64_t values[DRM_OBJECT_MAX_PROPERTY]; }; @@ -431,6 +435,7 @@ struct drm_crtc { void *helper_private; struct drm_object_properties properties; + struct drm_object_property_values propvals; }; @@ -597,6 +602,7 @@ struct drm_connector { struct list_head user_modes; struct drm_property_blob *edid_blob_ptr; struct drm_object_properties properties; + struct drm_object_property_values propvals; uint8_t polled; /* DRM_CONNECTOR_POLL_* */ @@ -681,6 +687,7 @@ struct drm_plane { void *helper_private; struct drm_object_properties properties; + struct drm_object_property_values propvals; }; /** @@ -934,6 +941,7 @@ extern int drm_connector_property_get_value(struct drm_connector *connector, struct drm_property *property, uint64_t *value); extern int drm_object_property_set_value(struct drm_mode_object *obj, + struct drm_object_property_values *propvals, struct drm_property *property, uint64_t val); extern int drm_object_property_get_value(struct drm_mode_object *obj,