From patchwork Fri Nov 23 21:53:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helen Mae Koike Fornazier X-Patchwork-Id: 10696537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E50AB13AD for ; Sat, 24 Nov 2018 13:57:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D414429D3D for ; Sat, 24 Nov 2018 13:57:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C790F2A858; Sat, 24 Nov 2018 13:57:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SUBJ_OBFU_PUNCT_MANY,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3AEED29D3D for ; Sat, 24 Nov 2018 13:57:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 62CDE6E0A9; Sat, 24 Nov 2018 13:57:14 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4DE986E57D for ; Fri, 23 Nov 2018 21:53:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: koike) with ESMTPSA id 1EC7F263AE1 From: Helen Koike To: David Airlie Subject: [PATCH] drm: add capability DRM_CAP_ASYNC_UPDATE Date: Fri, 23 Nov 2018 19:53:26 -0200 Message-Id: <20181123215326.14274-1-helen.koike@collabora.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-Mailman-Approved-At: Sat, 24 Nov 2018 13:57:13 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dnicoara@chromium.org, =?utf-8?q?St=C3=A9phane_Marchesin?= , Sean Paul , alexandros.frantzis@collabora.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, tomasz Figa , Gustavo Padovan , kernel@collabora.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Allow userspace to identify if the driver supports async update. Signed-off-by: Enric Balletbo i Serra [prepared for upstream] Signed-off-by: Helen Koike --- Hi, This patch introduces the ASYNC_UPDATE cap, which originated from the discussion regarding DRM_MODE_ATOMIC_AMEND on [1], to allow user to figure that async_update exists. This was tested using a small program that exercises the uAPI for easy sanity testing. The program was created by Alexandros and modified by Enric to test the capability flag [2]. The test worked on a rockchip Ficus v1.1 board on top of mainline plus the patch to update cursors asynchronously through atomic plus the patch that introduces the ATOMIC_AMEND flag for the drm/rockchip driver. To test, just build the program and use the --atomic flag to use the cursor plane with the ATOMIC_AMEND flag. E.g. drm_cursor --atomic [1] https://patchwork.freedesktop.org/patch/243088/ [2] https://gitlab.collabora.com/eballetbo/drm-cursor/commits/async-capability Thanks Helen drivers/gpu/drm/drm_ioctl.c | 11 +++++++++++ include/uapi/drm/drm.h | 1 + 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 94bd872d56c4..4a7e0f874171 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "drm_legacy.h" #include "drm_internal.h" #include "drm_crtc_internal.h" @@ -229,6 +230,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ { struct drm_get_cap *req = data; struct drm_crtc *crtc; + struct drm_plane *plane; req->value = 0; @@ -292,6 +294,15 @@ 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_ASYNC_UPDATE: + req->value = 1; + list_for_each_entry(plane, &dev->mode_config.plane_list, head) { + if (!plane->helper_private->atomic_async_update) { + req->value = 0; + break; + } + } + break; default: return -EINVAL; } diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 300f336633f2..ff01540cbb1d 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h @@ -649,6 +649,7 @@ struct drm_gem_open { #define DRM_CAP_PAGE_FLIP_TARGET 0x11 #define DRM_CAP_CRTC_IN_VBLANK_EVENT 0x12 #define DRM_CAP_SYNCOBJ 0x13 +#define DRM_CAP_ASYNC_UPDATE 0x14 /** DRM_IOCTL_GET_CAP ioctl argument type */ struct drm_get_cap {