From patchwork Mon Feb 25 14:26:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shayenne Moura X-Patchwork-Id: 10828635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3C96C17E6 for ; Mon, 25 Feb 2019 14:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2885D2B85E for ; Mon, 25 Feb 2019 14:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CC962B866; Mon, 25 Feb 2019 14:26:16 +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,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,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 1BA9E2B86F for ; Mon, 25 Feb 2019 14:26:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8D8E08968D; Mon, 25 Feb 2019 14:26:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by gabe.freedesktop.org (Postfix) with ESMTPS id 804228968D for ; Mon, 25 Feb 2019 14:26:11 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id f196so5345207qke.10 for ; Mon, 25 Feb 2019 06:26:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=oQx8Ikl37EpzxPFH8S4MVsrRB32APMK/9Vuc3hAlWNk=; b=dOoRe9dHbay1Ge2tSHg47lM8ZiZL4Er7wwxwjjqelsLiYLIWmWQQ7n3ZRRGvRtKpkV kCYXk9qh9AqQeN+kE/NircYEo36PNi1ZcS2M5oGUkQxIjdum8fqJf9WbrNh1lpDaYKyG fCGq8aMS6bBdiU/SIP/myIM1WYxjZhI14soxg3QMqQPpPrMt/AB16iWXQ2FBibX5Db61 xrp5ma14iCPpv0ZJ4Xj0Fjh00MZ1h3MO2MetBhNOpQyGr3oIEmDKht7M/Od7T7WUVYFp RvA/ryLa1K4Q4E15dwIErMOghvd5hoPPL/+MtWGk+RmakB0HFD7aptJxCizdE2GVuflR XcRA== X-Gm-Message-State: AHQUAuZGdgw/oH7c+3Uw5AFCTbYYnra+WRFb9fEzjPNZgi60wD/KS7Bi /hU7+iB8pKQiSoD0mGMvBqnvxltf78E= X-Google-Smtp-Source: AHgI3IYmOQjk4gBi8YFv551I1eJq3CPdBlLyqryfKSpj9E+deCDp1LL5Uj6opTKbh0WQkm4lW/VUig== X-Received: by 2002:a37:4bd7:: with SMTP id y206mr13288781qka.167.1551104770568; Mon, 25 Feb 2019 06:26:10 -0800 (PST) Received: from smtp.gmail.com ([143.107.45.1]) by smtp.gmail.com with ESMTPSA id h10sm10218600qta.3.2019.02.25.06.26.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Feb 2019 06:26:10 -0800 (PST) Date: Mon, 25 Feb 2019 11:26:06 -0300 From: Shayenne Moura To: Rodrigo Siqueira , Haneen Mohammed , Daniel Vetter , David Airlie Subject: [PATCH] drm/vkms: Solve bug on kms_crc_cursor tests Message-ID: <20190225142606.gov32asdq3qe375q@smtp.gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20171215 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=oQx8Ikl37EpzxPFH8S4MVsrRB32APMK/9Vuc3hAlWNk=; b=hiBydDQ4THaSJwUFx4Szq8Sz8Pm6dZbCvZKbtNcsWZyTC2MgjWAl1YNpngoIfjRFx4 eThU6zR0T/+pPj4OE5qed5w8JJDnXYirPcIiil8mjgMMypGUDLk/oempHAYoMAG+TPaZ DxGQCO7y9eWinyfh69NyqGoJtuzO922QrIK030ioD45fz/Joubh/TQWyJo26GK8Tx9ru KNqnwV46B/XauXqtwpnVaaq+lxHIn/xjIQUf/OdMFbq/CmziPIPAijmvj9hnH6ILwe4D y7pAAlDLJvu8srcGidL4+ZipnYT9G1alEjBIkSAjyWKR569OstDkdVgwonEt0YS351aU 9VKA== 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP vkms_crc_work_handle needs the value of the actual frame to schedule the workqueue that calls periodically the vblank handler and the destroy state functions. However, the frame value returned from vkms_vblank_simulate is updated and diminished in vblank_get_timestamp because it is not in a vblank interrupt, and return an inaccurate value. Solve this getting the actual vblank frame directly from the vblank->count inside the `struct drm_crtc`, instead of using the `drm_accurate_vblank_count` function. Signed-off-by: Shayenne Moura --- drivers/gpu/drm/vkms/vkms_crc.c | 4 +++- drivers/gpu/drm/vkms/vkms_crtc.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/vkms/vkms_crc.c b/drivers/gpu/drm/vkms/vkms_crc.c index d7b409a3c0f8..09a8b00ef1f1 100644 --- a/drivers/gpu/drm/vkms/vkms_crc.c +++ b/drivers/gpu/drm/vkms/vkms_crc.c @@ -161,6 +161,8 @@ void vkms_crc_work_handle(struct work_struct *work) struct vkms_output *out = drm_crtc_to_vkms_output(crtc); struct vkms_device *vdev = container_of(out, struct vkms_device, output); + unsigned int pipe = drm_crtc_index(crtc); + struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe]; struct vkms_crc_data *primary_crc = NULL; struct vkms_crc_data *cursor_crc = NULL; struct drm_plane *plane; @@ -196,7 +198,7 @@ void vkms_crc_work_handle(struct work_struct *work) if (primary_crc) crc32 = _vkms_get_crc(primary_crc, cursor_crc); - frame_end = drm_crtc_accurate_vblank_count(crtc); + frame_end = vblank->count; /* queue_work can fail to schedule crc_work; add crc for * missing frames diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c b/drivers/gpu/drm/vkms/vkms_crtc.c index 8a9aeb0a9ea8..9bf3268e2e92 100644 --- a/drivers/gpu/drm/vkms/vkms_crtc.c +++ b/drivers/gpu/drm/vkms/vkms_crtc.c @@ -10,6 +10,8 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) vblank_hrtimer); struct drm_crtc *crtc = &output->crtc; struct vkms_crtc_state *state = to_vkms_crtc_state(crtc->state); + unsigned int pipe = drm_crtc_index(crtc); + struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe]; u64 ret_overrun; bool ret; @@ -20,7 +22,7 @@ static enum hrtimer_restart vkms_vblank_simulate(struct hrtimer *timer) DRM_ERROR("vkms failure on handling vblank"); if (state && output->crc_enabled) { - u64 frame = drm_crtc_accurate_vblank_count(crtc); + u64 frame = vblank->count; /* update frame_start only if a queued vkms_crc_work_handle() * has read the data