From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans de Goede Subject: [PATCH resend 13/15] staging: vboxvideo: Call drm_atomic_helper_check_plane_state from atomic_check Date: Sat, 29 Sep 2018 14:18:23 +0200 Message-ID: <20180929121825.25765-14-hdegoede@redhat.com> References: <20180929121825.25765-1-hdegoede@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20180929121825.25765-1-hdegoede@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" To: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org, Hans de Goede , Michael Thayer , dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org Extend our planes atomic_check callbacks to be more thorough by calling the drm_atomic_helper_check_plane_state helper. Signed-off-by: Hans de Goede --- drivers/staging/vboxvideo/vbox_mode.c | 30 ++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vboxvideo/vbox_mode.c b/drivers/staging/vboxvideo/vbox_mode.c index 72fc6614179a..4993a6cf6770 100644 --- a/drivers/staging/vboxvideo/vbox_mode.c +++ b/drivers/staging/vboxvideo/vbox_mode.c @@ -280,7 +280,19 @@ static const struct drm_crtc_funcs vbox_crtc_funcs = { static int vbox_primary_atomic_check(struct drm_plane *plane, struct drm_plane_state *new_state) { - return 0; + struct drm_crtc_state *crtc_state = NULL; + + if (new_state->crtc) { + crtc_state = drm_atomic_get_existing_crtc_state( + new_state->state, new_state->crtc); + if (WARN_ON(!crtc_state)) + return -EINVAL; + } + + return drm_atomic_helper_check_plane_state(new_state, crtc_state, + DRM_PLANE_HELPER_NO_SCALING, + DRM_PLANE_HELPER_NO_SCALING, + false, true); } static void vbox_primary_atomic_update(struct drm_plane *plane, @@ -337,8 +349,24 @@ static void vbox_primary_cleanup_fb(struct drm_plane *plane, static int vbox_cursor_atomic_check(struct drm_plane *plane, struct drm_plane_state *new_state) { + struct drm_crtc_state *crtc_state = NULL; u32 width = new_state->crtc_w; u32 height = new_state->crtc_h; + int ret; + + if (new_state->crtc) { + crtc_state = drm_atomic_get_existing_crtc_state( + new_state->state, new_state->crtc); + if (WARN_ON(!crtc_state)) + return -EINVAL; + } + + ret = drm_atomic_helper_check_plane_state(new_state, crtc_state, + DRM_PLANE_HELPER_NO_SCALING, + DRM_PLANE_HELPER_NO_SCALING, + true, true); + if (ret) + return ret; if (!new_state->fb) return 0; -- 2.19.0