linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Stuge <peter@stuge.se>
To: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: hudson@trmm.net, markus@raatikainen.cc,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-usb@vger.kernel.org,
	dri-devel <dri-devel@lists.freedesktop.org>,
	th020394@gmail.com, lkundrak@v3.sk, pontus.fuchs@gmail.com,
	Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH v7 3/3] drm: Add GUD USB Display driver
Date: Thu, 11 Mar 2021 22:57:51 +0000	[thread overview]
Message-ID: <20210311225751.2721.qmail@stuge.se> (raw)
In-Reply-To: <CAKb7UvihLX0hgBOP3VBG7O+atwZcUVCPVuBdfmDMpg0NjXe-cQ@mail.gmail.com>

Ilia Mirkin wrote:
> > > #define DRM_FORMAT_XRGB8888   fourcc_code('X', 'R', '2', '4') /* [31:0]
> > > x:R:G:B 8:8:8:8 little endian */
> >
> > Okay, "[31:0] x:R:G:B 8:8:8:8" can certainly mean
> > [31:24]=x [23:16]=R [15:8]=G [7:0]=B, which when stored "little endian"
> > becomes B G R X in memory, for which your pix32 code is correct.
> >
> > That's the reverse *memory* layout of what the name says :)
> 
> The definition of the formats is memory layout in little endian.

To clarify, my new (hopefully correct?) understanding is this:

XRGB8888 does *not* mean that address 0=X, 1=R, 2=G, 3=B, but that
the most significant byte in a packed XRGB8888 32-bit integer is X
and the least significant byte is B, and that this is the case both
on LE and BE machines.

I previously thought that XRGB8888 indicated the memory byte order of
components being X R G B regardless of machine endianess, but now
understand XRGB to mean the MSB..LSB order of component bytes within
the 32-bit integer, as seen by software, not the order of bytes in memory.


> The definition you see is of a 32-bit packed little-endian integer,
> which is a fixed memory layout.

In the header definition I'm not completely sure what the "little endian"
means - I guess it refers to how the 32-bit integer will be stored in memory,
but it could also refer to the order of component packing within.

Noralf's code and testing and also what fbset tells me seems to support
this understanding, at least on LE machines.


> Now, if you're on an actual big-endian platform, and you want to
> accept big-endian-packed formats, there's a bit of unpleasantness that
> goes on.

In the particular case of XRGB8888 that Noralf has implemented and
I've tested every pixel is translated "manually" anyway; each
component byte is downconverted to a single bit, but this use case
is mostly for smaller resolutions, so no too big deal.


> I'm not sure why you guys were talking about BE in the first place,

I was worried that the translation didn't consider endianess.

Noralf, looking at the 3/3 patch again now, drm_fb_swab() gets called
on BE when format == fb->format, but does it also need to be called
on BE they are different, or will circumstances be such that it's
never neccessary then?


Thanks and sorry if I'm confusing things needlessly

//Peter

  reply	other threads:[~2021-03-11 22:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 16:31 [PATCH v7 0/3] GUD USB Display driver Noralf Trønnes
2021-03-05 16:31 ` [PATCH v7 1/3] drm/uapi: Add USB connector type Noralf Trønnes
2021-03-05 16:31 ` [PATCH v7 2/3] drm/probe-helper: Check epoch counter in output_poll_execute() Noralf Trønnes
2021-03-05 16:31 ` [PATCH v7 3/3] drm: Add GUD USB Display driver Noralf Trønnes
2021-03-08 18:13   ` Noralf Trønnes
2021-03-09 14:02   ` Peter Stuge
2021-03-09 18:07     ` Noralf Trønnes
2021-03-09 18:16       ` Noralf Trønnes
2021-03-10  4:55       ` Peter Stuge
2021-03-10 11:43         ` Noralf Trønnes
2021-03-11 14:48           ` Peter Stuge
2021-03-11 17:16             ` Noralf Trønnes
2021-03-11 20:02               ` Peter Stuge
2021-03-11 21:36                 ` Ilia Mirkin
2021-03-11 22:57                   ` Peter Stuge [this message]
2021-03-12  0:19                     ` Ilia Mirkin
2021-03-12  4:32                       ` Peter Stuge
2021-03-12 11:53                         ` Noralf Trønnes

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=20210311225751.2721.qmail@stuge.se \
    --to=peter@stuge.se \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hudson@trmm.net \
    --cc=imirkin@alum.mit.edu \
    --cc=linux-usb@vger.kernel.org \
    --cc=lkundrak@v3.sk \
    --cc=markus@raatikainen.cc \
    --cc=pontus.fuchs@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=th020394@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;
as well as URLs for NNTP newsgroup(s).