Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp950434ybm; Wed, 27 May 2020 12:00:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwDXntFhECw2fCxilRigT4SsyKogL+tQER/8g6UrZxo03Zt9p9MN/WxnVrVDyW6pnVZNkdt X-Received: by 2002:a50:e1c9:: with SMTP id m9mr19820245edl.196.1590606001964; Wed, 27 May 2020 12:00:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590606001; cv=none; d=google.com; s=arc-20160816; b=oh/RJqoXcMOg00JXc4hSQjiw6UZczTf5cMew08+ik05w6PSkKys0JQ5Xyx4Nj037Bv w7oRIy70EjCCzeIEKIQMFKxp1n0CTV0DWO3ozuhNzmVmLcvGZN7F5NFV0+A5HXUBWY0q Updnea4Pjt2i5MwbjoaZXWwyfjlBnDkrQNwexn0C/TC+SQD6Y8Ml/tIJzCSOjIfKdzGv IJgybldfQRc1+yOeZeJYnR9ImrkmvHPeBC2+NXU+zMA1DtnZi2B0CVyQyhqWZlANIi2z le5XYS2mWod02PDLwfdxL6mNjOfLdrEMyXx84fMd9/9cBlGoTcWQScBjoAByY0W42gW6 rcFA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=fXAGH/GM+q4xxPbojk7X1+ICqC0tJDMsSdwLOqBucRg=; b=ixhetNMy6eFZb2IgL2ru3wz4VGLODIVRrnIlYm7FOyABDsMGNL4W15raAKabPrgBt9 CCvXlbuzwIGMJWrT6wp0SrmPUW2DzkM/frUxOiicdCRcZVkTKoKBmdTx16RwcMPk3h0U egEdBTC3rS6yqCbLLu0bLyBPGeMT5KruVJUR7mNsb86UaYoWrmLHMRMo3avAiXBs4ziG WQa6KjScjiOJcwNA0cfsOKoz9kRWMRxZ9pobtx+BE0HCbGCizBCdnWwR5XKfaH7Gb+1e Dceq27sRumoMpPLFT85Hj0H80lrYzlbS5+XgRta1UgoI1+IyIO5VxDuWxRu/OZfwH2Ac F/7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=EnfzrFo5; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VOEb5FBf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a5si2176026edn.81.2020.05.27.11.59.39; Wed, 27 May 2020 12:00:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=EnfzrFo5; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=VOEb5FBf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726612AbgE0Pty (ORCPT + 98 others); Wed, 27 May 2020 11:49:54 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:38611 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390158AbgE0Ptr (ORCPT ); Wed, 27 May 2020 11:49:47 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id B1F8D58202B; Wed, 27 May 2020 11:49:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:49:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=fXAGH/GM+q4xx Pbojk7X1+ICqC0tJDMsSdwLOqBucRg=; b=EnfzrFo5+LJgapqqliSv/d7wKSHku 0lQROWzzSzXJJhdJ9gpyi6/w+yE4NgWKe0hgB5UT0ZJIK+NzTKN26A23KEkjWNgZ 5z8hI/nbqzID8cESUr/vOY7fp33dnn4H8UVI39QJO2UYxrwLeg+HHeuFE7p7v9QC lt9y+ghkZgChpsvF1XPhETKr5ER9w65n1pmX9TrJ7o75ssWFUMk2IwEzmuqc5jFc LTmxHOpYAr+DqCJRXrfTJEn7rfISTN9VNgfopfi6Fm4oBm1q2WpFSe38kjD7CCso RYhI3o0Qz1iZ4V7U2Xs609rDNPSVveso1yDWzbr3HW86IeaPh7lX/dLFQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=fXAGH/GM+q4xxPbojk7X1+ICqC0tJDMsSdwLOqBucRg=; b=VOEb5FBf t86zD31/2KvuK6PHrVUK/U7ENRoFK7pOCoV02zua5ArWoKljHfHElCnvMBMuG2J/ NAWNWQFuqsR0Z2G7G6vqRpsb0tfug3zHr3mOcy+yp+fzdVJTi1cx0qtKwRQQISke 8TjaTu9oB73avRPs8dwXVeuiyQJPiQpem2srK7lx8AeuTDZDMWShoa/RlhCg1rgo TttuaCrvCLOhc7LmduusfJeHUJO3GJ+Kf0azzeXba5b0ljY0aWj2vXoAUXx52IEK Y6Dzv1fpKDRBEw1wfWE1eEzc54nso1xy6ly21jbx2BHx54bXoxz7DYXxp7wyFvIG DnugjeDUPsgr3A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Received: from localhost (lfbn-tou-1-1502-76.w90-89.abo.wanadoo.fr [90.89.68.76]) by mail.messagingengine.com (Postfix) with ESMTPA id 5407C30618B7; Wed, 27 May 2020 11:49:46 -0400 (EDT) From: Maxime Ripard To: Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell , Maxime Ripard Subject: [PATCH v3 019/105] drm/vc4: plane: Register all the planes at once Date: Wed, 27 May 2020 17:47:49 +0200 Message-Id: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: 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 Instead of creating planes for each CRTC, we eventually want to create all the planes for each CRTCs. In order to make that more convenient, let's iterate on the CRTCs in the plane creation function instead of its caller. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_drv.c | 9 ++---- drivers/gpu/drm/vc4/vc4_drv.h | 3 +-- drivers/gpu/drm/vc4/vc4_plane.c | 54 +++++++++++++++++----------------- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index daf07a61a7b5..ed7893ee188a 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -250,7 +250,6 @@ static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev = to_platform_device(dev); struct drm_device *drm; - struct drm_crtc *crtc; struct vc4_dev *vc4; struct device_node *node; int ret = 0; @@ -289,11 +288,9 @@ static int vc4_drm_bind(struct device *dev) if (ret) goto gem_destroy; - drm_for_each_crtc(crtc, drm) { - ret = vc4_plane_create_additional_planes(drm, crtc); - if (ret) - continue; - } + ret = vc4_plane_create_additional_planes(drm); + if (ret) + goto unbind_all; drm_fb_helper_remove_conflicting_framebuffers(NULL, "vc4drmfb", false); diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h index b43514901bb9..80633c488b04 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.h +++ b/drivers/gpu/drm/vc4/vc4_drv.h @@ -855,8 +855,7 @@ int vc4_kms_load(struct drm_device *dev); /* vc4_plane.c */ struct drm_plane *vc4_plane_init(struct drm_device *dev, enum drm_plane_type type); -int vc4_plane_create_additional_planes(struct drm_device *dev, - struct drm_crtc *crtc); +int vc4_plane_create_additional_planes(struct drm_device *dev); u32 vc4_plane_write_dlist(struct drm_plane *plane, u32 __iomem *dlist); u32 vc4_plane_dlist_size(const struct drm_plane_state *state); void vc4_plane_async_set_fb(struct drm_plane *plane, diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 89d03605332e..824c188980b0 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -1372,39 +1372,41 @@ struct drm_plane *vc4_plane_init(struct drm_device *dev, return plane; } -int vc4_plane_create_additional_planes(struct drm_device *drm, - struct drm_crtc *crtc) +int vc4_plane_create_additional_planes(struct drm_device *drm) { struct drm_plane *cursor_plane; + struct drm_crtc *crtc; unsigned int i; - /* Set up some arbitrary number of planes. We're not limited - * by a set number of physical registers, just the space in - * the HVS (16k) and how small an plane can be (28 bytes). - * However, each plane we set up takes up some memory, and - * increases the cost of looping over planes, which atomic - * modesetting does quite a bit. As a result, we pick a - * modest number of planes to expose, that should hopefully - * still cover any sane usecase. - */ - for (i = 0; i < 8; i++) { - struct drm_plane *plane = - vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY); + drm_for_each_crtc(crtc, drm) { + /* Set up some arbitrary number of planes. We're not limited + * by a set number of physical registers, just the space in + * the HVS (16k) and how small an plane can be (28 bytes). + * However, each plane we set up takes up some memory, and + * increases the cost of looping over planes, which atomic + * modesetting does quite a bit. As a result, we pick a + * modest number of planes to expose, that should hopefully + * still cover any sane usecase. + */ + for (i = 0; i < 8; i++) { + struct drm_plane *plane = + vc4_plane_init(drm, DRM_PLANE_TYPE_OVERLAY); - if (IS_ERR(plane)) - continue; + if (IS_ERR(plane)) + continue; - plane->possible_crtcs = drm_crtc_mask(crtc); - } + plane->possible_crtcs = drm_crtc_mask(crtc); + } - /* Set up the legacy cursor after overlay initialization, - * since we overlay planes on the CRTC in the order they were - * initialized. - */ - cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR); - if (!IS_ERR(cursor_plane)) { - cursor_plane->possible_crtcs = drm_crtc_mask(crtc); - crtc->cursor = cursor_plane; + /* Set up the legacy cursor after overlay initialization, + * since we overlay planes on the CRTC in the order they were + * initialized. + */ + cursor_plane = vc4_plane_init(drm, DRM_PLANE_TYPE_CURSOR); + if (!IS_ERR(cursor_plane)) { + cursor_plane->possible_crtcs = drm_crtc_mask(crtc); + crtc->cursor = cursor_plane; + } } return 0; -- git-series 0.9.1