From patchwork Mon Oct 7 20:15:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 2999011 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 85C209F245 for ; Mon, 7 Oct 2013 20:17:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9EAC520216 for ; Mon, 7 Oct 2013 20:17:39 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 4C39920213 for ; Mon, 7 Oct 2013 20:17:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 396BDE750C for ; Mon, 7 Oct 2013 13:17:38 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-ye0-f176.google.com (mail-ye0-f176.google.com [209.85.213.176]) by gabe.freedesktop.org (Postfix) with ESMTP id A37B0E6090 for ; Mon, 7 Oct 2013 13:16:22 -0700 (PDT) Received: by mail-ye0-f176.google.com with SMTP id m4so1711956yen.35 for ; Mon, 07 Oct 2013 13:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HRiHy+fHGKwXIOMJ1vMaA4EUjEOAMPnCkl2ZDf93mv8=; b=WDR6YiQr/U62ZdHjVo6oPzS71PO7Zo9u2xAURax88Tc6smcIEOVDMrJwlH2GTPSs0e NZqeDONh2XLszqL1dEKvgY6kygb9vOfaP/cjDdGI6/z6Lf24yCY7kdomJ5717Ty0VxyG OzUO0jKZWpthvZtwGL7Jbxu5BDruDquqVyKFYS80/6b8VMJa8wZhvul6warcGVn0RmH7 ZrTvTssGpSvVKlE5uNwV8Ze1pZTgPFoNkV7h9rtuXj3HQrcRsn5tn8AHqO4OAT+z2NWS vlpZ8gUrVmeL/0im2D88f3MYEiEHrjSJMbrlBXQf1VymRogkqd3oQKtkXqNiyhuT/Szr LsOQ== X-Received: by 10.236.31.71 with SMTP id l47mr45240yha.121.1381176980984; Mon, 07 Oct 2013 13:16:20 -0700 (PDT) Received: from localhost.localdomain (200.188.217.18.dedicated.neoviatelecom.com.br. [200.188.217.18]) by mx.google.com with ESMTPSA id 48sm46243569yhq.11.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 07 Oct 2013 13:16:20 -0700 (PDT) From: Rodrigo Vivi To: intel-gfx@lists.freedesktop.org Date: Mon, 7 Oct 2013 17:15:46 -0300 Message-Id: <1381176948-2754-3-git-send-email-rodrigo.vivi@gmail.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1381176948-2754-1-git-send-email-rodrigo.vivi@gmail.com> References: <1381176948-2754-1-git-send-email-rodrigo.vivi@gmail.com> Subject: [Intel-gfx] [PATCH 2/4] drm/i915: Asynchronously perform the set-base for a simple modeset X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Chris Wilson A simple modeset, where we only wish to switch over to a new framebuffer such as the transition from fbcon to X, takes around 30-60ms. This is due to three factors: 1. We need to make sure the fb->obj is in the display domain, which incurs a cache flush to ensure no dirt is left on the scanout. 2. We need to flush any pending rendering before performing the mmio so that the frame is complete before it is shown. 3. We currently wait for the vblank after the mmio to be sure that the old fb is no longer being shown before releasing it. (1) can only be eliminated by userspace preparing the fb->obj in advance to already be in the display domain. This can be done through use of the create2 ioctl, or by reusing an existing fb->obj. However, (2) and (3) are already solved by the existing page flip mechanism, and it is surprisingly trivial to wire them up for use in the set-base fast path. Though it can be argued that this represents a subtle ABI break in that the set_config ioctl now returns before the old framebuffer is unpinned. The danger is that userspace will start to modify it before it is no longer being shown, however we should be able to prevent that through proper domain tracking. By combining all of the above, we can achieve an instaneous set_config: [ 6.601] (II) intel(0): switch to mode 2560x1440@60.0 on pipe 0 using DP2, position (0, 0), rotation normal [ 6.601] (II) intel(0): Setting screen physical size to 677 x 381 v2 (by Vivi): page_flip_flag was added to intel_crtc_page_flip in a previous commit. using 0. Signed-off-by: Chris Wilson Signed-off-by: Rodrigo Vivi Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/intel_display.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index b9cede7..bc47f1e 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -9569,10 +9569,13 @@ static int intel_crtc_set_config(struct drm_mode_set *set) ret = intel_set_mode(set->crtc, set->mode, set->x, set->y, set->fb); } else if (config->fb_changed) { - intel_crtc_wait_for_pending_flips(set->crtc); - - ret = intel_pipe_set_base(set->crtc, - set->x, set->y, set->fb); + if (to_intel_framebuffer(set->fb)->obj->ring == NULL || + save_set.x != set->x || save_set.y != set->y || + intel_crtc_page_flip(set->crtc, set->fb, NULL, 0)) { + intel_crtc_wait_for_pending_flips(set->crtc); + ret = intel_pipe_set_base(set->crtc, + set->x, set->y, set->fb); + } } if (ret) {