Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp2673493ybn; Thu, 26 Sep 2019 15:54:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwNS+qUWMfVsax2wNka7iH0Jj6sdgxAY9qD2Fq3H436evAhjurJPEjuyX+FgqJgoPyaB8vi X-Received: by 2002:a05:6402:16d5:: with SMTP id r21mr1337748edx.71.1569538452199; Thu, 26 Sep 2019 15:54:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569538452; cv=none; d=google.com; s=arc-20160816; b=TNI+vbbL+SmQQkahJaojamWUcyIukAbrJVn9mpHVD2hqtBQ1YcwXyZaMnbHBdBMA6j rxcSdnaAYPVC1T4z4JMJXcBgxZFP8R7W7OguJQgSoioIC09+scCtPxah0evhjJ3M/ir/ 4VJGArVvj8gJUGQ5BqXLo3Sn48wYPjqy3s4UYnSMHajkCs7Mjkl4UbLc5ApfGiSwBMU5 KE2MdKjfguziAiJ26GbL3H8v7tmD86H0xiM08THNOZKv2ZWpWm9saf6ziVxwJbhzebJH PJMXNvaRX8nmoQH7Vh/emSZlEHoE5DbzT80LUS8fpNlffYTyqGBw+JxThDBmEM57IcAS MlRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=SfYLsmWZJcRbVKiyf2r7hGlwtIw1wXCuqmtpJBPkYFw=; b=kZxJ7Q5XU8nX7cLjDeVPudizMzPDxAWCrrsS8Z1Fk3bkO6ycipxx+IHPAr+wn8D10Z +fZO4ROOOhOu+Ge//2x3kt1R9D7+9sqzLiYVRXe5rCEueURu4F+ts7TmYHEPA4r1685/ fFyKVCozqGTds8iamuQ6P9KWs04aYGgnostg81w1PCy8BI2/IhzUJ04Gt9/aHs1TYgGN mX2IkQK5YfYOhU02ooQZuLz57iyX1EYau4E1WNTTBt6EXfAA5JQX/L2ZNkq68rnR7yYt jhDLnNj091wPz7Lie3brcHN7Bp/HWGg9Ko4Rr9kmTU9z9TkbBU0qxOqKgeCSDyewXaq+ JX1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w12si449458edx.223.2019.09.26.15.53.45; Thu, 26 Sep 2019 15:54:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728047AbfIZWvz (ORCPT + 99 others); Thu, 26 Sep 2019 18:51:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbfIZWvz (ORCPT ); Thu, 26 Sep 2019 18:51:55 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FD5D30872C5; Thu, 26 Sep 2019 22:51:54 +0000 (UTC) Received: from malachite.bss.redhat.com (dhcp-10-20-1-34.bss.redhat.com [10.20.1.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F1DD600C1; Thu, 26 Sep 2019 22:51:49 +0000 (UTC) From: Lyude Paul To: amd-gfx@lists.freedesktop.org Cc: "Daniel Vetter" , "Alex Deucher" , "Leo Li" , "David Airlie" , =?UTF-8?q?Christian=20K=C3=B6nig?= , "David Francis" , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, "David (ChunMing) Zhou" , "Jerry (Fangzhi) Zuo" , "Harry Wentland" , "Thomas Lim" , "Lyude Paul" , "Mario Kleiner" , "Nicholas Kazlauskas" , "Dingchen Zhang" , "Brajeswar Ghosh" , "Sam Ravnborg" , "Maarten Lankhorst" , "Sean Paul" , "Maxime Ripard" Subject: [PATCH 0/6] drm/amdgpu: Fix incorrect encoder API usages Date: Thu, 26 Sep 2019 18:51:02 -0400 Message-Id: <20190926225122.31455-1-lyude@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 26 Sep 2019 22:51:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Noticed this while trying to respin my MST suspend/resume patch series. It's not technically possible (at least until someone moves amdgpu away from the deprecated drm_device->driver->{load,unload} hooks) for amdgpu to properly register all of it's encoders before registering with userspace. However, amdgpu also apparently adds and removes encoders along with MST connectors - which is a much bigger issue as userspace applications definitely do not expect this type of behavior. So, let's fix it and add some WARNs() so new drivers don't accidentally make this mistake in the future. Lyude Paul (6): drm/amdgpu/dm/mst: Don't create MST topology managers for eDP ports drm/amdgpu/dm/mst: Remove unnecessary NULL check drm/amdgpu/dm/mst: Use ->atomic_best_encoder drm/amdgpu/dm/mst: Make MST encoders per-CRTC and fix encoder usage drm/amdgpu/dm/mst: Report possible_crtcs incorrectly, for now drm/encoder: WARN() when adding/removing encoders after device registration drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h | 3 ++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++++++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 1 - .../display/amdgpu_dm/amdgpu_dm_mst_types.c | 46 ++++++++++--------- .../display/amdgpu_dm/amdgpu_dm_mst_types.h | 3 ++ drivers/gpu/drm/drm_encoder.c | 31 ++++++++++--- 6 files changed, 70 insertions(+), 29 deletions(-) -- 2.21.0