diff options
author | Dave Airlie <airlied@redhat.com> | 2016-09-02 01:48:38 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-09-02 01:48:38 -0400 |
commit | 5322942527156178874eec3d3108a4fae148d87d (patch) | |
tree | 722161e0938df36ad160c047552c16a4dc87b2e0 | |
parent | 27dd73503f690ee3593a2e73a1b1864860e7f7b0 (diff) | |
parent | a474478642d57641ea06645104a15acc0420f01a (diff) |
Merge tag 'imx-drm-fixes-2016-08-30' of git://git.pengutronix.de/git/pza/linux into drm-fixes
imx-drm atomic modeset regression fixes
- add active plane reconfiguration support
- add back crtc vblank state reporting
* tag 'imx-drm-fixes-2016-08-30' of git://git.pengutronix.de/git/pza/linux:
drm/imx: fix crtc vblank state regression
drm/imx: Add active plane reconfiguration support
-rw-r--r-- | drivers/gpu/drm/imx/imx-drm-core.c | 26 | ||||
-rw-r--r-- | drivers/gpu/drm/imx/ipuv3-crtc.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/imx/ipuv3-plane.c | 21 |
3 files changed, 43 insertions, 8 deletions
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 9f7dafce3a4c..7bf90e9e6139 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c | |||
@@ -171,10 +171,34 @@ static void imx_drm_output_poll_changed(struct drm_device *drm) | |||
171 | drm_fbdev_cma_hotplug_event(imxdrm->fbhelper); | 171 | drm_fbdev_cma_hotplug_event(imxdrm->fbhelper); |
172 | } | 172 | } |
173 | 173 | ||
174 | static int imx_drm_atomic_check(struct drm_device *dev, | ||
175 | struct drm_atomic_state *state) | ||
176 | { | ||
177 | int ret; | ||
178 | |||
179 | ret = drm_atomic_helper_check_modeset(dev, state); | ||
180 | if (ret) | ||
181 | return ret; | ||
182 | |||
183 | ret = drm_atomic_helper_check_planes(dev, state); | ||
184 | if (ret) | ||
185 | return ret; | ||
186 | |||
187 | /* | ||
188 | * Check modeset again in case crtc_state->mode_changed is | ||
189 | * updated in plane's ->atomic_check callback. | ||
190 | */ | ||
191 | ret = drm_atomic_helper_check_modeset(dev, state); | ||
192 | if (ret) | ||
193 | return ret; | ||
194 | |||
195 | return ret; | ||
196 | } | ||
197 | |||
174 | static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { | 198 | static const struct drm_mode_config_funcs imx_drm_mode_config_funcs = { |
175 | .fb_create = drm_fb_cma_create, | 199 | .fb_create = drm_fb_cma_create, |
176 | .output_poll_changed = imx_drm_output_poll_changed, | 200 | .output_poll_changed = imx_drm_output_poll_changed, |
177 | .atomic_check = drm_atomic_helper_check, | 201 | .atomic_check = imx_drm_atomic_check, |
178 | .atomic_commit = drm_atomic_helper_commit, | 202 | .atomic_commit = drm_atomic_helper_commit, |
179 | }; | 203 | }; |
180 | 204 | ||
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 08e188bc10fc..462056e4b9e4 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c | |||
@@ -76,6 +76,8 @@ static void ipu_crtc_disable(struct drm_crtc *crtc) | |||
76 | crtc->state->event = NULL; | 76 | crtc->state->event = NULL; |
77 | } | 77 | } |
78 | spin_unlock_irq(&crtc->dev->event_lock); | 78 | spin_unlock_irq(&crtc->dev->event_lock); |
79 | |||
80 | drm_crtc_vblank_off(crtc); | ||
79 | } | 81 | } |
80 | 82 | ||
81 | static void imx_drm_crtc_reset(struct drm_crtc *crtc) | 83 | static void imx_drm_crtc_reset(struct drm_crtc *crtc) |
@@ -175,6 +177,8 @@ static int ipu_crtc_atomic_check(struct drm_crtc *crtc, | |||
175 | static void ipu_crtc_atomic_begin(struct drm_crtc *crtc, | 177 | static void ipu_crtc_atomic_begin(struct drm_crtc *crtc, |
176 | struct drm_crtc_state *old_crtc_state) | 178 | struct drm_crtc_state *old_crtc_state) |
177 | { | 179 | { |
180 | drm_crtc_vblank_on(crtc); | ||
181 | |||
178 | spin_lock_irq(&crtc->dev->event_lock); | 182 | spin_lock_irq(&crtc->dev->event_lock); |
179 | if (crtc->state->event) { | 183 | if (crtc->state->event) { |
180 | WARN_ON(drm_crtc_vblank_get(crtc)); | 184 | WARN_ON(drm_crtc_vblank_get(crtc)); |
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 4ad67d015ec7..29423e757d36 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c | |||
@@ -319,13 +319,14 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, | |||
319 | return -EINVAL; | 319 | return -EINVAL; |
320 | 320 | ||
321 | /* | 321 | /* |
322 | * since we cannot touch active IDMAC channels, we do not support | 322 | * We support resizing active plane or changing its format by |
323 | * resizing the enabled plane or changing its format | 323 | * forcing CRTC mode change and disabling-enabling plane in plane's |
324 | * ->atomic_update callback. | ||
324 | */ | 325 | */ |
325 | if (old_fb && (state->src_w != old_state->src_w || | 326 | if (old_fb && (state->src_w != old_state->src_w || |
326 | state->src_h != old_state->src_h || | 327 | state->src_h != old_state->src_h || |
327 | fb->pixel_format != old_fb->pixel_format)) | 328 | fb->pixel_format != old_fb->pixel_format)) |
328 | return -EINVAL; | 329 | crtc_state->mode_changed = true; |
329 | 330 | ||
330 | eba = drm_plane_state_to_eba(state); | 331 | eba = drm_plane_state_to_eba(state); |
331 | 332 | ||
@@ -336,7 +337,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, | |||
336 | return -EINVAL; | 337 | return -EINVAL; |
337 | 338 | ||
338 | if (old_fb && fb->pitches[0] != old_fb->pitches[0]) | 339 | if (old_fb && fb->pitches[0] != old_fb->pitches[0]) |
339 | return -EINVAL; | 340 | crtc_state->mode_changed = true; |
340 | 341 | ||
341 | switch (fb->pixel_format) { | 342 | switch (fb->pixel_format) { |
342 | case DRM_FORMAT_YUV420: | 343 | case DRM_FORMAT_YUV420: |
@@ -372,7 +373,7 @@ static int ipu_plane_atomic_check(struct drm_plane *plane, | |||
372 | return -EINVAL; | 373 | return -EINVAL; |
373 | 374 | ||
374 | if (old_fb && old_fb->pitches[1] != fb->pitches[1]) | 375 | if (old_fb && old_fb->pitches[1] != fb->pitches[1]) |
375 | return -EINVAL; | 376 | crtc_state->mode_changed = true; |
376 | } | 377 | } |
377 | 378 | ||
378 | return 0; | 379 | return 0; |
@@ -392,8 +393,14 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, | |||
392 | enum ipu_color_space ics; | 393 | enum ipu_color_space ics; |
393 | 394 | ||
394 | if (old_state->fb) { | 395 | if (old_state->fb) { |
395 | ipu_plane_atomic_set_base(ipu_plane, old_state); | 396 | struct drm_crtc_state *crtc_state = state->crtc->state; |
396 | return; | 397 | |
398 | if (!crtc_state->mode_changed) { | ||
399 | ipu_plane_atomic_set_base(ipu_plane, old_state); | ||
400 | return; | ||
401 | } | ||
402 | |||
403 | ipu_disable_plane(plane); | ||
397 | } | 404 | } |
398 | 405 | ||
399 | switch (ipu_plane->dp_flow) { | 406 | switch (ipu_plane->dp_flow) { |