Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3213911imu; Sat, 24 Nov 2018 00:15:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/VZScNn9YlucMN82PHuB4t/JmE2y6Aq4IM8i+SlcWCB9MP1VxhvMpeEgsCj6wM7fkn9LorE X-Received: by 2002:a17:902:4222:: with SMTP id g31mr18950151pld.240.1543047336398; Sat, 24 Nov 2018 00:15:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543047336; cv=none; d=google.com; s=arc-20160816; b=cLMoBknVTFbkDBf0zlysc6AB1V1jd6YY3vcAUgQ1kVEVGjCPK+6k0Ox6Lw40vbeNL8 LozQWYtn8+C3AUHepJUWRXiiDfMjYU70EXxY668CnUFePqLLK0dHDtO40UshPmGE85d0 jqLKnYbExFDuHwV/Z3VZzTIeV6gR5x0VcW7bggnGiMFPxBgOMOgtAdZpm+BhktmUNQ3y y51hKSq1J2kwukmuYXRT0Nk2inr9DntlWruO5ClQMZR9LVmORs1G5q46nWAJfPJHXxPL aFjarYt0ZSIt6Y/2amW5FR07vPFow6sAKhdeIT84XFTtlJ+PypPFBeGOHEj3889fREn3 65PA== 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=xOFeNpG5k9805YLHXcEaQeS//CjB2LyTH2wXcaBVkLs=; b=imIVSixjF4mvTg2cVyuXXWJRIDYGojml5aXLD2f4umDZWuibgawr/YaJ+y/QBHyP+9 cPzMaA4eVmsRbfXTywFAXUY2ei52GAz6N6EKaZgwstw3WI7qYPuKXGQrViVZ8/xBScZ/ PTUMdw2F0cLBOzuH8dK13su/mYJvl3zzMi7Nu1NtzksEg1NZBd8mudD6smqJTpR+uwyy jaVhOAX52bs4X+tmdNH6HlDGE1TzU5mawGIEF+Sbl22veOJ2QEH8SA57t0GS5l0eFAqA uMe/QTuzVImhOZ8V0xQXI53Lh+93wPFPmdoLgWUW0c0TjohhYKDruMHeM5u9ooxmdrZr 2k9w== 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 p16si21597762plr.31.2018.11.24.00.15.22; Sat, 24 Nov 2018 00:15:36 -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 S2502655AbeKWUKQ (ORCPT + 99 others); Fri, 23 Nov 2018 15:10:16 -0500 Received: from mail.bootlin.com ([62.4.15.54]:49206 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502644AbeKWUKP (ORCPT ); Fri, 23 Nov 2018 15:10:15 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 0BE35213F9; Fri, 23 Nov 2018 10:26:48 +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 2E57420DC1; Fri, 23 Nov 2018 10:26:29 +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 07/43] drm/sun4i: backend: Use a specific function to check if a plane is supported Date: Fri, 23 Nov 2018 10:24:39 +0100 Message-Id: <20181123092515.2511-8-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 Before this patch, it is assumed that a plane is supported either through the frontend or through the backend alone. However, the DRM interface does not allow finely reporting our hardware capabilities and there are cases where neither are support. In particular, some plane formats are supported by the backend and not the frontend, so they can only be supported without scaling. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_backend.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_backend.c b/drivers/gpu/drm/sun4i/sun4i_backend.c index 735fea7ead0b..52caf561da0e 100644 --- a/drivers/gpu/drm/sun4i/sun4i_backend.c +++ b/drivers/gpu/drm/sun4i/sun4i_backend.c @@ -477,6 +477,23 @@ static bool sun4i_backend_plane_uses_frontend(struct drm_plane_state *state) return false; } +static bool sun4i_backend_plane_is_supported(struct drm_plane_state *state, + bool *uses_frontend) +{ + if (sun4i_backend_plane_uses_frontend(state)) { + *uses_frontend = true; + return true; + } + + *uses_frontend = false; + + /* Scaling is not supported without the frontend. */ + if (sun4i_backend_plane_uses_scaler(state)) + return false; + + return true; +} + static void sun4i_backend_atomic_begin(struct sunxi_engine *engine, struct drm_crtc_state *old_state) { @@ -517,14 +534,14 @@ static int sun4i_backend_atomic_check(struct sunxi_engine *engine, struct drm_framebuffer *fb = plane_state->fb; struct drm_format_name_buf format_name; - if (sun4i_backend_plane_uses_frontend(plane_state)) { + if (!sun4i_backend_plane_is_supported(plane_state, + &layer_state->uses_frontend)) + return -EINVAL; + + if (layer_state->uses_frontend) { DRM_DEBUG_DRIVER("Using the frontend for plane %d\n", plane->index); - - layer_state->uses_frontend = true; num_frontend_planes++; - } else { - layer_state->uses_frontend = false; } DRM_DEBUG_DRIVER("Plane FB format is %s\n", -- 2.19.1