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 {