From patchwork Wed Oct 25 00:53:15 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: 157779 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce89:0:b0:403:3b70:6f57 with SMTP id p9csp2293047vqx; Tue, 24 Oct 2023 17:54:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsVAKMlT70iqwfo2XRVtVc/SBPd9Ki0aYR5w/0IzSE7Cj6Iy7knNggJo62wmtDJ0CaLilg X-Received: by 2002:a05:6a00:24d1:b0:6be:2720:16a5 with SMTP id d17-20020a056a0024d100b006be272016a5mr17551198pfv.33.1698195245482; Tue, 24 Oct 2023 17:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698195245; cv=none; d=google.com; s=arc-20160816; b=XCMKwarGBBwuRgA7wMFFtWA9pKpfkTjHIY/06orFEXQI0VL0/9n9QBe3e/1VWM08k7 7gHtHEDvPeSxvRwlUMxNWthbuTo3cRNofbth2AvhiTPGJVVszTeUmqBk0ynumlhZbgNM mHNoeHY6ZTx94GRVEKgl56zMe2nDuByRnei5g++6opKwdM+y5Nxc1jO5jkXHLDEdUfny 6JUXLBTGRyaeRw5ETSotknLl0AvN+byZy4nIwv7Y8Mnz7bAVqN65jJgzd8gR7RYsQHsa SM7aOxddwXFc2LSP4VUz2T9D6VFO5j+Hzl0MGY3622uU4FgKmU4wSIIpcTasSrcHMEhV 6Lag== 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=xE7LTmMZjaRJ+zHlhQbtMeGR5wPTTYaFb8tvKPrpSe4=; fh=oozRrKarZZG8EJ8TWYFtLglEZVoKmF8bWYorcz/JMDw=; b=vbTu6nnfjYsqj7tZEV3IizASTSWzVz3kqj9yaqZTzXK4iGfQALS7K73STcZErBLNAZ YpxR2Xa3XPIXAtOHouc9kQNnVcPvVw2J0N5/Hy4MvhJ4IPOrXJkVBTydSBNYYSVUByow PfLUTaBFjy0LY0R9IN1QCNACEREpjbfb9rKkGNgeygzxo3deftUi3m2GZEEudLscJgP8 6PXd9NWpRk2QsIFJkG5x1CKPdIqhb7nG7JEyejeqgb5Q3Wne/Bu0mrehrag9NhaLmNT3 Jf/2wXTht8BZqaxQB1hSkdX8E1TnUYkmgGlOO7MUAi/0O8UY2nrauiRRgdfaWHq4P9M+ i/rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=MBE40FXB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id f19-20020a056a001ad300b006bceac424f7si9556897pfv.102.2023.10.24.17.54.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 17:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=MBE40FXB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C1B4C8025E42; Tue, 24 Oct 2023 17:54:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbjJYAx5 (ORCPT + 26 others); Tue, 24 Oct 2023 20:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229582AbjJYAxr (ORCPT ); Tue, 24 Oct 2023 20:53:47 -0400 Received: from fanzine2.igalia.com (fanzine.igalia.com [178.60.130.6]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2017E5 for ; Tue, 24 Oct 2023 17:53:44 -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=xE7LTmMZjaRJ+zHlhQbtMeGR5wPTTYaFb8tvKPrpSe4=; b=MBE40FXBrYAmSfHUHELm6J+ATg nom51bEDsd2qUTkCyIU1QdaD/YiWjlQgZZGMoJgPQvyYtJMdjC7SIi53JR6NmZPq/Y+L+2O8xUppX 8n5qydU4MiRM/NpHn0NfNoUpPxs1oBGFJw6um4O4vXQ1icyrSBiSXIg5D/xRpgscQ8XG+pFUeXu05 x8jPO1oWSOsN8LKZADJgfXXblDHBmoU5Dk/t5aoZZ1icvt5GEC1eFNzXRFabQyoeq1XdrLAPO6RNW XJJCIupnoLjWWKJHW6+JLvrfmwWbQQNnI0sB3a8GgSLmSLcPo3j4RzYyjsgRqhM/vkz2pgLBX3TiB 6UwZCTvQ==; Received: from [191.193.179.125] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qvS9W-006qog-41; Wed, 25 Oct 2023 02:53:42 +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 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?= , Randy Dunlap , =?utf-8?q?Andr=C3=A9_Almeida?= Subject: [PATCH v8 3/6] drm: introduce drm_mode_config.atomic_async_page_flip_not_supported Date: Tue, 24 Oct 2023 21:53:15 -0300 Message-ID: <20231025005318.293690-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231025005318.293690-1-andrealmeid@igalia.com> References: <20231025005318.293690-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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 17:54:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780686777305433589 X-GMAIL-MSGID: 1780686777305433589 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 --- 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_driver.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 45b8fd61a044..dec6e43e7198 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -4003,6 +4003,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 84c54e8622d1..f1d9bb1d7c34 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_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c index 44b59ac301e6..6142c83fba06 100644 --- a/drivers/gpu/drm/i915/display/intel_display_driver.c +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c @@ -126,6 +126,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 d8c92521226d..586aa51794e8 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -720,6 +720,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: *