From patchwork Tue Dec 11 18:42:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fritz Koenig X-Patchwork-Id: 10724437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E55F613BF for ; Tue, 11 Dec 2018 18:42:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D82852B60A for ; Tue, 11 Dec 2018 18:42:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9CCA2B630; Tue, 11 Dec 2018 18:42:48 +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.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 8DDC72B60A for ; Tue, 11 Dec 2018 18:42:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A0D506E3B4; Tue, 11 Dec 2018 18:42:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by gabe.freedesktop.org (Postfix) with ESMTPS id 974646E3AF for ; Tue, 11 Dec 2018 18:42:45 +0000 (UTC) Received: by mail-qk1-x749.google.com with SMTP id x125so13656698qka.17 for ; Tue, 11 Dec 2018 10:42:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=tfHgpbqAVkuVEE/PdNo/aG6U+Y7/UwDQkuBxZ5WuPig=; b=ry4e5kaD1ci20lr3bkRra8SG514YlM7ljz18afyppnv3hOMmYiwz6jJR2U0o8H1kgY zBwutlU2jzKiNKfhJnce3Mqp3qfG66sHu5HvggPd7Pp3NcoaJt5INDllRzk1EIWIE0f6 ltGrM4yd8LaiR0U2nZwReE8TFfofGKMhkDeaGejeZTuXbkAC9QqFuR/ryLr7trk3WUXw ZtjAX6ZQmZ7tDPLMgKntiJhp5tYkhiVgfu6xJkviosoUr+51s1CZ7wajwSzjelMGEKeW snUGhuJ/7MtAp+pxoIgJC7N5y6k40m2bseadR0SLdXor/3tyqEgqgs5rKsrJpPMrUrVG qm0A== X-Gm-Message-State: AA+aEWZxPZRgpUk/GAztNWr17+tAM5YFh9QLzlOBXKfGUqe8HtOw5tvc oz64ucCkDyJ9YZkW4PGTfZQdxdp2XOp8TfSdW7wUJK0lxllK3XFClPNQK576Z2gE3zudmgXHMPV aJBP2m5EX6A2eBu95P1XHvnzMv7xbW5mLzbM+0ZfbuHFI2JWzFIe9v5tBK+zLcKTi+yGIjfUysB lIILk= X-Google-Smtp-Source: AFSGD/UZxYvrT48btZv/fTeLqa+JAEheRNh8NTrAsGi3TIN7zYg7nqovGS2VnJ3QguVKimQufwISqsGiA+O0hA== X-Received: by 2002:a0c:b913:: with SMTP id u19mr13020987qvf.60.1544553764828; Tue, 11 Dec 2018 10:42:44 -0800 (PST) Date: Tue, 11 Dec 2018 10:42:22 -0800 In-Reply-To: <20181211184224.131478-1-frkoenig@google.com> Message-Id: <20181211184224.131478-3-frkoenig@google.com> Mime-Version: 1.0 References: <20181211184224.131478-1-frkoenig@google.com> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog Subject: [PATCH 3/5] drm/msm/dpu: Plane helper for modifiers From: Fritz Koenig To: dri-devel@lists.freedesktop.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: Fritz Koenig , sean@poorly.run Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Filter planes based on the supported modifiers Signed-off-by: Fritz Koenig Reviewed-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c index 6a49c253bbdc..9381c8af76d7 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -1410,6 +1410,23 @@ static void dpu_plane_early_unregister(struct drm_plane *plane) debugfs_remove_recursive(pdpu->debugfs_root); } +static bool dpu_plane_format_mod_supported(struct drm_plane *plane, + uint32_t format, uint64_t modifier) +{ + if (modifier == DRM_FORMAT_MOD_LINEAR) + return true; + + if (modifier == DRM_FORMAT_MOD_QCOM_COMPRESSED) { + int i; + for (i = 0; i < ARRAY_SIZE(qcom_compressed_supported_formats); i++) { + if (format == qcom_compressed_supported_formats[i]) + return true; + } + } + + return false; +} + static const struct drm_plane_funcs dpu_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -1419,6 +1436,7 @@ static const struct drm_plane_funcs dpu_plane_funcs = { .atomic_destroy_state = dpu_plane_destroy_state, .late_register = dpu_plane_late_register, .early_unregister = dpu_plane_early_unregister, + .format_mod_supported = dpu_plane_format_mod_supported, }; static const struct drm_plane_helper_funcs dpu_plane_helper_funcs = {