From patchwork Fri May 12 19:10:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gustavo Padovan X-Patchwork-Id: 9724807 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D9E5F601E7 for ; Fri, 12 May 2017 19:11:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D1E1728831 for ; Fri, 12 May 2017 19:11:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C61272886D; Fri, 12 May 2017 19:11:28 +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=-3.7 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM 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 7C9FA28831 for ; Fri, 12 May 2017 19:11:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A7F86E716; Fri, 12 May 2017 19:11:19 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk0-f193.google.com (mail-qk0-f193.google.com [209.85.220.193]) by gabe.freedesktop.org (Postfix) with ESMTPS id 442026E711 for ; Fri, 12 May 2017 19:11:16 +0000 (UTC) Received: by mail-qk0-f193.google.com with SMTP id y128so9025761qka.3 for ; Fri, 12 May 2017 12:11:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=l2N+gVN/0UuwHMRacyhGs4sxwubBHTqVRRMyGYVXMmA=; b=LdyxCwRwSZzCjvf0pPvVFv6tnUkyRsUFrQRq8R0bEszPYh9WBAv8wDq7nywatH/ThT GQgXVQJup6wCvlBNebU2Q/nPHgch/RY0XWXtVRuSag52VtXsjS7XYPTNV1lLa7bBDMmJ p6rLyBO05GyJo5oXPExqFf91mbtPz7ULfc5omK06jzcIEIQ0f8CsHNgp7Fd5NB4nb+Kq LfmrqH1sE+hJ3PyB7+4LA7TQRNTv85pmIcP8guBOTGv5owI5tmCxG1FPBSKLk1GMIgG6 nQd1+hxsU7d3gunEFythYiBr9A4HZMOOojNvFEyjgieXP+b/cMzoYWq9qtLNImmdU7qX HCZQ== X-Gm-Message-State: AODbwcCjmwOIZ2YUoYkOoX3ZeWZjWmowaM/hCjtYzc+DtpjDw7sQIX7C W8lKkYA82OuwUQ== X-Received: by 10.55.147.135 with SMTP id v129mr5488496qkd.146.1494616275409; Fri, 12 May 2017 12:11:15 -0700 (PDT) Received: from localhost.localdomain ([177.17.166.160]) by smtp.gmail.com with ESMTPSA id g32sm2930406qtc.19.2017.05.12.12.11.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 May 2017 12:11:14 -0700 (PDT) From: Gustavo Padovan To: dri-devel@lists.freedesktop.org Subject: [RFC v3 8/8] drm/atomic: add ASYNC_UPDATE flag to the Atomic IOCTL Date: Fri, 12 May 2017 16:10:54 -0300 Message-Id: <20170512191054.10074-9-gustavo@padovan.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170512191054.10074-1-gustavo@padovan.org> References: <20170512191054.10074-1-gustavo@padovan.org> Cc: Gustavo Padovan X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Gustavo Padovan This flag tells core to jump ahead the queued update if the conditions in drm_atomic_async_check() are met. That means we are only able to do an async update if no modeset is pending and update for the same plane is not queued. It uses the already in place infrastructure for async updates. It is useful for cursor updates and async PageFlips over the atomic ioctl, otherwise in some cases updates may be delayed to the point the user will notice it. DRM_MODE_ATOMIC_ASYNC_UPDATE should be passed to the Atomic IOCTL to use this feature. Signed-off-by: Gustavo Padovan --- drivers/gpu/drm/drm_atomic.c | 8 +++++++- include/uapi/drm/drm_mode.h | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 259a758..304dd0a 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -77,6 +77,7 @@ drm_atomic_state_init(struct drm_device *dev, struct drm_atomic_state *state) * setting this appropriately? */ state->allow_modeset = true; + state->async_update = true; state->crtcs = kcalloc(dev->mode_config.num_crtc, sizeof(*state->crtcs), GFP_KERNEL); @@ -1653,7 +1654,7 @@ int drm_atomic_check_only(struct drm_atomic_state *state) } } - if (state->legacy_cursor_update) + if (state->async_update || state->legacy_cursor_update) state->async_update = drm_atomic_async_check(state); return ret; @@ -2189,6 +2190,10 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, (arg->flags & DRM_MODE_PAGE_FLIP_EVENT)) return -EINVAL; + if ((arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET) && + (arg->flags & DRM_MODE_ATOMIC_ASYNC_UPDATE)) + return -EINVAL; + drm_modeset_acquire_init(&ctx, 0); state = drm_atomic_state_alloc(dev); @@ -2197,6 +2202,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, state->acquire_ctx = &ctx; state->allow_modeset = !!(arg->flags & DRM_MODE_ATOMIC_ALLOW_MODESET); + state->async_update = !!(arg->flags & DRM_MODE_ATOMIC_ASYNC_UPDATE); retry: plane_mask = 0; diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h index 8c67fc0..7c067ca 100644 --- a/include/uapi/drm/drm_mode.h +++ b/include/uapi/drm/drm_mode.h @@ -646,13 +646,15 @@ struct drm_mode_destroy_dumb { #define DRM_MODE_ATOMIC_TEST_ONLY 0x0100 #define DRM_MODE_ATOMIC_NONBLOCK 0x0200 #define DRM_MODE_ATOMIC_ALLOW_MODESET 0x0400 +#define DRM_MODE_ATOMIC_ASYNC_UPDATE 0x0800 #define DRM_MODE_ATOMIC_FLAGS (\ DRM_MODE_PAGE_FLIP_EVENT |\ DRM_MODE_PAGE_FLIP_ASYNC |\ DRM_MODE_ATOMIC_TEST_ONLY |\ DRM_MODE_ATOMIC_NONBLOCK |\ - DRM_MODE_ATOMIC_ALLOW_MODESET) + DRM_MODE_ATOMIC_ALLOW_MODESET |\ + DRM_MODE_ATOMIC_ASYNC_UPDATE) struct drm_mode_atomic { __u32 flags;