The drm_atomic_get_connector_state() function calls a hand-rolled
implementation of the deprecated
drm_atomic_get_existing_connector_state() helper to get find if a
connector state had already been allocated and was part of the given
drm_atomic_state.

At the point in time where drm_atomic_get_connector_state() can be
called (ie, during atomic_check), the existing state is the new state
and drm_atomic_get_existing_connector_state() can thus be replaced by
drm_atomic_get_new_connector_state().

Reviewed-by: Luca Ceresoli <luca.ceres...@bootlin.com>
Tested-by: Luca Ceresoli <luca.ceres...@bootlin.com> # on imx8mp
Reviewed-by: Dmitry Baryshkov <dmitry.barysh...@oss.qualcomm.com>
Reviewed-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
Signed-off-by: Maxime Ripard <mrip...@kernel.org>
---
 drivers/gpu/drm/drm_atomic.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 
cd15cf52f0c9144711da5879da57884674aea9e4..6d10a3e40b00c58030e4dc9fdf47bd252cac0189
 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -1150,12 +1150,13 @@ drm_atomic_get_connector_state(struct drm_atomic_state 
*state,
                       sizeof(*state->connectors) * (alloc - 
state->num_connector));
 
                state->num_connector = alloc;
        }
 
-       if (state->connectors[index].state)
-               return state->connectors[index].state;
+       connector_state = drm_atomic_get_new_connector_state(state, connector);
+       if (connector_state)
+               return connector_state;
 
        connector_state = connector->funcs->atomic_duplicate_state(connector);
        if (!connector_state)
                return ERR_PTR(-ENOMEM);
 

-- 
2.50.1

Reply via email to