From patchwork Wed Sep 14 12:55:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 9331365 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 24BAE60231 for ; Wed, 14 Sep 2016 12:56:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15E141FFC9 for ; Wed, 14 Sep 2016 12:56:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A8DC2921C; Wed, 14 Sep 2016 12:56:05 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 EF9B41FFC9 for ; Wed, 14 Sep 2016 12:56:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A90536E40F; Wed, 14 Sep 2016 12:55:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-x235.google.com (mail-pa0-x235.google.com [IPv6:2607:f8b0:400e:c03::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id 550E26E3F6 for ; Wed, 14 Sep 2016 12:55:28 +0000 (UTC) Received: by mail-pa0-x235.google.com with SMTP id cm16so5347489pac.0 for ; Wed, 14 Sep 2016 05:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8YqeMrm10zd5GzRGOC+/jgF6eFF96XyIMJ4eVBkCfNo=; b=biuRruvBUs41GKnjEgBOuu8XhLZ/JDvofwNDFKTyN/4tuUOsV7IXmJEuOi4qb/TzwK q/94JXslr9QqrKQsrBebs3lWlVFQSnnjD3BBRBa92D/OZGhZcdDmJHO5zi0PldL0fL2O HCQyFX+tkaOaI6wwGplykM+2n/hwgCoWlUEc0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=8YqeMrm10zd5GzRGOC+/jgF6eFF96XyIMJ4eVBkCfNo=; b=ilk6lFkHv3j+FmbJovK2xCUw8BRDNcCmd0uZ8EmxjI0csicsk+tvZVyGq5OwqZn3hb /WOBh8T14LrN5zf7o3XlRZeW402tB3oo4GEshcMe9M6uuY+gvD9e0aVhqQk+Bj3zgtUu tWnvBUwp9jmO2t/XV3i0VquSyaSaZEeID3K6fTV6Ws4aFA+s0z/3vqA/oO8jUyabLuos ZFjD8tYynp1oTuLwHzDIDFC0SIvMAorstWQuxjk2AE16A8FEpetH9PzzFAjDlIESIqPg DQe3oqsJDfGSv4eZTH4M1XcC39U/+uuEh0dz2iTXMzl2ZvBh83HRfZMjLLxmbIU+trAK ubcA== X-Gm-Message-State: AE9vXwM20wgS4S+Mp8mD8PW3s93WRRr4HdEYq4pp4ama+s7gbqdUGb/JKwwGakEE3aNB9IdR X-Received: by 10.66.192.102 with SMTP id hf6mr4274241pac.102.1473857726562; Wed, 14 Sep 2016 05:55:26 -0700 (PDT) Received: from basement.tok.corp.google.com ([100.103.3.207]) by smtp.gmail.com with ESMTPSA id t7sm5601309paz.21.2016.09.14.05.55.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Sep 2016 05:55:26 -0700 (PDT) From: Tomasz Figa To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/8] drm/rockchip: Always signal event in next vblank after cfg_done Date: Wed, 14 Sep 2016 21:55:00 +0900 Message-Id: <1473857701-9250-8-git-send-email-tfiga@chromium.org> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1473857701-9250-1-git-send-email-tfiga@chromium.org> References: <1473857701-9250-1-git-send-email-tfiga@chromium.org> Cc: linux-kernel@vger.kernel.org, Tomasz Figa , linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org 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-Virus-Scanned: ClamAV using ClamSMTP This patch makes the driver send the pending vblank event in next vblank following the commit, relying on vblank signalling improvements done in previous patches. This gives us vblank events that always represent the real moment of changes hitting on the screen (which was the case only for complete FB changes before) and lets us remove the manual window update check. Signed-off-by: Tomasz Figa --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 54 ++++++----------------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index bb7a865..cacdffb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -105,10 +105,6 @@ struct vop_win { struct drm_plane base; const struct vop_win_data *data; struct vop *vop; - - /* protected by dev->event_lock */ - bool enable; - dma_addr_t yrgb_mst; }; struct vop { @@ -716,11 +712,6 @@ static void vop_plane_atomic_disable(struct drm_plane *plane, if (!old_state->crtc) return; - spin_lock_irq(&plane->dev->event_lock); - vop_win->enable = false; - vop_win->yrgb_mst = 0; - spin_unlock_irq(&plane->dev->event_lock); - spin_lock(&vop->reg_lock); VOP_WIN_SET(vop, win, enable, 0); @@ -784,11 +775,6 @@ static void vop_plane_atomic_update(struct drm_plane *plane, offset += (src->y1 >> 16) * fb->pitches[0]; vop_plane_state->yrgb_mst = rk_obj->dma_addr + offset + fb->offsets[0]; - spin_lock_irq(&plane->dev->event_lock); - vop_win->enable = true; - vop_win->yrgb_mst = vop_plane_state->yrgb_mst; - spin_unlock_irq(&plane->dev->event_lock); - spin_lock(&vop->reg_lock); VOP_WIN_SET(vop, win, format, vop_plane_state->format); @@ -1112,6 +1098,16 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc, */ vop_wait_for_irq_handler(vop); + spin_lock_irq(&crtc->dev->event_lock); + if (crtc->state->event) { + WARN_ON(drm_crtc_vblank_get(crtc) != 0); + WARN_ON(vop->event); + + vop->event = crtc->state->event; + crtc->state->event = NULL; + } + spin_unlock_irq(&crtc->dev->event_lock); + for_each_plane_in_state(old_state, plane, old_plane_state, i) { if (!old_plane_state->fb) continue; @@ -1129,19 +1125,7 @@ static void vop_crtc_atomic_flush(struct drm_crtc *crtc, static void vop_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_crtc_state) { - struct vop *vop = to_vop(crtc); - rockchip_drm_psr_flush(crtc); - - spin_lock_irq(&crtc->dev->event_lock); - if (crtc->state->event) { - WARN_ON(drm_crtc_vblank_get(crtc) != 0); - WARN_ON(vop->event); - - vop->event = crtc->state->event; - crtc->state->event = NULL; - } - spin_unlock_irq(&crtc->dev->event_lock); } static const struct drm_crtc_helper_funcs vop_crtc_helper_funcs = { @@ -1207,29 +1191,11 @@ static void vop_fb_unref_worker(struct drm_flip_work *work, void *val) drm_framebuffer_unreference(fb); } -static bool vop_win_pending_is_complete(struct vop_win *vop_win) -{ - dma_addr_t yrgb_mst; - - if (!vop_win->enable) - return VOP_WIN_GET(vop_win->vop, vop_win->data, enable) == 0; - - yrgb_mst = VOP_WIN_GET_YRGBADDR(vop_win->vop, vop_win->data); - - return yrgb_mst == vop_win->yrgb_mst; -} - static void vop_handle_vblank(struct vop *vop) { struct drm_device *drm = vop->drm_dev; struct drm_crtc *crtc = &vop->crtc; unsigned long flags; - int i; - - for (i = 0; i < vop->data->win_size; i++) { - if (!vop_win_pending_is_complete(&vop->win[i])) - return; - } spin_lock_irqsave(&drm->event_lock, flags); if (vop->event) {