Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 027A4C433F5 for ; Fri, 14 Jan 2022 10:18:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240361AbiANKSd (ORCPT ); Fri, 14 Jan 2022 05:18:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240333AbiANKSZ (ORCPT ); Fri, 14 Jan 2022 05:18:25 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B524C06161C for ; Fri, 14 Jan 2022 02:18:25 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id o3so13001225pjs.1 for ; Fri, 14 Jan 2022 02:18:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Z7DU13bl/Kr7bejWSCxzgyPXSQzgiVvowF1ijJEKZSA=; b=cAwQUnNCDelxjGSSeJwpRmip0dJtKp8udIfbxmfTkCMejPUrysWAU9r/AzLK1YEVDe 1+xzfJqHpb6xp1mVbFPXI/DH1M7NudgxdzY6fXR0+tjChK4K/wS//Iwu1NHMVNAeY+eg ssDgLaxA5+G2IpMONfusc2/FG65zBGfLbLpNiYJH0XCbG76qkpVsggUm9BjdzKfzprFS UYOc67/AM06YoLO6MTc4VIm5mK8qU8J0Ad0rBk2SXixJp0zcFwuW+v01hLYobojca+NT nK440XBHjIhqU3MUJ7p1kHcP05xgDq2/W8QuqvXMrz1QJrmUUBynUBZ8BtTJJsSF4l0s PMiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Z7DU13bl/Kr7bejWSCxzgyPXSQzgiVvowF1ijJEKZSA=; b=2G7GaroG4PwycEKLm08ch89OiSVfC5hymAgHV7V7WF+rQN6sIf99HTKIhN/aT2GVpe whIzPbTF7KhhaLjaKBsCm1lb6m1XnxaugjHqsHIsO6lVSjTVKr9QiRP9EIGG5cry3S8x VNiW61wUlnFCsx6GPiZACTvqVSfA5Q+iBgKuWUGHWb5qKFhENqXCDI2GT5zHSo3IBKk+ yIms/QJ68AlJvd9fSJCQDYqpj1SEWOZz49HIWcwZwAE1Kip8sj40zyOjXcBFxhHbKayW T1eKBie5W3Pw4Z2d/nDUOoSxMo1kgMXcZ18i8fJToumdAZqKRWDeVGJNB47TNSEC48RE JXxw== X-Gm-Message-State: AOAM5315117ZnGOdw/soPZiLL45/EcB2sTfc0w+9/Ls1D7g++R6DpMVu zoJkH9Omwyme+fzBBSS04z/tvQ== X-Google-Smtp-Source: ABdhPJzS8wjD3XHWY3mgaylIQXfEpPeL2apV2hB38YBPJKQQNVuflbQO9VGaryB3jdxmbmi3XoWoNQ== X-Received: by 2002:a17:903:2292:b0:14a:8068:a75 with SMTP id b18-20020a170903229200b0014a80680a75mr5915261plh.105.1642155504809; Fri, 14 Jan 2022 02:18:24 -0800 (PST) Received: from aqua.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id 13sm5555970pfm.161.2022.01.14.02.18.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 02:18:24 -0800 (PST) From: Tomohito Esaki To: dri-devel@lists.freedesktop.org Cc: Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Ben Skeggs , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Simon Ser , Qingqing Zhuo , Bas Nieuwenhuizen , Mark Yacoub , Sean Paul , Evan Quan , Andy Shevchenko , Petr Mladek , Sakari Ailus , Lee Jones , Abhinav Kumar , Dmitry Baryshkov , Rob Clark , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, Daniel Stone , Laurent Pinchart , Tomohito Esaki , Damian Hobson-Garcia , Takanari Hayama Subject: [RFC PATCH v3 2/3] drm: add support modifiers for drivers whose planes only support linear layout Date: Fri, 14 Jan 2022 19:17:52 +0900 Message-Id: <20220114101753.24996-3-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220114101753.24996-1-etom@igel.co.jp> References: <20220114101753.24996-1-etom@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The LINEAR modifier is advertised as default if a driver doesn't specify modifiers. Signed-off-by: Tomohito Esaki --- drivers/gpu/drm/drm_plane.c | 15 ++++++++++++--- include/drm/drm_plane.h | 3 +++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index deeec60a3315..5aa7e241971e 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -237,6 +237,10 @@ static int __drm_universal_plane_init(struct drm_device *dev, const char *name, va_list ap) { struct drm_mode_config *config = &dev->mode_config; + const uint64_t default_modifiers[] = { + DRM_FORMAT_MOD_LINEAR, + DRM_FORMAT_MOD_INVALID + }; unsigned int format_modifier_count = 0; int ret; @@ -277,6 +281,11 @@ static int __drm_universal_plane_init(struct drm_device *dev, while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) format_modifier_count++; + } else { + if (!dev->mode_config.fb_modifiers_not_supported) { + format_modifiers = default_modifiers; + format_modifier_count = 1; + } } /* autoset the cap and check for consistency across all planes */ @@ -341,7 +350,7 @@ static int __drm_universal_plane_init(struct drm_device *dev, drm_object_attach_property(&plane->base, config->prop_src_h, 0); } - if (config->allow_fb_modifiers) + if (format_modifier_count) create_in_format_blob(dev, plane); return 0; @@ -368,8 +377,8 @@ static int __drm_universal_plane_init(struct drm_device *dev, * drm_universal_plane_init() to let the DRM managed resource infrastructure * take care of cleanup and deallocation. * - * Drivers supporting modifiers must set @format_modifiers on all their planes, - * even those that only support DRM_FORMAT_MOD_LINEAR. + * For drivers supporting modifiers, all planes will advertise + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set. * * Returns: * Zero on success, error code on failure. diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 0c1102dc4d88..cad641b1f797 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -803,6 +803,9 @@ void *__drmm_universal_plane_alloc(struct drm_device *dev, * * The @drm_plane_funcs.destroy hook must be NULL. * + * For drivers supporting modifiers, all planes will advertise + * DRM_FORMAT_MOD_LINEAR support, if @format_modifiers is not set. + * * Returns: * Pointer to new plane, or ERR_PTR on failure. */ -- 2.25.1