From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f43.google.com (mail-ed1-f43.google.com [209.85.208.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B15B72980A8 for ; Wed, 17 Jun 2026 15:02:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781708561; cv=none; b=ZAwgbRIkRbhYneB5PW71ale1lByHRghlRAezERLpAvCg7VFiR2h4govUO9opWZkDFylpdlrofe3P4Xk2H06vETDzLdnipJJmIk0nHS8VXMBFMul9obQ8TjdRElTBs/M55Vow6i9ev/jRSuJ/xcXf4hu6LplMH1SV6g0W5di6t4E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781708561; c=relaxed/simple; bh=HgAsGPcIsWFm6yjX16LNzN20kh5XERUxvB1p3l7joy4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=q6PXQX6F9MeAHAQvObB3DW+0g+sZtFe/fqxAoAJ1rfMHcEztAnYZQ9akaqPBTLTa8EnBAiYqYLH9/+7wtFDp+kWmiWxmE0IAbsDxUQ5o8maJFSkB/TQT2x2k8TyKQaVKjycGtzba4WQgtd8AJUAW6UaII+hL/k1Z0grtvrdh0iE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fireburn.co.uk; spf=none smtp.mailfrom=fireburn.co.uk; dkim=pass (2048-bit key) header.d=fireburn-co-uk.20251104.gappssmtp.com header.i=@fireburn-co-uk.20251104.gappssmtp.com header.b=ddx+jn+2; arc=none smtp.client-ip=209.85.208.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=fireburn.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=fireburn.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fireburn-co-uk.20251104.gappssmtp.com header.i=@fireburn-co-uk.20251104.gappssmtp.com header.b="ddx+jn+2" Received: by mail-ed1-f43.google.com with SMTP id 4fb4d7f45d1cf-68bac6e24fdso8424662a12.1 for ; Wed, 17 Jun 2026 08:02:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fireburn-co-uk.20251104.gappssmtp.com; s=20251104; t=1781708558; x=1782313358; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=lCa0uenWWZ89F0YVTYC+LQ6UyP30FoInUSkltfqEQkI=; b=ddx+jn+2Ey0M3UdwIGAyNFaDEcIRPMfiUm1oyXTWzi04qwqJtvQXGxoAEGSrQwwiH6 gIBgnpmeeME0l2nZ8gGGiQ+egwuwYizzWGfbZiof6PkQGM9MbbKCfYlvtMQ295JsYUNm C4uAclvGyAeOO8uVRHRtv3YkFlohmmKRl92a9nlPX/wxCF2QHAanu9OE0rXLljSG2G38 WihDJG3uz8olGu0ZtbaZ0hYo/pBDC2xljJkdVIHaBCpAtL/7ZuTYelNjfTLvlFT7H7wb yiDNoO9c0EQ+h7jNB79y8cGXZlcbxl5lyJHtZO8rT8liPv6vmFcI4tdKaLw5TgpWgT9H m/rQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781708558; x=1782313358; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lCa0uenWWZ89F0YVTYC+LQ6UyP30FoInUSkltfqEQkI=; b=T8x5lTnUyZFvc9YKICESJq6F09dUIp4NJEHqGwdw58y9poCVGATJnWK4utczyX15w3 SFRQ7HEkCMVMEWcb808Ds3yH7rZjKxopZWcKYh3ib51lWR2Dq/mrD3qcNRqM9MHvt72b PmH6fFqgyanv0iuQ//d6W1GRzhOxP7HGgw6TTpOFuXRmO74fVVy1G1GGKaFJR8m4ekmT e0T3ypkAhAsjISQgyzZielrBBdRVJur59r50ClT2skFSEtEbopnn5GVHtd9Y+TgR/NDL +S2lmzFWkNyZ/r+rS3Fo3KDEis7IV04DTJuPsPWH4/9j5Lbcu9KE4VSNKSNFVAPFJH+1 LEfA== X-Forwarded-Encrypted: i=1; AFNElJ+aRzXjKNSf25r1mYMtf4eR1WL+wcNmsdr8Lendxgn2ZYXmddnM7H94WQH+x9uaI4zr0DHGNXvK+4VpWoQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzuHs2fO98J5aVsq6g6dmOutn8VxM9t5y9G201yZ9nVd0+NZzjU jgWdJ756pBiJTvYQmBP6Z8+1amGWCMfazCK9muUCXBPmJrhQq/+HOGFRYIxMwsptjg== X-Gm-Gg: Acq92OHplx3zDlRKALKjbmvNgctUKMpGWqQYU98pKqc0yK/nwCYiasIlT23elCHLcgr JEACJ/shIII9cAiZ58v7Rlx5U17jXHM7/T2d+zxNAijccrjZNov391z6qC9jtQqa6BYqJJJS8qH CbX/80px1vrK9aDahExORZniLSRrKgvpNyZ2Gu1D+DkmvDw4CK7CLj1xt2Zi+IwXjNmvtj5c4Cp omckNzU59+MC08Z1gL4mcDqVMbNizZjWNU3ZokAwQP3H7V8H1LMLC7lM09n2cwXLQqElHrS7UvF GiuMCHU6CQbllXPshKoh//3u/PfQx7JXernWk9rSY7Cy1cp0JovRxBN7q4XAy+EoiKLB51M4BZ8 vPvuLSWmPZmumeyafszSLb+ykaEcjkx2Z/9A1MWbwmj6hRL7KfuYTMVma1AY/HaMSKJZHH2wq0S 4Usgzdf/XtBnb+5JaIVP4adKV5D/a1XBH7D/4VfO0L8bx19BiN+e28SsCe X-Received: by 2002:a17:906:9fca:b0:c03:b8c6:cc27 with SMTP id a640c23a62f3a-c05a6bded8bmr287227266b.24.1781708557936; Wed, 17 Jun 2026 08:02:37 -0700 (PDT) Received: from axion.fireburn.co.uk ([137.220.119.72]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4606f26f1cdsm57264311f8f.11.2026.06.17.08.02.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jun 2026 08:02:36 -0700 (PDT) From: Mike Lothian To: dri-devel@lists.freedesktop.org Cc: Mike Lothian , rust-for-linux@vger.kernel.org, Danilo Krummrich , David Airlie , Simona Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Lyude Paul , Miguel Ojeda , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , linux-kernel@vger.kernel.org Subject: [RFC PATCH 0/5] rust: drm: minimal KMS bindings, EDID read, rotation, HDCP defs Date: Wed, 17 Jun 2026 16:02:22 +0100 Message-ID: <20260617150232.2210-1-mike@fireburn.co.uk> X-Mailer: git-send-email 2.54.0 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 This RFC series exposes enough of the C KMS API to Rust for a driver to bring up an atomic mode-setting pipeline with the drm_simple_display_pipe helper (one CRTC + primary plane + encoder) and install a real EDID read off its own transport: 1/4 KMS headers + Driver::FEAT_MODESET/FEAT_ATOMIC 2/4 : drm_edid_alloc/_connector_update/_add_modes 3/4 pub drm::Device::as_raw() escape hatch (separate, contentious bit) 4/4 (atomic plane rotation property) + a rust_helper for drm_atomic_get_new_crtc_state() (inspect proposed CRTC state from a mode_config atomic_check) It is deliberately an RFC and interim: it does NOT add safe Rust KMS abstractions (CRTC/plane/connector wrappers - an active upstream effort), only the raw binding surface plus the trait/visibility tweaks a driver needs to call the C helpers itself. FEAT_MODESET / FEAT_ATOMIC follow the existing FEAT_RENDER idiom exactly (per-feature bool associated consts folded into compute_features()), so GEM-only drivers are unaffected. drm::Device::as_raw() is made pub as a documented temporary escape hatch for calling the C KMS helpers until safe wrappers exist. That is the part most likely to draw objections, so it is split into its own patch (3/3): the feature flags and header bindings in 1/3 and 2/3 are useful on their own and can land even if the escape hatch is reworked or dropped (e.g. replaced by narrow per-helper safe wrappers). drm_blend.h (4/4) exposes drm_plane_create_rotation_property() so a driver can offer the standard atomic rotation property, and adds a rust_helper for the static-inline drm_atomic_get_new_crtc_state() so a driver can read a CRTC's proposed state during atomic_check() (the vino driver uses it to reject a multi-head modeset that would exceed the USB bandwidth). Like the rest of the series it is interim raw-binding surface. drm_hdcp.h (5/5) exposes so a Rust HDCP driver can use the canonical HDCP 2.2 message IDs, length constants and hdcp2_* message structs instead of redefining them (the vino driver runs HDCP 2.2 over a vendor USB transport and reuses only the message definitions, not the drm_hdcp_helper state machine). It only pulls in . Note: a related but independent fix - using drm_dev_unplug() instead of drm_dev_unregister() in Registration::drop, which closes a real use-after-free for Rust DRM drivers on a hot-removable bus - is sent as a standalone, non-RFC patch ("rust: drm: unplug the device on Registration drop") rather than buried in this RFC, since it stands alone and should not be gated on the KMS-surface discussion. Factored out of an out-of-tree in-kernel Rust DisplayLink DL3 dock driver that drives a virtual connector and reads the dock's downstream EDID; but the bindings are generic (the same path simpledrm/gud/udl use). Compile-tested in-tree against drm-next. Mike Lothian (3): rust: drm: add minimal KMS bindings for simple-display-pipe drivers rust: drm: expose drm_edid.h for reading connector EDID rust: drm: expose drm::Device::as_raw() rust: drm: expose drm_blend.h and the atomic new-CRTC-state helper rust: drm: expose HDCP 2.2 message definitions rust/bindings/bindings_helper.h | 10 ++++++++++ rust/kernel/drm/device.rs | 18 +++++++++++++++++- rust/kernel/drm/driver.rs | 17 +++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) -- 2.54.0