From patchwork Sat Jul 1 02:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 114937 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10789598vqr; Fri, 30 Jun 2023 19:38:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4H0jkFjLjWKOJe9hvSSmqogbGNfMAnfMgVmb/xysmACgwFoAYm0aRvWEOIquuaz27MQMRl X-Received: by 2002:a05:6a20:7d9a:b0:126:8b2d:4462 with SMTP id v26-20020a056a207d9a00b001268b2d4462mr11523050pzj.24.1688179082824; Fri, 30 Jun 2023 19:38:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688179082; cv=none; d=google.com; s=arc-20160816; b=giV/BS2yRQkBB0Kj912+/vAP+vFVGB2TKHFWUkaIDJM8bS1YcwA9L0R7NARUjRljVn voP5oh4lNzjl4WmpBEZiVAbLautA0WmUHN1BN9t4YjfR0QRaCceqs/H4qiK9qY18V2Vl TL27eEaACRq7JAe1lS74vSYaQt52ygb84C/JXJwoATK1fR3gfOOgNvb2dZ0XCVNLRbuZ Jj7UkykEw5AUlFV4typ0HmxVEpKlcm16e6Uq/vkQLVRYyzKNXmq4xP8AY8w9BQSjAwno um1odQs1AjNCCBhNIYfSA6+f14ZdJvTVOZUIT+TdDkifjWVJMoXvEujjNI9CRNmwxZi3 qlbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mFfau7nIYSTNFQZxA6ftp9PAp8q78Z2XWdM3YuMBn/Y=; fh=yJKnCMONMPDb5DcRuNlFPqebkFeNCW1ydpZFk0usg5k=; b=FSIZmGfwJMv/gvTdgG5YRrTxQ39APjvInP7ep/EdDAguhN580cGuZ0dIihFXh7vGCv hDKgL++jEMILgdJ/nUKrOXfWzIJHBVRhNVESwwUAFtja47oq3aQqFhblZcK2K3o54QJf 2/0lnh9So5iTKeU8u/u5YNmXDR9v5fiSH0+0imZ707wutRc4imgAVnpchJqU8qFkTjbH WvEhZGMjwsrCa7VibxqAVDaLiHqiVvHfJAD1/OqdicGwwK9eG4RXI0Etq5usY1/RaIhl ezzWeoJy1fHTkQI5AflmCSa3+QVl8MA8OFUcalhnldF+Qo55H0HUAx/M+EQVvRAD5xwT Q6qA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=sWwtOONI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c37-20020a631c65000000b00544c0bf5ffesi13539134pgm.606.2023.06.30.19.37.41; Fri, 30 Jun 2023 19:38:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=sWwtOONI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbjGACKE (ORCPT + 99 others); Fri, 30 Jun 2023 22:10:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229897AbjGACJo (ORCPT ); Fri, 30 Jun 2023 22:09:44 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B02044213 for ; Fri, 30 Jun 2023 19:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=mFfau7nIYSTNFQZxA6ftp9PAp8q78Z2XWdM3YuMBn/Y=; b=sWwtOONIdKqA2mMlLCJC9q3u9Q WjIprRAukvaepVXv8Zd5uOgCTHjQMlCL3yE0abI16AZQjYwE1kcMK5Spk9F5z8/23DqYFMd7/fNj2 8561BsyNioG1N38YmO0UZJ9hnq9RoRm5xTihkAuNenIkkJhn2V99X2KAl+/tBGIGCAfPiPvT1GaeA rFZvkD//Syk+zAWvcZhTikEmkwlsMY9zK1O9CXRrYzwmCWl7XF0l4gUICAA2FxeAbb3LtkJvqVgAU xFGKYd5wwK+IISQXF643jtzPdhze3V6B+JQCGQPhQpn/tCPIKTkaNVdt79GuxQvOJqN9rHaGuxIpC t1VblfLQ==; Received: from [187.74.70.209] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qFQ3Q-006abr-TO; Sat, 01 Jul 2023 04:09:41 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, wayland-devel@lists.freedesktop.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, pierre-eric.pelloux-prayer@amd.com, Simon Ser , Rob Clark , Pekka Paalanen , Daniel Vetter , Daniel Stone , =?utf-8?b?J01hcmVrIE9sxaHDoWsn?= , Dave Airlie , =?utf-8?q?Michel_D=C3=A4nzer?= , Italo Nicola , Randy Dunlap , hwentlan@amd.com, joshua@froggi.es, ville.syrjala@linux.intel.com, =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH v4 3/6] drm: introduce drm_mode_config.atomic_async_page_flip_not_supported Date: Fri, 30 Jun 2023 23:09:14 -0300 Message-ID: <20230701020917.143394-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230701020917.143394-1-andrealmeid@igalia.com> References: <20230701020917.143394-1-andrealmeid@igalia.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770184070378868886?= X-GMAIL-MSGID: =?utf-8?q?1770184070378868886?= From: Simon Ser This new field indicates whether the driver has the necessary logic to support async page-flips via the atomic uAPI. This is leveraged by the next commit to allow user-space to use this functionality. All atomic drivers setting drm_mode_config.async_page_flip are updated to also set drm_mode_config.atomic_async_page_flip_not_supported. We will gradually check and update these drivers to properly handle drm_crtc_state.async_flip in their atomic logic. The goal of this negative flag is the same as fb_modifiers_not_supported: we want to eventually get rid of all drivers missing atomic support for async flips. New drivers should not set this flag, instead they should support atomic async flips (if they support async flips at all). IOW, we don't want more drivers with async flip support for legacy but not atomic. Signed-off-by: Simon Ser Reviewed-by: André Almeida Reviewed-by: Alex Deucher Signed-off-by: André Almeida --- v4: no changes --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 1 + drivers/gpu/drm/i915/display/intel_display.c | 1 + drivers/gpu/drm/nouveau/nouveau_display.c | 1 + include/drm/drm_mode_config.h | 11 +++++++++++ 5 files changed, 15 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 7acd73e5004f..258461826140 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3970,6 +3970,7 @@ static int amdgpu_dm_mode_config_init(struct amdgpu_device *adev) adev_to_drm(adev)->mode_config.prefer_shadow = 1; /* indicates support for immediate flip */ adev_to_drm(adev)->mode_config.async_page_flip = true; + adev_to_drm(adev)->mode_config.atomic_async_page_flip_not_supported = true; state = kzalloc(sizeof(*state), GFP_KERNEL); if (!state) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index 29603561d501..8afb22b1e730 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -639,6 +639,7 @@ static int atmel_hlcdc_dc_modeset_init(struct drm_device *dev) dev->mode_config.max_height = dc->desc->max_height; dev->mode_config.funcs = &mode_config_funcs; dev->mode_config.async_page_flip = true; + dev->mode_config.atomic_async_page_flip_not_supported = true; return 0; } diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 0aae9a1eb3d5..a5c503ca9168 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -8318,6 +8318,7 @@ static void intel_mode_config_init(struct drm_i915_private *i915) mode_config->helper_private = &intel_mode_config_funcs; mode_config->async_page_flip = HAS_ASYNC_FLIPS(i915); + mode_config->atomic_async_page_flip_not_supported = true; /* * Maximum framebuffer dimensions, chosen to match diff --git a/drivers/gpu/drm/nouveau/nouveau_display.c b/drivers/gpu/drm/nouveau/nouveau_display.c index ec3ffff487fc..f497dcd9e22f 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -709,6 +709,7 @@ nouveau_display_create(struct drm_device *dev) dev->mode_config.async_page_flip = false; else dev->mode_config.async_page_flip = true; + dev->mode_config.atomic_async_page_flip_not_supported = true; drm_kms_helper_poll_init(dev); drm_kms_helper_poll_disable(dev); diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 973119a9176b..47b005671e6a 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -918,6 +918,17 @@ struct drm_mode_config { */ bool async_page_flip; + /** + * @atomic_async_page_flip_not_supported: + * + * If true, the driver does not support async page-flips with the + * atomic uAPI. This is only used by old drivers which haven't yet + * accomodated for &drm_crtc_state.async_flip in their atomic logic, + * even if they have &drm_mode_config.async_page_flip set to true. + * New drivers shall not set this flag. + */ + bool atomic_async_page_flip_not_supported; + /** * @fb_modifiers_not_supported: *