From patchwork Sun Jan 24 20:47:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mario Kleiner X-Patchwork-Id: 12042641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C04AC433E0 for ; Sun, 24 Jan 2021 20:48:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 071BA22C7B for ; Sun, 24 Jan 2021 20:48:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 071BA22C7B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD2F089CF8; Sun, 24 Jan 2021 20:48:01 +0000 (UTC) Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by gabe.freedesktop.org (Postfix) with ESMTPS id A041789CF8 for ; Sun, 24 Jan 2021 20:48:00 +0000 (UTC) Received: by mail-ed1-x532.google.com with SMTP id d22so12871614edy.1 for ; Sun, 24 Jan 2021 12:48:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6tKRRX5Kl2zZPx/o+OFynVwdni47rXNbZksLyVensQY=; b=WRO2LlBxLF4O8t17LzYi5Bfcis0iogDScAuXvFn6cmWXCpi1viOxqn6v5t4BwL67LI LRUmuPQOaAHYhpnh6doS8K3Zr1TRpO1qvJ2u53+FRnb4UaDP4qHYd8mKidaCEZoEOw7m 7ZvPE1UoVnYFnWqzLBo65tvcPiGYoV2NHbKcwXgDunFT5opsgR0khlcLK2dPf7E7smnG k/xAFlrzK1HYeo+fr3qZOIe5andKlLN4FDVrKA/HcOb3Hk2hHW6LLEvGfUR0qns/M1fJ 5aKKuf7qpAH4su7T6k+eSCmnLruOELNYKXUtqN9Q7ioCxVKBXtNSoIoKawBf+Gs1VDsY YRKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6tKRRX5Kl2zZPx/o+OFynVwdni47rXNbZksLyVensQY=; b=fwgQBkLRRCJBtWkVYRZ+XdkPm96JYZr3vs+hHjxCnBeVvVHdqlnfTJ2Xdfaf2Py2Rl eVEE8p4ygEQehBcWv/HJBChkTtHIR9TpeZ70SJimDG63jZnzjTQ9ywegELa1yF55oXiA zTqAK2z2wG0bvcZpN0pm1HQJY83xNuZ5ebH3HDGdVmLtayMmpA8yn3ZEWSJOJJeR99bn l/rc3Nm4ErJ3X/VI9nWoZr6twIg/8Texfbc7/35sjFg/ccS4WpTaVGlNDZDvXkuzl9qJ SyO2kgpNyWkaWS9jTnsWoD+PWuPEX9Og7Tc9Fexmq28E5hbiFvJQ/SGuwq3oaJuKB5Ua pGtA== X-Gm-Message-State: AOAM530wr+Fi93+IpkvbNukMNCIbl97XSVzeTN7GLpbtKMv5d69Ryj4Y EDT38X44+dheBxdJoSYPS/I3uFV8SE0= X-Google-Smtp-Source: ABdhPJxKFSkd1sSCyxz+sw03LbPqmJ6s8+VwL4nOVOzi2dHRTwJ9jHAwn/BZ70oTGZiGMULZy01PTQ== X-Received: by 2002:a05:6402:19a:: with SMTP id r26mr1350198edv.54.1611521279005; Sun, 24 Jan 2021 12:47:59 -0800 (PST) Received: from twisty.localdomain (dynamic-2a01-0c22-d4ca-c600-6cbb-50d4-b91e-5b37.c22.pool.telefonica.de. [2a01:c22:d4ca:c600:6cbb:50d4:b91e:5b37]) by smtp.gmail.com with ESMTPSA id x9sm7356207ejd.99.2021.01.24.12.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Jan 2021 12:47:58 -0800 (PST) From: Mario Kleiner To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/simple-kms: Drop drm_simple_kms_format_mod_supported. Date: Sun, 24 Jan 2021 21:47:48 +0100 Message-Id: <20210124204748.25234-1-mario.kleiner.de@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The check was introduced to make sure that only the DRM_FORMAT_MOD_LINEAR modifier is accepted by tinydrm. However, if .format_mod_supported is not hooked up to drm_simple_kms_format_mod_supported then the core will simply validate modifiers against the format_modifiers list passed into drm_simple_display_pipe_init() or drm_universal_plane_init() and perform the same validation as drm_simple_kms_format_mod_supported() would have done. Additionally, if a kms driver / plane does not support modifiers, it will not reject fb updates with no modifiers/ DRM_FORMAT_MOD_INVALID. This is important, because some simple drm drivers, e.g., pl111, pass NULL as format_modifiers list, so modifier support is disabled for these drivers, userspace would fall back to drmAddFB() without modifiers, and ergo the current drm_simple_kms_format_mod_supported() function would reject valid modifier-less fb's. So this should fix display on non-tinydrm drivers like pl111, and probably also for non-atomic clients? The Mesa vc4 gallium driver mentions pl111 as one possible display driver in render_only mode, so i assume this matters for some SoC's? The background for the patch that introduced this was to fix atomic modesetting in the X-Servers modesetting-ddx, but with atomic modesetting and format modifiers disabled in modesetting-ddx (and also current kernels when interacting with modesetting-ddx), i assume this should fix some panels. Note that i don't have any of the hw required for testing this, this is purely based on looking at the code, so this patch is only compile-tested. For more reference, this fix was motivated by some discussions around broken page-flipping on VideoCore6 / RaspberryPi 4 with current Raspbian OS, so the experts may want to weigh in on that Mesa bug report as well, under the following link: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3601 Fixes: dff906c3f91c ("drm/tinydrm: Advertise that we can do only DRM_FORMAT_MOD_LINEAR.") Signed-off-by: Mario Kleiner Cc: Eric Anholt Cc: Noralf Trønnes Cc: Maxime Ripard --- drivers/gpu/drm/drm_simple_kms_helper.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/drm_simple_kms_helper.c b/drivers/gpu/drm/drm_simple_kms_helper.c index 743e57c1b44f..5f3e30553172 100644 --- a/drivers/gpu/drm/drm_simple_kms_helper.c +++ b/drivers/gpu/drm/drm_simple_kms_helper.c @@ -229,13 +229,6 @@ static void drm_simple_kms_plane_cleanup_fb(struct drm_plane *plane, pipe->funcs->cleanup_fb(pipe, state); } -static bool drm_simple_kms_format_mod_supported(struct drm_plane *plane, - uint32_t format, - uint64_t modifier) -{ - return modifier == DRM_FORMAT_MOD_LINEAR; -} - static const struct drm_plane_helper_funcs drm_simple_kms_plane_helper_funcs = { .prepare_fb = drm_simple_kms_plane_prepare_fb, .cleanup_fb = drm_simple_kms_plane_cleanup_fb, @@ -250,7 +243,6 @@ static const struct drm_plane_funcs drm_simple_kms_plane_funcs = { .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, - .format_mod_supported = drm_simple_kms_format_mod_supported, }; /**