Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3217247imu; Sat, 24 Nov 2018 00:20:12 -0800 (PST) X-Google-Smtp-Source: AJdET5dKErjFHAl7RufEBYD+WY4572KHsfhBDqkas+Elj1YOfX54nW/WmNdBgHCa2YXF7bBcAx9I X-Received: by 2002:a62:e501:: with SMTP id n1-v6mr19286292pff.71.1543047612091; Sat, 24 Nov 2018 00:20:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047612; cv=none; d=google.com; s=arc-20160816; b=j91xDhos095EsfIHdm1ssSphOEN5HfIitFtW585ExQX7+RjjjE41Y7R8pjCPE0iy7m Xs2BJQdedh/uufrbIGMQXqPy9T5XxsA688fF2cFi3b7hoMUhKYVhwJPZ64PlZmyObkdK Ewbe/oKV5HHnDu/AKWZuFCnGBOp/GaCzC2fYn+0orMOdCK1QuVNWTeHSeu46Xa9C2QTB ZVEBtd4qfuth/FJKxHk+zhcb1UENdltnnESNeEoZjZappCn/Es32Kip7nkd42Gwx+SwS 9mjciU4vyP9WwfxG96Ws8S00nzXOzVe1LY04XnrCs8QKziaxd08oME7BCe4WhTCh9WRg QCVQ== 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; bh=PO9tYNgaEvUs7nFpkTcnxjupF0SiA0eBwIs3DamdgdE=; b=ziYg2hSrUUaYXmIScLHnBjXYdtF6IBREQpIzs0rliNP5BxhDc8P4qncMLrCQUc8QIM FFdYX2peWtT4+uC1h0b23H8oslnGT5Zp7IQHMoDLY/UNx9nnhqSnaqm5s4o3PagDiAc2 0wwdScixtw19Vk858WIAwV5+RkKSeScxeqsoZaOcAO0fymaEXAJqtRDldt3pQDmAfOa7 EU2K+haNbGsGFQsX5vTlmDY/KeZfKg3zshuJnqvKBob87+D2ZJjSwhDPNq06rGam4ssB lovQo8fhfROT3kYfXROiL6g4p2IcSSyRP85uC0x1eEGvBJXCLiGi77WC7eVoha5n/1WW pJYw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c68-v6si59672297pfa.267.2018.11.24.00.19.57; Sat, 24 Nov 2018 00:20:12 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405213AbeKWUN5 (ORCPT + 99 others); Fri, 23 Nov 2018 15:13:57 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49187 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502643AbeKWUKP (ORCPT ); Fri, 23 Nov 2018 15:10:15 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id C8825215DD; Fri, 23 Nov 2018 10:26:47 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost.localdomain (aaubervilliers-681-1-94-205.w90-88.abo.wanadoo.fr [90.88.35.205]) by mail.bootlin.com (Postfix) with ESMTPSA id E22B620DBF; Fri, 23 Nov 2018 10:26:28 +0100 (CET) From: Paul Kocialkowski To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Cc: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Chen-Yu Tsai , Thomas Petazzoni , linux-sunxi@googlegroups.com, Daniel Vetter , Paul Kocialkowski Subject: [PATCH v2 06/43] drm/sun4i: backend: Refine the logic behind using the frontend Date: Fri, 23 Nov 2018 10:24:38 +0100 Message-Id: <20181123092515.2511-7-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> References: <20181123092515.2511-1-paul.kocialkowski@bootlin.com> 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 Checking that scaling is in use is not sufficient as a condition to decide to use the frontend. Since not all layer formats are supported by the frontend, we need to check for that support first. Then, the frontend must only be enabled if the backend doesn't support the format or that scaling is required. Signed-off-by:Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_backend.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index 7dd24eb03f89..735fea7ead0b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -449,16 +449,32 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state) { struct sun4i_layer *layer = plane_to_sun4i_layer(state->plane); struct sun4i_backend *backend = layer->backend; + uint32_t format = state->fb->format->format; if (IS_ERR(backend->frontend)) return false; + if (!sun4i_frontend_format_is_supported(format)) + return false; + + if (!sun4i_backend_format_is_supported(format)) + return true; + /* * TODO: The backend alone allows 2x and 4x integer scaling, including * support for an alpha component (which the frontend doesn't support). - * Use the backend directly instead of the frontend in this case. + * Use the backend directly instead of the frontend in this case, with + * another test to return false. + */ + + if (sun4i_backend_plane_uses_scaler(state)) + return true; + + /* + * Here the format is supported by both the frontend and the backend + * and no frontend scaling is required, so use the backend directly. */ - return sun4i_backend_plane_uses_scaler(state); + return false; } static void sun4i_backend_atomic_begin(struct sunxi_engine *engine, -- 2.19.1