From patchwork Mon Oct 24 03:08:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Joaqu=C3=ADn_Ignacio_Aramend=C3=ADa?= X-Patchwork-Id: 8140 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp228673wru; Sun, 23 Oct 2022 20:15:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Lk6P0UF2qrKBLk4J0r35aTj5hLEBnU8cZHITNRAy/uJuh+OETc/wze4i1qs0y4ZaLcWVp X-Received: by 2002:a17:90b:390c:b0:20d:a662:dac2 with SMTP id ob12-20020a17090b390c00b0020da662dac2mr64150805pjb.5.1666581345410; Sun, 23 Oct 2022 20:15:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666581345; cv=none; d=google.com; s=arc-20160816; b=i5u/ko5X2eiJueWI95cI9YPpWfaY8pAO7+9trBQQIy7ptkymxoTJxjdeRscmcNcsJy NW7ECP2q7zWA5nkoLxe4UXulBx9aLYaJdg5ApsWgNVjXRaLoetCZ77ZQo3cpskaxT/4N Hf2QH2khZKr7oZMWQXIOZGzl6PKDFOT+rk+DKFYR07+WPft8gHU06RoNuRTp8yMTYk7E aFgex0f27uO/05MgHHsDMx8aLbMbZI1WeGYzdbkY2ZygcPU+89/PRxQWMMH/vQ4heULr bFAEaYa0OeHAISNBP56C9hceDxQCWFINQeEHQ+86VMKfsCHuvbngT8NN1kggUT3aeWgj B3CA== 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=k8/YknSbFQ9UGuXWJAjoOa3rxaDwNTtu301KrN7t33w=; b=cA1maMN/0vH8bmle9xJ0/TB2edoztAhSVOqHEkIlFnjbcpPasyIghUZ9DkevpxdT5a XxMxkIllXMc5eldzfeyC649anJo18Z5OR8joZBcXTflCTd1jdvuUWdTV//lgGLBZ+sXB WEPoQYza5n2+2/cM9rellkaptnrBbbpiiXpOHD+i4GjUgYBKYIiXknTpjE37OleFSc++ YOld3u3ij7XYtjBFj/8ElgzX1m0q3LaroMxYSTS0KdXTVHI/k3RI0s4drzFOzFcSsVGT Ikw/nZxFx9B/WaHyKQkOwjL8pBoqoJFtHzUFUfEi93CD2hv1QaMY53xMq6VHyx3xKUda RG0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UxW4It48; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s3-20020a17090a440300b0020243dc975bsi7324732pjg.116.2022.10.23.20.15.33; Sun, 23 Oct 2022 20:15:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UxW4It48; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbiJXDOy (ORCPT + 99 others); Sun, 23 Oct 2022 23:14:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbiJXDNu (ORCPT ); Sun, 23 Oct 2022 23:13:50 -0400 Received: from mail-oa1-x2d.google.com (mail-oa1-x2d.google.com [IPv6:2001:4860:4864:20::2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD447757F; Sun, 23 Oct 2022 20:13:00 -0700 (PDT) Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-13b6c1c89bdso4659545fac.13; Sun, 23 Oct 2022 20:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k8/YknSbFQ9UGuXWJAjoOa3rxaDwNTtu301KrN7t33w=; b=UxW4It4842ubChhEIJFFyORGE03n8vikDzc0DCblWfILHwUmLC2KDL7Nawf2ibu/s4 bJ3P4MNzCZS/3py1/tt6al5dqe2dkStiqrd7TpbROmT7ho/ta89ga7xaanV2IQU8zSA1 U8H+WmKvzZHIjfDX2clipcOQuKPK2lP9vXjCo1jVfWozHFaiOSheRF2HnvE6VzR9cIZI /GDdt5Yhspedsy6f8xmqRJeme8Gqz4M2nIhRBQrA08CFsjdklwimZKTubIU3zjSM7NIE Nl/pdsUbbDYcqfKUdJEFeBxL4MzYtYtnlGVjwCbvnsd6zfaBljXJxLQZAI+LxRsGfH1j 65LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k8/YknSbFQ9UGuXWJAjoOa3rxaDwNTtu301KrN7t33w=; b=eZ9L0l/76iyyoIsRhmJdlL7n6DQ1Vp2I0Bw9k9sWLJ851lwkT0N4Vq0EmB6znkgwsc gBqET6C3VAKCjbmhnrLPKyQLdxWItBE2zjuVTuvX1PRKeUhgAobTlda3nEgFjRKSg/IQ 5DUGH/0FHMKbEkzxbEPFCHpKH02vCiZ+PqW1zIURktO398o3ueWf1bcvvhmDwyL3wXwO epQVPjj1GSO0PELNTWpCV4U8TCeCKsKFwnjoSRwjCpZU/UPP8cMQqx4uWRXaZchsrHPa gjxKxeMzcNYJedeQ7Vs2Kr1exnCcWxdmI0Qw2uzd9tazCvUwazFRqkzivtuB6cb/CJib SxaA== X-Gm-Message-State: ACrzQf04UR5E+7Nz3i+VzMKX6vi9HaqfnN/3f1yayLJPjp4tklaYsX0N NWIUW9WI4IbjzzzsqbGJd5w1QuviRAGkOQ== X-Received: by 2002:a05:6870:4284:b0:13b:91b7:89a8 with SMTP id y4-20020a056870428400b0013b91b789a8mr2946370oah.284.1666581179060; Sun, 23 Oct 2022 20:12:59 -0700 (PDT) Received: from smeagol.fibertel.com.ar ([201.235.4.68]) by smtp.gmail.com with ESMTPSA id a12-20020a056870618c00b0013b92b3ac64sm1599365oah.3.2022.10.23.20.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Oct 2022 20:12:58 -0700 (PDT) From: =?utf-8?q?Joaqu=C3=ADn_Ignacio_Aramend=C3=ADa?= To: bas@basnieuwenhuizen.nl Cc: Xinhui.Pan@amd.com, alexander.deucher@amd.com, amd-gfx@lists.freedesktop.org, christian.koenig@amd.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, rodrigo.siqueira@amd.com, samsagax@gmail.com, sunpeng.li@amd.com, stable@vger.kernel.org Subject: [PATCH v2] drm/amd/display: Revert logic for plane modifiers Date: Mon, 24 Oct 2022 00:08:33 -0300 Message-Id: <20221024030832.119039-1-samsagax@gmail.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747130811824910386?= X-GMAIL-MSGID: =?utf-8?q?1747537200772759952?= This file was split in commit 5d945cbcd4b16a29d6470a80dfb19738f9a4319f ("drm/amd/display: Create a file dedicated to planes") and the logic in dm_plane_format_mod_supported() function got changed by a switch logic. That change broke drm_plane modifiers setting on series 5000 APUs (tested on OXP mini AMD 5800U and HP Dev One 5850U PRO) leading to Gamescope not working as reported on GitHub[1] To reproduce the issue, enter a TTY and run: $ gamescope -- vkcube With said commit applied it will abort. This one restores the old logic, fixing the issue that affects Gamescope. [1](https://github.com/Plagman/gamescope/issues/624) Signed-off-by: Joaquín Ignacio Aramendía Reviewed-by: Bas Nieuwenhuizen --- Removed asic_id and excess newlines --- .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 50 +++---------------- 1 file changed, 7 insertions(+), 43 deletions(-) -- 2.38.1 diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c index dfd3be49eac8..e6854f7270a6 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c @@ -1369,7 +1369,7 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, { struct amdgpu_device *adev = drm_to_adev(plane->dev); const struct drm_format_info *info = drm_format_info(format); - struct hw_asic_id asic_id = adev->dm.dc->ctx->asic_id; + int i; enum dm_micro_swizzle microtile = modifier_gfx9_swizzle_mode(modifier) & 3; @@ -1386,49 +1386,13 @@ static bool dm_plane_format_mod_supported(struct drm_plane *plane, return true; } - /* check if swizzle mode is supported by this version of DCN */ - switch (asic_id.chip_family) { - case FAMILY_SI: - case FAMILY_CI: - case FAMILY_KV: - case FAMILY_CZ: - case FAMILY_VI: - /* asics before AI does not have modifier support */ - return false; - case FAMILY_AI: - case FAMILY_RV: - case FAMILY_NV: - case FAMILY_VGH: - case FAMILY_YELLOW_CARP: - case AMDGPU_FAMILY_GC_10_3_6: - case AMDGPU_FAMILY_GC_10_3_7: - switch (AMD_FMT_MOD_GET(TILE, modifier)) { - case AMD_FMT_MOD_TILE_GFX9_64K_R_X: - case AMD_FMT_MOD_TILE_GFX9_64K_D_X: - case AMD_FMT_MOD_TILE_GFX9_64K_S_X: - case AMD_FMT_MOD_TILE_GFX9_64K_D: - return true; - default: - return false; - } - break; - case AMDGPU_FAMILY_GC_11_0_0: - case AMDGPU_FAMILY_GC_11_0_1: - switch (AMD_FMT_MOD_GET(TILE, modifier)) { - case AMD_FMT_MOD_TILE_GFX11_256K_R_X: - case AMD_FMT_MOD_TILE_GFX9_64K_R_X: - case AMD_FMT_MOD_TILE_GFX9_64K_D_X: - case AMD_FMT_MOD_TILE_GFX9_64K_S_X: - case AMD_FMT_MOD_TILE_GFX9_64K_D: - return true; - default: - return false; - } - break; - default: - ASSERT(0); /* Unknown asic */ - break; + /* Check that the modifier is on the list of the plane's supported modifiers. */ + for (i = 0; i < plane->modifier_count; i++) { + if (modifier == plane->modifiers[i]) + break; } + if (i == plane->modifier_count) + return false; /* * For D swizzle the canonical modifier depends on the bpp, so check