From patchwork Tue May 26 09:15:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6478901 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D088B9F1CC for ; Tue, 26 May 2015 09:16:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 032FC2046F for ; Tue, 26 May 2015 09:16:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 19E032044B for ; Tue, 26 May 2015 09:16:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8258A6E61D; Tue, 26 May 2015 02:16:05 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [93.93.135.160]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A6EC6E61E for ; Tue, 26 May 2015 02:16:04 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 9B71460043B From: Daniel Stone To: dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/plane_helper: Use helper for plane->CRTC linkage Date: Tue, 26 May 2015 10:15:58 +0100 Message-Id: <1432631758-26599-1-git-send-email-daniels@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1432631573-17221-1-git-send-email-daniels@collabora.com> References: <1432631573-17221-1-git-send-email-daniels@collabora.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP plane_state->crtc shouldn't be assigned directly, but instead use drm_atomic_set_crtc_for_plane, which also takes care of updating the plane_mask on each CRTC's state. v2: First patch sent by mistake; this one checks the return value. Signed-off-by: Daniel Stone --- drivers/gpu/drm/drm_plane_helper.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 40c1db9..7c6a2ad 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -519,6 +519,7 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, uint32_t src_w, uint32_t src_h) { struct drm_plane_state *plane_state; + int ret; if (plane->funcs->atomic_duplicate_state) plane_state = plane->funcs->atomic_duplicate_state(plane); @@ -530,7 +531,10 @@ int drm_plane_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, return -ENOMEM; plane_state->plane = plane; - plane_state->crtc = crtc; + ret = drm_atomic_set_crtc_for_plane(plane_state, crtc); + if (ret) + return ret; + drm_atomic_set_fb_for_plane(plane_state, fb); plane_state->crtc_x = crtc_x; plane_state->crtc_y = crtc_y; @@ -561,6 +565,7 @@ EXPORT_SYMBOL(drm_plane_helper_update); int drm_plane_helper_disable(struct drm_plane *plane) { struct drm_plane_state *plane_state; + int ret; /* crtc helpers love to call disable functions for already disabled hw * functions. So cope with that. */ @@ -577,7 +582,10 @@ int drm_plane_helper_disable(struct drm_plane *plane) return -ENOMEM; plane_state->plane = plane; - plane_state->crtc = NULL; + ret = drm_atomic_set_crtc_for_plane(plane_state, NULL); + if (ret) + return ret; + drm_atomic_set_fb_for_plane(plane_state, NULL); return drm_plane_helper_commit(plane, plane_state, plane->fb);