Hi Maarten,
Thank you for the patch.
On Monday 16 Jan 2017 10:37:42 Maarten Lankhorst wrote:
After atomic commit, these macros should be used in place of get_existing_state. Also after commit get_xx_state should no longer be used because it may not have the required locks.
Should this be captured in the functions' documentation ? In particular, should the drm_atomic_get_existing_*_state() functions be marked as deprecated ?
Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com
include/drm/drm_atomic.h | 99 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+)
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 6062e7f27325..2e6bb7acc837 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -285,6 +285,35 @@ drm_atomic_get_existing_crtc_state(struct drm_atomic_state *state, }
/**
- drm_atomic_get_old_crtc_state - get old crtc state, if it exists
- @state: global atomic state object
- @crtc: crtc to grab
- This function returns the old crtc state for the given crtc, or
- NULL if the crtc is not part of the global atomic state.
- */
+static inline struct drm_crtc_state * +drm_atomic_get_old_crtc_state(struct drm_atomic_state *state,
struct drm_crtc *crtc)
+{
- return state->crtcs[drm_crtc_index(crtc)].old_state;
+} +/**
- drm_atomic_get_new_crtc_state - get new crtc state, if it exists
- @state: global atomic state object
- @crtc: crtc to grab
- This function returns the new crtc state for the given crtc, or
- NULL if the crtc is not part of the global atomic state.
- */
+static inline struct drm_crtc_state * +drm_atomic_get_new_crtc_state(struct drm_atomic_state *state,
struct drm_crtc *crtc)
+{
- return state->crtcs[drm_crtc_index(crtc)].new_state;
+}
+/**
- drm_atomic_get_existing_plane_state - get plane state, if it exists
- @state: global atomic state object
- @plane: plane to grab
@@ -300,6 +329,36 @@ drm_atomic_get_existing_plane_state(struct drm_atomic_state *state, }
/**
- drm_atomic_get_old_plane_state - get plane state, if it exists
- @state: global atomic state object
- @plane: plane to grab
- This function returns the old plane state for the given plane, or
- NULL if the plane is not part of the global atomic state.
- */
+static inline struct drm_plane_state * +drm_atomic_get_old_plane_state(struct drm_atomic_state *state,
struct drm_plane *plane)
+{
- return state->planes[drm_plane_index(plane)].old_state;
+}
+/**
- drm_atomic_get_new_plane_state - get plane state, if it exists
- @state: global atomic state object
- @plane: plane to grab
- This function returns the new plane state for the given plane, or
- NULL if the plane is not part of the global atomic state.
- */
+static inline struct drm_plane_state * +drm_atomic_get_new_plane_state(struct drm_atomic_state *state,
struct drm_plane *plane)
+{
- return state->planes[drm_plane_index(plane)].new_state;
+}
+/**
- drm_atomic_get_existing_connector_state - get connector state, if it
exists * @state: global atomic state object
- @connector: connector to grab
@@ -320,6 +379,46 @@ drm_atomic_get_existing_connector_state(struct drm_atomic_state *state, }
/**
- drm_atomic_get_old_connector_state - get connector state, if it exists
- @state: global atomic state object
- @connector: connector to grab
- This function returns the old connector state for the given connector,
- or NULL if the connector is not part of the global atomic state.
- */
+static inline struct drm_connector_state * +drm_atomic_get_old_connector_state(struct drm_atomic_state *state,
struct drm_connector *connector)
+{
- int index = drm_connector_index(connector);
- if (index >= state->num_connector)
return NULL;
- return state->connectors[index].old_state;
+}
+/**
- drm_atomic_get_new_connector_state - get connector state, if it exists
- @state: global atomic state object
- @connector: connector to grab
- This function returns the new connector state for the given connector,
- or NULL if the connector is not part of the global atomic state.
- */
+static inline struct drm_connector_state * +drm_atomic_get_new_connector_state(struct drm_atomic_state *state,
struct drm_connector *connector)
+{
- int index = drm_connector_index(connector);
- if (index >= state->num_connector)
return NULL;
- return state->connectors[index].new_state;
+}
+/**
- __drm_atomic_get_current_plane_state - get current plane state
- @state: global atomic state object
- @plane: plane to grab