From patchwork Mon Jan 19 16:31:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 5659471 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 35C089F333 for ; Mon, 19 Jan 2015 16:32:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D9BE0203B1 for ; Mon, 19 Jan 2015 16:32:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A6268203AE for ; Mon, 19 Jan 2015 16:32:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B27816E5B6; Mon, 19 Jan 2015 08:32:38 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTP id F0B226E5B6 for ; Mon, 19 Jan 2015 08:32:36 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 19 Jan 2015 08:26:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,427,1418112000"; d="scan'208";a="653233996" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by fmsmga001.fm.intel.com with ESMTP; 19 Jan 2015 08:32:23 -0800 Received: from mattrope by mdroper-hswdev with local (Exim 4.82) (envelope-from ) id 1YDFFX-0006IN-FS; Mon, 19 Jan 2015 08:32:23 -0800 From: Matt Roper To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/plane-helper: Skip prepare_fb/cleanup_fb when newfb==oldfb Date: Mon, 19 Jan 2015 08:31:49 -0800 Message-Id: <1421685109-24167-1-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, 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 When commiting a plane update where the framebuffer doesn't change, we can skip the prepare_fb/cleanup_fb steps. This also allows us to avoid an unnecessary vblank wait at the end of the operation when we're just moving a plane and not changing its image (e.g., for a cursor). At the moment, i915 is the only upstream driver using the transitional plane helpers, and thus the only driver affected by this change. Reported-by: Jeremiah Mahler Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88540 Signed-off-by: Matt Roper Tested-by: Rodrigo Vivi --- drivers/gpu/drm/drm_plane_helper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index f24c4cf..7a5814a 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c @@ -435,7 +435,8 @@ int drm_plane_helper_commit(struct drm_plane *plane, goto out; } - if (plane_funcs->prepare_fb && plane_state->fb) { + if (plane_funcs->prepare_fb && plane_state->fb && + plane_state->fb != old_fb) { ret = plane_funcs->prepare_fb(plane, plane_state->fb); if (ret) goto out; @@ -456,6 +457,13 @@ int drm_plane_helper_commit(struct drm_plane *plane, crtc_funcs[i]->atomic_flush(crtc[i]); } + /* + * If we only moved the plane and didn't change fb's, there's no need to + * wait for vblank. + */ + if (plane->state->fb == old_fb) + goto out; + for (i = 0; i < 2; i++) { if (!crtc[i]) continue;