Just a quick tidy now to make the next patch neater. Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/i915/intel_display.c | 43 +++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c4120d8792c2..009ceb8f6085 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -14035,6 +14035,17 @@ static int intel_atomic_check(struct drm_device *dev, return calc_watermark_data(state); } +static bool old_plane_needs_modeset(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + struct drm_crtc_state *crtc_state; + + crtc_state = drm_atomic_get_existing_crtc_state(new_state->state, + plane->state->crtc); + + return needs_modeset(crtc_state); +} + /** * intel_prepare_plane_fb - Prepare fb for usage on plane * @plane: drm plane to prepare for @@ -14056,16 +14067,12 @@ intel_prepare_plane_fb(struct drm_plane *plane, struct drm_device *dev = plane->dev; struct drm_framebuffer *fb = new_state->fb; struct drm_i915_gem_object *obj = intel_fb_obj(fb); - struct drm_i915_gem_object *old_obj = intel_fb_obj(plane->state->fb); struct reservation_object *resv; - int ret = 0; - - if (!obj && !old_obj) - return 0; + int ret; - if (old_obj) { - struct drm_crtc_state *crtc_state = - drm_atomic_get_existing_crtc_state(new_state->state, plane->state->crtc); + if (plane->state->fb && old_plane_needs_modeset(plane, new_state)) { + struct drm_i915_gem_object *old_obj = + intel_fb_obj(plane->state->fb); /* Big Hammer, we also need to ensure that any pending * MI_WAIT_FOR_EVENT inside a user batch buffer on the @@ -14078,8 +14085,8 @@ intel_prepare_plane_fb(struct drm_plane *plane, * This should only fail upon a hung GPU, in which case we * can safely continue. */ - if (needs_modeset(crtc_state)) - ret = i915_gem_object_wait_rendering(old_obj, true); + + ret = i915_gem_object_wait_rendering(old_obj, true); if (ret) { /* GPU hangs should have been swallowed by the wait */ WARN_ON(ret == -EIO); @@ -14107,25 +14114,25 @@ intel_prepare_plane_fb(struct drm_plane *plane, INTEL_INFO(dev)->cursor_needs_physical) { int align = IS_I830(dev) ? 16 * 1024 : 256; ret = i915_gem_object_attach_phys(obj, align); - if (ret) + if (ret) { DRM_DEBUG_KMS("failed to attach phys object\n"); + return ret; + } } else { struct i915_vma *vma; vma = intel_pin_and_fence_fb_obj(fb, new_state->rotation); if (IS_ERR(vma)) - ret = PTR_ERR(vma); + return PTR_ERR(vma); to_intel_plane_state(new_state)->vma = vma; } - if (ret == 0) { - new_state->fence = - &i915_gem_active_get(&obj->last_write, - &obj->base.dev->struct_mutex)->fence; - } + new_state->fence = + &i915_gem_active_get(&obj->last_write, + &obj->base.dev->struct_mutex)->fence; - return ret; + return 0; } /** -- 2.9.3 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx