From: Benno Lossin <benno.lossin@proton.me>
To: Lyude Paul <lyude@redhat.com>, dri-devel@lists.freedesktop.org
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Daniel Vetter" <daniel@ffwll.ch>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Alex Gaynor" <alex.gaynor@gmail.com>,
"Wedson Almeida Filho" <wedsonaf@gmail.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH 2/4] WIP: drm: Introduce rvkms
Date: Wed, 27 Mar 2024 21:06:42 +0000 [thread overview]
Message-ID: <b41f707d-7e06-4c1a-93f0-d74ee242b650@proton.me> (raw)
In-Reply-To: <20240322221305.1403600-3-lyude@redhat.com>
On 22.03.24 23:03, Lyude Paul wrote:
> diff --git a/drivers/gpu/drm/rvkms/connector.rs b/drivers/gpu/drm/rvkms/connector.rs
> new file mode 100644
> index 0000000000000..40f84d38437ee
> --- /dev/null
> +++ b/drivers/gpu/drm/rvkms/connector.rs
> @@ -0,0 +1,55 @@
> +// TODO: License and stuff
> +// Contain's rvkms's drm_connector implementation
> +
> +use super::{RvkmsDriver, RvkmsDevice, MAX_RES, DEFAULT_RES};
> +use kernel::{
> + prelude::*,
> + drm::{
> + device::Device,
> + kms::{
> + connector::{self, ConnectorGuard},
> + ModeConfigGuard
> + }
> + },
> + prelude::*
> +};
> +use core::marker::PhantomPinned;
> +
> +#[pin_data]
> +pub(crate) struct DriverConnector {
> + #[pin]
> + _p: PhantomPinned
> +}
This struct does not need to be annotated with `#[pin_data]`, this
should just work:
pub(crate) struct DriverConnector;
> +
> +pub(crate) type Connector = connector::Connector<DriverConnector>;
> +
> +impl connector::DriverConnector for DriverConnector {
> + type Initializer = impl PinInit<Self, Error>;
> +
> + type State = ConnectorState;
> +
> + type Driver = RvkmsDriver;
> +
> + type Args = ();
> +
> + fn new(dev: &Device<Self::Driver>, args: Self::Args) -> Self::Initializer {
And then here just return `Self`.
This works, since there is a blanket impl `PinInit<T, E> for T`.
Looking at how you use this API, I am not sure if you actually need
pin-init for the type that implements `DriverConnector`.
Do you need to store eg `Mutex<T>` or something else that needs
pin-init in here in a more complex driver?
--
Cheers,
Benno
> + try_pin_init!(Self { _p: PhantomPinned })
> + }
> +
> + fn get_modes(
> + connector: ConnectorGuard<'_, Self>,
> + _guard: &ModeConfigGuard<'_, Self::Driver>
> + ) -> i32 {
> + let count = connector.add_modes_noedid(MAX_RES);
> +
> + connector.set_preferred_mode(DEFAULT_RES);
> + count
> + }
> +}
> +
> +#[derive(Clone, Default)]
> +pub(crate) struct ConnectorState;
> +
> +impl connector::DriverConnectorState for ConnectorState {
> + type Connector = DriverConnector;
> +}
next prev parent reply other threads:[~2024-03-27 21:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240322221305.1403600-1-lyude@redhat.com>
2024-03-22 22:03 ` [PATCH 1/4] WIP: rust: Add basic KMS bindings Lyude Paul
2024-03-27 20:50 ` Benno Lossin
2024-04-22 1:47 ` Lyude Paul
2024-04-25 15:42 ` Benno Lossin
2024-03-22 22:03 ` [PATCH 2/4] WIP: drm: Introduce rvkms Lyude Paul
2024-03-27 21:06 ` Benno Lossin [this message]
2024-04-22 1:54 ` Lyude Paul
2024-04-25 15:46 ` Benno Lossin
2024-04-29 19:54 ` Lyude Paul
2024-03-22 22:03 ` [PATCH 3/4] rust/drm/kms: Extract PlaneState<T> into IntoPlaneState Lyude Paul
2024-03-22 22:03 ` [PATCH 4/4] WIP: rust/drm/kms: Add ShadowPlaneState<T> Lyude Paul
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=b41f707d-7e06-4c1a-93f0-d74ee242b650@proton.me \
--to=benno.lossin@proton.me \
--cc=a.hindborg@samsung.com \
--cc=airlied@gmail.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=gary@garyguo.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tzimmermann@suse.de \
--cc=wedsonaf@gmail.com \
/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
all inboxes | Powered by JetHome®