From mboxrd@z Thu Jan 1 00:00:00 1970 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 C0336C4332F for ; Tue, 18 Jan 2022 08:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344666AbiARIhd (ORCPT ); Tue, 18 Jan 2022 03:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344501AbiARIhY (ORCPT ); Tue, 18 Jan 2022 03:37:24 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABFB7C061574 for ; Tue, 18 Jan 2022 00:37:24 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id 78so12450037pfu.10 for ; Tue, 18 Jan 2022 00:37:24 -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=YLSxu/tIwj92oYZwW7XT/H9srKLMjIQQT+1nn/oOFcZLB4PgCo3+UDGGZcffN6xDLN fiY8zn+trt9sov1CskL0+pT6MAvoPHgB7Z/nRy20Y57dKLRXOoZplUdqd/cUnbQaoO+P ur+SOLXf5+Tr+gfMMMvxQcG8FdHMzW+kJrXJdaA+Tb94t4eapVv5nADD2uJIavifzmvC aq4MMGAdZg5Q2IgIfOFOuvCy29XWqKuBktEFwlABvPZa+bDCLWUJDX+ueDSzGYUGzHE1 Ay2XO98YiVEGcPqsk0Z/ElsxPO4L+GAPzZQ/yrDFRsxojzPV1q5C9HVd+KyQpo3TQ5Vl 4F/Q== 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=GCej4VXP8sUVxFSXEcw8o7jFXp1C6XWzmbNJPwi6g5w5E35idKKWKTR1QAwpCsnH6r +4Hdtq+QEcFTKtr02lJ79ZN9aOGYKI/38SZrYUsM8qR2kNW9iwhVDWeR+T5R6Nqwk8ko EuFil9Nuz9d9Hvk/rnX+iJlaZgkoLdNP2BuVBFkItm8WDGYCIq1cEcw/Jnb3lvsx/7A5 kvIArYljIyZIP9wkkny1jMdCRQIFWtqnAFnNhdkvIEAP4l6qITDvprcvDTZBoBFx6zuD 9bH1lHvtnIGn4Wp9j2LXRtTEBLCyuvkko13v6221ij31cZZnh8MPAK1UPkrvUVFBAOWj UajQ== X-Gm-Message-State: AOAM532q9L50je/QIQKMJMrZCeEJDfVIilhojfBUqSyCMGB/IeFoFbc0 tFZv7/lVcQ+IlErayoiulr/1+w== X-Google-Smtp-Source: ABdhPJxUXPnlq3fnqBxNwq+VU2c6cdmBk++xs+hnu+nnviQYYFI6uuFUKT5La/Jt+m2gv1zoVNQ6+w== X-Received: by 2002:a05:6a00:1a55:b0:4c4:394:8a22 with SMTP id h21-20020a056a001a5500b004c403948a22mr10068904pfv.63.1642495044202; Tue, 18 Jan 2022 00:37: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 c6sm1775615pjo.39.2022.01.18.00.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 00:37:23 -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 v4 2/3] drm: add support modifiers for drivers whose planes only support linear layout Date: Tue, 18 Jan 2022 17:36:51 +0900 Message-Id: <20220118083652.16335-3-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118083652.16335-1-etom@igel.co.jp> References: <20220118083652.16335-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 From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 101BEC433FE for ; Tue, 18 Jan 2022 08:37:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 05EF0112929; Tue, 18 Jan 2022 08:37:26 +0000 (UTC) Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by gabe.freedesktop.org (Postfix) with ESMTPS id E348B1122B3 for ; Tue, 18 Jan 2022 08:37:24 +0000 (UTC) Received: by mail-pg1-x52b.google.com with SMTP id g2so13275476pgo.9 for ; Tue, 18 Jan 2022 00:37:24 -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=YLSxu/tIwj92oYZwW7XT/H9srKLMjIQQT+1nn/oOFcZLB4PgCo3+UDGGZcffN6xDLN fiY8zn+trt9sov1CskL0+pT6MAvoPHgB7Z/nRy20Y57dKLRXOoZplUdqd/cUnbQaoO+P ur+SOLXf5+Tr+gfMMMvxQcG8FdHMzW+kJrXJdaA+Tb94t4eapVv5nADD2uJIavifzmvC aq4MMGAdZg5Q2IgIfOFOuvCy29XWqKuBktEFwlABvPZa+bDCLWUJDX+ueDSzGYUGzHE1 Ay2XO98YiVEGcPqsk0Z/ElsxPO4L+GAPzZQ/yrDFRsxojzPV1q5C9HVd+KyQpo3TQ5Vl 4F/Q== 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=ICvQKB/66uLMT3d/eOFDsMbf8vkvwMUrUJzbo/W5t/mLROJISggMkkeUVS+rzBLQV6 Zrc8tLPU3JnwZ1vxJ/D0HhMTzHVFFub7QjSS+oKG/pc0kxeRepOP82oRK+i6QSTNsi82 f1rCW/xf6MyzDkhwqb9iX2HB8lbhUWX9WeU4yTAmcDWWKhxMJa/k55Qul4+qZYPuzrTE L7ZQLe/iBB8l2e7cAFYMKHV64tdHEWU/jht934+QSYiVcXAFIPdWQZDqIDSe1LutWSk0 PgCD1Hs0CcdFf1s0+uN3DQ7GtTiQUcLGvIOP8dYxdWU8+fffrMBPK8atDkhZ0ZyeWkAU b4ew== X-Gm-Message-State: AOAM530zoGTWk+zFN/nsQHEdGvO/F8hGnsKvVGKk9/EpfU1xc6Py47Ow 9JDIJ8Mqd+XoFPSoT+UKqwQUjsM3wUZS25Gp X-Google-Smtp-Source: ABdhPJxUXPnlq3fnqBxNwq+VU2c6cdmBk++xs+hnu+nnviQYYFI6uuFUKT5La/Jt+m2gv1zoVNQ6+w== X-Received: by 2002:a05:6a00:1a55:b0:4c4:394:8a22 with SMTP id h21-20020a056a001a5500b004c403948a22mr10068904pfv.63.1642495044202; Tue, 18 Jan 2022 00:37: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 c6sm1775615pjo.39.2022.01.18.00.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 00:37:23 -0800 (PST) From: Tomohito Esaki To: dri-devel@lists.freedesktop.org Subject: [RFC PATCH v4 2/3] drm: add support modifiers for drivers whose planes only support linear layout Date: Tue, 18 Jan 2022 17:36:51 +0900 Message-Id: <20220118083652.16335-3-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118083652.16335-1-etom@igel.co.jp> References: <20220118083652.16335-1-etom@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , nouveau@lists.freedesktop.org, =?UTF-8?q?Michel=20D=C3=A4nzer?= , Lee Jones , Tomohito Esaki , Rob Clark , Evan Quan , amd-gfx@lists.freedesktop.org, Ben Skeggs , Petr Mladek , Sakari Ailus , Abhinav Kumar , Dmitry Baryshkov , Takanari Hayama , Sean Paul , Andy Shevchenko , Mark Yacoub , Qingqing Zhuo , "Pan, Xinhui" , linux-kernel@vger.kernel.org, Thomas Zimmermann , Alex Deucher , Damian Hobson-Garcia , =?UTF-8?q?Christian=20K=C3=B6nig?= , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CF7BC433F5 for ; Tue, 18 Jan 2022 08:37:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 388821122B3; Tue, 18 Jan 2022 08:37:25 +0000 (UTC) Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by gabe.freedesktop.org (Postfix) with ESMTPS id 96088112917 for ; Tue, 18 Jan 2022 08:37:24 +0000 (UTC) Received: by mail-pf1-x432.google.com with SMTP id i65so12455727pfc.9 for ; Tue, 18 Jan 2022 00:37:24 -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=YLSxu/tIwj92oYZwW7XT/H9srKLMjIQQT+1nn/oOFcZLB4PgCo3+UDGGZcffN6xDLN fiY8zn+trt9sov1CskL0+pT6MAvoPHgB7Z/nRy20Y57dKLRXOoZplUdqd/cUnbQaoO+P ur+SOLXf5+Tr+gfMMMvxQcG8FdHMzW+kJrXJdaA+Tb94t4eapVv5nADD2uJIavifzmvC aq4MMGAdZg5Q2IgIfOFOuvCy29XWqKuBktEFwlABvPZa+bDCLWUJDX+ueDSzGYUGzHE1 Ay2XO98YiVEGcPqsk0Z/ElsxPO4L+GAPzZQ/yrDFRsxojzPV1q5C9HVd+KyQpo3TQ5Vl 4F/Q== 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=AdvgOYG8I68ULfCC0Cx7ej5wKTqa3Cy+rmGoCjC+ydgBuIzDrb4gRDd5e95mSP0W2q 0tsjM4BcKND4T5IWUFQKJa1wWr7wMaReP0wSPk2N6zQtbr8ULwk/QJSASW5YzPANjVE7 0m0boFklk3h+Empoj1kez24RJpZMaO0sKDWnUPykVCxIOGrbhSIwhVmkzUUxDXaBc2pp P7bRmeiM+ArlL+GeG9WI1Yfrtp5i5GUEB5MlkYAnZvbkQx9ZwisP/iE6yK31j4YL9l20 fsAf6tB6RNp0gaHCNcf6TYUaNtz/EhPGYYv20s4s1edpOy3c2zPBeB0/tq5ij9FN0mzw rBXg== X-Gm-Message-State: AOAM532Jx9WAL4CVHlu19Cbe/1YSjUwibA8lqiN1OU7lCdK7oV4DqNs9 LgpGyWSYfZxoXUBfy7hoXJgSPA== X-Google-Smtp-Source: ABdhPJxUXPnlq3fnqBxNwq+VU2c6cdmBk++xs+hnu+nnviQYYFI6uuFUKT5La/Jt+m2gv1zoVNQ6+w== X-Received: by 2002:a05:6a00:1a55:b0:4c4:394:8a22 with SMTP id h21-20020a056a001a5500b004c403948a22mr10068904pfv.63.1642495044202; Tue, 18 Jan 2022 00:37: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 c6sm1775615pjo.39.2022.01.18.00.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 00:37:23 -0800 (PST) From: Tomohito Esaki To: dri-devel@lists.freedesktop.org Subject: [RFC PATCH v4 2/3] drm: add support modifiers for drivers whose planes only support linear layout Date: Tue, 18 Jan 2022 17:36:51 +0900 Message-Id: <20220118083652.16335-3-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118083652.16335-1-etom@igel.co.jp> References: <20220118083652.16335-1-etom@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , nouveau@lists.freedesktop.org, =?UTF-8?q?Michel=20D=C3=A4nzer?= , Daniel Stone , Lee Jones , Tomohito Esaki , Rob Clark , Evan Quan , amd-gfx@lists.freedesktop.org, Ben Skeggs , Petr Mladek , Sakari Ailus , Bas Nieuwenhuizen , Maarten Lankhorst , Abhinav Kumar , Dmitry Baryshkov , Takanari Hayama , Sean Paul , Maxime Ripard , Daniel Vetter , Andy Shevchenko , Mark Yacoub , Qingqing Zhuo , "Pan, Xinhui" , linux-kernel@vger.kernel.org, Thomas Zimmermann , Simon Ser , Alex Deucher , Damian Hobson-Garcia , =?UTF-8?q?Christian=20K=C3=B6nig?= , Laurent Pinchart Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 26C1FC433EF for ; Tue, 18 Jan 2022 20:08:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4951A10E553; Tue, 18 Jan 2022 20:08:38 +0000 (UTC) Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 941BF1122B3 for ; Tue, 18 Jan 2022 08:37:24 +0000 (UTC) Received: by mail-pf1-x42d.google.com with SMTP id r5so5332682pfl.2 for ; Tue, 18 Jan 2022 00:37:24 -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=YLSxu/tIwj92oYZwW7XT/H9srKLMjIQQT+1nn/oOFcZLB4PgCo3+UDGGZcffN6xDLN fiY8zn+trt9sov1CskL0+pT6MAvoPHgB7Z/nRy20Y57dKLRXOoZplUdqd/cUnbQaoO+P ur+SOLXf5+Tr+gfMMMvxQcG8FdHMzW+kJrXJdaA+Tb94t4eapVv5nADD2uJIavifzmvC aq4MMGAdZg5Q2IgIfOFOuvCy29XWqKuBktEFwlABvPZa+bDCLWUJDX+ueDSzGYUGzHE1 Ay2XO98YiVEGcPqsk0Z/ElsxPO4L+GAPzZQ/yrDFRsxojzPV1q5C9HVd+KyQpo3TQ5Vl 4F/Q== 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=kev6AsV8Vk3D50Uysm1QR1qYulAGipgtqqNsP3GyzGIPg1/jS3dOQ4b7WNt/ITXyf1 tavxpHnPyx5eAwF1Qc370vzSDvPpL67UikHW+D3WnvmOcEqeB5YdKwecwkGF9/5WIGjV 6vUfwH3DDx9j2J8Twy1OTmZ25T4D8hqU/qQfADfOWautKc3KiPruPyfImHih2IkheaUC 2k5tOYjXmvB0NiqtXGrZDcUZskl1imvg2cfLoc6YVjzQFEjKefWZYAp4ji+cF3Kwvmcy YeOamkNk001BMaFhCyCb3MshFU38GqOSGQ8OMdR/Pm5uQrelndJX5wxnTYpbqggAMEM2 Tblw== X-Gm-Message-State: AOAM530MK6ad6qO1uwuCWvYSxQCGbXnHkr5sbEVi5pclheeWT3CK++tx s+SZCpDOIr2GRCN7AZuUzHPuaQ== X-Google-Smtp-Source: ABdhPJxUXPnlq3fnqBxNwq+VU2c6cdmBk++xs+hnu+nnviQYYFI6uuFUKT5La/Jt+m2gv1zoVNQ6+w== X-Received: by 2002:a05:6a00:1a55:b0:4c4:394:8a22 with SMTP id h21-20020a056a001a5500b004c403948a22mr10068904pfv.63.1642495044202; Tue, 18 Jan 2022 00:37: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 c6sm1775615pjo.39.2022.01.18.00.37.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jan 2022 00:37:23 -0800 (PST) From: Tomohito Esaki To: dri-devel@lists.freedesktop.org Date: Tue, 18 Jan 2022 17:36:51 +0900 Message-Id: <20220118083652.16335-3-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220118083652.16335-1-etom@igel.co.jp> References: <20220118083652.16335-1-etom@igel.co.jp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Tue, 18 Jan 2022 20:08:37 +0000 Subject: [Nouveau] [RFC PATCH v4 2/3] drm: add support modifiers for drivers whose planes only support linear layout X-BeenThere: nouveau@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Nouveau development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , nouveau@lists.freedesktop.org, =?UTF-8?q?Michel=20D=C3=A4nzer?= , Daniel Stone , Lee Jones , Tomohito Esaki , Rob Clark , Evan Quan , amd-gfx@lists.freedesktop.org, Ben Skeggs , Petr Mladek , Sakari Ailus , Bas Nieuwenhuizen , Maarten Lankhorst , Abhinav Kumar , Dmitry Baryshkov , Takanari Hayama , Sean Paul , Maxime Ripard , Daniel Vetter , Andy Shevchenko , Mark Yacoub , Qingqing Zhuo , "Pan, Xinhui" , linux-kernel@vger.kernel.org, Simon Ser , Alex Deucher , Damian Hobson-Garcia , =?UTF-8?q?Christian=20K=C3=B6nig?= , Laurent Pinchart Errors-To: nouveau-bounces@lists.freedesktop.org Sender: "Nouveau" 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