From patchwork Wed Jan 24 14:47:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 10183243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A976160353 for ; Wed, 24 Jan 2018 23:08:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92D5E28928 for ; Wed, 24 Jan 2018 23:08:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86D9D28958; Wed, 24 Jan 2018 23:08:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F52F28928 for ; Wed, 24 Jan 2018 23:08:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 96A736E6D0; Wed, 24 Jan 2018 23:07:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id D2DB16E606 for ; Wed, 24 Jan 2018 14:47:40 +0000 (UTC) Received: by mail-wm0-x22d.google.com with SMTP id r78so9140567wme.0 for ; Wed, 24 Jan 2018 06:47:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WWXeLZfjFbhR2FAwzDNiwrD+llnOrjBcl5XkvjFEHmk=; b=OPycrfXwGusi5mjo1dF4OkTfpL9Ff7bTaECKeeInkysst0gHvjM45aq5FVvzrNEOko Ix85NKHpwMvNrt+qUlN57NADj62CCYciEnAzI/Xdjr4Zbq9uRuEAdzR8GC0imTGn8xMT w6ECBUw10ebaRmK6OywRQVogvX/ZuHrgWtsiQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WWXeLZfjFbhR2FAwzDNiwrD+llnOrjBcl5XkvjFEHmk=; b=P+HKL9q5Qpx9S9aI0rxtD/QYEd+QtIflelFGVtcar5SA1oa74lP0N8QNT/0NnaB6qQ GjTaPDdjAzSSXTuzgvqbHxjVg8Y0e8Ivm0Pp21GLZkXqDc5F0cmMmqjLS7botGwdHtPg TNLgqXvOBEB8Hgce9F1brdmLNOKKHmK87j5m7kcKjx3KYYDGCIX/qChy+gufZqpEacM0 8qQSneCf1/LbBECz3kkC3RT0sYM/BV28uvNw3lLHjI7IY76sTsfLUeFH5srot84+YytX cYWQ9CrYEHsCuL9iwvi0y996s1LIwRaVSuQ3RfZMeSGgU2vQTmQaowcyLy+oTCNDs4QN HgRQ== X-Gm-Message-State: AKwxytdxX1R2NQc4ZZZQewI+o7JHt03ju7wURFwNatSN1qhztc4NCP1C RqVhnF6zslnt0i9JU10JqiSyWSTDe435b+bCILxkKw== X-Google-Smtp-Source: AH8x227AXy6L8VMNBUetHabY2doq/XY3r4UAkoxyVuvBR0AZm0sUl/5cjvV2j0irT+cR37TZtdwdtr7vbepWWh3Gq5U= X-Received: by 10.80.170.157 with SMTP id q29mr25630600edc.43.1516805259396; Wed, 24 Jan 2018 06:47:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.171.164 with HTTP; Wed, 24 Jan 2018 06:47:19 -0800 (PST) In-Reply-To: <1516749399-29504-4-git-send-email-john.stultz@linaro.org> References: <1516749399-29504-1-git-send-email-john.stultz@linaro.org> <1516749399-29504-4-git-send-email-john.stultz@linaro.org> From: Rob Herring Date: Wed, 24 Jan 2018 08:47:19 -0600 Message-ID: Subject: Re: [RFC][PATCH 3/4 v2] drm_hwcomposer: Use client compositing if there is only one plane To: John Stultz X-Mailman-Approved-At: Wed, 24 Jan 2018 23:07:46 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Szczesiak , Dmitry Shmidt , Sean Paul , Robert Foss , Liviu Dudau , dri-devel , Marissa Wall , David Hanna Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Tue, Jan 23, 2018 at 5:16 PM, John Stultz wrote: > Originally based on work by Rob Herring, this patch changes > ValidateDisplay() so that if there is only one plane, we modify > Device composited layers to be Client composited. > > Without this, on devices with just one plane, nothing gets > displayed on the screen. > > Suggestions for alternative solutions here would be greatly > appreciated! > > Cc: Marissa Wall > Cc: Sean Paul > Cc: Dmitry Shmidt > Cc: Robert Foss > Cc: Matt Szczesiak > Cc: Liviu Dudau > Cc: David Hanna > Cc: Rob Herring > Signed-off-by: John Stultz > --- > v2: > * Rework Rob's change to check planes > --- > drmhwctwo.cpp | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp > index dfca1a6..6d88c5c 100644 > --- a/drmhwctwo.cpp > +++ b/drmhwctwo.cpp > @@ -695,6 +695,13 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, > layer.set_validated_type(HWC2::Composition::Client); > ++*num_types; > break; > + case HWC2::Composition::Device: > + /* If we only have one plane, always do Client composition */ > + if (primary_planes_.size() + overlay_planes_.size() == 1) { > + layer.set_validated_type(HWC2::Composition::Client); > + ++*num_types; > + break; > + } This needs to be conditional on GL compositing being disabled (either thru init failure or a property flag). Also, this can be generalized to use as many planes as we have. Something like the following patch. BTW, "gl_enabled" doesn't exist. I left that for you to figure out how to set and propagate. for (std::pair &l : layers_) { @@ -696,7 +698,12 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, ++*num_types; break; default: - layer.set_validated_type(layer.sf_type()); + if (--planes > 0 || gl_enabled) { + layer.set_validated_type(layer.sf_type()); + } else { + layer.set_validated_type(HWC2::Composition::Client); + ++*num_types; + } break; } } diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp index dfca1a6e9d2d..d7a85bbf67dd 100644 --- a/drmhwctwo.cpp +++ b/drmhwctwo.cpp @@ -684,6 +684,8 @@ HWC2::Error DrmHwcTwo::HwcDisplay::SetVsyncEnabled(int32_t enabled) { HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, uint32_t *num_requests) { supported(__func__); + int planes = primary_planes_.size() + overlay_planes_.size(); + *num_types = 0; *num_requests = 0;