From patchwork Mon Jun 30 23:44:23 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Roper X-Patchwork-Id: 4455341 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AE669BEEAA for ; Mon, 30 Jun 2014 23:44:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C5174202F0 for ; Mon, 30 Jun 2014 23:44:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D9ACC201FA for ; Mon, 30 Jun 2014 23:44:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71AEE6E416; Mon, 30 Jun 2014 16:44:09 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E3A16E416 for ; Mon, 30 Jun 2014 16:44:08 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 30 Jun 2014 16:38:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,578,1400050800"; d="scan'208";a="566304009" Received: from mdroper-hswdev.fm.intel.com (HELO mdroper-hswdev) ([10.1.134.215]) by orsmga002.jf.intel.com with ESMTP; 30 Jun 2014 16:44:07 -0700 Received: from mattrope by mdroper-hswdev with local (Exim 4.82) (envelope-from ) id 1X1lFk-0002fW-Om; Mon, 30 Jun 2014 16:44:52 -0700 From: Matt Roper To: intel-gfx@lists.freedesktop.org Date: Mon, 30 Jun 2014 16:44:23 -0700 Message-Id: <1404171870-10206-3-git-send-email-matthew.d.roper@intel.com> X-Mailer: git-send-email 1.8.5.1 In-Reply-To: <1404171870-10206-1-git-send-email-matthew.d.roper@intel.com> References: <1404171870-10206-1-git-send-email-matthew.d.roper@intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/9] lib/kms: Track need for vblank wait locally X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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 The need to wait for a vblank after programming is due to the way we actually program the hardware. Move need_wait_for_vblank out of the pipe and into a local variable in preparation for future programming styles (e.g., atomic pageflip) that will need different logic. Signed-off-by: Matt Roper --- lib/igt_kms.c | 15 ++++++++++----- lib/igt_kms.h | 1 - 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/igt_kms.c b/lib/igt_kms.c index 1e7b901..3f561e9 100644 --- a/lib/igt_kms.c +++ b/lib/igt_kms.c @@ -759,13 +759,11 @@ static int igt_cursor_commit(igt_plane_t *plane, igt_output_t *output) static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) { igt_display_t *display = output->display; - igt_pipe_t *pipe; uint32_t fb_id, crtc_id; int ret; fb_id = igt_plane_get_fb_id(plane); crtc_id = output->config.crtc->crtc_id; - pipe = igt_output_get_driving_pipe(output); if (plane->fb_changed && fb_id == 0) { LOG(display, @@ -814,7 +812,6 @@ static int igt_drm_plane_commit(igt_plane_t *plane, igt_output_t *output) plane->fb_changed = false; plane->position_changed = false; - pipe->need_wait_for_vblank = true; } return 0; @@ -840,6 +837,7 @@ static int igt_output_commit(igt_output_t *output) igt_plane_t *primary; igt_plane_t *cursor; int i; + bool need_wait_for_vblank = false; pipe = igt_output_get_driving_pipe(output); primary = igt_pipe_get_plane(pipe, IGT_PLANE_PRIMARY); @@ -925,17 +923,24 @@ static int igt_output_commit(igt_output_t *output) igt_assert(ret == 0); cursor->fb_changed = false; + need_wait_for_vblank = true; } for (i = 0; i < pipe->n_planes; i++) { igt_plane_t *plane = &pipe->planes[i]; + if (plane->fb_changed || plane->position_changed) + need_wait_for_vblank = true; + igt_plane_commit(plane, output); } - if (pipe->need_wait_for_vblank) { + /* + * If the crtc is enabled, wait until the next vblank before returning + * if we made changes to any of the planes. + */ + if (need_wait_for_vblank && igt_plane_get_fb_id(primary) != 0) { igt_wait_for_vblank(display->drm_fd, pipe->pipe); - pipe->need_wait_for_vblank = false; } return 0; diff --git a/lib/igt_kms.h b/lib/igt_kms.h index 88b695a..a9a4236 100644 --- a/lib/igt_kms.h +++ b/lib/igt_kms.h @@ -120,7 +120,6 @@ typedef struct { struct igt_pipe { igt_display_t *display; enum pipe pipe; - unsigned int need_wait_for_vblank : 1; #define IGT_MAX_PLANES 4 int n_planes; igt_plane_t planes[IGT_MAX_PLANES];