From patchwork Tue Apr 24 00:06:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 10358389 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 11E37601D3 for ; Tue, 24 Apr 2018 00:07:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0136828C95 for ; Tue, 24 Apr 2018 00:07:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E80E528CA1; Tue, 24 Apr 2018 00:06:59 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,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 9A22828C95 for ; Tue, 24 Apr 2018 00:06:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0B5DD6E321; Tue, 24 Apr 2018 00:06:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pg0-x244.google.com (mail-pg0-x244.google.com [IPv6:2607:f8b0:400e:c05::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 28D496E325 for ; Tue, 24 Apr 2018 00:06:53 +0000 (UTC) Received: by mail-pg0-x244.google.com with SMTP id t12so9483991pgp.13 for ; Mon, 23 Apr 2018 17:06:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3qP0BuNZd0G17EwFfNyBvNKLeemyvGXNnBYOZWFkx+8=; b=djP8pMMBIB7nQLN+kLzQ3zE/EZHE7Xh+d1r6wp/4uhYCB+Utx3qLbSQX+BgJrcOA+0 JyIPNH04aPlNcfUYLgySoUZMrNfFuhBAO1W0bPWY3HOp1rjsoWi7sTFKB24L0mPZeYSm FYRZ91CiTO+6gfzDEOy08TeDRzbLvYjX0Tk4Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3qP0BuNZd0G17EwFfNyBvNKLeemyvGXNnBYOZWFkx+8=; b=bLqMKVP4Ui9B02JbO29xOW9nQRV5WJLZ9+d/Tki7wcr0Se1B9axKnOaK5P3hicUbqD T5yD+tfYevJi5rmy74srj9RcTuLUmPrgTTKbB0C8DQfTzzAVeAY7/wKVT2NxuQXtHC0q qPY8DyweuMU/I+PxDJzux5CH9yTXyUM1qSfakug435u9bQ1DJW2OrSwElRjg61pcC7pG dcQYmBbLRuZtBUfiDpcQBOkJ3IJ/mjlG2B0mV5td/hVyxvqgLgfXdZAD3YshV2X/pYtI OOvCIWt4kvDuhLUJicyyVJB+8jIZ24UOZiMrHgt7U3mvQRFOkl5v+u2qeiXVr3JSlt94 0aEA== X-Gm-Message-State: ALQs6tDXIk7A2TK2OqjW8IQKuxKDU86GT3JhWc/4p1z446C5VEpEnXc4 q2ynv2NxlD65pgKoogOgYGPGO8Sp08E= X-Google-Smtp-Source: AIpwx4/FClpqi+YHzg6J90Hiu6eo471nAOWmKmPZjIlUtnXGR2xYOhzNLAbF+yVDp51wHT1G57RPLw== X-Received: by 2002:a17:902:284b:: with SMTP id e69-v6mr22225605plb.240.1524528412161; Mon, 23 Apr 2018 17:06:52 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:600:5100:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id x137sm23909976pfd.162.2018.04.23.17.06.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 23 Apr 2018 17:06:50 -0700 (PDT) From: John Stultz To: dri-devel Subject: [RFC][PATCH 2/2] drm_hwcomposer: Fall back to client compositon if the gl precompostior fails Date: Mon, 23 Apr 2018 17:06:44 -0700 Message-Id: <1524528404-12331-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1524528404-12331-1-git-send-email-john.stultz@linaro.org> References: <1524528404-12331-1-git-send-email-john.stultz@linaro.org> 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: Rob Herring , Matt Szczesiak , Dmitry Shmidt , Sean Paul , Robert Foss , Alexandru-Cosmin Gheorghe , Liviu Dudau , Alistair Strachan , Marissa Wall , David Hanna MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP If the gl precompositor isn't being used, we cannot accept every layer as a device composited layer. Thus this patch adds some extra logic in the validate function to try to map layers to available device planes, falling back to client side compositing if we run-out of planes. Credit to Rob Herring, who's work this single plane patch was originally based on. Feedback or alternative ideas 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 Cc: Alexandru-Cosmin Gheorghe Cc: Alistair Strachan Signed-off-by: John Stultz Signed-off-by: John Stultz --- drmhwctwo.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drmhwctwo.cpp b/drmhwctwo.cpp index dfca1a6..437a439 100644 --- a/drmhwctwo.cpp +++ b/drmhwctwo.cpp @@ -686,6 +686,15 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, supported(__func__); *num_types = 0; *num_requests = 0; + int avail_planes = primary_planes_.size() + overlay_planes_.size(); + + /* + * If more layers then planes, save one plane + * for client composited layers + */ + if (avail_planes < layers_.size()) + avail_planes--; + for (std::pair &l : layers_) { DrmHwcTwo::HwcLayer &layer = l.second; switch (layer.sf_type()) { @@ -695,6 +704,15 @@ HWC2::Error DrmHwcTwo::HwcDisplay::ValidateDisplay(uint32_t *num_types, layer.set_validated_type(HWC2::Composition::Client); ++*num_types; break; + case HWC2::Composition::Device: + if (!compositor_.uses_GL() && !avail_planes) { + layer.set_validated_type(HWC2::Composition::Client); + ++*num_types; + break; + } else { + avail_planes--; + } + /* fall through */ default: layer.set_validated_type(layer.sf_type()); break;