From patchwork Wed Jun 23 16:24:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 12340121 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.6 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,SPF_PASS,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 87E4EC4743C for ; Wed, 23 Jun 2021 16:25:05 +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 46BEC60FEE for ; Wed, 23 Jun 2021 16:25:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 46BEC60FEE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A44C66E96A; Wed, 23 Jun 2021 16:25:04 +0000 (UTC) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by gabe.freedesktop.org (Postfix) with ESMTPS id C69B26E961 for ; Wed, 23 Jun 2021 16:25:03 +0000 (UTC) Received: by mail-ej1-x62d.google.com with SMTP id bg14so4889980ejb.9 for ; Wed, 23 Jun 2021 09:25:03 -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=evd9uRpnK0uEjS2cLGzJbOTA3IaXIFBWw8o9hBWCnsw=; b=glE1Uxd0Hao5qbW/fH1Z4ZyZBgpIor+OuYYnxiZbpXsQTVVO6qEKin78RTxpzMCeSf +DyyS6t1k5MIrjBBOv+qpnwcIQ5IOxdT/Gm/HP7kTgoXK+OUhQPDits2HNArqthZ2BmK WXoTBVi+Q9Ja48+f7AO/6Y+w1FKGcPr6awfx8= 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=evd9uRpnK0uEjS2cLGzJbOTA3IaXIFBWw8o9hBWCnsw=; b=kgNU1ufvjJritm07o+EQ8fzO37cq2EG4X5Pmh2gRBKS/Vlo1bZfafgQvNnyEtNVVFB 6bhYdxqrQtA0w08NnvmyL0H5+dTn8pJ7tIH7fwY0yXDIgdhfWpPlJk1W6coqy5Y776N8 2mgSfDISyHZqIGmvip0w5hHhy+z8KDkB14zi/VbRac9ObykPvS6OQQkB+WwysTigTPLW XuG19KuJPPOtaegXdOfLfuUK9cDdoJwvQd0viIT5WXVLQVSz8IJABNdfE4yot6+tK3RY s1cXRRpHcdSGGSm1VoaZCdEyacb/RDVz37IP78kjCPIY4to+Cn5NFHnQYCBOrfNxUulp Q2dg== X-Gm-Message-State: AOAM53006ZlzEg06ZOmCDZ9XsP9hjBYsXr5AwovYfha4m0J+3AdlR+C9 NR5NLu/78Nvmji7/KjyZXUR0ldmOq1gGbA== X-Google-Smtp-Source: ABdhPJy15JtfO+Vgum0gt4CFdtOtR76N4UGUKK6T3O9Hm7qYaUp75WqGCJQuhtaXn+CEyNP+fXdBGg== X-Received: by 2002:a17:906:e108:: with SMTP id gj8mr932050ejb.90.1624465502238; Wed, 23 Jun 2021 09:25:02 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b8sm308926edr.42.2021.06.23.09.25.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Jun 2021 09:25:01 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Wed, 23 Jun 2021 18:24:56 +0200 Message-Id: <20210623162456.3373469-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0.rc2 In-Reply-To: <20210622165511.3169559-13-daniel.vetter@ffwll.ch> References: <20210622165511.3169559-13-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/simple-helper: drm_gem_simple_display_pipe_prepare_fb as default X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Daniel Vetter , DRI Development , =?utf-8?q?Noralf_Tr?= =?utf-8?q?=C3=B8nnes?= , Maxime Ripard , Thomas Zimmermann , Daniel Vetter , Sam Ravnborg Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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) v3: It's neither ... nor, not not (Sam) Cc: Sam Ravnborg 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 Acked-by: Sam Ravnborg --- 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..cf07132d4ee8 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 nor @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);