From: Daniel Almeida <daniel.almeida@collabora.com>
To: Gary Guo <gary@garyguo.net>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Boris Brezillon" <boris.brezillon@collabora.com>,
nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 1/2] rust: drm: add support for driver features
Date: Wed, 21 Jan 2026 16:05:22 -0300 [thread overview]
Message-ID: <FBB3C949-5568-4F26-95C8-8873F6DF1530@collabora.com> (raw)
In-Reply-To: <DFUG2U4PVVTN.1DVPXGJK735F8@garyguo.net>
Hi Gary,
> On 21 Jan 2026, at 14:31, Gary Guo <gary@garyguo.net> wrote:
>
> On Mon Jan 19, 2026 at 11:34 PM GMT, Daniel Almeida wrote:
>> Add initial support for drm driver features via the DriverFeatures trait.
>> This trait is unsafe, requiring the implementer to comply with the safety
>> requirements of each feature individually if the feature is enabled.
>
> I think such unsafe requirement is quite vague and also very non-local.
>
> Maybe we can use a single trait (the `ModesetOps` that you described) to do
> this:
>
> Something like:
>
> pub unsafe trait ModesetOps<D> { ... }
>
> // Maybe the never type in the future...
> pub enum NoFeature {}
>
> impl<D> ModesetOps<D> for NoFeature {
> fn foo(&self, ...) { unimplemented!() }
> }
>
> impl Driver {
> /// Reference the modeset implementation (typically Self),
> /// or `NoFeature` to indicate that the feature is not implemented.
> type Modeset: ModesetOps<Self>;
Yeah, this looks better indeed. I assume we can have multiple features by
having multiple traits, right?
> }
>
> When building, you can use `TypeId` to check if it's actually implemented, and
> set bits in the feature flags automatically.
>
> Best,
> Gary
I assume we would enable FeatureFoo if typeid(Foo) != typeid(NoFeatureFoo)?
Where Foo is “type Foo: FooOps” in the Driver trait.
next prev parent reply other threads:[~2026-01-21 19:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-19 23:34 [PATCH 0/2] DRM 'feature' support for DRM drivers Daniel Almeida
2026-01-19 23:34 ` [PATCH 1/2] rust: drm: add support for driver features Daniel Almeida
2026-01-21 17:31 ` Gary Guo
2026-01-21 19:05 ` Daniel Almeida [this message]
2026-05-05 10:13 ` Laura Nao
2026-01-19 23:34 ` [PATCH 2/2] rust: drm: add FeatureRender Daniel Almeida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=FBB3C949-5568-4F26-95C8-8873F6DF1530@collabora.com \
--to=daniel.almeida@collabora.com \
--cc=a.hindborg@kernel.org \
--cc=airlied@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dakr@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=nouveau@lists.freedesktop.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox