drm/msm/mdp5: Use plane helpers to configure src/dst rectangles
The MDP5 plane's atomic_check ops doesn't perform clipping tests. This didn't hurt us much in the past, but clipping becomes important with cursor planes. Use drm_plane_helper_check_state, the way rockchip/intel/mtk drivers already do. Use these drivers as reference. Clipping requires knowledge of the crtc width and height. This requires us to call drm_atomic_helper_check_modeset before drm_atomic_helper_check_planes in the driver's atomic_check op, because check_modetest will populate the mode for the crtc, needed to populate the clip rectangle. We update the plane_enabled(state) local helper to use state->visible, since state->visible and 'state->fb && state->crtc' represent the same thing. One issue with the existing code is that we don't have a way to disable the plane when it's completely clipped out. Until there isn't an update on the crtc (which would de-stage the plane), we would still see the plane in its last 'visible' configuration. Signed-off-by: Archit Taneja <architt@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
@@ -151,20 +151,29 @@ static void commit_worker(struct work_struct *work)
|
||||
complete_commit(container_of(work, struct msm_commit, work), true);
|
||||
}
|
||||
|
||||
/*
|
||||
* this func is identical to the drm_atomic_helper_check, but we keep this
|
||||
* because we might eventually need to have a more finegrained check
|
||||
* sequence without using the atomic helpers.
|
||||
*
|
||||
* In the past, we first called drm_atomic_helper_check_planes, and then
|
||||
* drm_atomic_helper_check_modeset. We needed this because the MDP5 plane's
|
||||
* ->atomic_check could update ->mode_changed for pixel format changes.
|
||||
* This, however isn't needed now because if there is a pixel format change,
|
||||
* we just assign a new hwpipe for it with a new SMP allocation. We might
|
||||
* eventually hit a condition where we would need to do a full modeset if
|
||||
* we run out of planes. There, we'd probably need to set mode_changed.
|
||||
*/
|
||||
int msm_atomic_check(struct drm_device *dev,
|
||||
struct drm_atomic_state *state)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* msm ->atomic_check can update ->mode_changed for pixel format
|
||||
* changes, hence must be run before we check the modeset changes.
|
||||
*/
|
||||
ret = drm_atomic_helper_check_planes(dev, state);
|
||||
ret = drm_atomic_helper_check_modeset(dev, state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = drm_atomic_helper_check_modeset(dev, state);
|
||||
ret = drm_atomic_helper_check_planes(dev, state);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user