]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm: Use plane->state->fb over plane->fb
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 22 Mar 2018 15:22:58 +0000 (17:22 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 29 Mar 2018 16:14:21 +0000 (19:14 +0300)
Stop looking at plane->fb on atomic drivers. Use plane->state->fb
instead.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180322152313.6561-9-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
drivers/gpu/drm/drm_atomic_helper.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_plane.c

index fe09d6254c1920189bce77fc8315a22e00b6a8ac..ee03c1ed252109289ad76b5e913fdd043bb5e80f 100644 (file)
@@ -2670,7 +2670,7 @@ int drm_atomic_helper_disable_plane(struct drm_plane *plane,
                goto fail;
        }
 
-       if (plane_state->crtc && (plane == plane->crtc->cursor))
+       if (plane_state->crtc && plane_state->crtc->cursor == plane)
                plane_state->state->legacy_cursor_update = true;
 
        ret = __drm_atomic_helper_disable_plane(plane, plane_state);
index 537ffaab855c5f9e0f55c82e89d5ec28adf306f7..a231dd5dce16eca73745357077100baacf233202 100644 (file)
@@ -597,13 +597,20 @@ retry:
                /* If we have a mode we need a framebuffer. */
                /* If we pass -1, set the mode with the currently bound fb */
                if (crtc_req->fb_id == -1) {
-                       if (!plane->fb) {
+                       struct drm_framebuffer *old_fb;
+
+                       if (plane->state)
+                               old_fb = plane->state->fb;
+                       else
+                               old_fb = plane->fb;
+
+                       if (!old_fb) {
                                DRM_DEBUG_KMS("CRTC doesn't have current FB\n");
                                ret = -EINVAL;
                                goto out;
                        }
 
-                       fb = plane->fb;
+                       fb = old_fb;
                        /* Make refcounting symmetric with the lookup path. */
                        drm_framebuffer_get(fb);
                } else {
index 008f9456a5e840bfbc99c159ac6a7e5e087604c7..0350544553010c374c122af5093d7d93aac95e4e 100644 (file)
@@ -792,7 +792,11 @@ static int drm_mode_cursor_universal(struct drm_crtc *crtc,
                        fb = NULL;
                }
        } else {
-               fb = plane->fb;
+               if (plane->state)
+                       fb = plane->state->fb;
+               else
+                       fb = plane->fb;
+
                if (fb)
                        drm_framebuffer_get(fb);
        }
@@ -934,7 +938,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
        struct drm_mode_crtc_page_flip_target *page_flip = data;
        struct drm_crtc *crtc;
        struct drm_plane *plane;
-       struct drm_framebuffer *fb = NULL;
+       struct drm_framebuffer *fb = NULL, *old_fb;
        struct drm_pending_vblank_event *e = NULL;
        u32 target_vblank = page_flip->sequence;
        struct drm_modeset_acquire_ctx ctx;
@@ -1012,7 +1016,12 @@ retry:
        if (ret)
                goto out;
 
-       if (plane->fb == NULL) {
+       if (plane->state)
+               old_fb = plane->state->fb;
+       else
+               old_fb = plane->fb;
+
+       if (old_fb == NULL) {
                /* The framebuffer is currently unbound, presumably
                 * due to a hotplug event, that userspace has not
                 * yet discovered.
@@ -1027,7 +1036,7 @@ retry:
                goto out;
        }
 
-       if (crtc->state) {
+       if (plane->state) {
                const struct drm_plane_state *state = plane->state;
 
                ret = drm_framebuffer_check_src_coords(state->src_x,
@@ -1042,7 +1051,7 @@ retry:
        if (ret)
                goto out;
 
-       if (plane->fb->format != fb->format) {
+       if (old_fb->format != fb->format) {
                DRM_DEBUG_KMS("Page flip is not allowed to change frame buffer format.\n");
                ret = -EINVAL;
                goto out;