From patchwork Tue Dec 16 23:05:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5504031 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8BEC89F1CD for ; Tue, 16 Dec 2014 23:06:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CE12209E5 for ; Tue, 16 Dec 2014 23:06:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EC3D520A1B for ; Tue, 16 Dec 2014 23:06:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 35F3C6E42C; Tue, 16 Dec 2014 15:06:01 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qa0-f48.google.com (mail-qa0-f48.google.com [209.85.216.48]) by gabe.freedesktop.org (Postfix) with ESMTP id D84C56E42C for ; Tue, 16 Dec 2014 15:05:59 -0800 (PST) Received: by mail-qa0-f48.google.com with SMTP id v10so10482902qac.35 for ; Tue, 16 Dec 2014 15:05:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MvHhAAfSM7VC655NRyU/x+wSbl2mY9oS7ya1As+Uly8=; b=K5PTMoY+ieQKoz5rja6I4ZqqqH1SId0egs2jRHyeGDrcOwZl+NTCp0bYWbuUNPn6rG zOetW0CwnfJUTkCOKCThNdqJ1hES258zBYWBwrYZ/hHNLRvbZvalTchQ+uav6zobKMCa SC1Eb+8HCVwUjr7lcAzI4hOkkm6vyNkRocEgPgun7fQ1Ee0u9oDiVsui361pRISfs3Nr rrHUGqSqsZO05JcAedBDg1NP+94WPUj7gg36zWEM18yQyziU2tyKoEFqvMH8WKutqQ88 SI1R9ZzcnLJFwAh1h1WGkJ4ErXFS2UJJi0bBmnbvcdXEQQFFj8FT2XqM01iHQDOlTVV8 okmg== X-Received: by 10.140.84.197 with SMTP id l63mr18040393qgd.100.1418771159471; Tue, 16 Dec 2014 15:05:59 -0800 (PST) Received: from localhost ([2601:6:2c00:943:eab1:fcff:fe75:3f91]) by mx.google.com with ESMTPSA id h36sm2218538qge.25.2014.12.16.15.05.58 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Dec 2014 15:05:58 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Subject: [PATCH 05/13] drm: add atomic_get_property Date: Tue, 16 Dec 2014 18:05:33 -0500 Message-Id: <1418771141-16954-6-git-send-email-robdclark@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1418771141-16954-1-git-send-email-robdclark@gmail.com> References: <1418771141-16954-1-git-send-email-robdclark@gmail.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since we won't be using the obj->properties->values[] array to shadow property values for atomic drivers, we are going to need a vfunc for getting prop values. Add that along w/ mandatory wrapper fxns. Signed-off-by: Rob Clark --- drivers/gpu/drm/drm_atomic.c | 76 ++++++++++++++++++++++++++++++++++++++++++++ include/drm/drm_atomic.h | 9 ++++++ include/drm/drm_crtc.h | 18 +++++++++++ 3 files changed, 103 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 1261ade..4099b44 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -239,6 +239,28 @@ int drm_atomic_crtc_set_property(struct drm_crtc *crtc, EXPORT_SYMBOL(drm_atomic_crtc_set_property); /** + * drm_atomic_crtc_get_property - get property on connector + * @crtc: the drm CRTC to get a property on + * @state: the state object with the property value to read + * @property: the property to get + * @val: the property value (returned by reference) + * + * Use this instead of calling crtc->atomic_get_property directly + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, + const struct drm_crtc_state *state, + struct drm_property *property, uint64_t *val) +{ + if (crtc->funcs->atomic_get_property) + return crtc->funcs->atomic_get_property(crtc, state, property, val); + return -EINVAL; +} +EXPORT_SYMBOL(drm_atomic_crtc_get_property); + +/** * drm_atomic_get_plane_state - get plane state * @state: global atomic state object * @plane: plane to get state object for @@ -316,6 +338,28 @@ int drm_atomic_plane_set_property(struct drm_plane *plane, EXPORT_SYMBOL(drm_atomic_plane_set_property); /** + * drm_atomic_plane_get_property - get property on plane + * @plane: the drm plane to get a property on + * @state: the state object with the property value to read + * @property: the property to get + * @val: the property value (returned by reference) + * + * Use this instead of calling plane->atomic_get_property directly + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_plane_get_property(struct drm_plane *plane, + const struct drm_plane_state *state, + struct drm_property *property, uint64_t *val) +{ + if (plane->funcs->atomic_get_property) + return plane->funcs->atomic_get_property(plane, state, property, val); + return -EINVAL; +} +EXPORT_SYMBOL(drm_atomic_plane_get_property); + +/** * drm_atomic_get_connector_state - get connector state * @state: global atomic state object * @connector: connector to get state object for @@ -421,6 +465,38 @@ int drm_atomic_connector_set_property(struct drm_connector *connector, EXPORT_SYMBOL(drm_atomic_connector_set_property); /** + * drm_atomic_connector_get_property - get property on connector + * @connector: the drm connector to get a property on + * @state: the state object with the property value to read + * @property: the property to get + * @val: the property value (returned by reference) + * + * Use this instead of calling connector->atomic_get_property directly + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_atomic_connector_get_property(struct drm_connector *connector, + const struct drm_connector_state *state, + struct drm_property *property, uint64_t *val) +{ + struct drm_device *dev = connector->dev; + struct drm_mode_config *config = &dev->mode_config; + + if (property == config->dpms_property) { + *val = connector->dpms; + } else if (connector->funcs->atomic_get_property) { + return connector->funcs->atomic_get_property(connector, + state, property, val); + } else { + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL(drm_atomic_connector_get_property); + +/** * drm_atomic_set_crtc_for_plane - set crtc for plane * @state: the incoming atomic state * @plane: the plane whose incoming state to update diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index b0834dc..b34224a 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -41,18 +41,27 @@ drm_atomic_get_crtc_state(struct drm_atomic_state *state, int drm_atomic_crtc_set_property(struct drm_crtc *crtc, struct drm_crtc_state *state, struct drm_property *property, uint64_t val); +int drm_atomic_crtc_get_property(struct drm_crtc *crtc, + const struct drm_crtc_state *state, + struct drm_property *property, uint64_t *val); struct drm_plane_state * __must_check drm_atomic_get_plane_state(struct drm_atomic_state *state, struct drm_plane *plane); int drm_atomic_plane_set_property(struct drm_plane *plane, struct drm_plane_state *state, struct drm_property *property, uint64_t val); +int drm_atomic_plane_get_property(struct drm_plane *plane, + const struct drm_plane_state *state, + struct drm_property *property, uint64_t *val); struct drm_connector_state * __must_check drm_atomic_get_connector_state(struct drm_atomic_state *state, struct drm_connector *connector); int drm_atomic_connector_set_property(struct drm_connector *connector, struct drm_connector_state *state, struct drm_property *property, uint64_t val); +int drm_atomic_connector_get_property(struct drm_connector *connector, + const struct drm_connector_state *state, + struct drm_property *property, uint64_t *val); int __must_check drm_atomic_set_crtc_for_plane(struct drm_atomic_state *state, diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 1b71f60..e6cfdaf 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -301,6 +301,8 @@ struct drm_crtc_state { * @atomic_destroy_state: destroy an atomic state for this CRTC * @atomic_set_property: set a property on an atomic state for this CRTC * (do not call directly, use drm_atomic_crtc_set_property()) + * @atomic_get_property: get a property on an atomic state for this CRTC + * (do not call directly, use drm_atomic_crtc_get_property()) * * The drm_crtc_funcs structure is the central CRTC management structure * in the DRM. Each CRTC controls one or more connectors (note that the name @@ -360,6 +362,10 @@ struct drm_crtc_funcs { struct drm_crtc_state *state, struct drm_property *property, uint64_t val); + int (*atomic_get_property)(struct drm_crtc *crtc, + const struct drm_crtc_state *state, + struct drm_property *property, + uint64_t *val); }; /** @@ -485,6 +491,8 @@ struct drm_connector_state { * @atomic_destroy_state: destroy an atomic state for this connector * @atomic_set_property: set a property on an atomic state for this connector * (do not call directly, use drm_atomic_connector_set_property()) + * @atomic_get_property: get a property on an atomic state for this connector + * (do not call directly, use drm_atomic_connector_get_property()) * * Each CRTC may have one or more connectors attached to it. The functions * below allow the core DRM code to control connectors, enumerate available modes, @@ -518,6 +526,10 @@ struct drm_connector_funcs { struct drm_connector_state *state, struct drm_property *property, uint64_t val); + int (*atomic_get_property)(struct drm_connector *connector, + const struct drm_connector_state *state, + struct drm_property *property, + uint64_t *val); }; /** @@ -746,6 +758,8 @@ struct drm_plane_state { * @atomic_destroy_state: destroy an atomic state for this plane * @atomic_set_property: set a property on an atomic state for this plane * (do not call directly, use drm_atomic_plane_set_property()) + * @atomic_get_property: get a property on an atomic state for this plane + * (do not call directly, use drm_atomic_plane_get_property()) */ struct drm_plane_funcs { int (*update_plane)(struct drm_plane *plane, @@ -769,6 +783,10 @@ struct drm_plane_funcs { struct drm_plane_state *state, struct drm_property *property, uint64_t val); + int (*atomic_get_property)(struct drm_plane *plane, + const struct drm_plane_state *state, + struct drm_property *property, + uint64_t *val); }; enum drm_plane_type {