]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
drm/atomic: Add __drm_atomic_helper_connector_reset, v2.
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>
Tue, 10 May 2016 00:16:47 +0000 (18:16 -0600)
committerKamal Mostafa <kamal@canonical.com>
Mon, 16 May 2016 17:27:30 +0000 (10:27 -0700)
BugLink: http://bugs.launchpad.net/bugs/1542939
This is useful for drivers that subclass connector_state, like tegra.

Changes since v1:
- Docbook updates.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1451908400-25147-2-git-send-email-maarten.lankhorst@linux.intel.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(cherry picked from commit 4cd39917ddb2fb5691e05b13b13f1f2398343b3e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
drivers/gpu/drm/drm_atomic_helper.c
include/drm/drm_atomic_helper.h

index ba86e157b9e95732a51ac8fe03b77c500f894f07..2f3fd5c046ef1a2cf3ef7a8e3e3b6893ddf876f1 100644 (file)
@@ -2581,6 +2581,28 @@ void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
 }
 EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
 
+/**
+ * __drm_atomic_helper_connector_reset - reset state on connector
+ * @connector: drm connector
+ * @conn_state: connector state to assign
+ *
+ * Initializes the newly allocated @conn_state and assigns it to
+ * #connector ->state, usually required when initializing the drivers
+ * or when called from the ->reset hook.
+ *
+ * This is useful for drivers that subclass the connector state.
+ */
+void
+__drm_atomic_helper_connector_reset(struct drm_connector *connector,
+                                   struct drm_connector_state *conn_state)
+{
+       if (conn_state)
+               conn_state->connector = connector;
+
+       connector->state = conn_state;
+}
+EXPORT_SYMBOL(__drm_atomic_helper_connector_reset);
+
 /**
  * drm_atomic_helper_connector_reset - default ->reset hook for connectors
  * @connector: drm connector
@@ -2591,11 +2613,11 @@ EXPORT_SYMBOL(drm_atomic_helper_plane_destroy_state);
  */
 void drm_atomic_helper_connector_reset(struct drm_connector *connector)
 {
-       kfree(connector->state);
-       connector->state = kzalloc(sizeof(*connector->state), GFP_KERNEL);
+       struct drm_connector_state *conn_state =
+               kzalloc(sizeof(*conn_state), GFP_KERNEL);
 
-       if (connector->state)
-               connector->state->connector = connector;
+       kfree(connector->state);
+       __drm_atomic_helper_connector_reset(connector, conn_state);
 }
 EXPORT_SYMBOL(drm_atomic_helper_connector_reset);
 
index 1ebc22df9b94ee2e79bb8dbde29d5f5a4da8f1a9..c04bb09b333b41844bcd8827e8529b69cf89f94d 100644 (file)
@@ -128,6 +128,8 @@ void __drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
 void drm_atomic_helper_plane_destroy_state(struct drm_plane *plane,
                                          struct drm_plane_state *state);
 
+void __drm_atomic_helper_connector_reset(struct drm_connector *connector,
+                                        struct drm_connector_state *conn_state);
 void drm_atomic_helper_connector_reset(struct drm_connector *connector);
 void
 __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector,