rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Asahi Lina <lina@asahilina.net>
Cc: rust-for-linux@vger.kernel.org
Subject: Re: Writing the Apple AGX GPU driver in Rust?
Date: Thu, 11 Aug 2022 20:45:34 +0200	[thread overview]
Message-ID: <CANiq72=71W-d7385YySknCWrToigDwrQ6nz2fh2zEWSQtrH2qg@mail.gmail.com> (raw)
In-Reply-To: <70657af9-90bb-ee9e-4877-df4b14c134a5@asahilina.net>

On Thu, Aug 11, 2022 at 4:29 PM Asahi Lina <lina@asahilina.net> wrote:
>
> I'd like to hear your thoughts about how crazy an idea this is. ^_^

It is less crazy than writing it in Python, for sure ;)

But joking aside, using Rust for a particular subsystem is up to the
maintainers of the subsystem. From what I understand (please correct
me if I am wrong!), you are part of the Asahi team, so you are your
own maintainers, thus it is up to you to decide!

Now, of course, reality is more complex than that, and you will
probably want to discuss things with the DRM people to see if they
would be willing to accept and/or maintain their part of the Rust
bindings you may need etc.

In any case, one quick note: so far, we have been doing the "Rust
driver that talks to Rust safe abstractions that for the most part
wrap existing C facilities" approach. While it is of course
technically possible to mix C and Rust in other ways, and it may be
the case that we need to do it as some point, it would be best to
avoid having to expose C APIs from Rust code, to avoid losing the
advantages of the type system. So writing the entire driver in Rust
would be the way to go if I understood you correctly, and would make
also things much easier for others later too, since some safe
abstractions for DRM would be there already etc., which I am sure
people will appreciate a lot in the future!

As for the proc macros: so far we generally try to avoid them as much
as possible, but a lot of details on how we will expand on that are
still in the air (and we have not needed to generate a lot of
hardware-description-based code anyway). Some of that will likely be
discussed in Kangrejos and LPC in September. In any case, when talking
about proc macros, it can be useful to consider whether "raw" code
generation in an independent build step may be easier or not (i.e.
like your previous Python approach, if I understood correctly; but
maybe based on a Rust host program which we have support for) --
especially if that code does not change often.

(I sent you the Zulip invitation soon after seeing your message -- if
you have not received it, let me know!)

Cheers,
Miguel

  parent reply	other threads:[~2022-08-11 18:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 14:03 Writing the Apple AGX GPU driver in Rust? Asahi Lina
2022-08-11 15:28 ` Alex Gaynor
2022-08-11 18:45 ` Miguel Ojeda [this message]
2022-08-12  4:01   ` Asahi Lina
2022-08-12 17:48     ` Miguel Ojeda
2022-08-13  6:17       ` Asahi Lina
2022-08-13 13:05         ` Miguel Ojeda
2022-08-13 15:06           ` Asahi Lina
2022-08-13 15:30             ` Greg KH
2022-08-13 15:59               ` Asahi Lina
2022-08-13 16:07             ` Miguel Ojeda

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='CANiq72=71W-d7385YySknCWrToigDwrQ6nz2fh2zEWSQtrH2qg@mail.gmail.com' \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=lina@asahilina.net \
    --cc=rust-for-linux@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).