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: 134032 Delivered-To: patches@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1597220lji; Mon, 23 Apr 2018 17:06:52 -0700 (PDT) X-Received: by 10.99.125.19 with SMTP id y19mr18491962pgc.160.1524528412726; Mon, 23 Apr 2018 17:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524528412; cv=none; d=google.com; s=arc-20160816; b=yRUwRXG9g8LY+fzsDXdRRqA6hDK2dhC9RsbiPUTi7208yVPA7h2gS6+B2P4SQQ30YV yoyMw3zTkkFLxBZioqqG+EeT45dBbKa21HIWFVoFWSDxBXvksx/gtdzRzl+nuW+dbwS7 uISRF1SBAUsO0ZHMK7p+uLuDsP/z5H7z+u/wiOpkPwB8UgJv9SshciSlo4+Fp5xC1ZEy wX29765i5U3fa/69us9XLEwdxGw8d25RPL8pIFrNwjzm/o5psAmDs0Z//IzRmTtQ1kRp PPWQfFIc+aNHq8A4nIkvcE5WaFlIPot0j8Y4xSrj0IlBF6CY0OnHTYevmA8F3aet53Iq O1uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=3qP0BuNZd0G17EwFfNyBvNKLeemyvGXNnBYOZWFkx+8=; b=qvOpFjOLW1303XQ1l3vkxZAHJm7n5sIAJDUsshCcfbaCTqnNSaJ79V23r9tdMGR/1W haMiS/Ws2x4fBDZQ7eNE1vZ1MpXWSgyKiTvBv5Dbc8w7pvgcrBuHtYI95m5AGZkasXTV 4FTR3mZ6C47XiM7nZZCXWeo1YRoQlHmfQQkY2PX4EdYAPogdtAik67mqkWTk3ox3UmhN 2YejUB6h0RIOGiasDaebkAzAE0Kr3H0mzduTtY+hPYSbEZpy1L7YG5EG/nNdeahKjVJQ yTr30Wwq6rDy9vfDWYuaM4oacb9Lw92p39k2AnuWlWJw9TXuP8fCtOip6m2fF1CIqIGu nlQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=djP8pMMB; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 92-v6sor4843650pli.109.2018.04.23.17.06.52 for (Google Transport Security); Mon, 23 Apr 2018 17:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=djP8pMMB; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=MEa3je30u+m9/X7jtV/yjDAb/S9qhnZ34zFlm1CZpLXIOioHHm9hdK678kHjn5cvcp QXUBz0/Q7DHle6JjnALZ96KN6A0DogiAbRiEf0AUjEzxNAVpk0Bl9/3sVMTIiMLtpj7g K5+eq/beBQo7Q27OJCowSPnZTA8ErcKaH32Qb/J1PTLls/Cs8SXw3QuUqSDGHK6glSnF A/6okCkTENJnnQg/hLltYLorm/OUBCZkoiA3OSoIH9VWGPC9gegsl8b6JVRrEPoCl/M0 etjFJqkRg/urBF572AJ9GT4cKk9VLnx3PTG2kXBKSWABwygcH4i/hbWmhS87jTNaclSA VXFw== X-Gm-Message-State: ALQs6tCsfzcPTRthED4WY3d9HGiH3eb6dvExoEHXF+AIXFVF8P9y6qgh hTHfzJaaEifa0QwCggmxxU7Y2Zlc 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) Return-Path: 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 Cc: John Stultz , Marissa Wall , Sean Paul , Dmitry Shmidt , Robert Foss , Matt Szczesiak , Liviu Dudau , David Hanna , Rob Herring , Alexandru-Cosmin Gheorghe , Alistair Strachan 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> 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(+) -- 2.7.4 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;