From: Simona Vetter <simona.vetter@ffwll.ch>
To: Lucas Stach <l.stach@pengutronix.de>
Cc: "Michel Dänzer" <michel.daenzer@mailbox.org>,
"Marek Olšák" <maraeo@gmail.com>,
dri-devel <dri-devel@lists.freedesktop.org>,
"amd-gfx mailing list" <amd-gfx@lists.freedesktop.org>,
"ML Mesa-dev" <mesa-dev@lists.freedesktop.org>
Subject: Re: [PATCH] drm/fourcc: add LINEAR modifiers with an exact pitch alignment
Date: Mon, 16 Dec 2024 15:53:10 +0100 [thread overview]
Message-ID: <Z2A-1i6YiPSjdUnP@phenom.ffwll.local> (raw)
In-Reply-To: <a42981617e880d48e9614c9ab5a8892f7ae0a315.camel@pengutronix.de>
On Mon, Dec 16, 2024 at 11:46:13AM +0100, Lucas Stach wrote:
> Am Montag, dem 16.12.2024 um 10:27 +0100 schrieb Michel Dänzer:
> > On 2024-12-15 21:53, Marek Olšák wrote:
> > > The comment explains the problem with DRM_FORMAT_MOD_LINEAR.
> > >
> > > Signed-off-by: Marek Olšák <marek.olsak@amd.com <mailto:marek.olsak@amd.com>>
> > >
> > > diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> > > index 78abd819fd62e..8ec4163429014 100644
> > > --- a/include/uapi/drm/drm_fourcc.h
> > > +++ b/include/uapi/drm/drm_fourcc.h
> > > @@ -484,9 +484,27 @@ extern "C" {
> > > * modifier (e.g. not setting DRM_MODE_FB_MODIFIERS in the DRM_ADDFB2 ioctl),
> > > * which tells the driver to also take driver-internal information into account
> > > * and so might actually result in a tiled framebuffer.
> > > + *
> > > + * WARNING:
> > > + * There are drivers out there that expose DRM_FORMAT_MOD_LINEAR, but only
> > > + * support a certain pitch alignment and can't import images with this modifier
> > > + * if the pitch alignment isn't exactly the one supported. They can however
> > > + * allocate images with this modifier and other drivers can import them only
> > > + * if they support the same pitch alignment. Thus, DRM_FORMAT_MOD_LINEAR is
> > > + * fundamentically incompatible across devices and is the only modifier that
> > > + * has a chance of not working. The PITCH_ALIGN modifiers should be used
> > > + * instead.
> > > */
> > > #define DRM_FORMAT_MOD_LINEAR fourcc_mod_code(NONE, 0)
> > >
> > > +/* Linear layout modifiers with an explicit pitch alignment in bytes.
> > > + * Exposing this modifier requires that the pitch alignment is exactly
> > > + * the number in the definition.
> > > + */
> > > +#define DRM_FORMAT_MOD_LINEAR_PITCH_ALIGN_64B fourcc_mod_code(NONE, 1)
> >
> > It's not clear what you mean by "requires that the pitch alignment is exactly
> > the number in the definition", since a pitch which is aligned to 256 bytes is
> > also aligned to 128 & 64 bytes. Do you mean the pitch must be exactly the width
> > rounded up to the next / smallest possible multiple of the specified number of bytes?
>
> I guess that's the intention here, as some AMD GPUs apparently have
> this limitation that they need an exact aligned pitch.
>
> If we open the can of worms to overhaul the linear modifier, I think it
> would make sense to also add modifiers for the more common restriction,
> where the pitch needs to be aligned to a specific granule, but the
> engine doesn't care if things get overaligned to a multiple of the
> granule. Having both sets would probably make it easier for the reader
> to see the difference to the exact pitch modifiers proposed in this
> patch.
Yeah I think with linear modifiers that sepcificy alignment limitations we
need to be _extremely_ precise in what exactly is required, and what not.
There's all kinds of hilarious stuff that might be incompatible, and if we
don't mind those we're right back to the "everyone agrees on what linear
means" falacy.
So if pitch must be a multiple of 64, but cannot be a multiple of 128
(because the hw does not cope with the padding, then that's important).
Other things are alignment constraints on the starting point, and any
padding you need to add at the bottom (yeah some hw overscans and gets
pissed if there's not memory there). So I think it's best to go overboard
here with verbosity.
There's also really funny stuff like power-of-two alignment and things
like that, but I guess we'll get there if that's ever needed. That's also
why I think we don't need to add all possible linear modifiers from the
start, unless there's maybe too much confusion with stuff like "exactly
64b aligned pitch" and "at least 64b aligned pitch, but you can add lots
of padding if you feel like".
-""ma
>
> Regards,
> Lucas
--
Simona Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
next prev parent reply other threads:[~2024-12-16 14:53 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-15 20:53 [PATCH] drm/fourcc: add LINEAR modifiers with an exact pitch alignment Marek Olšák
2024-12-15 20:54 ` Marek Olšák
2024-12-15 23:22 ` Joshua Ashton
2024-12-15 23:57 ` Marek Olšák
2024-12-16 2:08 ` Joshua Ashton
2024-12-16 5:40 ` Marek Olšák
2024-12-16 9:28 ` Dmitry Baryshkov
2024-12-16 21:49 ` Marek Olšák
2024-12-16 9:27 ` Michel Dänzer
2024-12-16 10:46 ` Lucas Stach
2024-12-16 14:53 ` Simona Vetter [this message]
2024-12-16 21:58 ` Marek Olšák
2024-12-18 10:21 ` Simona Vetter
2024-12-16 21:54 ` Marek Olšák
2024-12-17 9:59 ` Michel Dänzer
2024-12-16 21:29 ` Marek Olšák
2024-12-17 9:14 ` Michel Dänzer
2024-12-17 9:14 ` Brian Starkey
2024-12-17 10:13 ` Michel Dänzer
2024-12-17 11:03 ` Brian Starkey
2024-12-18 9:44 ` Michel Dänzer
2024-12-18 10:24 ` Simona Vetter
2024-12-18 10:32 ` Brian Starkey
2024-12-19 2:53 ` Marek Olšák
2024-12-19 9:09 ` Daniel Stone
2024-12-19 10:32 ` Brian Starkey
2024-12-20 0:33 ` Marek Olšák
2024-12-20 11:30 ` Brian Starkey
2024-12-20 14:24 ` Marek Olšák
2024-12-20 15:27 ` Simona Vetter
2024-12-19 9:02 ` Daniel Stone
2024-12-19 16:09 ` Michel Dänzer
2024-12-20 15:24 ` Simona Vetter
2024-12-25 7:34 ` Marek Olšák
2024-12-19 18:03 ` Simona Vetter
2025-01-10 21:23 ` James Jones
2025-01-14 9:38 ` Marek Olšák
2025-01-14 17:55 ` James Jones
2025-01-15 3:49 ` Marek Olšák
2025-01-14 17:58 ` Daniel Stone
2025-01-15 4:05 ` Marek Olšák
2025-01-15 12:20 ` Daniel Stone
2025-01-17 14:18 ` Simona Vetter
2025-01-18 2:37 ` Marek Olšák
2025-01-20 7:58 ` Thomas Zimmermann
2025-01-20 18:41 ` Simona Vetter
2025-01-21 19:21 ` Marek Olšák
2025-01-22 10:47 ` Simona Vetter
2025-01-20 21:31 ` Laurent Pinchart
2025-01-21 9:02 ` Philipp Zabel
2025-01-14 18:33 ` Faith Ekstrand
2025-01-15 4:27 ` Marek Olšák
2025-01-15 8:37 ` Simona Vetter
2025-01-20 22:00 ` Laurent Pinchart
2025-01-21 22:40 ` James Jones
2025-01-20 21:48 ` Laurent Pinchart
2025-01-14 13:46 ` Thomas Zimmermann
2025-01-14 13:50 ` Thomas Zimmermann
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=Z2A-1i6YiPSjdUnP@phenom.ffwll.local \
--to=simona.vetter@ffwll.ch \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=l.stach@pengutronix.de \
--cc=maraeo@gmail.com \
--cc=mesa-dev@lists.freedesktop.org \
--cc=michel.daenzer@mailbox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.