From patchwork Fri Jun 15 00:57:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Keith Packard X-Patchwork-Id: 10465507 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 7D9AD600F4 for ; Fri, 15 Jun 2018 00:57:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6869B28C30 for ; Fri, 15 Jun 2018 00:57:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A9CB28C3F; Fri, 15 Jun 2018 00:57:11 +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 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 102CE28C30 for ; Fri, 15 Jun 2018 00:57:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C13A96E126; Fri, 15 Jun 2018 00:57:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from elaine.keithp.com (home.keithp.com [63.227.221.253]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C17D6E0D5; Fri, 15 Jun 2018 00:57:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by elaine.keithp.com (Postfix) with ESMTP id CC55B3F239CC; Thu, 14 Jun 2018 17:57:03 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at keithp.com Received: from elaine.keithp.com ([127.0.0.1]) by localhost (elaine.keithp.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Ek55jiA_EWwf; Thu, 14 Jun 2018 17:57:03 -0700 (PDT) Received: from keithp.com (unknown [156.39.10.47]) by elaine.keithp.com (Postfix) with ESMTPSA id 717483F23991; Thu, 14 Jun 2018 17:57:03 -0700 (PDT) Received: by keithp.com (Postfix, from userid 1000) id CB1B81582AD9; Thu, 14 Jun 2018 17:57:02 -0700 (PDT) From: Keith Packard To: mesa-dev@lists.freedesktop.org Subject: [PATCH] wsi_common_display: Deal with vscan values Date: Thu, 14 Jun 2018 17:57:01 -0700 Message-Id: <20180615005701.22266-1-keithp@keithp.com> X-Mailer: git-send-email 2.17.1 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: Keith Packard , dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP We sorted out what 'vscan' means and are trying to use it correctly. vscan = 0 is the same as vscan = 1, which is slightly annoying; we use MAX2(vscan, 1) everywhere. randr doesn't pass vscan at all, so we set wsi mode vscan = 0. The doublescan flag doubles the vscan value, so we don't need to deal with that separately, we can just compare flags normally. Signed-off-by: Keith Packard Reviewed-by: Jason Ekstrand --- src/vulkan/wsi/wsi_common_display.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index c7f794a0eff..de1c1826bd2 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -149,7 +149,7 @@ wsi_display_mode_matches_drm(wsi_display_mode *wsi, wsi->vsync_start == drm->vsync_start && wsi->vsync_end == drm->vsync_end && wsi->vtotal == drm->vtotal && - wsi->vscan == drm->vscan && + MAX2(wsi->vscan, 1) == MAX2(drm->vscan, 1) && wsi->flags == drm->flags; } @@ -158,7 +158,7 @@ wsi_display_mode_refresh(struct wsi_display_mode *wsi) { return (double) wsi->clock * 1000.0 / ((double) wsi->htotal * (double) wsi->vtotal * - (double) (wsi->vscan + 1)); + (double) MAX2(wsi->vscan, 1)); } static uint64_t wsi_get_current_monotonic(void) @@ -1657,6 +1657,7 @@ wsi_display_mode_matches_x(struct wsi_display_mode *wsi, wsi->vsync_start == xcb->vsync_start && wsi->vsync_end == xcb->vsync_end && wsi->vtotal == xcb->vtotal && + wsi->vscan <= 1 && wsi->flags == xcb->mode_flags; } @@ -1707,8 +1708,6 @@ wsi_display_register_x_mode(struct wsi_device *wsi_device, display_mode->vsync_end = x_mode->vsync_end; display_mode->vtotal = x_mode->vtotal; display_mode->vscan = 0; - if (x_mode->mode_flags & XCB_RANDR_MODE_FLAG_DOUBLE_SCAN) - display_mode->vscan = 1; display_mode->flags = x_mode->mode_flags; list_addtail(&display_mode->list, &connector->display_modes);