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 976AFC433EF for ; Wed, 22 Dec 2021 05:27:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242601AbhLVF15 (ORCPT ); Wed, 22 Dec 2021 00:27:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242598AbhLVF14 (ORCPT ); Wed, 22 Dec 2021 00:27:56 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 560D8C061574 for ; Tue, 21 Dec 2021 21:27:56 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id n15-20020a17090a160f00b001a75089daa3so4665811pja.1 for ; Tue, 21 Dec 2021 21:27:56 -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=FZMLZON20bWtrq2sz7nwh4szNbVAnGuVe7s0LuBQMY8=; b=UyG/PNgRZFP+f0K7oJsfFcc5cx0QD0KkSprzgxJyzSsQOTIZTmUQPik+BRVLqiNfg9 grOsl5/Fgc/ZUmhEJOGz1tSmF37OAFbLNCtua+JEYOdqC8D0er7AEYQY9/PXLYP2KkIz TMIRtpqnpRgwOQz4CoIhPgQ4c11ZZYVdt6eULiAx9a7GTUAKUHztSoEcV+CYC0QoBGLg ofVYhLyh4IEZNMllZimyaR5pdINQss0X+kBAlwN1faa09IPAdKdL2VZPviYaxBeNY8XO a25i+zxIg+k4sVZARLV6HlSp7sD7JbIfLwOTe0WxfRJIo06O34fwvYxdRApGg5oLK2Jw PNtg== 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=FZMLZON20bWtrq2sz7nwh4szNbVAnGuVe7s0LuBQMY8=; b=BVKXKz4aQJ9BP3UBa5fdwRmJc2hgDt+Fj73X/WNWgUkUzvBAtgUHjZcE9aF0CFQgxG BaSVXDhSPFmVndR3MA7O98SCrlv9LjvjaNAQ9MYH0Pp16WOyCizdy7w2+lbTeZkLarT+ BbZyHsha46igFvCD4T1Mb/Ap6l0RJTqA2nTGG/WmmxPew8+Jmrh7+/g0UXpXF0UonCl4 qJjqzu9/Kqnb0SLdw19jYS3/P6wVImm9c2PtjDTmaJ//hklGlZt8z7wLu3Q4w/H8LxQe gg3TWkgYC24XnWB7gFx6LRd9s/sE1GD3YKM2gQ/TixUU1uB48yvsdLd3DvC3hZsr6J98 IpQw== X-Gm-Message-State: AOAM530imaWFMemsYdPYP4EQz16hnswhJlDi9dn/TtxgsSOAnzWdJCvJ b/duiiG6smb0CwJ/1b919hOQVw== X-Google-Smtp-Source: ABdhPJy7FkeNfEP/7vNs+Ieyaz441/RBOQCDZsCiph+YCqhU9zps42TIopAfRgQSxH+FSStJjWPiug== X-Received: by 2002:a17:902:ea03:b0:148:ea19:557 with SMTP id s3-20020a170902ea0300b00148ea190557mr1355994plg.129.1640150875860; Tue, 21 Dec 2021 21:27:55 -0800 (PST) Received: from aqua.hq.igel.co.jp (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id v63sm737465pgv.71.2021.12.21.21.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Dec 2021 21:27:55 -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, Tomohito Esaki , Damian Hobson-Garcia , Takanari Hayama Subject: [RFC PATH 3/3] drm: replace allow_fb_modifiers with fb_modifiers_not_supported Date: Wed, 22 Dec 2021 14:27:27 +0900 Message-Id: <20211222052727.19725-4-etom@igel.co.jp> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211222052727.19725-1-etom@igel.co.jp> References: <20211222052727.19725-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 Since almost drivers support fb modifiers, allow_fb_modifiers is replaced with fb_modifiers_not_supported and removed. Signed-off-by: Tomohito Esaki --- drivers/gpu/drm/drm_framebuffer.c | 6 +++--- drivers/gpu/drm/drm_ioctl.c | 2 +- drivers/gpu/drm/drm_plane.c | 9 --------- drivers/gpu/drm/selftests/test-drm_framebuffer.c | 1 - include/drm/drm_mode_config.h | 16 ---------------- 5 files changed, 4 insertions(+), 30 deletions(-) diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c index 07f5abc875e9..4562a8b86579 100644 --- a/drivers/gpu/drm/drm_framebuffer.c +++ b/drivers/gpu/drm/drm_framebuffer.c @@ -309,7 +309,7 @@ drm_internal_framebuffer_create(struct drm_device *dev, } if (r->flags & DRM_MODE_FB_MODIFIERS && - !dev->mode_config.allow_fb_modifiers) { + dev->mode_config.fb_modifiers_not_supported) { DRM_DEBUG_KMS("driver does not support fb modifiers\n"); return ERR_PTR(-EINVAL); } @@ -594,7 +594,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev, r->pixel_format = fb->format->format; r->flags = 0; - if (dev->mode_config.allow_fb_modifiers) + if (!dev->mode_config.fb_modifiers_not_supported) r->flags |= DRM_MODE_FB_MODIFIERS; for (i = 0; i < ARRAY_SIZE(r->handles); i++) { @@ -607,7 +607,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev, for (i = 0; i < fb->format->num_planes; i++) { r->pitches[i] = fb->pitches[i]; r->offsets[i] = fb->offsets[i]; - if (dev->mode_config.allow_fb_modifiers) + if (!dev->mode_config.fb_modifiers_not_supported) r->modifier[i] = fb->modifier; } diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index 8b8744dcf691..51fcf1298023 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -297,7 +297,7 @@ static int drm_getcap(struct drm_device *dev, void *data, struct drm_file *file_ req->value = 64; break; case DRM_CAP_ADDFB2_MODIFIERS: - req->value = dev->mode_config.allow_fb_modifiers; + req->value = !dev->mode_config.fb_modifiers_not_supported; break; case DRM_CAP_CRTC_IN_VBLANK_EVENT: req->value = 1; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 75308ee240c0..5b546d80d248 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -302,15 +302,6 @@ static int __drm_universal_plane_init(struct drm_device *dev, } } - /* 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); - } - plane->modifier_count = format_modifier_count; plane->modifiers = kmalloc_array(format_modifier_count, sizeof(format_modifiers[0]), diff --git a/drivers/gpu/drm/selftests/test-drm_framebuffer.c b/drivers/gpu/drm/selftests/test-drm_framebuffer.c index 61b44d3a6a61..f6d66285c5fc 100644 --- a/drivers/gpu/drm/selftests/test-drm_framebuffer.c +++ b/drivers/gpu/drm/selftests/test-drm_framebuffer.c @@ -323,7 +323,6 @@ static struct drm_device mock_drm_device = { .max_width = MAX_WIDTH, .min_height = MIN_HEIGHT, .max_height = MAX_HEIGHT, - .allow_fb_modifiers = true, .funcs = &mock_config_funcs, }, }; diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index c56f298c55bd..6fd13d6510f1 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -904,22 +904,6 @@ struct drm_mode_config { */ bool async_page_flip; - /** - * @allow_fb_modifiers: - * - * Whether the driver supports fb modifiers in the ADDFB2.1 ioctl call. - * Note that drivers should not set this directly, it is automatically - * set in drm_universal_plane_init(). - * - * IMPORTANT: - * - * If this is set the driver must fill out the full implicit modifier - * information in their &drm_mode_config_funcs.fb_create hook for legacy - * userspace which does not set modifiers. Otherwise the GETFB2 ioctl is - * broken for modifier aware userspace. - */ - bool allow_fb_modifiers; - /** * @fb_modifiers_not_supported: * -- 2.17.1