From patchwork Thu Feb 16 16:44:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 9577713 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EED5860209 for ; Thu, 16 Feb 2017 16:44:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E150C2862B for ; Thu, 16 Feb 2017 16:44:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D664F28649; Thu, 16 Feb 2017 16:44:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C86A22862B for ; Thu, 16 Feb 2017 16:44:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8ADE36EBC0; Thu, 16 Feb 2017 16:44:52 +0000 (UTC) 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 [46.235.227.227]) by gabe.freedesktop.org (Postfix) with ESMTPS id CB1E76EBC0 for ; Thu, 16 Feb 2017 16:44:51 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id CFDD32609CB From: Gabriel Krisman Bertazi To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm: Always prepare null framebuffer in transitional helper Date: Thu, 16 Feb 2017 14:44:42 -0200 Message-Id: <20170216164442.28704-1-krisman@collabora.co.uk> X-Mailer: git-send-email 2.11.0 Cc: Gabriel Krisman Bertazi 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-Virus-Scanned: ClamAV using ClamSMTP Despite the documentation claim that cleanup_fb will match prior calls to prepare_fb, in case of NULL framebuffers in the transitional helpers, the code will skip the call to prepare_fb but not the corresponding cleanup_fb call. This asymmetry in semantics is unnecessarily surprising for developers transitioning drivers to atomic model, specially because the final atomic handlers don't have the issue - the prepare_fb is always called, despite the new state framebuffer being null. The only current user of the transitional helper that doesn't take care of null framebuffers explicitly inside the prepare_fb hook is atmel_hlcdc, so we take special care to make sure we don't break anything there. Signed-off-by: Gabriel Krisman Bertazi --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c | 3 +++ drivers/gpu/drm/drm_plane_helper.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c index bd2791c4b002..886ed5d8e304 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c @@ -772,6 +772,9 @@ static int atmel_hlcdc_plane_prepare_fb(struct drm_plane *p, drm_plane_state_to_atmel_hlcdc_plane_state(s); int ret; + if (!new_state->fb) + return 0; + ret = atmel_hlcdc_layer_update_start(&plane->layer); if (!ret) state->prepared = true; diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index 148688fb920a..d8639e46bd2b 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -450,8 +450,7 @@ int drm_plane_helper_commit(struct drm_plane *plane, goto out; } - if (plane_funcs->prepare_fb && plane_state->fb && - plane_state->fb != old_fb) { + if (plane_funcs->prepare_fb && plane_state->fb != old_fb) { ret = plane_funcs->prepare_fb(plane, plane_state); if (ret)