From patchwork Thu Aug 20 03:56:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 248004 Delivered-To: patches@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp1008811ils; Wed, 19 Aug 2020 20:56:25 -0700 (PDT) X-Received: by 2002:a17:90b:470f:: with SMTP id jc15mr910764pjb.166.1597895785334; Wed, 19 Aug 2020 20:56:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597895785; cv=none; d=google.com; s=arc-20160816; b=Qdu8nfgoSACGqN5xsjtwOHHLWv4uYDA0MybRsVGtXDszP8JLm+lh8OxSErFCG7EHnt mUkZCG+uSEHLrVHfWRgvxKmSDJLymObqoyNl8KQZyCdptJvFncDAddUvaU9I8etBujFC QIRrD+zwyvwblT/90auHLOl/M2cEzYakKwzDMPmu4AY3+R4/53Z9InbCb021KeM7IvhX Br9uOrdvftgNsDNossf40xVhzoKwOW/psezD3DWbE7/+NJOZiyjLxPZYBQvTEk39kkGe OeVZE+2Afe1B/H6Ih6PTObTyt2PJt8AvmJqEls70yPaBmi797709w1ncQ74RqiR3Xzy8 mUAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4LFTcC1aLlcyeO02My6c2qM77nYX84bs/G0eccqWdp8=; b=JI5yChTVGj9IxxkADQHZxdNIEkwizfeTGr2/axh7wViS88kKr/0B2NAslm2n6zWQk7 b/6+k54Q3pPlkh6Qen1riZWyD2zXROK0N0H1Kxpe9PG5Mt+QIJTn11H8oPAMF4SyBfxw 1fSIPI2BRFqfw97iGaHz+wCcqrd9Jhzbsl/m/ljQIEctl+EuohdtYWxAM1MkUZ3zt/Fj oPDfbbsqO8izIoWv3LYWaLYIIkxnlZPKZ/yo8R3/BEH5Di20we6otUiGAXXlSiUHv06E YhcwrcYZHuffFNHIg5IFRDs2K47mkOrZhcij0n9g1oYVQj+Yzcy06pB3GSvWGqockb6g c7XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zKLxVFu4; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id g14sor365963pjv.32.2020.08.19.20.56.25 for (Google Transport Security); Wed, 19 Aug 2020 20:56:25 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zKLxVFu4; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4LFTcC1aLlcyeO02My6c2qM77nYX84bs/G0eccqWdp8=; b=zKLxVFu4Dg3PQ1EfE/gMN6Q/9V3SUjEcpJci/s0ywSt5tlKuJsaiV58p4HFeN3/5TL 51PwPoSUzkq+piYo6ZuUNZQMaKxlJnkKKDKUdmONgsBdTTES0jHonRkMIqVYFJp+TLh/ 2KL/xWSqUUjrTIn0y2tsgmuVreBtpvGInfY1p8MfClhqL2L+VN9D+H37sDAJx7BynlgT WxK6cZrKv3hTbdKSYdfJwrtWGLPNUo4aefePUbFWGl6GiOrOXQGsYtlSLiDSxPZr9Tbh 8puli8qrbhX58+IJmOagiJgdfHOja1jqoNyL2htDUvoTa5skihArxs4N6gQ1ys3FFCuk xqow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=4LFTcC1aLlcyeO02My6c2qM77nYX84bs/G0eccqWdp8=; b=NqtzJSQhUKrvMXH1jbqh5a4iqFcwzkdS6w+8WXau5D4T1lLQ0NO57tc630zkZHN5p6 a1eFteCYOMjthSVvwKwFqf23+KnsnjVJA9ts5TFbEo6FzxR9gRzBKhplr+9skbOdejGB jJsGmIJJvDY4CCxFDT+XGt0ieFQeSMtzUTsUJKH0Zu6FWmMiudUiV4T2erxCQcf5sIaO ygFlGzQ+eEgycfRiuQCatAPiONbNAumBYWUW1yzrhTxyEPFVCJWAEjMHlhGv1dI2EJWj 6KLDjtm38VN14QOKqutl6boAaNmlOaHXqqPFeK7YfFazlH5/P2cyteONcC/6bbs+aH6t YYGg== X-Gm-Message-State: AOAM532XocUSgu3aFIaf6Iwh039yd4HQGzxy8tlFx3oPvt1AADYmu9ob iSl/FVS32BMmY+67XlMddJWJ9SdD X-Google-Smtp-Source: ABdhPJwzXXRtWo8gBWKqXwGsX+9ri1iFa4kPakvat1NHTNiDKd791H+hxLLpHH4BLHMLq5iZqXv0Jg== X-Received: by 2002:a17:90a:4dca:: with SMTP id r10mr858796pjl.200.1597895784572; Wed, 19 Aug 2020 20:56:24 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id o65sm759429pfg.176.2020.08.19.20.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Aug 2020 20:56:23 -0700 (PDT) From: John Stultz To: lkml Cc: Vincent Donnefort , Mauro Carvalho Chehab , Greg Kroah-Hartman , Manivannan Sadhasivam , dri-devel , Liwei Cai , Xinliang Liu , Laurent Pinchart , Sam Ravnborg , Sumit Semwal , Chen Feng , John Stultz Subject: [PATCH 4/3] drm: hikey9xx: remove wait for VACTIVE IRQ Date: Thu, 20 Aug 2020 03:56:17 +0000 Message-Id: <20200820035617.5836-1-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200820034100.128062-2-john.stultz@linaro.org> References: <20200820034100.128062-2-john.stultz@linaro.org> From: Vincent Donnefort A quick add-on to my earlier fixup series as I realized what the performance problem was. This is against Mauro's tree here: https://gitlab.freedesktop.org/mchehab_kernel/hikey-970/-/commits/master/ For each display cycle, the Kirin960 display IP will generate a VACTIVE interrupt followed by a VBLANK. During a FBIOPAN ioctl, the driver will then wait for the first one to then wait for the second one. This is an issue when the CPU load is too low: the wait_event() function might trigger a transition to a deep sleep state and then, waking up from that state will take too much time to catch the VBLANK interrupt on time, the difference between those two interrupts being only 60 us. * Ideal case: ACT VBL + + v v ---> wait(ACT) +------> wait(VBL) +--> * Our case: ACT VBL ACT VBL + + + + v v v v ---> wait(ACT) +------> wait(VBL) +--> The wait for VACTIVE IRQ can safely be removed: there is no hardware access performed between the VACTIVE and the VBLANK IRQs. This behavior has been introduced from 4.11 with the following patch: a3fbb53f4 drm/atomic: Wait for vblank whenever a plane is added to state. Cc: Mauro Carvalho Chehab Cc: Greg Kroah-Hartman Cc: Manivannan Sadhasivam Cc: dri-devel Cc: Liwei Cai Cc: Xinliang Liu Cc: Laurent Pinchart Cc: Sam Ravnborg Cc: Sumit Semwal Cc: Chen Feng Signed-off-by: Vincent Donnefort [jstultz: hand-ported to Mauro's patch set] Signed-off-by: John Stultz --- .../hikey9xx/gpu/kirin9xx_drm_dpe_utils.c | 2 +- .../staging/hikey9xx/gpu/kirin9xx_drm_dss.c | 5 --- .../hikey9xx/gpu/kirin9xx_drm_overlay_utils.c | 36 ------------------- 3 files changed, 1 insertion(+), 42 deletions(-) -- 2.17.1 diff --git a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.c b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.c index 82a0edb95953..cc80689d90c9 100644 --- a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.c +++ b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dpe_utils.c @@ -582,7 +582,7 @@ void dpe_interrupt_unmask(struct dss_crtc *acrtc) writel(unmask, dss_base + GLB_CPU_PDP_INT_MSK); unmask = ~0; - unmask &= ~(BIT_VSYNC | BIT_VACTIVE0_END | BIT_LDI_UNFLOW); + unmask &= ~(BIT_VSYNC | BIT_LDI_UNFLOW); writel(unmask, dss_base + DSS_LDI0_OFFSET + LDI_CPU_ITF_INT_MSK); } diff --git a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c index 7adbd924bec2..c99ce7c4d479 100644 --- a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c +++ b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_dss.c @@ -440,11 +440,6 @@ static irqreturn_t dss_irq_handler(int irq, void *data) isr_s1 &= ~(readl(dss_base + GLB_CPU_PDP_INT_MSK)); isr_s2 &= ~(readl(dss_base + DSS_LDI0_OFFSET + LDI_CPU_ITF_INT_MSK)); - if (isr_s2 & BIT_VACTIVE0_END) { - ctx->vactive0_end_flag++; - wake_up_interruptible_all(&ctx->vactive0_end_wq); - } - if (isr_s2 & BIT_VSYNC) { ctx->vsync_timestamp = ktime_get(); drm_crtc_handle_vblank(crtc); diff --git a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c index 5ac7f4b31d99..932bad2f428e 100644 --- a/drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c +++ b/drivers/staging/hikey9xx/gpu/kirin9xx_drm_overlay_utils.c @@ -822,40 +822,6 @@ void hisifb_mctl_sw_clr(struct dss_crtc *acrtc) DRM_INFO("-.\n"); } -static int hisi_dss_wait_for_complete(struct dss_crtc *acrtc) -{ - int ret = 0; - u32 times = 0; - u32 prev_vactive0_end = 0; - struct dss_hw_ctx *ctx = acrtc->ctx; - - prev_vactive0_end = ctx->vactive0_end_flag; - -REDO: - ret = wait_event_interruptible_timeout(ctx->vactive0_end_wq, - (prev_vactive0_end != ctx->vactive0_end_flag), - msecs_to_jiffies(300)); - if (ret == -ERESTARTSYS) { - if (times < 50) { - times++; - mdelay(10); - goto REDO; - } - } - - if (ret <= 0) { - disable_ldi(acrtc); - hisifb_mctl_sw_clr(acrtc); - DRM_ERROR("wait_for vactive0_end_flag timeout! ret=%d.\n", ret); - - ret = -ETIMEDOUT; - } else { - ret = 0; - } - - return ret; -} - void hisi_fb_pan_display(struct drm_plane *plane) { struct drm_plane_state *state = plane->state; @@ -932,7 +898,6 @@ void hisi_fb_pan_display(struct drm_plane *plane) hisi_dss_unflow_handler(ctx, true); enable_ldi(acrtc); - hisi_dss_wait_for_complete(acrtc); } void hisi_dss_online_play(struct kirin_fbdev *fbdev, struct drm_plane *plane, @@ -1001,5 +966,4 @@ void hisi_dss_online_play(struct kirin_fbdev *fbdev, struct drm_plane *plane, hisi_dss_unflow_handler(ctx, true); enable_ldi(acrtc); - hisi_dss_wait_for_complete(acrtc); }