diff mbox series

[v3,4/4] drm/msm/dpu: Replace dpu_crtc_reset by atomic helper

Message ID 20181005210403.54615-5-bzwang@chromium.org (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show
Series drm/msm: Use atomic helpers for PM suspend/resume | expand

Commit Message

Bruce Wang Oct. 5, 2018, 9:04 p.m. UTC
Since we removed all suspend logic from the crtc code (see patch 3/4),
dpu_crtc_reset does the same things as drm_atomic_helper_crtc_reset, so let's
just replace it with a call to the atomic helper.

v3: added patch to patchset

Signed-off-by: Bruce Wang <bzwang@chromium.org>
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 39 +-----------------------
 1 file changed, 1 insertion(+), 38 deletions(-)

Comments

Sean Paul Oct. 8, 2018, 5:07 p.m. UTC | #1
On Fri, Oct 05, 2018 at 05:04:03PM -0400, Bruce Wang wrote:
> Since we removed all suspend logic from the crtc code (see patch 3/4),
> dpu_crtc_reset does the same things as drm_atomic_helper_crtc_reset, so let's
> just replace it with a call to the atomic helper.
> 
> v3: added patch to patchset
> 
> Signed-off-by: Bruce Wang <bzwang@chromium.org>

Alllllllright!

Reviewed-by: Sean Paul <seanpaul@chromium.org>


> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 39 +-----------------------
>  1 file changed, 1 insertion(+), 38 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index ac604055a824..c5ba753d441c 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -844,43 +844,6 @@ static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc)
>  	return &cstate->base;
>  }
>  
> -/**
> - * dpu_crtc_reset - reset hook for CRTCs
> - * Resets the atomic state for @crtc by freeing the state pointer (which might
> - * be NULL, e.g. at driver load time) and allocating a new empty state object.
> - * @crtc: Pointer to drm crtc structure
> - */
> -static void dpu_crtc_reset(struct drm_crtc *crtc)
> -{
> -	struct dpu_crtc *dpu_crtc;
> -	struct dpu_crtc_state *cstate;
> -
> -	if (!crtc) {
> -		DPU_ERROR("invalid crtc\n");
> -		return;
> -	}
> -
> -	/* revert suspend actions, if necessary */
> -	if (dpu_kms_is_suspend_state(crtc->dev))
> -		_dpu_crtc_set_suspend(crtc, false);
> -
> -	/* remove previous state, if present */
> -	if (crtc->state) {
> -		dpu_crtc_destroy_state(crtc, crtc->state);
> -		crtc->state = 0;
> -	}
> -
> -	dpu_crtc = to_dpu_crtc(crtc);
> -	cstate = kzalloc(sizeof(*cstate), GFP_KERNEL);
> -	if (!cstate) {
> -		DPU_ERROR("failed to allocate state\n");
> -		return;
> -	}
> -
> -	cstate->base.crtc = crtc;
> -	crtc->state = &cstate->base;
> -}
> -
>  static void dpu_crtc_handle_power_event(u32 event_type, void *arg)
>  {
>  	struct drm_crtc *crtc = arg;
> @@ -1499,7 +1462,7 @@ static const struct drm_crtc_funcs dpu_crtc_funcs = {
>  	.set_config = drm_atomic_helper_set_config,
>  	.destroy = dpu_crtc_destroy,
>  	.page_flip = drm_atomic_helper_page_flip,
> -	.reset = dpu_crtc_reset,
> +	.reset = drm_atomic_helper_crtc_reset,
>  	.atomic_duplicate_state = dpu_crtc_duplicate_state,
>  	.atomic_destroy_state = dpu_crtc_destroy_state,
>  	.late_register = dpu_crtc_late_register,
> -- 
> 2.19.0.605.g01d371f741-goog
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
index ac604055a824..c5ba753d441c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
@@ -844,43 +844,6 @@  static struct drm_crtc_state *dpu_crtc_duplicate_state(struct drm_crtc *crtc)
 	return &cstate->base;
 }
 
-/**
- * dpu_crtc_reset - reset hook for CRTCs
- * Resets the atomic state for @crtc by freeing the state pointer (which might
- * be NULL, e.g. at driver load time) and allocating a new empty state object.
- * @crtc: Pointer to drm crtc structure
- */
-static void dpu_crtc_reset(struct drm_crtc *crtc)
-{
-	struct dpu_crtc *dpu_crtc;
-	struct dpu_crtc_state *cstate;
-
-	if (!crtc) {
-		DPU_ERROR("invalid crtc\n");
-		return;
-	}
-
-	/* revert suspend actions, if necessary */
-	if (dpu_kms_is_suspend_state(crtc->dev))
-		_dpu_crtc_set_suspend(crtc, false);
-
-	/* remove previous state, if present */
-	if (crtc->state) {
-		dpu_crtc_destroy_state(crtc, crtc->state);
-		crtc->state = 0;
-	}
-
-	dpu_crtc = to_dpu_crtc(crtc);
-	cstate = kzalloc(sizeof(*cstate), GFP_KERNEL);
-	if (!cstate) {
-		DPU_ERROR("failed to allocate state\n");
-		return;
-	}
-
-	cstate->base.crtc = crtc;
-	crtc->state = &cstate->base;
-}
-
 static void dpu_crtc_handle_power_event(u32 event_type, void *arg)
 {
 	struct drm_crtc *crtc = arg;
@@ -1499,7 +1462,7 @@  static const struct drm_crtc_funcs dpu_crtc_funcs = {
 	.set_config = drm_atomic_helper_set_config,
 	.destroy = dpu_crtc_destroy,
 	.page_flip = drm_atomic_helper_page_flip,
-	.reset = dpu_crtc_reset,
+	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = dpu_crtc_duplicate_state,
 	.atomic_destroy_state = dpu_crtc_destroy_state,
 	.late_register = dpu_crtc_late_register,