Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp951317ybm; Wed, 27 May 2020 12:01:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmREbOLolVla+FztATb14KcO2tx886QANnUJIZdW6i5gEnFABhu2gvOl7spfHxDmp2TX9z X-Received: by 2002:a17:906:f891:: with SMTP id lg17mr7153792ejb.405.1590606068465; Wed, 27 May 2020 12:01:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590606068; cv=none; d=google.com; s=arc-20160816; b=vdS0/n0rjPpHvZrWu0PKclSDkliHZ/RC5MhC0uuueYg57GmsJ/uC02ktzV9VqwKQ8V XndzSglX3yARqpBPz/saie6Ud69HUm7dK4R81bEeSBkUp58m1KW5gQQJdbh6hcZhabVA icp4ghXhF2PdJwEXVbDPKrVEliojrSUIfeWZn8NIy6xO2JmKdnY4B1Usg0TrnsnHj9g6 Qk2l9u79DlEVM9xKWvK+yNum02aMiCpxEhxmkIKk3w7nrWCyIODZ2ztzxHFSW0olpHxI HhM9cfxYwK9ZVfFbsoDPJtAAWsZ23IxJ+i1dK6u6whh5ml+hE+/oo68KmiuupfHvLQUp 5iPw== 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=tCu9N/0DYaTKdzput/rwIDzoBFeoKGcV0BJL7O264Xg=; b=xJfhqneyT4Vcnyfa3XeK8eHvB1cKHp93KhDkyN4BvUuiygJHFB8ykmADrqJMgczejk t4DZO6s3qdWO1Rhh8B2o3cjg+5zY/lL9yEBICm00JUf/c9g+1j8kYsi0n10GwKsTFfSv iWa2geMOODIvl8N+YEg9XgWe3c9+qaJzGLHGMja10bghDcchJrBencoIQ8TUp5Aoqg+w Ovkae6GQVFAXyrF6pTUrgywoWx/iBU/zU0grXeTesKGsJW3Xf3hEFne2zaDEYexHsKs1 TYMe8Qq+Fhg5ZGplnOaovI+w+p5umV2nD7Wdiuej/uAD3ZAvqJhhIGq2YQSzsXC7P1LK QxsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm2 header.b=u5Hmc9hj; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="iiCwZt4/"; 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 g25si2056878edy.554.2020.05.27.12.00.45; Wed, 27 May 2020 12:01:08 -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=u5Hmc9hj; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b="iiCwZt4/"; 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 S2390160AbgE0Ptr (ORCPT + 98 others); Wed, 27 May 2020 11:49:47 -0400 Received: from new1-smtp.messagingengine.com ([66.111.4.221]:40009 "EHLO new1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390141AbgE0Ptn (ORCPT ); Wed, 27 May 2020 11:49:43 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 29E8958201B; Wed, 27 May 2020 11:49:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 27 May 2020 11:49:42 -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=tCu9N/0DYaTKd zput/rwIDzoBFeoKGcV0BJL7O264Xg=; b=u5Hmc9hjI4vjy+9mBkIG/GvwQ4hY6 27y07L/GeLlqHRogQjc5lEFtIhLfh+jB1u2p9EEW+l93tMdK+y9/NxD144kuuSK4 Dog+kXzAsPSc+OZUfRotI1Q9qsRVQ3NG2HEf6UtmpybLqlLEqnf9mGScDqrsES+Z Ob6Qlz8YzG8TyknyYzhnU+jZZg/VFeJ4gYy+3aM/Vn7ECzZonXloGL2SY+JIbFCJ Zj29yWGe0YkFKIuOfImlGrElBG9GHvA8l7wLZUD5wnHUtH4sLkPhJzje7KDA/YEX mmavbOL7y/QiA+FzEBymbpf4T6cjnbngEMW8Um1APFeW/Wz6MbLmRBh3A== 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=tCu9N/0DYaTKdzput/rwIDzoBFeoKGcV0BJL7O264Xg=; b=iiCwZt4/ KN6pdWuZIEVTVwrYX8zSbitkHK+XA9VHl6Vy3Hgy8N8HEiEbMyRF132uyWkwsfQG LpV6XUiIS/VbGbauG354kjkWt061Ew7cXgvFM3eRhUCgr5WxDLXUHD6pBacbDEsE JvJXPi7/Wul6E9HwQbquzYILioSxn62RWWy24Q2BIgItXH2sJ9xwp8Ct7fZM8JNL Pzi9eV1BlQpoRSm8s4gHGMDj9y8hMD52C/+U58GUHlJ/qBSoCG5x0STlYvk8MpU3 IwahX3ACwVf4C3CGicKMHz3+kCGtdyIfeRkTiqetC4rJR7CZUqF8WS0fpaW55DTz HMjCYV2kvquooA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedruddvgedgkeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpeforgigihhm vgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrfgrth htvghrnhepvdekleevfeffkeejhfffueelteelfeduieefheduudfggffhhfffheevveeh hedvnecukfhppeeltddrkeelrdeikedrjeeinecuvehluhhsthgvrhfuihiivgepfeehne curfgrrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdrthgvtghh 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 AF7673280069; Wed, 27 May 2020 11:49:41 -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 016/105] drm/vc4: plane: Improve LBM usage Date: Wed, 27 May 2020 17:47:46 +0200 Message-Id: <44e3ec27ee6c0d81c440cd2d6cdd1bf93ea102e7.1590594512.git-series.maxime@cerno.tech> 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 From: Dave Stevenson LBM allocations were always taking the worst case sizing of max(src_width, dst_width) * 16. This is significantly over the required sizing, and stops us rendering multiple 4k images to the screen. Add some of the additional constraints to more accurately describe the LBM requirements. Signed-off-by: Dave Stevenson Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_plane.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plane.c index 1575c05e3106..602927745f84 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -142,9 +142,10 @@ static const struct hvs_format *vc4_get_hvs_format(u32 drm_format) return NULL; } -static enum vc4_scaling_mode vc4_get_scaling_mode(u32 src, u32 dst) +static enum vc4_scaling_mode vc4_get_scaling_mode(u32 src, u32 dst, + bool chroma_vrep) { - if (dst == src) + if (dst == src && !chroma_vrep) return VC4_SCALING_NONE; if (3 * dst >= 2 * src) return VC4_SCALING_PPF; @@ -369,9 +370,11 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) return ret; vc4_state->x_scaling[0] = vc4_get_scaling_mode(vc4_state->src_w[0], - vc4_state->crtc_w); + vc4_state->crtc_w, + false); vc4_state->y_scaling[0] = vc4_get_scaling_mode(vc4_state->src_h[0], - vc4_state->crtc_h); + vc4_state->crtc_h, + false); vc4_state->is_unity = (vc4_state->x_scaling[0] == VC4_SCALING_NONE && vc4_state->y_scaling[0] == VC4_SCALING_NONE); @@ -384,10 +387,12 @@ static int vc4_plane_setup_clipping_and_scaling(struct drm_plane_state *state) vc4_state->x_scaling[1] = vc4_get_scaling_mode(vc4_state->src_w[1], - vc4_state->crtc_w); + vc4_state->crtc_w, + v_subsample == 2); vc4_state->y_scaling[1] = vc4_get_scaling_mode(vc4_state->src_h[1], - vc4_state->crtc_h); + vc4_state->crtc_h, + v_subsample == 2); /* YUV conversion requires that horizontal scaling be enabled * on the UV plane even if vc4_get_scaling_mode() returned @@ -437,10 +442,7 @@ static void vc4_write_ppf(struct vc4_plane_state *vc4_state, u32 src, u32 dst) static u32 vc4_lbm_size(struct drm_plane_state *state) { struct vc4_plane_state *vc4_state = to_vc4_plane_state(state); - /* This is the worst case number. One of the two sizes will - * be used depending on the scaling configuration. - */ - u32 pix_per_line = max(vc4_state->src_w[0], (u32)vc4_state->crtc_w); + u32 pix_per_line; u32 lbm; /* LBM is not needed when there's no vertical scaling. */ @@ -448,6 +450,11 @@ static u32 vc4_lbm_size(struct drm_plane_state *state) vc4_state->y_scaling[1] == VC4_SCALING_NONE) return 0; + if (vc4_state->x_scaling[0] == VC4_SCALING_TPZ) + pix_per_line = vc4_state->crtc_w; + else + pix_per_line = vc4_state->src_w[0]; + if (!vc4_state->is_yuv) { if (vc4_state->y_scaling[0] == VC4_SCALING_TPZ) lbm = pix_per_line * 8; @@ -583,7 +590,9 @@ static int vc4_plane_allocate_lbm(struct drm_plane_state *state) spin_lock_irqsave(&vc4->hvs->mm_lock, irqflags); ret = drm_mm_insert_node_generic(&vc4->hvs->lbm_mm, &vc4_state->lbm, - lbm_size, 32, 0, 0); + lbm_size, + vc4->hvs->hvs5 ? 64 : 32, + 0, 0); spin_unlock_irqrestore(&vc4->hvs->mm_lock, irqflags); if (ret) -- git-series 0.9.1