[PATCH 54/70] drm/msm: dpu1: Convert to atomic_create_state

Maxime Ripard <[email protected]>
Newsgroups org.freedesktop.lists.dri-devel,org.kernel.vger.linux-arm-msm
Message-ID <[email protected]>
The dpu1 crtc implementation provides a custom reset hook. However,
this hook only allocates the state, initializes it with
__drm_atomic_helper_crtc_reset(), and frees the previous state. It
does not perform any hardware reset.

Since this is exactly what the atomic_create_state hook is meant to
do, minus the old state cleanup which the caller handles, convert the
implementation to use atomic_create_state with
__drm_atomic_helper_crtc_state_init() instead.

Signed-off-by: Maxime Ripard <[email protected]>
---
Cc: Abhinav Kumar <[email protected]>
Cc: Dmitry Baryshkov <[email protected]>
Cc: Jessica Zhang <[email protected]>
Cc: Marijn Suijten <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Sean Paul <[email protected]>
Cc: [email protected]
Cc: [email protected]
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index 42d0a529b4d5..77a2d1f6700d 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -1138,21 +1138,21 @@ void dpu_crtc_commit_kickoff(struct drm_crtc *crtc)
 
 end:
 	DPU_ATRACE_END("crtc_commit");
 }
 
-static void dpu_crtc_reset(struct drm_crtc *crtc)
+static struct drm_crtc_state *dpu_crtc_create_state(struct drm_crtc *crtc)
 {
-	struct dpu_crtc_state *cstate = kzalloc_obj(*cstate);
+	struct dpu_crtc_state *cstate;
 
-	if (crtc->state)
-		dpu_crtc_destroy_state(crtc, crtc->state);
+	cstate = kzalloc_obj(*cstate);
+	if (!cstate)
+		return ERR_PTR(-ENOMEM);
 
-	if (cstate)
-		__drm_atomic_helper_crtc_reset(crtc, &cstate->base);
-	else
-		__drm_atomic_helper_crtc_reset(crtc, NULL);
+	__drm_atomic_helper_crtc_state_init(&cstate->base, crtc);
+
+	return &cstate->base;
 }
 
 /**
  * dpu_crtc_duplicate_state - state duplicate hook
  * @crtc: Pointer to drm crtc structure
@@ -1841,11 +1841,11 @@ static int dpu_crtc_late_register(struct drm_crtc *crtc)
 }
 
 static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
 	.page_flip = drm_atomic_helper_page_flip,
-	.reset = dpu_crtc_reset,
+	.atomic_create_state = dpu_crtc_create_state,
 	.atomic_duplicate_state = dpu_crtc_duplicate_state,
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.atomic_print_state = dpu_crtc_atomic_print_state,
 	.late_register = dpu_crtc_late_register,
 	.verify_crc_source = dpu_crtc_verify_crc_source,

-- 
2.55.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.