From patchwork Tue Jun 22 16:55:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12338053 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95C61C49EA2 for ; Tue, 22 Jun 2021 16:55:53 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5FFA16102A for ; Tue, 22 Jun 2021 16:55:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FFA16102A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7DA6F6E820; Tue, 22 Jun 2021 16:55:33 +0000 (UTC) Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3C4EA6E81C for ; Tue, 22 Jun 2021 16:55:32 +0000 (UTC) Received: by mail-wm1-x336.google.com with SMTP id u5-20020a7bc0450000b02901480e40338bso1911282wmc.1 for ; Tue, 22 Jun 2021 09:55:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=alI8IW7ceIVR5GkdBwlxYMJXZdabM6O8bGMLLcoibIk=; b=PA89EpCVBw7LVWE3M6rD3b29Sn2YxnPF9C6xHlBXLijvg2oDkiMfGO1WfzdL7APYBd gDw8M0tWiC7DaBAQJoutpuiVh8k/KMLchw56h4fCpA2d7zFpfTo+3vHByQwmLPS3rJCm Y4B3w5D9tEEKDebHWmWocTlk5wf9W7hRDdz/o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=alI8IW7ceIVR5GkdBwlxYMJXZdabM6O8bGMLLcoibIk=; b=M69gNECpaYTj2eUQHOiRg8+Q2NJNuoHBHfVvrxHDWzHxm8I1gRpnYVEtp5Pw5faj4F QOGU7G73aVZyxJzcx1nGnLut3SJTRxqHw6poEUud4D446qqfKf5v/ouuw1jxYByipvQi HxnHfXhS7ptRzSg0INvttotbZoRp0nZKFfXM/tSne61UlLxweMDAdZA4WBX1N+e7tOVP sanj8Re+hjyUgrS2bHR8ZKtv0aI2zJAsJhkPEoQQ/XCKWSxScLfjpMCZ2ZYDkGAfglD4 dbfE6JMcF/8yciF6ItpHJv4LAxAd9EQqG5DZIy5LCGGDAv0KP4IuUWvhJcztcsO8Q3t8 kZdA== X-Gm-Message-State: AOAM5333DUFdVW4hrktxHys9s/7r7IsTVuqlRkKy2I916tmLAMtuvLiX Ug7IEAgA+O1pU5CV7IEHHsc3LUpGOFcmsg== X-Google-Smtp-Source: ABdhPJwpqsQM2rveAkEffx++xxhvdDvefVuM8QIt9EG8oIqRofuW7SGXfSsOcvl6voitTizs3+smtg== X-Received: by 2002:a05:600c:358b:: with SMTP id p11mr5330052wmq.112.1624380930488; Tue, 22 Jun 2021 09:55:30 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l23sm3632342wmc.5.2021.06.22.09.55.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Jun 2021 09:55:30 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 12/15] drm/simple-helper: drm_gem_simple_display_pipe_prepare_fb as default Date: Tue, 22 Jun 2021 18:55:08 +0200 Message-Id: <20210622165511.3169559-13-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0.rc2 In-Reply-To: <20210622165511.3169559-1-daniel.vetter@ffwll.ch> References: <20210622165511.3169559-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , Intel Graphics Development , =?utf-8?q?Nor?= =?utf-8?q?alf_Tr=C3=B8nnes?= , Thomas Zimmermann , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's tedious to review this all the time, and my audit showed that arcpgu actually forgot to set this. Make this the default and stop worrying. Again I sprinkled WARN_ON_ONCE on top to make sure we don't have strange combinations of hooks: cleanup_fb without prepare_fb doesn't make sense, and since simpler drivers are all new they better be GEM based drivers. v2: Warn and bail when it's _not_ a GEM driver (Noralf) Cc: Noralf Trønnes Acked-by: Noralf Trønnes Signed-off-by: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter --- drivers/gpu/drm/drm_simple_kms_helper.c | 12 ++++++++++-- include/drm/drm_simple_kms_helper.h | 7 +++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 0b095a313c44..735f4f34bcc4 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include #include @@ -225,8 +227,14 @@ static int drm_simple_kms_plane_prepare_fb(struct drm_plane *plane, struct drm_simple_display_pipe *pipe; pipe = container_of(plane, struct drm_simple_display_pipe, plane); - if (!pipe->funcs || !pipe->funcs->prepare_fb) - return 0; + if (!pipe->funcs || !pipe->funcs->prepare_fb) { + if (WARN_ON_ONCE(!drm_core_check_feature(plane->dev, DRIVER_GEM))) + return 0; + + WARN_ON_ONCE(pipe->funcs && pipe->funcs->cleanup_fb); + + return drm_gem_simple_display_pipe_prepare_fb(pipe, state); + } return pipe->funcs->prepare_fb(pipe, state); } diff --git a/include/drm/drm_simple_kms_helper.h b/include/drm/drm_simple_kms_helper.h index ef9944e9c5fc..363a9a8c3587 100644 --- a/include/drm/drm_simple_kms_helper.h +++ b/include/drm/drm_simple_kms_helper.h @@ -116,8 +116,11 @@ struct drm_simple_display_pipe_funcs { * the documentation for the &drm_plane_helper_funcs.prepare_fb hook for * more details. * - * Drivers which always have their buffers pinned should use - * drm_gem_simple_display_pipe_prepare_fb() for this hook. + * For GEM drivers who neither have a @prepare_fb not @cleanup_fb hook + * set drm_gem_simple_display_pipe_prepare_fb() is called automatically + * to implement this. Other drivers which need additional plane + * processing can call drm_gem_simple_display_pipe_prepare_fb() from + * their @prepare_fb hook. */ int (*prepare_fb)(struct drm_simple_display_pipe *pipe, struct drm_plane_state *plane_state);