From patchwork Sat Oct 13 00:49:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 12200 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 DA17D23EFB for ; Sat, 13 Oct 2012 00:49:32 +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 8E708A18888 for ; Sat, 13 Oct 2012 00:49:32 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so5509064iej.11 for ; Fri, 12 Oct 2012 17:49:32 -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=8zJ4RbJkN3o9O/35NGCqw+/cuwtDKoFJ8VMJUlOY26c=; b=LapRh3yPbVv4GWefq+qEgrLRyXzFpFp/at8aIzGuHRpzkBeZMInjpbyMTDitTilUn5 o+A1yrXbQj9QhZ77fl4hQdLJHTycKtllNOMD6AYKNy8wKKOVfxEbrxdDxyK1ROdiLcUW tFjXo+CDwULHsetwyxQO8TDHpuXszlIkKZFHClmu19B8+aBhX6UupSGw6duKXcsHNw+F DEMrb7krAzDj5guip6B/3+ge4AN/FhXsG98hr/W2+XFyuIRIGlka1zG5po+3ywKt/HOm XoJtChFBGqjkrdQaKbxdWYR7FYBB3F7ykUSSuqgaoszQ+C//wG5jd7xe98PlQ3TqtRyD Sm1w== Received: by 10.50.236.72 with SMTP id us8mr3592015igc.70.1350089372146; Fri, 12 Oct 2012 17:49:32 -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.67.148 with SMTP id n20csp274625igt; Fri, 12 Oct 2012 17:49:31 -0700 (PDT) Received: by 10.60.3.6 with SMTP id 6mr4877549oey.117.1350089371734; Fri, 12 Oct 2012 17:49:31 -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 d7si101858oea.37.2012.10.12.17.49.31 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 17:49:31 -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 tb18so4158660obb.37 for ; Fri, 12 Oct 2012 17:49:31 -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=8zJ4RbJkN3o9O/35NGCqw+/cuwtDKoFJ8VMJUlOY26c=; b=pMXBHFDbAfj1f0SEI7YoOnJZK9M3ohY0zlSrWqsj5o/ormcj4F7sGLy1rpKYoSpxYW ztn/DFiqjNh/KcfWT0Hipe0TtvLCq+hjxahEuKVh60BdDZv7emAgDmBDM1iV00/I/PTv WosEMn/0NNGSrGbVwXhz4FZ0cBNpS8lxSkGJwI6KbnqanOhNRfHRoSmtP87lIvU3CdtT 2ip1QmJ3H7uTbJZ2SIRhcAdhKHZtrA1PTRzhvSGfsmBsmRFM7gAHNAP0Ga9v+zElpk5k wndZjYxRgeoCgj5Vk+Uxz8ageM8+YqtwL+ECuNMiME0pruxgC/84lFyVUSuvrhPzIYDE vVeQ== Received: by 10.60.7.65 with SMTP id h1mr4958264oea.66.1350089371600; Fri, 12 Oct 2012 17:49:31 -0700 (PDT) Received: from localhost (ppp-70-129-143-201.dsl.rcsntx.swbell.net. [70.129.143.201]) by mx.google.com with ESMTPS id n7sm8240474obd.16.2012.10.12.17.49.30 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 12 Oct 2012 17:49:31 -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, krh@bitplanet.net, Rob Clark Subject: [RFC 05/11] drm: split property values out Date: Fri, 12 Oct 2012 19:49:06 -0500 Message-Id: <1350089352-18162-6-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1350089352-18162-1-git-send-email-rob.clark@linaro.org> References: <1350089352-18162-1-git-send-email-rob.clark@linaro.org> X-Gm-Message-State: ALoCoQnb63S0dnuzpEV6OXzWf//jkyj1WNS9wgJ6kjX3hFY0VBgLKcc/j3A6VF5cvjHN6n4FwaMS 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 | 29 ++++++++++++++++++++--------- drivers/gpu/drm/drm_fb_helper.c | 1 + drivers/staging/omapdrm/omap_drv.c | 5 +++-- include/drm/drm_crtc.h | 10 +++++++++- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 5308a34..b1ccfea 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; @@ -2951,19 +2954,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; } } @@ -2979,7 +2983,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; } } @@ -3172,7 +3176,9 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, /* Delete edid, when there is none. */ if (!edid) { connector->edid_blob_ptr = NULL; - ret = drm_object_property_set_value(&connector->base, dev->mode_config.edid_property, 0); + ret = drm_object_property_set_value(&connector->base, + &connector->propvals, + dev->mode_config.edid_property, 0); return ret; } @@ -3181,6 +3187,7 @@ int drm_mode_connector_update_edid_property(struct drm_connector *connector, size, edid); ret = drm_object_property_set_value(&connector->base, + &connector->propvals, dev->mode_config.edid_property, connector->edid_blob_ptr->base.id); @@ -3254,7 +3261,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; } @@ -3267,7 +3276,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; } @@ -3281,7 +3291,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; } @@ -3382,7 +3393,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/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 712b3e88..80bdb59 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c @@ -332,6 +332,7 @@ static void drm_fb_helper_dpms(struct fb_info *info, int dpms_mode) connector = fb_helper->connector_info[j]->connector; connector->funcs->dpms(connector, dpms_mode); drm_object_property_set_value(&connector->base, + &connector->propvals, dev->mode_config.dpms_property, dpms_mode); } } diff --git a/drivers/staging/omapdrm/omap_drv.c b/drivers/staging/omapdrm/omap_drv.c index bdb98d5..5f5ee84 100644 --- a/drivers/staging/omapdrm/omap_drv.c +++ b/drivers/staging/omapdrm/omap_drv.c @@ -526,8 +526,9 @@ static void dev_lastclose(struct drm_device *dev) * default state on lastclose? */ for (i = 0; i < priv->num_planes; i++) { - drm_object_property_set_value(&priv->planes[i]->base, - priv->rotation_prop, 0); + struct drm_plane *plane = priv->planes[i]; + drm_object_property_set_value(&plane->base, + &plane->propvals, priv->rotation_prop, 0); } mutex_lock(&dev->mode_config.mutex); diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 219d35a..cb438bf 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]; }; @@ -430,6 +434,7 @@ struct drm_crtc { void *helper_private; struct drm_object_properties properties; + struct drm_object_property_values propvals; }; @@ -596,6 +601,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; }; /** @@ -928,6 +935,7 @@ extern void drm_mode_connector_list_update(struct drm_connector *connector); extern int drm_mode_connector_update_edid_property(struct drm_connector *connector, struct edid *edid); 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,