Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5955671pxb; Thu, 27 Jan 2022 03:23:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzUGoaeDbvLak2UuXm0S5iwn8/WzpGOHdKCd9yiGCjEot6TZzxhAs/U9qBuA9+p0rOZQbIA X-Received: by 2002:aa7:9904:: with SMTP id z4mr2571240pff.68.1643282605781; Thu, 27 Jan 2022 03:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643282605; cv=none; d=google.com; s=arc-20160816; b=NcYR2m0NtjHsWppt68Z3PeRQItVPxQ969BPabGj6nCYHETLZL55n47cB4xZ58ksTOY AYzCERgjgdRkWIMpOSbR9eRy6UNk34fw9wYjR2J74Z6W2/E93DQsfaJkeV7suokY7dXV 8C+t9tSoLVCnppltr1n86zxRqe9rdsukAsUsMg7y6+3VhtfbH1LMOtkpVdzPJ1Udizp9 v8YTIUpHExBZj7V6ugXrtYYVvZLE/rNegHEkrjtDQ7M/z7fyXinO3+S+pmddUix2j5x+ NcF+NBHDoYtq70LZ/WvhuzKQ/hqel+9g2VjFlguc+Ga14RRL6HanG4akz621ubKrf4IC 6DRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=emJGgAZKsXHfbFDFmzqJm+vf0jLHKtmm1jh15gidIuc=; b=wRt+xhX1lIoZ3Mnau2+WUcSNKaCVecT3fWkO8bvDH3jPeqVZkteM0t6pnq5A1REzNC iLjBOMb3jupbjz7+/1ZTTMDS2YMHOb2cg3n7TUOeopvKz7zsL25ZXpVAPTRxD+xkQspy PYuH5nwiCiW02fj23jbXnOwX57f2UhyU1LcrdQti7nBxFklJVy6hx4X/sRsjys6bRMst jvnQ6h7SDAoaJVomco0g5EcL8khPJUq3F40I/Wm3R2A/NXfuJ4jiz4Q+FAtaf2uM7hzM KeOd6rYI3dmMPvwZtABcWOc2qabD2B1SgTqUF05DngEgQ29ltVy+D6hQUg2FFZWZ8VBC 9d6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=INAvcROf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c13si5196879pjg.73.2022.01.27.03.23.14; Thu, 27 Jan 2022 03:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@igel-co-jp.20210112.gappssmtp.com header.s=20210112 header.b=INAvcROf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235718AbiA0D0K (ORCPT + 99 others); Wed, 26 Jan 2022 22:26:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235585AbiA0D0I (ORCPT ); Wed, 26 Jan 2022 22:26:08 -0500 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C913C06161C for ; Wed, 26 Jan 2022 19:26:08 -0800 (PST) Received: by mail-pl1-x62c.google.com with SMTP id k17so1423637plk.0 for ; Wed, 26 Jan 2022 19:26:08 -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=emJGgAZKsXHfbFDFmzqJm+vf0jLHKtmm1jh15gidIuc=; b=INAvcROfrUBBxfcEHa4GOL58R5CqSKk73+AcncbMRxk6vIdER/muBwmOVz7Alh2zrF ksmuPXiHJrfYC9BysjY+IkOsMUcYkIm8gieWJdNzilKRXVhqt3QTVdS0R53qNkI5X8n/ BbKUCzXl8L0SzZFt1BPtyCApK2ce2YuK7Rm7BGMlo1+x/+HEdMr8kE4rPkZaRG7kvuqN VlP6h6/XKx/4vqmDRLjexXzIJpSvaHahMizDzj0kfS5PLkLYWQOtZeFpry+NXcgOO4BC fcyFxirEDPEI1r5wqb93sm6NP/6Fs72qaeSBdNTP06tykOEkj1mCLrnfjkT/qAW9nOOo mDZw== 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=emJGgAZKsXHfbFDFmzqJm+vf0jLHKtmm1jh15gidIuc=; b=4p8DxisHc4VCTb8bmkX9CpV0rJwSWbXUaerB5lYKqD4ir0pWnbwb/FfLZFXiH9s6kF VK+QQscziDrEeKWgPHQgoNNA9spC2qdu5aA5KUryJfMb5SdtcHNuIX7D+b4o8B3qGi81 aCpCgL5v16eN4qfH88r49LtJnn9bIAnBC1sCJ7z9YRhixS6TPwkX29t1Y6RQeb1zmmjr HrZELwTYmeXIg5Z1YBrcmVvmD3RI97Wel6AiRxw4APOU/o/P6fGru77l54NcnNx6mjA3 b6avCxuvUKAvHeyR/mcG7OGu/k/MiOP9RNB/JYMxzDQ+DeMILCPcfNzEYuWMpLXcMLPi bjvQ== X-Gm-Message-State: AOAM531LnSJt80Aj2aZD+jeIWhu4DZBTg3XBOlfZ92YreXjebytycvRu 42knlfrePW+N9PDrJsX3fGmcKg== X-Received: by 2002:a17:90b:354f:: with SMTP id lt15mr11999702pjb.83.1643253967894; Wed, 26 Jan 2022 19:26:07 -0800 (PST) Received: from aqua.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id t15sm4203111pjy.17.2022.01.26.19.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 19:26:07 -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 v5 2/3] drm: add support modifiers for drivers whose planes only support linear layout Date: Thu, 27 Jan 2022 12:25:38 +0900 Message-Id: <20220127032539.9929-3-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127032539.9929-1-etom@igel.co.jp> References: <20220127032539.9929-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 | 23 +++++++++++++---------- include/drm/drm_plane.h | 3 +++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index deeec60a3315..bf0daa8d9bbd 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -237,6 +237,9 @@ static int __drm_universal_plane_init(struct drm_device *dev, const char *name, va_list ap) { struct drm_mode_config *config = &dev->mode_config; + static const uint64_t default_modifiers[] = { + DRM_FORMAT_MOD_LINEAR, + }; unsigned int format_modifier_count = 0; int ret; @@ -277,16 +280,16 @@ 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 = ARRAY_SIZE(default_modifiers); + } } /* autoset the cap and check for consistency across all planes */ - if (format_modifier_count) { - drm_WARN_ON(dev, !config->allow_fb_modifiers && - !list_empty(&config->plane_list)); - config->allow_fb_modifiers = true; - } else { - drm_WARN_ON(dev, config->allow_fb_modifiers); - } + drm_WARN_ON(dev, config->fb_modifiers_not_supported && + format_modifier_count); plane->modifier_count = format_modifier_count; plane->modifiers = kmalloc_array(format_modifier_count, @@ -341,7 +344,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 +371,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. + * Drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set + * @format_modifiers to NULL. The plane will advertise the linear modifier. * * Returns: * Zero on success, error code on failure. diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 0c1102dc4d88..a0390b6ad3b4 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. * + * Drivers that only support the DRM_FORMAT_MOD_LINEAR modifier support may set + * @format_modifiers to NULL. The plane will advertise the linear modifier. + * * Returns: * Pointer to new plane, or ERR_PTR on failure. */ -- 2.25.1