Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp55353rdb; Sun, 28 Jan 2024 13:26:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IGcFhGjjZxxvKSRY4FxKBNyTXQWSJ1Z+3LKqQhuADjy8FaLHOe+27QQGcjSHil/TaK7BnPX X-Received: by 2002:a17:90a:5895:b0:294:be7b:16fc with SMTP id j21-20020a17090a589500b00294be7b16fcmr2267193pji.1.1706477185671; Sun, 28 Jan 2024 13:26:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706477185; cv=pass; d=google.com; s=arc-20160816; b=IyUjqQSLrRVFWUfMDBn5M7MHPDHx77ALcm6Lrx44ntzgNXXwMyL2O/Xbhc2AS3ZMuw SCvElT5+4pVFcvznks3Pj84yozzNIGbIssOrNhv7ofJEniXhaenTXfRvckl7BY5q8vR0 XqgJj7iFG/YeU7dSlVs7TT0TmJOgTbSv5iN0xXB+KnOgKpnXAhG83hAE/mBloMRVMdVA Yt57lnUsCWnp6okAouQxSy6gueALng9wUJw0DfPgP0/E0K9mpLCPj3rwjaGdKzKGhR49 IwTCYE0ajypfrWXORHEoySle/sXhXHrfCeCzqXMoQ8erIyoiqBeVrd5/8TzGf4eLZhXe o0/w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ZabLYiK1CYMel8JukYGi2S/lIUCPgU/oF9HydEUjizI=; fh=njd2ecPfO+MOSUbjxezZy5Zaoa3J5aSXR1p04i4lAW0=; b=iGD7ejTWH3Aidpd0de2bmmkL6B0ovKLaX6IDd84A9YCoJSYV73BbHZ1pqby+Uwcx17 C3ekpCBuiMRwW7jixrj7TiR5JZ8NlxgummnyOCPR20Njjz9YV7K9szc2jyQITGkoYWf5 7Qb8k1PFmTt0ZAp6l9fzzZU9az6TV3vjqVRiTOMD4qfkKc1RUVwfqggDbvCR1DFl6ac2 Zg/CqUGU4Bc2nTbwC06XhUR6vitRdy/lTMVn6x9w0LIwbeFzZtJb5OqwQv3Y0BEjj0m8 o2ida/hpLlKDthHDBd6QAnSF0kjdY8NMT0H20K7c/YIAAGMQWYEGAiaFfWY0puoraUky R4vg== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=sTdTnV8K; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-41964-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41964-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v23-20020a17090a521700b002901ec8a477si3592321pjh.64.2024.01.28.13.26.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 13:26:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-41964-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=sTdTnV8K; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-41964-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-41964-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 97CDDB20FBB for ; Sun, 28 Jan 2024 21:26:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13FC4446CA; Sun, 28 Jan 2024 21:25:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="sTdTnV8K" Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0191D3C480 for ; Sun, 28 Jan 2024 21:25:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706477140; cv=none; b=eGlniGVTWsRNdflqzVsahgKrppVAbjHL3MXzSXP3DpolTellMVtTRY3HrpDwleUr11UCppSHBAvuZDfB/sH52cott6gJd1gzjRhglxfWQxYYogpnohsxszxtl9KQQgsMGptpjLMQOqKXdiLiuTkS7pdU2RmyC9V/xi+AlndotDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706477140; c=relaxed/simple; bh=q2o1SfbPZrT5U3Oc3x3XPvH3UQjxmd9gBQstr09RxAQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mQxQyUjK9NNwCbpb1CHa3NVXKtE+Yc/nKe1qMJmAIakDe3k6p0KsUzrHivKx4fHOYZuCRUnTjbw4yDW6/vGybgYEs5OhoKXumNZVnIFr8b/2v+Pr0rRmZ5Y4tT7lpz8FQs7JJapaTNVADgZ23hWqKP/h5pLztOFMkFVqik0uGHE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=sTdTnV8K; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=ZabLYiK1CYMel8JukYGi2S/lIUCPgU/oF9HydEUjizI=; b=sTdTnV8KGZYjh/k/J0CAcEaB+f N+u1qMUI4AKBfpjYRhut8fxG8FOpeB02fQ7ai+fnzPn11XMuEH2ZQdHNtDrdi/pDYDBGYX9bua03n UYp3F5gcke50iXJrtPwkRG2OuEynoW83lLc8u9llPAieTketeDqLDME7eL8pZw9zX+zpnkiXSt01Z sofkQ71aBbylnAPbhtNmRhMrseYrXuLpw1QVv0Ct9Kj3Ey+EzH7Z4bCGb8Zjf0Pz5QZv1tx69BAxo OKEPVMghNpyCIVyfMXROq8LtZnYTXsxV3FLs7oWfyszRX/UQDOeO+n7SgtIvf77K8jbbZp0mdVcnx p4X8xgkg==; Received: from 201-42-129-61.dsl.telesp.net.br ([201.42.129.61] helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1rUCek-00B1M8-Mr; Sun, 28 Jan 2024 22:25:35 +0100 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, Simon Ser , Pekka Paalanen , daniel@ffwll.ch, Daniel Stone , =?UTF-8?q?=27Marek=20Ol=C5=A1=C3=A1k=27?= , Dave Airlie , ville.syrjala@linux.intel.com, Xaver Hugl , Joshua Ashton , =?UTF-8?q?Michel=20D=C3=A4nzer?= , =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH v3 3/3] drm/amdgpu: Implement check_async_props for planes Date: Sun, 28 Jan 2024 18:25:15 -0300 Message-ID: <20240128212515.630345-4-andrealmeid@igalia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240128212515.630345-1-andrealmeid@igalia.com> References: <20240128212515.630345-1-andrealmeid@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AMD GPUs can do async flips with changes on more properties than just the FB ID, so implement a custom check_async_props for AMD planes. Allow amdgpu to do async flips with overlay planes as well. Signed-off-by: André Almeida --- v3: allow overlay planes .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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 116121e647ca..ed75b69636b4 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 @@ -25,6 +25,7 @@ */ #include +#include #include #include #include @@ -1430,6 +1431,33 @@ static void amdgpu_dm_plane_drm_plane_destroy_state(struct drm_plane *plane, drm_atomic_helper_plane_destroy_state(plane, state); } +static int amdgpu_dm_plane_check_async_props(struct drm_property *prop, + struct drm_plane *plane, + struct drm_plane_state *plane_state, + struct drm_mode_object *obj, + u64 prop_value, u64 old_val) +{ + struct drm_mode_config *config = &plane->dev->mode_config; + int ret; + + if (prop != config->prop_fb_id && + prop != config->prop_in_fence_fd) { + ret = drm_atomic_plane_get_property(plane, plane_state, + prop, &old_val); + return drm_atomic_check_prop_changes(ret, old_val, prop_value, prop); + } + + if (plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY && + plane_state->plane->type != DRM_PLANE_TYPE_OVERLAY) { + drm_dbg_atomic(prop->dev, + "[OBJECT:%d] Only primary or overlay planes can be changed during async flip\n", + obj->id); + return -EINVAL; + } + + return 0; +} + static const struct drm_plane_funcs dm_plane_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, @@ -1438,6 +1466,7 @@ static const struct drm_plane_funcs dm_plane_funcs = { .atomic_duplicate_state = amdgpu_dm_plane_drm_plane_duplicate_state, .atomic_destroy_state = amdgpu_dm_plane_drm_plane_destroy_state, .format_mod_supported = amdgpu_dm_plane_format_mod_supported, + .check_async_props = amdgpu_dm_plane_check_async_props, }; int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, -- 2.43.0