All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v4 5/5] drm/ofdrm: Support big-endian scanout buffers
Date: Wed, 12 Oct 2022 08:29:39 +0200	[thread overview]
Message-ID: <87fbe7bd-1160-420e-984b-5afccd5d523c@app.fastmail.com> (raw)
In-Reply-To: <20221011213841.GA28810@kitsune.suse.cz>

On Tue, Oct 11, 2022, at 11:38 PM, Michal Suchánek wrote:
> On Tue, Oct 11, 2022 at 10:06:59PM +0200, Arnd Bergmann wrote:
>> On Tue, Oct 11, 2022, at 1:30 PM, Thomas Zimmermann wrote:
>> > Am 11.10.22 um 09:46 schrieb Javier Martinez Canillas:
>> >>> +static bool display_get_big_endian_of(struct drm_device *dev, struct device_node *of_node)
>> >>> +{
>> >>> +	bool big_endian;
>> >>> +
>> >>> +#ifdef __BIG_ENDIAN
>> >>> +	big_endian = true;
>> >>> +	if (of_get_property(of_node, "little-endian", NULL))
>> >>> +		big_endian = false;
>> >>> +#else
>> >>> +	big_endian = false;
>> >>> +	if (of_get_property(of_node, "big-endian", NULL))
>> >>> +		big_endian = true;
>> >>> +#endif
>> >>> +
>> >>> +	return big_endian;
>> >>> +}
>> >>> +
>> >> 
>> >> Ah, I see. The heuristic then is whether the build is BE or LE or if the Device
>> >> Tree has an explicit node defining the endianess. The patch looks good to me:
>> >
>> > Yes. I took this test from offb.
>> 
>> Has the driver been tested with little-endian kernels though? While
>> ppc32 kernels are always BE, you can build kernels as either big-endian
>> or little-endian for most (modern) powerpc64 and arm/arm64 hardware,
>> and I don't see why that should change the defaults of the driver
>> when describing the same framebuffer hardware.
>
> The original code was added with
> commit 7f29b87a7779 ("powerpc: offb: add support for foreign endianness")
>
> The hardware is either big-endian or runtime-switchable-endian.

Are you referring to CPU hardware or framebuffer hardware here?

> It makes
> sense to assume big-endian when runnig big-endian and the DT does not
> specify endian which is likely on a historical system.

Agreed, assuming big-endian here clearly makes sense.

> It also makes sense to assume that on system with
> runtime-switchable-endian the DT specifies the framebuffer endian.
>
> If systems that only do little-endian exist or emerge later then it also
> makes sense to assume that the framebuffer matches the host if not
> specified.
>
> I don't really see a problem here.
>
> BTW is this used on arm and on what platform?

I'm not aware of any users on Arm, most likely they all use
simplefb/simpledrm or a gpu specific binding. There might be
users on sparc, but they would obviously be big-endian
as well.

> I do not see any bindings in dts.

Right, that is the real problem I see as well. I found the original
CHRP binding document at
https://www.devicetree.org/open-firmware/bindings/devices/html/lfb-1_0d.html

Unfortunately, this only specifies an 8-bit-per-pixel mode, and the
multi-byte pixel support that was added in linux-2.1.125 was
probably powermac specific without a public specification.

I think ideally we should add a binding document that describes what
the driver actually expects, but in this case I would just drop the
#ifdef check and always assume the framebuffer is big-endian unless
the "little-endian" property is set, in order to have a sensible
definition that does not depend on what OS (i.e. Linux
CONFIG_CPU_BIG_ENDIAN) you are running.

       Arnd

  reply	other threads:[~2022-10-12  6:31 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-28 10:50 [PATCH v4 0/5] drm: Add driver for PowerPC OF displays Thomas Zimmermann
2022-09-28 10:50 ` Thomas Zimmermann
2022-09-28 10:50 ` [PATCH v4 1/5] drm/ofdrm: Add ofdrm for Open Firmware framebuffers Thomas Zimmermann
2022-09-28 10:50   ` Thomas Zimmermann
2022-09-28 10:50 ` [PATCH v4 2/5] drm/ofdrm: Add CRTC state Thomas Zimmermann
2022-09-28 10:50   ` Thomas Zimmermann
2022-09-28 10:50 ` [PATCH v4 3/5] drm/ofdrm: Add per-model device function Thomas Zimmermann
2022-09-28 10:50   ` Thomas Zimmermann
2022-09-28 10:50 ` [PATCH v4 4/5] drm/ofdrm: Support color management Thomas Zimmermann
2022-09-28 10:50   ` Thomas Zimmermann
2022-09-28 10:50 ` [PATCH v4 5/5] drm/ofdrm: Support big-endian scanout buffers Thomas Zimmermann
2022-09-28 10:50   ` Thomas Zimmermann
2022-09-28 11:12   ` Michal Suchánek
2022-09-28 11:12     ` Michal Suchánek
2022-09-28 11:12     ` Michal Suchánek
2022-09-28 11:30     ` Thomas Zimmermann
2022-09-28 11:30       ` Thomas Zimmermann
2022-09-28 11:30       ` Thomas Zimmermann
2022-10-11  7:46   ` Javier Martinez Canillas
2022-10-11 11:30     ` Thomas Zimmermann
2022-10-11 20:06       ` Arnd Bergmann
2022-10-11 21:38         ` Michal Suchánek
2022-10-11 21:38           ` Michal Suchánek
2022-10-11 21:38           ` Michal Suchánek
2022-10-12  6:29           ` Arnd Bergmann [this message]
2022-10-12  7:23             ` Michal Suchánek
2022-10-12  6:46         ` Thomas Zimmermann
2022-10-12  7:17           ` Arnd Bergmann
2022-10-12  7:40             ` Thomas Zimmermann
2022-10-12  7:44               ` Arnd Bergmann
2022-10-12  8:27                 ` Thomas Zimmermann
2022-10-12  8:38                   ` Arnd Bergmann
2022-10-12 12:00                     ` Thomas Zimmermann
2022-10-12 13:12                       ` Arnd Bergmann
2022-10-12 14:27                         ` Michal Suchánek
2022-10-12 14:27                           ` Michal Suchánek
2022-10-12 14:27                           ` Michal Suchánek
2022-10-13  7:39                           ` Javier Martinez Canillas
2022-10-13  7:39                             ` Javier Martinez Canillas
2022-10-13  7:39                             ` Javier Martinez Canillas
2022-10-17  6:44                             ` Benjamin Herrenschmidt
2022-10-17  6:44                               ` Benjamin Herrenschmidt
2022-10-17  6:44                               ` Benjamin Herrenschmidt
2022-10-12 14:31                         ` Thomas Zimmermann
2022-10-12 14:59                           ` Ville Syrjälä
2022-10-12 14:59                             ` Ville Syrjälä
2022-10-12 14:59                             ` Ville Syrjälä
2022-10-12 16:01                             ` Michal Suchánek
2022-10-12 16:01                               ` Michal Suchánek
2022-10-12 16:01                               ` Michal Suchánek
2022-10-12 12:07                     ` Michal Suchánek
2022-10-12 12:07                       ` Michal Suchánek
2022-10-12 12:07                       ` Michal Suchánek

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=87fbe7bd-1160-420e-984b-5afccd5d523c@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=linuxppc-dev@lists.ozlabs.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.