Skip to content

Commit a712b30

Browse files
robclarkmripard
authored andcommitted
drm/msm/dpu: Delete bonkers code
dpu_crtc_atomic_flush() was directly poking it's attached planes in a code path that ended up in dpu_plane_atomic_update(), even if the plane was not involved in the current atomic update. While a bit dubious, this worked before because plane->state would always point to something valid. But now using drm_atomic_get_new_plane_state() we could get a NULL state pointer instead, leading to: [ 20.873273] Call trace: [ 20.875740] dpu_plane_atomic_update+0x5c/0xed0 [ 20.880311] dpu_plane_restore+0x40/0x88 [ 20.884266] dpu_crtc_atomic_flush+0xf4/0x208 [ 20.888660] drm_atomic_helper_commit_planes+0x150/0x238 [ 20.894014] msm_atomic_commit_tail+0x1d4/0x7a0 [ 20.898579] commit_tail+0xa4/0x168 [ 20.902102] drm_atomic_helper_commit+0x164/0x178 [ 20.906841] drm_atomic_commit+0x54/0x60 [ 20.910798] drm_atomic_connector_commit_dpms+0x10c/0x118 [ 20.916236] drm_mode_obj_set_property_ioctl+0x1e4/0x440 [ 20.921588] drm_connector_property_set_ioctl+0x60/0x88 [ 20.926852] drm_ioctl_kernel+0xd0/0x120 [ 20.930807] drm_ioctl+0x21c/0x478 [ 20.934235] __arm64_sys_ioctl+0xa8/0xe0 [ 20.938193] invoke_syscall+0x64/0x130 [ 20.941977] el0_svc_common.constprop.3+0x5c/0xe0 [ 20.946716] do_el0_svc+0x80/0xa0 [ 20.950058] el0_svc+0x20/0x30 [ 20.953145] el0_sync_handler+0x88/0xb0 [ 20.957014] el0_sync+0x13c/0x140 The reason for the codepath seems dubious, the atomic suspend/resume heplers should handle the power-collapse case. If not, the CRTC's atomic_check() should be adding the planes to the atomic update. Reported-by: Stephen Boyd <[email protected]> Reported-by: John Stultz <[email protected]> Fixes: 37418bf ("drm: Use state helper instead of the plane state pointer") Tested-by: John Stultz <[email protected]> Signed-off-by: Rob Clark <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 74deef0 commit a712b30

File tree

3 files changed

+0
-32
lines changed

3 files changed

+0
-32
lines changed

drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -566,16 +566,6 @@ static void dpu_crtc_atomic_flush(struct drm_crtc *crtc,
566566
if (unlikely(!cstate->num_mixers))
567567
return;
568568

569-
/*
570-
* For planes without commit update, drm framework will not add
571-
* those planes to current state since hardware update is not
572-
* required. However, if those planes were power collapsed since
573-
* last commit cycle, driver has to restore the hardware state
574-
* of those planes explicitly here prior to plane flush.
575-
*/
576-
drm_atomic_crtc_for_each_plane(plane, crtc)
577-
dpu_plane_restore(plane, state);
578-
579569
/* update performance setting before crtc kickoff */
580570
dpu_core_perf_crtc_update(crtc, 1, false);
581571

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,22 +1258,6 @@ static void dpu_plane_atomic_update(struct drm_plane *plane,
12581258
}
12591259
}
12601260

1261-
void dpu_plane_restore(struct drm_plane *plane, struct drm_atomic_state *state)
1262-
{
1263-
struct dpu_plane *pdpu;
1264-
1265-
if (!plane || !plane->state) {
1266-
DPU_ERROR("invalid plane\n");
1267-
return;
1268-
}
1269-
1270-
pdpu = to_dpu_plane(plane);
1271-
1272-
DPU_DEBUG_PLANE(pdpu, "\n");
1273-
1274-
dpu_plane_atomic_update(plane, state);
1275-
}
1276-
12771261
static void dpu_plane_destroy(struct drm_plane *plane)
12781262
{
12791263
struct dpu_plane *pdpu = plane ? to_dpu_plane(plane) : NULL;

drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ bool is_dpu_plane_virtual(struct drm_plane *plane);
8484
void dpu_plane_get_ctl_flush(struct drm_plane *plane, struct dpu_hw_ctl *ctl,
8585
u32 *flush_sspp);
8686

87-
/**
88-
* dpu_plane_restore - restore hw state if previously power collapsed
89-
* @plane: Pointer to drm plane structure
90-
*/
91-
void dpu_plane_restore(struct drm_plane *plane, struct drm_atomic_state *state);
92-
9387
/**
9488
* dpu_plane_flush - final plane operations before commit flush
9589
* @plane: Pointer to drm plane structure

0 commit comments

Comments
 (0)