From patchwork Tue May 26 09:15:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Stone X-Patchwork-Id: 6478891 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E11ACC0020 for ; Tue, 26 May 2015 09:16:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1EA3F2046F for ; Tue, 26 May 2015 09:16:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 39A6620490 for ; Tue, 26 May 2015 09:16:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A37D66E61C; Tue, 26 May 2015 02:15:59 -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 777E66E61C for ; Tue, 26 May 2015 02:15:57 -0700 (PDT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: daniels) with ESMTPSA id 18954600EDF 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:44 +0100 Message-Id: <1432631744-26471-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);