From nobody Wed Aug 26 23:41:51 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 9E1423749EA for ; Sat, 4 Jul 2026 18:33:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783190018; cv=none; b=Jy1BhRo1kHshRIaTXPIDXoP3RzNh6RkTfz8+5y7Dnw/Nbt5dj0mRiQGHyGAojmBT1VxhWATwyNK7zJgy5lXritcdcX+OqjxSB/ZS9/zJnlBOeT5Wfzs4doyitrZtjS0f0mbxilbKESs3gqaC+Ap/OXGI+R8F15ZRKKGm3IF2Zsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783190018; c=relaxed/simple; bh=jES7nUSVZBQKhOgvari+mSaMEA9hK9OzE4xbZwzc1Wc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L/lxIp3UESYI6BQLXcNaKGni8TYc+fR3kjqlQfSc7AH3ErXo9hZN6l+OssLRbABDK+kVDSzdPEz916miJq5A5+go51LE6va4wDRqWEUAVCXJqfJ838u7KDgS2uw+jZ5WkQiA7N6CtBPPxmtP9D1G6hFNyKs7QE1F1bAVh0c9xdE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ECvd+FOX; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=DaWaJzly; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ECvd+FOX"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="DaWaJzly" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 664G8PfJ3429471 for ; Sat, 4 Jul 2026 18:33:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= IGXwZHbQah8WajNXtsa2tZqdRDir4hma/P5IIaHQ79g=; b=ECvd+FOX6m7m+uK6 znPdHfToJCGz5vNdP6tV4GzW8+gWG/emNUZmGO/Rxywzfrha5unEY40pl2LXO59h 7JXv5BMnvdyYquNsxkHqexO5Aqt/ozoQqMvQZkR6SmIcjSk/KX09cknpXg/SmD4y hP6befM9yAWltSsaHmCWvED4/fNXwWB77sN5NX05AUqZLG70NP16/tIDoYPnLcE2 EH04DJfiCX6/0wgXIsEVPx0mePP3/mRq6UkdeWFfub4bU+t6MlFqgUKWB0nt0To0 f3F3hcil7VXRNQY8Rzd+7aj/3W2ujxhjIQiNl0U335fTz9dmXSjkNMM560EDCcCr drpp9A== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f6qvgspbt-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sat, 04 Jul 2026 18:33:35 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-8479b45ad08so2701888b3a.3 for ; Sat, 04 Jul 2026 11:33:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1783190015; x=1783794815; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=IGXwZHbQah8WajNXtsa2tZqdRDir4hma/P5IIaHQ79g=; b=DaWaJzlykrdhvteZkPTuxAdELza5cbfC/vKoJbMk+O3hWdMlg7PP6ac1AjqDA5gr28 j6B4CkiNnX7QLKzy0c+cY87+nTDcoJBK5y7L/GPAMeAz8DU7Tc/Rt4bsDvlBOCZ+Cmuv VqYIqWlnjo/6xI/laaQkgetV/Q1IDw/FNNKWudTEFBImAc8w7Xu8LjsvPzlJJNEBtzzE RvAJXwMaZIoxQl5IF/rKNv59eaOY2fefSBRaxL0xj6v5Lid8HWwPveqcIT8vX8ksP3K8 gz0YjD/flLLiuc9b26SldmZnBMQL7I6/0zVYq5Ah3KUX0jZyft4CcIE1YIA7XuCoTd/b lleQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783190015; x=1783794815; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=IGXwZHbQah8WajNXtsa2tZqdRDir4hma/P5IIaHQ79g=; b=LbgvPWuAVc/kPfigZLZ4SOmHryivSe+oQR435XXXrLEnZz4bQYxSNmxKFABEQZQgiQ E+4CcT83sMAda5VYMTd5AXK9DxGdoW5rdquBPpzIIy8jOBdup46NUoqJNIPwMXD0Zw7P gViM0yPl936g0IRaSnNuscH9ByxuxkSJgxnqsT5w2uLn1458fRm20OgzMAbzp0UNjt6O FBs5fKQ3FxBQw8d9Pw/PapEliW6QcEIFSDn8ycmo6Vkle4Ry+r15LeSNGu+ovvUxks3J pJ4mpld6PpEhdHgq4DSJ7KaN/N9TqNOTmm7l8TD33ectLkEOGCXvIwnmTvp8RwXmrJuk fDjQ== X-Forwarded-Encrypted: i=1; AHgh+RrQsLjEmS25MMgv6QGyHvU2HJS7JFYKf7eHGaly+1ovDIAzHzPHsKnJEzHex2IwZgBVJA3dz2/Z25kCacQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzgOVf7V9XqEAhz5YGYDLcuUQZje5+UJXzOtLv4+Y0IzPbur+Tm t8qK/KLyHv3ZLKwwRcbEAPhm49G61YyCcRVFcZhMrEHHz2+hN+s9fDPeQA4E6rs3SnEBAy8uyzv B3rfcybeJL662xgou3FfAKVqMygy+wUO4+gxDKF8+7EeqFsPfkBDXBLuQlKL5ArytkHQ= X-Gm-Gg: AfdE7cnPx+G66FrMrnCBl458PRayH9CulgWRdyVzOpte2/rvA5l9TD6oh7Hkg5XSSDJ U5GwaqSc0OHVppg4CI/q1ypud8IHbD5KR2qhxpeGMDaafiNeHL0EA1zumTQmh+owQlCBibe+KvB zP+4iYxbb1wpJQGvW8PfGIz5lzQeLjPQX9BUjU9CKQqrgCaanDM0QCN1sLzHkqD+rutgPonZ5Ul 7+3MEG70wUd4ZBhh4XrXpLWA7v5RG2dxTB1AAqa0hTpBy+1S3CfriG7KiaOK65bcSUNU+bqf8jL lrNQRR6riAj5VL/8UU6XdY3ez+Mn31S/aBJudWBEpx54qSqiWMOTFdyzC2wZapkAf5nTLJwEK0E gnoovmpvvGD744OsQuD4XfhE= X-Received: by 2002:a05:6a00:a16:b0:845:e34d:f226 with SMTP id d2e1a72fcca58-847f6da5228mr4452848b3a.16.1783190015056; Sat, 04 Jul 2026 11:33:35 -0700 (PDT) X-Received: by 2002:a05:6a00:a16:b0:845:e34d:f226 with SMTP id d2e1a72fcca58-847f6da5228mr4452818b3a.16.1783190014533; Sat, 04 Jul 2026 11:33:34 -0700 (PDT) Received: from [192.168.1.100] ([151.243.38.149]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-847f6b6057dsm1508437b3a.7.2026.07.04.11.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Jul 2026 11:33:34 -0700 (PDT) From: Ze Huang Date: Sun, 05 Jul 2026 02:31:18 +0800 Subject: [PATCH 9/9] drm/xen: replace struct drm_simple_display_pipe with regular atomic helpers 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: quoted-printable Message-Id: <20260705-drm-simple-kms-removal-v1-9-b4e1ca053623@oss.qualcomm.com> References: <20260705-drm-simple-kms-removal-v1-0-b4e1ca053623@oss.qualcomm.com> In-Reply-To: <20260705-drm-simple-kms-removal-v1-0-b4e1ca053623@oss.qualcomm.com> To: Alexey Brodkin , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Joel Stanley , Andrew Jeffery , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Linus Walleij , Hans de Goede , Alex Lanzano , Oleksandr Andrushchenko Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-aspeed@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, xen-devel@lists.xenproject.org, Ze Huang X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1783189912; l=11508; i=ze.huang@oss.qualcomm.com; s=20260704; h=from:subject:message-id; bh=jES7nUSVZBQKhOgvari+mSaMEA9hK9OzE4xbZwzc1Wc=; b=naeMyylZbpop3bZogsF4t3ncusoDzSV5MAr4bFahQ9OZoV1nX45pewAGKcoP51qwspHbJK4qL CrLEMD+vWkoAPiK+s51b/vLkl6FeLtlnVwJdSWw0mdLqi6JOcjJSi+K X-Developer-Key: i=ze.huang@oss.qualcomm.com; a=ed25519; pk=pSsISLZF2ubEjJRmslsa6Ps4W3yAuPY7yaircQTlQQU= X-Authority-Analysis: v=2.4 cv=VvoTxe2n c=1 sm=1 tr=0 ts=6a4951ff cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=cNux22OjBTKCC6TmznXXXA==:17 a=IkcTkHD0fZMA:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=eoimf2acIAo5FJnRuUoq:22 a=EUspDBNiAAAA:8 a=yt2wVW2Sl_HzNKkdQ3QA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 X-Proofpoint-ORIG-GUID: 28oX-SDtQJwnpf6NbdTPQccjQwOXldB3 X-Proofpoint-GUID: 28oX-SDtQJwnpf6NbdTPQccjQwOXldB3 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzA0MDE5MiBTYWx0ZWRfX1rdFw03DDb64 rDULld+Q8mpSN8jjLs41sXz4bxOdwGc7wtQUlHGz5fll7F7xZhyQsfqthloldwMoHbkT1jG5YMt Z1resRjugVY0vwMaaZBETcd/yOFAFUY= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzA0MDE5MiBTYWx0ZWRfX8+7eRFkuJsVg Ko6oZdRF8iX54D2xp0Q+KFUpApmP3/r6nmw49ptfxBzzZTByZmiHfDQAuiPJ9znWrMjwpnC/VVN TYKvHPMCY62l3Fe7H4HePgeaPlqfSJwTqOq9ZaYJwfn5Amve1ga5DfrrgZ3V4Lkgq7HA5anza9w TzV2kZan5YDl3RwpFqyEUiRorKG5DVuewoZq4GyX1tatbLCd/bYOddhzjjEI7DJRsRcXmxBZecS FUXPq7mfrccvYq4irkLTSsza7JaO8g37dzd6vR9n35e4gQ2UiPFenyO8it363E+BjLI4cjQapUV mZbsNAJDVLOG49Ded7uENd5ZKN4dQebR/NDOd4R5wnI2jNWEb/KcT70PrxFNzwAj+U8oxdGEdfp l8iIzNFSk5Nkv/KLV76nZ/cfPjcrjnWGwpcjyzGoReL08qv6Izx/sjqSa5RJRqSDqxSjvefQiw6 rG+GDNhMLRWFAG9gxcA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-07-04_02,2026-07-03_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 adultscore=0 suspectscore=0 impostorscore=0 clxscore=1015 malwarescore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607040192 Replace Xen frontend simple display pipe with explicit plane, CRTC and encoder objects for each pipeline. Keep generic plane-state validation before Xen-specific checks, and install GEM framebuffer prepare helper explicitly. Signed-off-by: Ze Huang --- drivers/gpu/drm/xen/xen_drm_front.h | 6 +- drivers/gpu/drm/xen/xen_drm_front_kms.c | 177 ++++++++++++++++++++++++----= ---- 2 files changed, 138 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/xen/xen_drm_front.h b/drivers/gpu/drm/xen/xen_= drm_front.h index a987c78abe41..02138b5abef5 100644 --- a/drivers/gpu/drm/xen/xen_drm_front.h +++ b/drivers/gpu/drm/xen/xen_drm_front.h @@ -14,7 +14,7 @@ #include =20 #include -#include +#include =20 #include "xen_drm_front_cfg.h" =20 @@ -100,7 +100,9 @@ struct xen_drm_front_drm_pipeline { =20 int index; =20 - struct drm_simple_display_pipe pipe; + struct drm_plane plane; + struct drm_crtc crtc; + struct drm_encoder encoder; =20 struct drm_connector conn; /* These are only for connector mode checking */ diff --git a/drivers/gpu/drm/xen/xen_drm_front_kms.c b/drivers/gpu/drm/xen/= xen_drm_front_kms.c index 48772b5fe71c..57e1bef452f8 100644 --- a/drivers/gpu/drm/xen/xen_drm_front_kms.c +++ b/drivers/gpu/drm/xen/xen_drm_front_kms.c @@ -31,9 +31,9 @@ #define FRAME_DONE_TO_MS (XEN_DRM_FRONT_WAIT_BACK_MS + 100) =20 static struct xen_drm_front_drm_pipeline * -to_xen_drm_pipeline(struct drm_simple_display_pipe *pipe) +to_xen_drm_pipeline(struct drm_crtc *crtc) { - return container_of(pipe, struct xen_drm_front_drm_pipeline, pipe); + return container_of(crtc, struct xen_drm_front_drm_pipeline, crtc); } =20 static void fb_destroy(struct drm_framebuffer *fb) @@ -94,7 +94,7 @@ static const struct drm_mode_config_funcs mode_config_fun= cs =3D { =20 static void send_pending_event(struct xen_drm_front_drm_pipeline *pipeline) { - struct drm_crtc *crtc =3D &pipeline->pipe.crtc; + struct drm_crtc *crtc =3D &pipeline->crtc; struct drm_device *dev =3D crtc->dev; unsigned long flags; =20 @@ -105,17 +105,15 @@ static void send_pending_event(struct xen_drm_front_d= rm_pipeline *pipeline) spin_unlock_irqrestore(&dev->event_lock, flags); } =20 -static void display_enable(struct drm_simple_display_pipe *pipe, - struct drm_crtc_state *crtc_state, - struct drm_plane_state *plane_state) +static void xen_drm_crtc_helper_atomic_enable(struct drm_crtc *crtc, + struct drm_atomic_commit *state) { - struct xen_drm_front_drm_pipeline *pipeline =3D - to_xen_drm_pipeline(pipe); - struct drm_crtc *crtc =3D &pipe->crtc; + struct xen_drm_front_drm_pipeline *pipeline =3D to_xen_drm_pipeline(crtc); + struct drm_plane_state *plane_state =3D pipeline->plane.state; struct drm_framebuffer *fb =3D plane_state->fb; int ret, idx; =20 - if (!drm_dev_enter(pipe->crtc.dev, &idx)) + if (!drm_dev_enter(crtc->dev, &idx)) return; =20 ret =3D xen_drm_front_mode_set(pipeline, crtc->x, crtc->y, @@ -131,13 +129,13 @@ static void display_enable(struct drm_simple_display_= pipe *pipe, drm_dev_exit(idx); } =20 -static void display_disable(struct drm_simple_display_pipe *pipe) +static void xen_drm_crtc_helper_atomic_disable(struct drm_crtc *crtc, + struct drm_atomic_commit *state) { - struct xen_drm_front_drm_pipeline *pipeline =3D - to_xen_drm_pipeline(pipe); + struct xen_drm_front_drm_pipeline *pipeline =3D to_xen_drm_pipeline(crtc); int ret =3D 0, idx; =20 - if (drm_dev_enter(pipe->crtc.dev, &idx)) { + if (drm_dev_enter(crtc->dev, &idx)) { ret =3D xen_drm_front_mode_set(pipeline, 0, 0, 0, 0, 0, xen_drm_front_fb_to_cookie(NULL)); drm_dev_exit(idx); @@ -177,12 +175,13 @@ static void pflip_to_worker(struct work_struct *work) send_pending_event(pipeline); } =20 -static bool display_send_page_flip(struct drm_simple_display_pipe *pipe, +static bool display_send_page_flip(struct xen_drm_front_drm_pipeline *pipe= line, + struct drm_atomic_commit *state, struct drm_plane_state *old_plane_state) { struct drm_plane_state *plane_state =3D - drm_atomic_get_new_plane_state(old_plane_state->state, - &pipe->plane); + drm_atomic_get_new_plane_state(state, + &pipeline->plane); =20 /* * If old_plane_state->fb is NULL and plane_state->fb is not, @@ -193,8 +192,6 @@ static bool display_send_page_flip(struct drm_simple_di= splay_pipe *pipe, * sent to the backend as a part of display_set_config call. */ if (old_plane_state->fb && plane_state->fb) { - struct xen_drm_front_drm_pipeline *pipeline =3D - to_xen_drm_pipeline(pipe); struct xen_drm_front_drm_info *drm_info =3D pipeline->drm_info; int ret; =20 @@ -224,10 +221,30 @@ static bool display_send_page_flip(struct drm_simple_= display_pipe *pipe, return false; } =20 -static int display_check(struct drm_simple_display_pipe *pipe, - struct drm_plane_state *plane_state, - struct drm_crtc_state *crtc_state) +static int xen_drm_plane_helper_atomic_check(struct drm_plane *plane, + struct drm_atomic_commit *state) { + struct drm_plane_state *plane_state =3D drm_atomic_get_new_plane_state(st= ate, plane); + struct drm_crtc *crtc =3D plane_state->crtc; + struct drm_crtc_state *crtc_state =3D NULL; + int ret; + + if (crtc) + crtc_state =3D drm_atomic_get_new_crtc_state(state, crtc); + + ret =3D drm_atomic_helper_check_plane_state(plane_state, crtc_state, + DRM_PLANE_NO_SCALING, + DRM_PLANE_NO_SCALING, + false, false); + if (ret) + return ret; + + if (!plane_state->visible) + return 0; + + if (!crtc_state) + return 0; + /* * Xen doesn't initialize vblanking via drm_vblank_init(), so * DRM helpers assume that it doesn't handle vblanking and start @@ -242,15 +259,19 @@ static int display_check(struct drm_simple_display_pi= pe *pipe, return 0; } =20 -static void display_update(struct drm_simple_display_pipe *pipe, - struct drm_plane_state *old_plane_state) +static void xen_drm_plane_helper_atomic_update(struct drm_plane *plane, + struct drm_atomic_commit *state) { - struct xen_drm_front_drm_pipeline *pipeline =3D - to_xen_drm_pipeline(pipe); - struct drm_crtc *crtc =3D &pipe->crtc; + struct drm_plane_state *old_plane_state =3D drm_atomic_get_old_plane_stat= e(state, plane); + struct drm_crtc *crtc =3D plane->state->crtc ?: old_plane_state->crtc; + struct xen_drm_front_drm_pipeline *pipeline; struct drm_pending_vblank_event *event; int idx; =20 + if (!crtc) + return; + + pipeline =3D to_xen_drm_pipeline(crtc); event =3D crtc->state->event; if (event) { struct drm_device *dev =3D crtc->dev; @@ -265,7 +286,7 @@ static void display_update(struct drm_simple_display_pi= pe *pipe, spin_unlock_irqrestore(&dev->event_lock, flags); } =20 - if (!drm_dev_enter(pipe->crtc.dev, &idx)) { + if (!drm_dev_enter(crtc->dev, &idx)) { send_pending_event(pipeline); return; } @@ -278,19 +299,19 @@ static void display_update(struct drm_simple_display_= pipe *pipe, * If this is not a page flip, e.g. no flip done event from the backend * is expected, then send now. */ - if (!display_send_page_flip(pipe, old_plane_state)) + if (!display_send_page_flip(pipeline, state, old_plane_state)) send_pending_event(pipeline); =20 drm_dev_exit(idx); } =20 static enum drm_mode_status -display_mode_valid(struct drm_simple_display_pipe *pipe, - const struct drm_display_mode *mode) +xen_drm_crtc_helper_mode_valid(struct drm_crtc *crtc, + const struct drm_display_mode *mode) { struct xen_drm_front_drm_pipeline *pipeline =3D - container_of(pipe, struct xen_drm_front_drm_pipeline, - pipe); + container_of(crtc, struct xen_drm_front_drm_pipeline, + crtc); =20 if (mode->hdisplay !=3D pipeline->width) return MODE_ERROR; @@ -301,12 +322,55 @@ display_mode_valid(struct drm_simple_display_pipe *pi= pe, return MODE_OK; } =20 -static const struct drm_simple_display_pipe_funcs display_funcs =3D { - .mode_valid =3D display_mode_valid, - .enable =3D display_enable, - .disable =3D display_disable, - .check =3D display_check, - .update =3D display_update, +static int xen_drm_crtc_helper_atomic_check(struct drm_crtc *crtc, struct = drm_atomic_commit *state) +{ + struct drm_crtc_state *crtc_state =3D drm_atomic_get_new_crtc_state(state= , crtc); + int ret; + + if (!crtc_state->enable) + goto out; + + ret =3D drm_atomic_helper_check_crtc_primary_plane(crtc_state); + if (ret) + return ret; + +out: + return drm_atomic_add_affected_planes(state, crtc); +} + +static const struct drm_plane_helper_funcs display_plane_helper_funcs =3D { + .prepare_fb =3D drm_gem_plane_helper_prepare_fb, + .atomic_check =3D xen_drm_plane_helper_atomic_check, + .atomic_update =3D xen_drm_plane_helper_atomic_update, +}; + +static const struct drm_plane_funcs display_plane_funcs =3D { + .update_plane =3D drm_atomic_helper_update_plane, + .disable_plane =3D drm_atomic_helper_disable_plane, + .destroy =3D drm_plane_cleanup, + .reset =3D drm_atomic_helper_plane_reset, + .atomic_duplicate_state =3D drm_atomic_helper_plane_duplicate_state, + .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state, +}; + +static const struct drm_crtc_helper_funcs display_crtc_helper_funcs =3D { + .mode_valid =3D xen_drm_crtc_helper_mode_valid, + .atomic_check =3D xen_drm_crtc_helper_atomic_check, + .atomic_enable =3D xen_drm_crtc_helper_atomic_enable, + .atomic_disable =3D xen_drm_crtc_helper_atomic_disable, +}; + +static const struct drm_crtc_funcs display_crtc_funcs =3D { + .reset =3D drm_atomic_helper_crtc_reset, + .destroy =3D drm_crtc_cleanup, + .set_config =3D drm_atomic_helper_set_config, + .page_flip =3D drm_atomic_helper_page_flip, + .atomic_duplicate_state =3D drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state =3D drm_atomic_helper_crtc_destroy_state, +}; + +static const struct drm_encoder_funcs display_encoder_funcs =3D { + .destroy =3D drm_encoder_cleanup, }; =20 static int display_pipe_init(struct xen_drm_front_drm_info *drm_info, @@ -331,10 +395,37 @@ static int display_pipe_init(struct xen_drm_front_drm= _info *drm_info, =20 formats =3D xen_drm_front_conn_get_formats(&format_count); =20 - return drm_simple_display_pipe_init(dev, &pipeline->pipe, - &display_funcs, formats, - format_count, NULL, - &pipeline->conn); + ret =3D drm_universal_plane_init(dev, &pipeline->plane, 1, + &display_plane_funcs, + formats, format_count, + NULL, + DRM_PLANE_TYPE_PRIMARY, NULL); + if (ret) + return ret; + + drm_plane_helper_add(&pipeline->plane, &display_plane_helper_funcs); + + ret =3D drm_crtc_init_with_planes(dev, &pipeline->crtc, + &pipeline->plane, NULL, + &display_crtc_funcs, NULL); + if (ret) + return ret; + + drm_crtc_helper_add(&pipeline->crtc, &display_crtc_helper_funcs); + + ret =3D drm_encoder_init(dev, &pipeline->encoder, + &display_encoder_funcs, + DRM_MODE_ENCODER_NONE, NULL); + if (ret) + return ret; + + pipeline->encoder.possible_crtcs =3D drm_crtc_mask(&pipeline->crtc); + + ret =3D drm_connector_attach_encoder(&pipeline->conn, &pipeline->encoder); + if (ret) + return ret; + + return 0; } =20 int xen_drm_front_kms_init(struct xen_drm_front_drm_info *drm_info) --=20 2.55.0