From patchwork Sat Jul 1 02:09:12 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: 114938 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10789596vqr; Fri, 30 Jun 2023 19:38:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ45mPU3kwtHR774L3gb1o9QT+28TL/caFbR5L3ZOHJjM67nT0HzT0XtTwK+y1QZRK8GzXiW X-Received: by 2002:a05:6a20:7d99:b0:12b:f44f:bc98 with SMTP id v25-20020a056a207d9900b0012bf44fbc98mr5025252pzj.21.1688179082825; 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=KJjOXYUqCWAV7VeJS8zAqbnH45CHdB8gVa9zmAu9LHdjnkDfVLoK7YQeIm9aGYidgM 4v5t5GyCPxh0rrewgXVdwUZkKIRJznGbpPHeesvoQwsKcsxODPnjii2OCOFgI4mQ9E4Q VYUbq8Bk9dbrowFqeAS1Vjq3ecNKmES8rtutlFUzXNidpAifEVtV/XUMXTLlH8VWhe6W KsLUGWpDvdpWEPhzvBnsqIQLrFkZPDA0y7yR5wvubxrxvocXUGbsrw7E6ITnUz7A3Il0 AI8Csv5THmJEjW2RGWS5QKN4W41TPh+/GJFgmRQexgmRgPUWbUB8eSLtXfc+yXO1AWd1 nYdQ== 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=lbvpM8EakHHy+USxQroX9eqPrbtC1pudfZEWMIGGBk8=; fh=yJKnCMONMPDb5DcRuNlFPqebkFeNCW1ydpZFk0usg5k=; b=aGljBSYSG8/L8kFa7OatJGPG+8qLD9L9eoqWDh/sweLIy/pe8U1osJR480kokxViQs Kg7K9V+5ZPN/EaIzZPNB3frd8IA3Qc0iHWSNA7EekDr0aBKjV1e8Y2uDrSmtcr1Fwn1J l3//PoMz5RQjHTBT35UVSVLUea/vbnb4wg2lcnTFJ4KDYfCC6x9DhRqCeUts699vEqpG w6ySP9WbPog/bfHKMG5X3pk0FglliJYt+7PiW/kear6t801TaMn9hKsAqeYwf9g66aKw QNqoQHiHX0DVceXnBGGpfzMspuN0yCTipk+pWIuMuLttTHTpSv7OrCzinM6zlfWIFprk 55JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=jAChnC3X; 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 bv125-20020a632e83000000b0055b7171f869si1493562pgb.189.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=jAChnC3X; 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 S229890AbjGACJn (ORCPT + 99 others); Fri, 30 Jun 2023 22:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229601AbjGACJg (ORCPT ); Fri, 30 Jun 2023 22:09:36 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D2484212 for ; Fri, 30 Jun 2023 19:09:33 -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=lbvpM8EakHHy+USxQroX9eqPrbtC1pudfZEWMIGGBk8=; b=jAChnC3XqO7clZ/D2UTM1bk7V+ ACA7rfSqiHtTvJaIgmVDgk55VAkxAmI4Bd7QI32sJhjL308zVBz4J4IlNor6WNWW00oZLLbfGBSkX 6JRw0ro4uj+GBUCsCqs2QnCZ0Jvrq9aeuo96lkILj4+NSjsOfbGF201fbt0bZYA+sf/EOsxAv1+f/ 70ko7KOkjMmY9XOMJ/KXVTjWIdL84rd1IBnKsIZNAWqJvhUxrPh+wZY0PmVfNFp4Zes3hcRRny7dU 8abbZpMs1sj9rvGQYi/7XPm5PAMc95/orFVitWvHu7U8c2Ev3vIfFWyIEh2TcoldMRj28N38oUMgY ZDTUbvwg==; 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 1qFQ3G-006abr-R6; Sat, 01 Jul 2023 04:09:31 +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 1/6] drm: allow DRM_MODE_PAGE_FLIP_ASYNC for atomic commits Date: Fri, 30 Jun 2023 23:09:12 -0300 Message-ID: <20230701020917.143394-2-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?1770184069995305676?= X-GMAIL-MSGID: =?utf-8?q?1770184069995305676?= From: Simon Ser If the driver supports it, allow user-space to supply the DRM_MODE_PAGE_FLIP_ASYNC flag to request an async page-flip. Set drm_crtc_state.async_flip accordingly. Document that drivers will reject atomic commits if an async flip isn't possible. This allows user-space to fall back to something else. For instance, Xorg falls back to a blit. Another option is to wait as close to the next vblank as possible before performing the page-flip to reduce latency. Signed-off-by: Simon Ser Reviewed-by: Alex Deucher Co-developed-by: André Almeida Signed-off-by: André Almeida --- v4: no changes --- drivers/gpu/drm/drm_atomic_uapi.c | 28 +++++++++++++++++++++++++--- include/uapi/drm/drm_mode.h | 9 +++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index d867e7f9f2cd..dfd4cf7169df 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1286,6 +1286,18 @@ static void complete_signaling(struct drm_device *dev, kfree(fence_state); } +static void +set_async_flip(struct drm_atomic_state *state) +{ + struct drm_crtc *crtc; + struct drm_crtc_state *crtc_state; + int i; + + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { + crtc_state->async_flip = true; + } +} + int drm_mode_atomic_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { @@ -1326,9 +1338,16 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, } if (arg->flags & DRM_MODE_PAGE_FLIP_ASYNC) { - drm_dbg_atomic(dev, - "commit failed: invalid flag DRM_MODE_PAGE_FLIP_ASYNC\n"); - return -EINVAL; + if (!dev->mode_config.async_page_flip) { + drm_dbg_atomic(dev, + "commit failed: DRM_MODE_PAGE_FLIP_ASYNC not supported\n"); + return -EINVAL; + } + if (dev->mode_config.atomic_async_page_flip_not_supported) { + drm_dbg_atomic(dev, + "commit failed: DRM_MODE_PAGE_FLIP_ASYNC not supported with atomic\n"); + return -EINVAL; + } } /* can't test and expect an event at the same time. */ @@ -1426,6 +1445,9 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, if (ret) goto out; + if (arg->flags & DRM_MODE_PAGE_FLIP_ASYNC) + set_async_flip(state); + if (arg->flags & DRM_MODE_ATOMIC_TEST_ONLY) { ret = drm_atomic_check_only(state); } else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) { diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 46becedf5b2f..56342ba2c11a 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -949,6 +949,15 @@ struct hdr_output_metadata { * Request that the page-flip is performed as soon as possible, ie. with no * delay due to waiting for vblank. This may cause tearing to be visible on * the screen. + * + * When used with atomic uAPI, the driver will return an error if the hardware + * doesn't support performing an asynchronous page-flip for this update. + * User-space should handle this, e.g. by falling back to a regular page-flip. + * + * Note, some hardware might need to perform one last synchronous page-flip + * before being able to switch to asynchronous page-flips. As an exception, + * the driver will return success even though that first page-flip is not + * asynchronous. */ #define DRM_MODE_PAGE_FLIP_ASYNC 0x02 #define DRM_MODE_PAGE_FLIP_TARGET_ABSOLUTE 0x4 From patchwork Sat Jul 1 02:09:13 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: 114935 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:1082:b0:134:fbd7:a636 with SMTP id j2csp657760rwi; Fri, 30 Jun 2023 19:11:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlFfKaIr9z+vDgLkC0I+wegcVmfOpoPm2bFLLoeu8GbN2NyVApsZq5WxAEKyu5g7eKgL18KV X-Received: by 2002:a17:902:ea0c:b0:1b6:eff5:c00c with SMTP id s12-20020a170902ea0c00b001b6eff5c00cmr4030127plg.40.1688177480632; Fri, 30 Jun 2023 19:11:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688177480; cv=none; d=google.com; s=arc-20160816; b=I0kNJzTmpBC/81GdmvyRwWJuqQmdutvz4hZrf3TBNb8xXrAXNw8x3i5IVcNF0Jr+o2 JkHvLQrcbUKRSEeuQc2us0WQTOJ5w2nq1/1bzx42/IM5pLWGujNkHvO7NW32D2VUZyoY 2zT+w7ouM5Nu1Xto4vyVSFc0B1nZVBU5KHhlowWgOCj/Z4smorIf1TXY9LC+n7tPTEqQ 5qLrAgYqLHAaRZgEYi4TlmlJd9S32zP/1Pa/eBcAUoA81w/EzH+lSpX3U5ItAtG2aD3U ZF9riVDpuKreOEyxi+F7fKqcQsbQPGh4Ujn5j3UBeSqkDxluoAYHYuR0zjwVc1bvZWoq OyVQ== 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=HPO0XUJvL8MHQ9quXzm+tMdaWyxXHw4tFqRhJIQaDP4=; fh=yJKnCMONMPDb5DcRuNlFPqebkFeNCW1ydpZFk0usg5k=; b=T6adt1qJQ+Sv68LVLl78/CPGm0P0AfuApvSDJI0KiIW0uHvhVfIRU9HvR93xbU4jsk nWQ02nWka7EZx9DPaSiwn01vF8zzNIeHl27Ww9glju5S0A1/fglWAYgL3Ll36i0GxJQZ NsZiswbXSeu+mH04abWD3U+dyLf/Yxc1EiGn/yjQCY6CVCCfcqLOvIYU9wn1ed6XDEWW A/OEsGCZlsNwk8h+ZtDjiuFNizQdmBBQ3hwQSWE0nt9v3cqDoE+W101Uf4k3a1EfpcS5 nEprY25npXc6CerXg1krNZLhjRtNdSRx/t92Ckz2iw19cKUrdEcNnrpeIqw9NlNYRC1d 7vcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=G81G6jtz; 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 q7-20020a170902a3c700b001b8843afee6si21334plb.260.2023.06.30.19.11.07; Fri, 30 Jun 2023 19:11:20 -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=G81G6jtz; 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 S229906AbjGACJp (ORCPT + 99 others); Fri, 30 Jun 2023 22:09:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229878AbjGACJj (ORCPT ); Fri, 30 Jun 2023 22:09:39 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BC9A1997 for ; Fri, 30 Jun 2023 19:09:38 -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=HPO0XUJvL8MHQ9quXzm+tMdaWyxXHw4tFqRhJIQaDP4=; b=G81G6jtzf5peArDdZPEHo5CFND 9ShevZnQGMgqjIxJa8fJvELfg5qHbJpntuyUtQyljiOgRr00DsNj0pIb9i7kfq5Ar6aFMWsZrpD05 AwlRe/nsLRKLaDUtiEMgPPijGxLzDmpTs/WOpKeUWfXJ65CONWQFUhwxoQQfM2XqO4xLqFb1tux1P oraLfPnC4/2W3gEwfeZSCfxviWGgka8EUWyjkuo5AkzrVG/W4gxVDTaQwBGpUuDn4SZgEcGJ9VCtK 6SMHc7OWFITQUT6bOwQsXMdoYP+c7qg4hoL0Gd8nh6kmYLY/HssVVGJ1uNzftRxSm3Te6PkhEYILP XcKuM40A==; 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 1qFQ3L-006abr-S9; Sat, 01 Jul 2023 04:09:36 +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 2/6] drm: introduce DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP Date: Fri, 30 Jun 2023 23:09:13 -0300 Message-ID: <20230701020917.143394-3-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?1770182389499814004?= X-GMAIL-MSGID: =?utf-8?q?1770182389499814004?= From: Simon Ser This new kernel capability indicates whether async page-flips are supported via the atomic uAPI. DRM clients can use it to check for support before feeding DRM_MODE_PAGE_FLIP_ASYNC to the kernel. Make it clear that DRM_CAP_ASYNC_PAGE_FLIP is for legacy uAPI only. Signed-off-by: Simon Ser Reviewed-by: André Almeida Reviewed-by: Alex Deucher Signed-off-by: André Almeida --- v4: no changes --- drivers/gpu/drm/drm_ioctl.c | 5 +++++ include/uapi/drm/drm.h | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 7c9d66ee917d..8f756b99260d 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -302,6 +302,11 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ case DRM_CAP_CRTC_IN_VBLANK_EVENT: req->value = 1; break; + case DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP: + req->value = drm_core_check_feature(dev, DRIVER_ATOMIC) && + dev->mode_config.async_page_flip && + !dev->mode_config.atomic_async_page_flip_not_supported; + break; default: return -EINVAL; } diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index a87bbbbca2d4..54c558f81f3c 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -706,7 +706,8 @@ struct drm_gem_open { /** * DRM_CAP_ASYNC_PAGE_FLIP * - * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC. + * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for legacy + * page-flips. */ #define DRM_CAP_ASYNC_PAGE_FLIP 0x7 /** @@ -767,6 +768,13 @@ struct drm_gem_open { * Documentation/gpu/drm-mm.rst, section "DRM Sync Objects". */ #define DRM_CAP_SYNCOBJ_TIMELINE 0x14 +/** + * DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP + * + * If set to 1, the driver supports &DRM_MODE_PAGE_FLIP_ASYNC for atomic + * commits. + */ +#define DRM_CAP_ATOMIC_ASYNC_PAGE_FLIP 0x15 /* DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap { 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: * From patchwork Sat Jul 1 02:09: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: 114936 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:1082:b0:134:fbd7:a636 with SMTP id j2csp657999rwi; Fri, 30 Jun 2023 19:12:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlEjJvjE0ZFChMKeYmBdMdAUPKnQBSM3+vyEdNm2XUUGALs081zHm/1XchhagsZJ9BMf+Vlc X-Received: by 2002:a17:902:a409:b0:1b8:5a42:5145 with SMTP id p9-20020a170902a40900b001b85a425145mr7120970plq.31.1688177525810; Fri, 30 Jun 2023 19:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688177525; cv=none; d=google.com; s=arc-20160816; b=0WYxlvehdxDNG7xX63ClqBEUBGvHRS6f1ZPtEBWb82AXVEvYiunZeRzJkR/A2ipm25 FsNwR6f34iFUSybH51v2nCziWpxK0sVezKNHfZhFg5hkKElmjB5+TBdbG7oGkegkr8b3 3RkWMdNcsc4ZTX6Fs9l5Pr+VXgpXbIO6hlcoRUswqZRTY+s0hcimhs7+Lk+py+ONW9mO Re8ctofP7TQ2cx03LFCBsLno0BVwls5PdNMy4GVkSqSFUiN2BUrM1y4mmUZ9Rp8GUotQ opekwLSY4ZdY91qSVl84Vfje+9SvcLbqwKRnKkQ8jCtlUXq0Q83Q0jupxDlKsCKB7bm3 XBPQ== 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=aypGJ9zKriwl5rC/G/jg2t+UqZhEdGjhBXoWEgZUCvg=; fh=yJKnCMONMPDb5DcRuNlFPqebkFeNCW1ydpZFk0usg5k=; b=gKdaia2fyIFQ4Kk/+Ndh5QmKmHCep/n4moYt9ABOIUjiHWBxJlWBg7jJBVU0wJrqX0 AMLyIKICbYx+hBSpsRj4hP1xqQf29r+77pf7GiG8VxPYxryaQzNV+VYp52BAaJkXTrWR moIQbvUNa6AoCV1OYd63FSOzaGCIARf7xip9yIN+U/DRW+v5KjAdYgHrQ6VYuc1ZjSAY iwDLXvCIGWpCcfRXr9b8uYY5CzC9p3uxZR+R3Erobw6AgbL3FFdgpqoNv6F9uAWTJg8b CiLVg2ATKlqxSyDjGyOsc7giDkue3tO3vB6zp6/ou5bg5/grRYEBRDkuUbEjtcNDfex+ qUPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=pRlncQxZ; 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 m1-20020a170902bb8100b001ae0691dfdbsi12555300pls.158.2023.06.30.19.11.53; Fri, 30 Jun 2023 19:12:05 -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=pRlncQxZ; 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 S229916AbjGACJ7 (ORCPT + 99 others); Fri, 30 Jun 2023 22:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbjGACJx (ORCPT ); Fri, 30 Jun 2023 22:09:53 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA5334481 for ; Fri, 30 Jun 2023 19:09:48 -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=aypGJ9zKriwl5rC/G/jg2t+UqZhEdGjhBXoWEgZUCvg=; b=pRlncQxZeXRzBd8d9pNtQjHbw2 OLM2JC1G2JQw2KDsTdhL/GLf61rRrwZKZLPt1eoBrhgaWy0buejKE5scLhE+J5rDDdrCTXr/m1Tip C15kxHnHoG2WDisBaaxszxaFbhZKKddOhZ04VPevK1TxHJdoDWfvqbLaqib+QElLSris1ivEWygF8 bwcMpjoxkfkqbyj1EbP2BLw13IUxTJF5GTvIl8NlIbv61oJwvV0XQaL69UQ9Y+jhYsqr1oc5JDWGU hADgZkZ28NFCHyF0/7OsOGnXmDUQp+Jsd1d6NfZCqu2MZOHu+dO4SMMc7VhOuzKU7TwLfZ7PFY5yR nbC0vvUg==; 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 1qFQ3V-006abr-U9; Sat, 01 Jul 2023 04:09:46 +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 4/6] amd/display: indicate support for atomic async page-flips on DC Date: Fri, 30 Jun 2023 23:09:15 -0300 Message-ID: <20230701020917.143394-5-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?1770182437572547404?= X-GMAIL-MSGID: =?utf-8?q?1770182437572547404?= From: Simon Ser amdgpu_dm_commit_planes() already sets the flip_immediate flag for async page-flips. This flag is used to set the UNP_FLIP_CONTROL register. Thus, no additional change is required to handle async page-flips with the atomic uAPI. 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 - 1 file changed, 1 deletion(-) 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 258461826140..7acd73e5004f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3970,7 +3970,6 @@ 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) From patchwork Sat Jul 1 02:09:16 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: 114939 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10789599vqr; Fri, 30 Jun 2023 19:38:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlGmQm84I8vEUxpSG7MrSCexq8CmBwnk33oKaV2RU3zFvbF+6uJY3SE2z3c72rYYmEgDhZoT X-Received: by 2002:a17:902:a502:b0:1b8:5827:8765 with SMTP id s2-20020a170902a50200b001b858278765mr3687586plq.12.1688179082829; 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=XhD+UNow46+qu1lboMpmaihLABo9JHUWG9ke10Z4Tx2PKyaPZXS49QXVFlDeuh+dqx 80/qnGJwvZ0vbA4TuYVe6ZJLr61jWr0LyR8MKMaH5dYY6ptEKcmVqrhUy3wmxBRwfCzi IsYYDxtxyot2+HZA6AyA+sIfaL3kDsBDnXziajvj08+T+iWf/nI48iKwllqWlflzNYv+ Z20fMb6EeWGwtGJ/FY+Ld8/GBumB23j7zUwcLLg4hTONGOeH1I1c72pEEKhrwvKgYgV5 ylq7aCmWA//WW+n6gp0DL21OM51A1N6udWsYSxKTCzq+X08WhKLhGyNS8tfosQfqF6eL fw+A== 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=de0EjBF+hzGDM+i69O+/YEHpbFntjniyjiLFzME0BgQ=; fh=yJKnCMONMPDb5DcRuNlFPqebkFeNCW1ydpZFk0usg5k=; b=dtrsqE+l/JILgVI4S2XxVxuWkTALLA6ZkPdMr9+YrZBYOsVTrmuxOKexCg0SoWen7E WJV2aisDQsZH/bmLMmEmk88lbXcf3q0xr1Tb8kZW7R0wpgWZeufKDcZvR4rQ3J6litnA YWmQsRFkWU8LRq6iqZ5xxPx1SWB41BSQfiOUFaruvkkMxqzQEJpBRKGAhySh0IOELzsB LXGuALyGwq/LLCfM7bV1HP9U6vEohOeSOwxwPvCFMBNrqXlvU+2IFCgHZiZgFw/LM+QL CJHKovkE2xWsurc51/p7Zo3XJGLtFijC2V3yOWAw2K1RBLEF+eReEfYzwUo/7VHT3LyX NLxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=a4riN7Jo; 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 w21-20020a170902d71500b001b0044f186fsi12769412ply.41.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=a4riN7Jo; 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 S229592AbjGACKP (ORCPT + 99 others); Fri, 30 Jun 2023 22:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230036AbjGACKB (ORCPT ); Fri, 30 Jun 2023 22:10:01 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E24144A9 for ; Fri, 30 Jun 2023 19:09:53 -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=de0EjBF+hzGDM+i69O+/YEHpbFntjniyjiLFzME0BgQ=; b=a4riN7JozDAboAKaEv2mm+NGVe 0RWqF6NrsmtCsq+BgVwElu3CKKNrQqQTUuOwmFq4lmmENYMOQa+xFRRimUrdJ3Aqq5GiAwqZfKcPl cFxN0SMbhacM/QsGX8C7QNW7B24TQ9reYx+guJxGzvEfz0aUfFWcGNC0m8yv8iTJLsbHBSfPYaW89 yEYSMkoRROA8nDY+98yVgoZFlsCX25aF/E2tha5SYU8ZtPVq6QCc+QhyBs9SgNOMk/6RvGCDuhL/A 1l7R00AcEY5E5tecrzisQbMFDKNmC8Mj+jEttzk4yM4qowjC6pd/koLFamwWhufgGAwU7Qsm3K2g0 ItP8rF9Q==; 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 1qFQ3b-006abr-0e; Sat, 01 Jul 2023 04:09:51 +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 5/6] drm: Refuse to async flip with atomic prop changes Date: Fri, 30 Jun 2023 23:09:16 -0300 Message-ID: <20230701020917.143394-6-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?1770184070067050398?= X-GMAIL-MSGID: =?utf-8?q?1770184070067050398?= Given that prop changes may lead to modesetting, which would defeat the fast path of the async flip, refuse any atomic prop change for async flips in atomic API. The only exceptions are the framebuffer ID to flip to and the mode ID, that could be referring to an identical mode. Signed-off-by: André Almeida --- v4: new patch --- drivers/gpu/drm/drm_atomic_helper.c | 5 +++ drivers/gpu/drm/drm_atomic_uapi.c | 52 +++++++++++++++++++++++++++-- drivers/gpu/drm/drm_crtc_internal.h | 2 +- drivers/gpu/drm/drm_mode_object.c | 2 +- 4 files changed, 56 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 2c2c9caf0be5..1e2973f0e1f6 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -629,6 +629,11 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, WARN_ON(!drm_modeset_is_locked(&crtc->mutex)); if (!drm_mode_equal(&old_crtc_state->mode, &new_crtc_state->mode)) { + if (new_crtc_state->async_flip) { + drm_dbg_atomic(dev, "[CRTC:%d:%s] no mode changes allowed during async flip\n", + crtc->base.id, crtc->name); + return -EINVAL; + } drm_dbg_atomic(dev, "[CRTC:%d:%s] mode changed\n", crtc->base.id, crtc->name); new_crtc_state->mode_changed = true; diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index dfd4cf7169df..536c21f53b5f 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -972,13 +972,28 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state, return ret; } +static int drm_atomic_check_prop_changes(int ret, uint64_t old_val, uint64_t prop_value, + struct drm_property *prop) +{ + if (ret != 0 || old_val != prop_value) { + drm_dbg_atomic(prop->dev, + "[PROP:%d:%s] No prop can be changed during async flip\n", + prop->base.id, prop->name); + return -EINVAL; + } + + return 0; +} + int drm_atomic_set_property(struct drm_atomic_state *state, struct drm_file *file_priv, struct drm_mode_object *obj, struct drm_property *prop, - uint64_t prop_value) + uint64_t prop_value, + bool async_flip) { struct drm_mode_object *ref; + uint64_t old_val; int ret; if (!drm_property_change_valid_get(prop, prop_value, &ref)) @@ -995,6 +1010,13 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } + if (async_flip) { + ret = drm_atomic_connector_get_property(connector, connector_state, + prop, &old_val); + ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); + break; + } + ret = drm_atomic_connector_set_property(connector, connector_state, file_priv, prop, prop_value); @@ -1003,6 +1025,7 @@ int drm_atomic_set_property(struct drm_atomic_state *state, case DRM_MODE_OBJECT_CRTC: { struct drm_crtc *crtc = obj_to_crtc(obj); struct drm_crtc_state *crtc_state; + struct drm_mode_config *config = &crtc->dev->mode_config; crtc_state = drm_atomic_get_crtc_state(state, crtc); if (IS_ERR(crtc_state)) { @@ -1010,6 +1033,18 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } + /* + * We allow mode_id changes here for async flips, because we + * check later on drm_atomic_helper_check_modeset() callers if + * there are modeset changes or they are equal + */ + if (async_flip && prop != config->prop_mode_id) { + ret = drm_atomic_crtc_get_property(crtc, crtc_state, + prop, &old_val); + ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); + break; + } + ret = drm_atomic_crtc_set_property(crtc, crtc_state, prop, prop_value); break; @@ -1017,6 +1052,7 @@ int drm_atomic_set_property(struct drm_atomic_state *state, case DRM_MODE_OBJECT_PLANE: { struct drm_plane *plane = obj_to_plane(obj); struct drm_plane_state *plane_state; + struct drm_mode_config *config = &plane->dev->mode_config; plane_state = drm_atomic_get_plane_state(state, plane); if (IS_ERR(plane_state)) { @@ -1024,6 +1060,13 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } + if (async_flip && prop != config->prop_fb_id) { + ret = drm_atomic_plane_get_property(plane, plane_state, + prop, &old_val); + ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); + break; + } + ret = drm_atomic_plane_set_property(plane, plane_state, file_priv, prop, prop_value); @@ -1312,6 +1355,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, struct drm_out_fence_state *fence_state; int ret = 0; unsigned int i, j, num_fences; + bool async_flip = false; /* disallow for drivers not supporting atomic: */ if (!drm_core_check_feature(dev, DRIVER_ATOMIC)) @@ -1348,6 +1392,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, "commit failed: DRM_MODE_PAGE_FLIP_ASYNC not supported with atomic\n"); return -EINVAL; } + + async_flip = true; } /* can't test and expect an event at the same time. */ @@ -1427,8 +1473,8 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, goto out; } - ret = drm_atomic_set_property(state, file_priv, - obj, prop, prop_value); + ret = drm_atomic_set_property(state, file_priv, obj, + prop, prop_value, async_flip); if (ret) { drm_mode_object_put(obj); goto out; diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h index 501a10edd0e1..381130cebe81 100644 --- a/drivers/gpu/drm/drm_crtc_internal.h +++ b/drivers/gpu/drm/drm_crtc_internal.h @@ -251,7 +251,7 @@ int drm_atomic_set_property(struct drm_atomic_state *state, struct drm_file *file_priv, struct drm_mode_object *obj, struct drm_property *prop, - uint64_t prop_value); + uint64_t prop_value, bool async_flip); int drm_atomic_get_property(struct drm_mode_object *obj, struct drm_property *property, uint64_t *val); diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c index ba1608effc0f..64f519254895 100644 --- a/drivers/gpu/drm/drm_mode_object.c +++ b/drivers/gpu/drm/drm_mode_object.c @@ -536,7 +536,7 @@ static int set_property_atomic(struct drm_mode_object *obj, obj_to_connector(obj), prop_value); } else { - ret = drm_atomic_set_property(state, file_priv, obj, prop, prop_value); + ret = drm_atomic_set_property(state, file_priv, obj, prop, prop_value, false); if (ret) goto out; ret = drm_atomic_commit(state); From patchwork Sat Jul 1 02:09:17 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: 114940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp10789936vqr; Fri, 30 Jun 2023 19:39:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5uvrGQyVGEGZQD+m1twk68rbkywFymR/LbWpcDUK87U6gufZtTO0pcqxNJhyRl4nI0faRA X-Received: by 2002:a9d:75ce:0:b0:6b8:19d8:6925 with SMTP id c14-20020a9d75ce000000b006b819d86925mr5189567otl.12.1688179153086; Fri, 30 Jun 2023 19:39:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688179153; cv=none; d=google.com; s=arc-20160816; b=yP3FCijUU4YwHjdb2v3k/VGgMg79afLY0O1rCzETOqAN8S9qRLuBeHap19MACNdHBv Rklmc206WPbQut+vqJB7S7gtW9AH4ixH5tIlLq5d5UBz2ozP9KHxNPcDsxHoZmHc0cIU s8lzz1RhytFo06jJnA0//MUkOFg9G3pwgUFClBoqMSioB5HwOfU5jeNpgTCLcnPXbhGO LTuFrrU3Idtr3PhfTwgwEHwrbhl2/1b1BeIoy5T2qmBanvdrypcU6NkweL17Sus5sutV X62gBIlFtOmBuCci9oD7MyajgOXb85wSyKd57Zikh5/TXsGt2TVqW3etkn3UaYsdEGka +IMw== 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=FpvV1NRn92NjSFc/aa9HU0kB1fj/LcwCHP8r7t79LKQ=; fh=yJKnCMONMPDb5DcRuNlFPqebkFeNCW1ydpZFk0usg5k=; b=ZvcuEhBRJRhpc74zkZHZ0xq0Ep3lSRIbKyodKIrzTgYQhtCjCLk8WRTvYVTl/A1GXV GLa3Xw2F7REXYsKtD/gXswkq+n121hfffEDWyHk4cKY5d7NGPwQwj5u2WwPcc/jz+Qtg EzWtKIYP5iXF6gtQy4b+GE2wAKH9SwKeqtv/cItsxqMkpOKhJg2DVoQx5PvjgVpOWGTH uGRKIlvzRuTfMbVkMjLga67cYjtX6HO+FDZV+mqDIngoR/8R51WI6WiAUHDEJC/fgYgD v4Es8CR6GRU1ojR/tI9gMBWCHEFtzGphISWHk14V3O0TSrfWXHnBjtCShtODtjiEOROr 5Lqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=IQwSBaK4; 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 w67-20020a636246000000b0055752f5a119si14075958pgb.517.2023.06.30.19.39.00; Fri, 30 Jun 2023 19:39:13 -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=IQwSBaK4; 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 S229506AbjGACKb (ORCPT + 99 others); Fri, 30 Jun 2023 22:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229995AbjGACKS (ORCPT ); Fri, 30 Jun 2023 22:10:18 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86F39448B for ; Fri, 30 Jun 2023 19:09:58 -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=FpvV1NRn92NjSFc/aa9HU0kB1fj/LcwCHP8r7t79LKQ=; b=IQwSBaK4dtvffDRp6/HaKl/E7a HJgIluzVyRfp+1nipl9ZO4ikcNp8vPJyIiK/sZ+AWWQz+fEHLF82HpYZdnE/xq61NQ0xOcAkPXuhj pNuMDYbZBfQX4QF3DdXJRehvlT1FOK1ExMYnBSGJvkYGAeE+wqpoqi7VxqUovfVXj7uiUZRvZ7oj+ HIgVNImcyhMGUOTsesmF9Nc19mBFj+GqABzhb0pwSEHz3Udeit2RPm1/3ygDq4s42EMG4D4FvKMjA KYl6+k6jm1dmt0Z+IHtvyZSQP2YpdRPA/xy2zERwziURYskIVdOjutkBqjj87mWiK5IG4ArTQ9aVz oswa/ALg==; 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 1qFQ3g-006abr-5T; Sat, 01 Jul 2023 04:09:56 +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 6/6] drm/doc: Define KMS atomic state set Date: Fri, 30 Jun 2023 23:09:17 -0300 Message-ID: <20230701020917.143394-7-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?1770184143562679407?= X-GMAIL-MSGID: =?utf-8?q?1770184143562679407?= Specify how the atomic state is maintained between userspace and kernel, plus the special case for async flips. Signed-off-by: André Almeida Signed-off-by: Pekka Paalanen --- v4: new patch --- Documentation/gpu/drm-uapi.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst index 65fb3036a580..5464376051cc 100644 --- a/Documentation/gpu/drm-uapi.rst +++ b/Documentation/gpu/drm-uapi.rst @@ -486,3 +486,22 @@ and the CRTC index is its position in this array. .. kernel-doc:: include/uapi/drm/drm_mode.h :internal: + +KMS atomic state +================ + +If a userspace using the DRM atomic API would like to change the modeset, it +needs to do in an atomic way, changing all desired properties in a single +commit. Following commits may contain the same properties again, as if they were +new. The kernel can then judge if those properties requires modesetting and real +changes, or it's just the same state as before. In summary, userspace commits do +not need to set the minimal state as possible and can commit redundant +information, and the kernel will ignore it. + +An observation must be made for atomic operations with DRM_MODE_PAGE_FLIP_ASYNC. +In such scenarios properties values can be sent, but the if they change +something, the kernel will reject the flip. This is done because property +changes can lead to modesetting, that would defeat the goal of flipping as fast +as possible. The only exceptions are the framebuffer ID to be flipped to and +mode IDs changes, which could be referring to an identical mode, thus not +requiring modeset.