From patchwork Thu Feb 8 21:05:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 198579 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp452521dyd; Thu, 8 Feb 2024 13:06:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEN7Q7ryToUXXjSiZ4DRMyuIh65wwLHG32bm9pWv/UXp85cijId41TZA3mSFQClXxZM1WeF X-Received: by 2002:a05:620a:31a0:b0:783:915c:1fc4 with SMTP id bi32-20020a05620a31a000b00783915c1fc4mr969370qkb.20.1707426415618; Thu, 08 Feb 2024 13:06:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707426415; cv=pass; d=google.com; s=arc-20160816; b=fbHhI7U/VIPx+9kp4uj+qm5+rgKUYPrT6HbQl5+PbDkVupyQy925MsTKeIRKee+O5K ganafOSvfoWc+2g20SLKYTxQYS8xTtWZK7BmoZWl61HTvSvmBDrc6yHvPic+tDNzoQiw vQpoqSDSZXsuSoEaOdWfiy5lOg0frCmhZ2x08B281xgDNmf34g8o3IPp0KEWFfRn5Pm4 OqY1gxC42HzvCDerXr+a1CJYv0nK33XL4sAMsGv0pWmwmhl7vMyOWbsOA5+Gt8zTgfxf v0s9LWAfs+9H6GlY5jYdL8qaUCFpGJHbNw8Pys9Aaf8hrnJ8rQ7KqKukrmxX3E/TPi76 lXgQ== 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=krDIRYgU1uLFsIvNtqFMjTjuXBLodI3PgcqmjvYIA64=; fh=Cv+VwTeVT4bLzbrNnKb50OC0cma7dwz1HijjE2mmstQ=; b=faCiiH5S/IsfubEt+6IwuPQSz31JGu/7XdubRn94bija6juUaGE96akYJADoSYA5Kx DGNyzhYFr0uDr9+8uAtb+dzaEQ8UL3CaeTzpliC2g5oYzI8ekjKaR/KYpSCEcC6VK2NZ 6y9SrIcCkh5h7vnBquHMhT8xm63sp/1ddCwr9M64P3lnomSSQsvoVuh2bsjSNe0BQHBk mNfQXEXKWXvLoy43s0Zn2jXHl/pr1QNf634+kkEEDiCElfiNUxgMwAsRgtr8IrQ+zCBI V9iTLaRyW0ygeFGjcoj0chiUCu3yu6tJxuPA6JxA30FoJSQ+YpHLdcnkNcwRCk/WbRsj FJ1Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b="hvr/cR0O"; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-58694-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58694-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVWfAqboxZYbTP7J78ZxCr5OX509OZGUTsBZaSPRG/DrQnp0B/h5NB8nTIx+AlHqmCX0nIKVgxrYCoDnusrWoczwJ7PYw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id os40-20020a05620a812800b0078393cb6533si418927qkn.243.2024.02.08.13.06.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Feb 2024 13:06:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-58694-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b="hvr/cR0O"; arc=pass (i=1 spf=pass spfdomain=igalia.com dkim=pass dkdomain=igalia.com); spf=pass (google.com: domain of linux-kernel+bounces-58694-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-58694-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5172F1C22F94 for ; Thu, 8 Feb 2024 21:06:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 09E764F5FA; Thu, 8 Feb 2024 21:06:15 +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="hvr/cR0O" 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 710304C3BB for ; Thu, 8 Feb 2024 21:06:06 +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=1707426371; cv=none; b=brvODFhfqh2KVg1zXkAAGORv3Vwf2A7UXNPHEqmVi8rYX5t4hMtpSrU+8JVzDuzv+P+YHhDxU4LNMl9xMr1Z38+bh+PfqP5lBRxs4WrdXYt6NjWhETri9uC/WshbaW7AqE8C5yefYX9aXib0AwPXUt5qk8F9EAwc4eBT+tbUbBM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707426371; c=relaxed/simple; bh=5ThtQbWLBgHmpYKWBlCX/ig9OsKqfKuNyKhycD5kgVI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RNFkFzCOx/ukhm+q8J1iOYfp5VKjNuUjh5h/TyyAOfERmA0Dgqn0VLVvl1OhehrvtZYQmSuPTG2HmiAZny/pxvzU1QwSmsoS0nlp37QNiXfOBn5yXWDesSk0/R9YrN/t2Ls0p5hN8HLouT1NrFWxdmFPBLDhRr5Y+WbN6G4/1gY= 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=hvr/cR0O; 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=krDIRYgU1uLFsIvNtqFMjTjuXBLodI3PgcqmjvYIA64=; b=hvr/cR0OHf6P3tXchCv2gDE5aR PVtyfC8SHe/BPtOuviR8yFT02FG/43kEbAnTlNU5BxEqQjOkgPs7iorjBv1dfuFiNwpel9TR20pDn nzqrLugDg5OIAhtBj3CBhIO45J+Mge9L605ebRtZY3wAOyJnbJSTI2ZEKUcqlyYeB++k8+K592jfH Kr0QG+L0fbMxxJIo5XvZ5LqPrMKo/FSML27ad/kxcGHSTOYIjGnpY8QkoM/s1EOYbM7ERCsrchhOY 1wsj4MU3d17wuKKAt1z4vG0lUhaK/05C67sJ0Y20gxnR6LiKutb5yjbQNatTw4YcY/JUij+OSkHAC zFsE88YQ==; Received: from [177.45.63.184] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1rYBat-00FMBk-2a; Thu, 08 Feb 2024 22:06:03 +0100 From: =?utf-8?q?Andr=C3=A9_Almeida?= 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?b?J01hcmVrIE9sxaHDoWsn?= , Dave Airlie , ville.syrjala@linux.intel.com, Xaver Hugl , Joshua Ashton , =?utf-8?q?Michel_D=C3=A4nzer?= , =?utf-8?q?Andr?= =?utf-8?q?=C3=A9_Almeida?= Subject: [PATCH v4 2/3] drm: Allow drivers to choose plane types to async flip Date: Thu, 8 Feb 2024 18:05:41 -0300 Message-ID: <20240208210542.550626-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240208210542.550626-1-andrealmeid@igalia.com> References: <20240208210542.550626-1-andrealmeid@igalia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790366360714147098 X-GMAIL-MSGID: 1790366360714147098 Different planes may have different capabilities of doing async flips, so create a field to let drivers allow async flip per plane type. Signed-off-by: André Almeida --- v4: new patch drivers/gpu/drm/drm_atomic_uapi.c | 4 ++-- drivers/gpu/drm/drm_plane.c | 3 +++ include/drm/drm_plane.h | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 1eecfb9e240d..5c66289188be 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -1075,9 +1075,9 @@ int drm_atomic_set_property(struct drm_atomic_state *state, break; } - if (async_flip && plane_state->plane->type != DRM_PLANE_TYPE_PRIMARY) { + if (async_flip && !plane_state->plane->async_flip) { drm_dbg_atomic(prop->dev, - "[OBJECT:%d] Only primary planes can be changed during async flip\n", + "[OBJECT:%d] This type of plane cannot be changed during async flip\n", obj->id); ret = -EINVAL; break; diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c index 672c655c7a8e..71ada690222a 100644 --- a/drivers/gpu/drm/drm_plane.c +++ b/drivers/gpu/drm/drm_plane.c @@ -366,6 +366,9 @@ static int __drm_universal_plane_init(struct drm_device *dev, drm_modeset_lock_init(&plane->mutex); + if (type == DRM_PLANE_TYPE_PRIMARY) + plane->async_flip = true; + plane->base.properties = &plane->properties; plane->dev = dev; plane->funcs = funcs; diff --git a/include/drm/drm_plane.h b/include/drm/drm_plane.h index 641fe298052d..5e9efb7321ac 100644 --- a/include/drm/drm_plane.h +++ b/include/drm/drm_plane.h @@ -779,6 +779,11 @@ struct drm_plane { * @hotspot_y_property: property to set mouse hotspot y offset. */ struct drm_property *hotspot_y_property; + + /** + * @async_flip: indicates if a plane can do async flips + */ + bool async_flip; }; #define obj_to_plane(x) container_of(x, struct drm_plane, base)