From patchwork Thu Jan 14 16:22:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 363189 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D2D2C433E0 for ; Thu, 14 Jan 2021 16:24:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6307D22B2B for ; Thu, 14 Jan 2021 16:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726440AbhANQYs (ORCPT ); Thu, 14 Jan 2021 11:24:48 -0500 Received: from perceval.ideasonboard.com ([213.167.242.64]:54786 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbhANQYs (ORCPT ); Thu, 14 Jan 2021 11:24:48 -0500 Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AE5D62B3; Thu, 14 Jan 2021 17:24:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1610641445; bh=hXfu5UH4biLC000racXZNQYm7fv8Vam4UwXoKqIH4UA=; h=From:To:Cc:Subject:Date:From; b=Pz3pEQ9lfAgsD48O1v4mOyKGPfVhIvBXM0Rz6mx1fI2loqZOv2wBMQ3PWF8tQ2z/k ryVW7awL1ixCPMRYNSLHcMEKGjVN4OlvnnHJkPDFZhZoUOr9FjyWjDiODt+qIEGc2f yfKg3awvuCLBg1BmdNFyHInR9is8vO6jGFNTCdBM= From: Kieran Bingham To: dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Laurent Pinchart Cc: Kieran Bingham Subject: [PATCH v4 00/10] drm: rcar-du: Rework CRTC and groups for atomic commits Date: Thu, 14 Jan 2021 16:22:45 +0000 Message-Id: <20210114162255.705868-1-kieran.bingham+renesas@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org This patch series refactors atomic commit tail handling in the R-Car DU driver to simplify the code flow, and open the door to further optimisations. It rebases the series posted by Laurent "[PATCH v3 00/10] drm: rcar-du: Rework CRTC and groups for atomic commits", which was itself based upon work that I had started originally. A few minor updates were required for the rebase, and review comments from v3 were handled, along with minor updates based upon suggestions from 'checkpatch.pl --strict'. The R-Car DU is a bit of a strange beast, with support for up to four CRTCs that share resources in groups of two CRTCs. Depending on the generation, planes can be shared (on Gen 1 and Gen 2), and output routing configuration is also handled at the group level to some extent. Furthermore, many configuration parameters, especially those related to routing or clock handling, require the whole group to be restarted to take effect, even when the parameter itself affects a single CRTC only. This hardware architecture is difficult to handle properly on the software side, and has resulted in group usage being reference-counted while CRTC usage only tracks the enabled state. Calls are then unbalanced and difficult to trace, especially for the configuration of output routing, and implementation of new shared resources is hindered. This patch series aims at solving this problem. The series starts with 4 patches that touch the API between the DU and VSP drivers. It became apparent that we need to split the configuration of the VSP to allow fine grain control of setting the mode configuration and enabling/disabling of the pipeline. To support the cross-component API, the new interface is added in patch 01/10, including an implementation of vsp1_du_setup_lif() to support the transition. Patch 02/10 prepares for the new call flow that will call the atomic flush handler before enabling the pipeline. The DRM usage is adapted in patch 03/10, before the call is removed entirely in patch 04/10. The next two patches convert CRTC clock handling and initial setup, potentially called from both the CRTC .atomic_begin() and .atomic_enable() operations, to a simpler code flow controlled by the commit tail handler. Patch 05/10 takes the CRTCs out of standby and put them back in standby respectively at the beginning and end of the commit tail handler, based on the CRTC atomic state instead of state information stored in the custom rcar_du_crtc structure. Patch 06/10 then performs a similar change for the CRTC mode setting configuration. Finally, the last four patches introduce a DRM private object for the CRTC groups, along with an associated state. Patch 07/10 adds a helper macro to easily iterate over CRTC groups, and patch 08/10 adds the group private objects and empty states. Patches 09/10 and 10/10 respectively move the group setup and routing configuration under control of the commit tail handler, simplifying the configuration and moving state information from driver structures to state structures. More refactoring is expected, with plane assignment being moved to group states, and group restart being optimised to avoid flickering. Better configuration of pixel clocks could also be implemented on top of this series. The whole series has been tested on Salvator-XS with the DU test suite (http://git.ideasonboard.com/renesas/kms-tests.git). No failure or change in behaviour has been noticed. Kieran Bingham (8): media: vsp1: drm: Split vsp1_du_setup_lif() drm: rcar-du: Convert to the new VSP atomic API media: vsp1: drm: Remove vsp1_du_setup_lif() drm: rcar-du: Handle CRTC standby from commit tail handler drm: rcar-du: Handle CRTC configuration from commit tail handler drm: rcar-du: Provide for_each_group helper drm: rcar-du: Create a group state object drm: rcar-du: Perform group setup from the atomic tail handler Laurent Pinchart (2): media: vsp1: drm: Don't configure hardware when the pipeline is disabled drm: rcar-du: Centralise routing configuration in commit tail handler drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 160 ++++++---- drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 9 +- drivers/gpu/drm/rcar-du/rcar_du_drv.h | 6 +- drivers/gpu/drm/rcar-du/rcar_du_group.c | 390 +++++++++++++++++++----- drivers/gpu/drm/rcar-du/rcar_du_group.h | 44 ++- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 63 ++-- drivers/gpu/drm/rcar-du/rcar_du_plane.c | 10 +- drivers/gpu/drm/rcar-du/rcar_du_vsp.c | 20 +- drivers/gpu/drm/rcar-du/rcar_du_vsp.h | 3 + drivers/media/platform/vsp1/vsp1_drm.c | 188 ++++++++---- drivers/media/platform/vsp1/vsp1_drm.h | 2 + include/media/vsp1.h | 25 +- 12 files changed, 644 insertions(+), 276 deletions(-)