diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-06-10 05:50:53 -0400 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2016-11-02 04:38:28 -0400 |
commit | 70dd2a62aa35687ee01c756ea201ea3e970c28ad (patch) | |
tree | 9c501163813b7ce5892018e1877915fa9a237130 /drivers/gpu/drm/omapdrm/omap_plane.c | |
parent | aaf7642e98917fc95c260cbee98d2f426754b265 (diff) |
drm/omap: cleanup omap_plane_atomic_check()
Clean up omap_plane_atomic_check() with:
- Check state->fb first. If no fb, return 0.
- use drm_atomic_get_existing_crtc_state() instead of
drm_atomic_get_crtc_state()
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_plane.c')
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_plane.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_plane.c b/drivers/gpu/drm/omapdrm/omap_plane.c index 7bd24185f33c..adab71b17017 100644 --- a/drivers/gpu/drm/omapdrm/omap_plane.c +++ b/drivers/gpu/drm/omapdrm/omap_plane.c | |||
@@ -157,12 +157,17 @@ static int omap_plane_atomic_check(struct drm_plane *plane, | |||
157 | { | 157 | { |
158 | struct drm_crtc_state *crtc_state; | 158 | struct drm_crtc_state *crtc_state; |
159 | 159 | ||
160 | if (!state->crtc) | 160 | if (!state->fb) |
161 | return 0; | 161 | return 0; |
162 | 162 | ||
163 | crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc); | 163 | /* crtc should only be NULL when disabling (i.e., !state->fb) */ |
164 | if (IS_ERR(crtc_state)) | 164 | if (WARN_ON(!state->crtc)) |
165 | return PTR_ERR(crtc_state); | 165 | return 0; |
166 | |||
167 | crtc_state = drm_atomic_get_existing_crtc_state(state->state, state->crtc); | ||
168 | /* we should have a crtc state if the plane is attached to a crtc */ | ||
169 | if (WARN_ON(!crtc_state)) | ||
170 | return 0; | ||
166 | 171 | ||
167 | if (!crtc_state->enable) | 172 | if (!crtc_state->enable) |
168 | return 0; | 173 | return 0; |
@@ -176,11 +181,9 @@ static int omap_plane_atomic_check(struct drm_plane *plane, | |||
176 | if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) | 181 | if (state->crtc_y + state->crtc_h > crtc_state->adjusted_mode.vdisplay) |
177 | return -EINVAL; | 182 | return -EINVAL; |
178 | 183 | ||
179 | if (state->fb) { | 184 | if (state->rotation != DRM_ROTATE_0 && |
180 | if (state->rotation != DRM_ROTATE_0 && | 185 | !omap_framebuffer_supports_rotation(state->fb)) |
181 | !omap_framebuffer_supports_rotation(state->fb)) | 186 | return -EINVAL; |
182 | return -EINVAL; | ||
183 | } | ||
184 | 187 | ||
185 | return 0; | 188 | return 0; |
186 | } | 189 | } |