Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2565100ybl; Thu, 29 Aug 2019 09:50:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyBjt/WP4FGwIFEQlanbNv6xbQAeEzZ4DPUVMETWc/2SgIY6c9AcR4V9ViPLY6+giejmtGV X-Received: by 2002:a17:90a:c386:: with SMTP id h6mr10761021pjt.122.1567097428285; Thu, 29 Aug 2019 09:50:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567097428; cv=none; d=google.com; s=arc-20160816; b=eod25op14VBZfS8qVz0nXNXSF0esMELxxJqtbOK3DppjoPvIfsY11wcuRItBlYPQRn kyghTjMxuFehXa/ZpJKRZy7fxn/0TJooNFVlmI0vOW6es/3CuHwPq335H122IYQxj9ar nkUBgxKO8LiU9W5itNn4PBm7C3b0GuPb4QxjLrjFp0ILy+IazCR40OVSne3K2HIhdELX edGnfNTVobXNDjGG1jyh8bj+rWR3DSebnD9vrNpcWknO0ustJvBN5K0VzDN8ZqLzSW3d MJHkHy9Gc0ge76Ym2ar6vzdwmg0KVe32PM0j/DRko96jA/qt5r3gePsaKZVQakv9o3J7 PP2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=+npB6gUnTr3XNVbB8y8PFXfDiZznn6tH9wpAPdNtoUY=; b=XWFra7s+Z1TP6qS94v+aXqYe/MQEM3l6P5jXC/bWSHo3Ib1cpXtYjyQblpHZdMnLtl ASVb+504c2uGwS67vyhRbiJWhQK3y+q3PmXLdVWAwHoG8OFG9WU/o+HOfkFbbZLNkKGx pbTOe7jqCysc13+joMqMzO/BljsMhjfuBEZEmz9CNHlGFOlDy52wBZyIB3dFLg57vr+d rhnHUw6Ps2U9F5IDOMP4whXu0KrVzVlRsJe6NqLIwPp1hEkZuYmpskWiD+OKU79iZt7S 3VmOHUPMetwGsG7LZRDAthzBL00K5CvMD8UaLagpfxb+HsMimEg0AUNRVqqCF7jxM+Cg VfRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H6PCbsL4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n128si2419137pgn.82.2019.08.29.09.50.12; Thu, 29 Aug 2019 09:50:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=H6PCbsL4; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbfH2QtH (ORCPT + 99 others); Thu, 29 Aug 2019 12:49:07 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:46655 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727115AbfH2QtG (ORCPT ); Thu, 29 Aug 2019 12:49:06 -0400 Received: by mail-pg1-f194.google.com with SMTP id m3so1865796pgv.13; Thu, 29 Aug 2019 09:49:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=+npB6gUnTr3XNVbB8y8PFXfDiZznn6tH9wpAPdNtoUY=; b=H6PCbsL4lkrK49kVBBw7zNbF2XUqct4jZEBExuqbxGaqcHnBLk6MWn6QLAgnza710W JGNb16n+DysidYP3kakhXN15EUuJ+qLDiX96yNuKm+s1Vk3bSXCgX0Kajimk/WQNyJmU 6UNX6hrLBZR1lbTrJIxyOrGYmE0P3ijlx1K7rPwVdCcjacCNPYGZjPze69HcJA30yVkM 9alFhTfuEIxNUCAMyFC7fmRR9tFf++1Zf9YPYFRsgEyWuCAsQXZZotGfBgG1fMlNOObD QXu/0M31fbjOU+3HI0dE1l65vOHT/dGR/1IJ3zKz3zqjkNgRV1b79XkKya0zM80m/1bR Mpxw== 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:mime-version :content-transfer-encoding; bh=+npB6gUnTr3XNVbB8y8PFXfDiZznn6tH9wpAPdNtoUY=; b=LS+edH2E65Ku+2I38gZYnYZp1wySZQymNQi1lqwSkWstldYi0y0YrXus9grbG24Ix/ gG1QE5sP3sXJhyY9Al/ThZPlXaono/p7naiyo1zWV2WHF+7UkpC2QfGNUB3U1SON0ftP jerpr1D2bk2Biv9ZCVMNsrZ9TN1TgKk69ODYRTkeAoJ1xvjnd7CfNtDdS0D/TRSDuMVD ldIdgRJ/dmqvLwsaA6sMHwxtkODyn/OZYTw+W90CdYLqt7RmEXY0/xDTQKs7Ya8gdf+6 YH3AGYyy/mBIlqf0RshyBvtp1hvztLzdQtOWv+wwNyH2Do1aHicYWaYAE+AHWaIfPzfa jpSQ== X-Gm-Message-State: APjAAAVNQYbrQcmd8Kb9sOavSzIOMiWlKkIm+jnwpkgzGcs0KoIkhsef lQEEoU3SqJ8ZcBmj8ILoS3A= X-Received: by 2002:a17:90a:c08f:: with SMTP id o15mr11133504pjs.31.1567097345796; Thu, 29 Aug 2019 09:49:05 -0700 (PDT) Received: from localhost ([100.118.89.196]) by smtp.gmail.com with ESMTPSA id y9sm3548671pfn.152.2019.08.29.09.49.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2019 09:49:05 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: Rob Clark , Abhinav Kumar , Alexios Zavras , Allison Randal , Boris Brezillon , Bruce Wang , Daniel Vetter , Enrico Weigelt , freedreno@lists.freedesktop.org (open list:DRM DRIVER FOR MSM ADRENO GPU), Georgi Djakov , Greg Kroah-Hartman , Jeykumar Sankaran , Jonathan Marek , Jordan Crouse , linux-arm-msm@vger.kernel.org (open list:DRM DRIVER FOR MSM ADRENO GPU), linux-kernel@vger.kernel.org (open list), Mamta Shukla , Sean Paul , Sravanthi Kollukuduru , Thomas Gleixner Subject: [PATCH 00/10] drm/msm: async commit support (v2) Date: Thu, 29 Aug 2019 09:45:08 -0700 Message-Id: <20190829164601.11615-1-robdclark@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Currently the dpu backend attempts to handle async commits. But it is racey and could result in flushing multiple times in a frame, or modifying hw state (such as scanout address or cursor position) after the previous flush, but before vblank, causing underflows (which manifest as brief black flashes). This patchset removes the previous dpu async commit handling, and reworks the internal kms backend API to decouple flushing. And in the end introduces an hrtimer to flush async updates. The overall approach is: 1) Move flushing various hw state out of encoder/crtc atomic commit (which is anyways an improvement over the current state, where we either flush from crtc or encoder, depending on whether it is a full modeset) 2) Switch to crtc_mask for anything that completes after atomic _commit_tail(), so we do not need to keep the atomic state around. Ie. from drm core's perspective, an async commit completes immediately. This avoids fighting with drm core about the lifecycle of an atomic state object. 3) Track a bitmask of crtcs w/ pending async flush, and setup an hrtimer with expiration 1ms before vblank, to trigger the flush. For async commits, we push the state down to the double buffered hw registers immediately, and only defer writing the flush registers. Current patchset only includes the dpu backend support for async commits.. mdp4 and mdp5 should be relatively trivial (less layers of indirection involved). But I won't have access to any mdp4 hw for a few more weeks, so at least that part I might punt on for now. v2: couple small cosmetic updates, re-work locking to avoid stalls, add some tracepoints Rob Clark (10): drm/msm/dpu: unwind async commit handling drm/msm/dpu: add real wait_for_commit_done() drm/msm/dpu: handle_frame_done() from vblank irq drm/msm: add kms->wait_flush() drm/msm: convert kms->complete_commit() to crtc_mask drm/msm: add kms->flush_commit() drm/msm: split power control from prepare/complete_commit drm/msm: async commit support drm/msm/dpu: async commit support drm/msm: add atomic traces drivers/gpu/drm/msm/Makefile | 1 + drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 48 +--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.h | 7 +- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 46 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 8 +- .../drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 39 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 99 +++++--- drivers/gpu/drm/msm/disp/mdp4/mdp4_kms.c | 48 ++-- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 47 ++-- drivers/gpu/drm/msm/msm_atomic.c | 233 +++++++++++++++--- drivers/gpu/drm/msm/msm_atomic_trace.h | 110 +++++++++ drivers/gpu/drm/msm/msm_atomic_tracepoints.c | 3 + drivers/gpu/drm/msm/msm_drv.c | 1 + drivers/gpu/drm/msm/msm_drv.h | 4 + drivers/gpu/drm/msm/msm_gpu_trace.h | 2 +- drivers/gpu/drm/msm/msm_kms.h | 108 +++++++- 16 files changed, 603 insertions(+), 201 deletions(-) create mode 100644 drivers/gpu/drm/msm/msm_atomic_trace.h create mode 100644 drivers/gpu/drm/msm/msm_atomic_tracepoints.c -- 2.21.0