From patchwork Wed Oct 21 16:32:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11849417 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=-12.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 D73CDC55179 for ; Wed, 21 Oct 2020 16:32:53 +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 5312320872 for ; Wed, 21 Oct 2020 16:32:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Q04BouVn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5312320872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 6A1ED6EDD5; Wed, 21 Oct 2020 16:32:51 +0000 (UTC) Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1D9AF6EDD3 for ; Wed, 21 Oct 2020 16:32:50 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id t9so3746992wrq.11 for ; Wed, 21 Oct 2020 09:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dWPluaY/fdJwctZMykbZWvFFDF2mR5Py4vGKTofXd+8=; b=Q04BouVngbRdV5wxTNhSSRkra+WMFXFg42+1lRqECLQTCZDbklwhEdm0f2rJo5CANi vmnguTyOeZs8XJk7LhX5VabUxiNOIISI5gaFcY4pmcBWD6lEr3FQVqWdUQX5n5zad239 z9v+HG6iHSssDx+bxSYzpdmoxS3o9jDC/DVgo= 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=dWPluaY/fdJwctZMykbZWvFFDF2mR5Py4vGKTofXd+8=; b=qoUTaaSM91IsrE0dgiXA3613CtVj+5inEm7PsarG04hk/B/RWhIOzl6TJZ3dCvSHUF PBs9MF1eByrTq6WeDTg6NUbb4A5AxYy7sfwF5VnEf2iQciGBpyiFY7IpiXHOtQSvhP4m wwz15DkeevQtN4deX1vMPhPgIo6Z+UlI3A/XMylWOufd+0gFyY3F9AtC9WKupNkdhscL P9aG1DXxgZUshK4eyf1MCwxnZmDAtDZFh6ytIF1f7hTkHxEf2/zTSlQ5GuL51lLlDwno 7NC+LkMe5y961KJN5joo7vtPrUwyYpQdNCzRLUNo+yEly/n4AQ7Y2EwWH4Iz+ckLOwdQ gyjg== X-Gm-Message-State: AOAM533+ySV9Rfkk9Y+sksdDLGMg/GQ69w+qJjf8MzVKcVHW0aYOROo6 TOUx6Fa/xqPIGLLfZRe2RD/+CLHrKyURvUFa X-Google-Smtp-Source: ABdhPJwmOTGqHFKqQUTMBuUZBxeF86lPtUg/wWEwfEhIb64Cv8KLNJhnmQddksJTzyoEd1TV0Dullw== X-Received: by 2002:adf:f54c:: with SMTP id j12mr5802564wrp.413.1603297968501; Wed, 21 Oct 2020 09:32:48 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id v17sm5547431wrc.23.2020.10.21.09.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Oct 2020 09:32:47 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 1/3] drm/atomic-helpers: remove legacy_cursor_update hacks Date: Wed, 21 Oct 2020 18:32:40 +0200 Message-Id: <20201021163242.1458885-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.28.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: , Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter , mikita.lipski@amd.com, =?utf-8?q?M?= =?utf-8?q?ichel_D=C3=A4nzer?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The stuff never really worked, and leads to lots of fun because it out-of-order frees atomic states. Which upsets KASAN, among other things. For async updates we now have a more solid solution with the ->atomic_async_check and ->atomic_async_commit hooks. Support for that for msm and vc4 landed. nouveau and i915 have their own commit routines, doing something similar. For everyone else it's probably better to remove the use-after-free bug, and encourage folks to use the async support instead. The affected drivers which register a legacy cursor plane and don't either use the new async stuff or their own commit routine are: amdgpu, atmel, mediatek, qxl, rockchip, sti, sun4i, tegra, virtio, and vmwgfx. Inspired by an amdgpu bug report. v2: Drop RFC, I think with amdgpu converted over to use atomic_async_check/commit done in commit 674e78acae0dfb4beb56132e41cbae5b60f7d662 Author: Nicholas Kazlauskas Date: Wed Dec 5 14:59:07 2018 -0500 drm/amd/display: Add fast path for cursor plane updates we don't have any driver anymore where we have userspace expecting solid legacy cursor support _and_ they are using the atomic helpers in their fully glory. So we can retire this. References: https://bugzilla.kernel.org/show_bug.cgi?id=199425 Cc: mikita.lipski@amd.com Cc: Michel Dänzer Cc: harry.wentland@amd.com Signed-off-by: Daniel Vetter --- drivers/gpu/drm/drm_atomic_helper.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index a7bcb4b4586c..549a31e6042c 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -1481,13 +1481,6 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, int i, ret; unsigned crtc_mask = 0; - /* - * Legacy cursor ioctls are completely unsynced, and userspace - * relies on that (by doing tons of cursor updates). - */ - if (old_state->legacy_cursor_update) - return; - for_each_oldnew_crtc_in_state(old_state, crtc, old_crtc_state, new_crtc_state, i) { if (!new_crtc_state->active) continue; @@ -2106,12 +2099,6 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, continue; } - /* Legacy cursor updates are fully unsynced. */ - if (state->legacy_cursor_update) { - complete_all(&commit->flip_done); - continue; - } - if (!new_crtc_state->event) { commit->event = kzalloc(sizeof(*commit->event), GFP_KERNEL);