From: Pekka Paalanen <ppaalanen@gmail.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: dri-devel@lists.freedesktop.org,
open list <linux-kernel@vger.kernel.org>,
amd-gfx@lists.freedesktop.org,
Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [RfC PATCH] drm: fourcc byteorder: brings header file comments in line with reality.
Date: Mon, 10 Apr 2017 16:12:14 +0300 [thread overview]
Message-ID: <20170410161214.305f5daf@eldfell> (raw)
In-Reply-To: <20170410101202.19229-1-kraxel@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 4979 bytes --]
On Mon, 10 Apr 2017 12:12:01 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:
> Ok, this is really a kickstart for a discussion. While working on
> graphics support for virtual machines on ppc64 (which exists in both
> little and big endian variants) I've figured the comments in the header
> file don't match reality. They are not considered little endian (as
> suggested by the comments) but in practice are used as native endian.
>
> So, go update the comments.
>
> This patch switches all 32bpp / 8 bpc formats over to native endian.
> Those used/supported by ppc64 virtual machines (virtio-gpu/bochs-drm
> drivers).
>
> Given that DRM_FORMAT_BIG_ENDIAN isn't used anywhere in the codebase
> I suspect this problem applies to more formats. When looking at
> drm_mode_legacy_fb_format it seems *all* RGB formats are actually
> native endian not little endian.
>
> Dunno where we stand in terms of YCbCr.
>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel.vetter@intel.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
> include/uapi/drm/drm_fourcc.h | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
Hi,
which software have you used as representative of "reality"?
I worry is that there is potential to have endianess bugs in every
layer of the graphics stack: driver, Mesa, display servers,
compositors, toolkits, and applications. What's worse, two wrongs might
sometimes make a right - incorrectly swapping twice gives you what you
expected in the first place.
We just had a detailed review to get a new pixel format
definitions list in Weston right for LE vs. BE and Pixman vs. DRM vs.
OpenGL. We took the DRM definition literally to be always described in
LE regardless of machine endianess:
https://cgit.freedesktop.org/wayland/weston/commit/?id=903721a6215f474787b5daf02761fbcb1d3a0bb5
We also have this fun problem in Wayland:
https://lists.freedesktop.org/archives/wayland-devel/2017-March/033492.html
To solve that problem, we would like to know if anything existing would
break for each possible solution, but no developers using BE have really
turned up.
We have known for a long time that at least Weston is likely broken on
BE wrt. pixel formats.
We also have a bug for Mesa EGL/Wayland:
https://bugs.freedesktop.org/show_bug.cgi?id=99638
> diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
> index 995c8f9..a7fc81d 100644
> --- a/include/uapi/drm/drm_fourcc.h
> +++ b/include/uapi/drm/drm_fourcc.h
> @@ -85,15 +85,15 @@ extern "C" {
> #define DRM_FORMAT_BGR888 fourcc_code('B', 'G', '2', '4') /* [23:0] B:G:R little endian */
>
> /* 32 bpp RGB */
> -#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 little endian */
> -#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 little endian */
> -#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 little endian */
> -#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 little endian */
> +#define DRM_FORMAT_XRGB8888 fourcc_code('X', 'R', '2', '4') /* [31:0] x:R:G:B 8:8:8:8 native endian */
> +#define DRM_FORMAT_XBGR8888 fourcc_code('X', 'B', '2', '4') /* [31:0] x:B:G:R 8:8:8:8 native endian */
> +#define DRM_FORMAT_RGBX8888 fourcc_code('R', 'X', '2', '4') /* [31:0] R:G:B:x 8:8:8:8 native endian */
> +#define DRM_FORMAT_BGRX8888 fourcc_code('B', 'X', '2', '4') /* [31:0] B:G:R:x 8:8:8:8 native endian */
>
> -#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 little endian */
> -#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 little endian */
> -#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 little endian */
> -#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 little endian */
> +#define DRM_FORMAT_ARGB8888 fourcc_code('A', 'R', '2', '4') /* [31:0] A:R:G:B 8:8:8:8 native endian */
> +#define DRM_FORMAT_ABGR8888 fourcc_code('A', 'B', '2', '4') /* [31:0] A:B:G:R 8:8:8:8 native endian */
> +#define DRM_FORMAT_RGBA8888 fourcc_code('R', 'A', '2', '4') /* [31:0] R:G:B:A 8:8:8:8 native endian */
> +#define DRM_FORMAT_BGRA8888 fourcc_code('B', 'A', '2', '4') /* [31:0] B:G:R:A 8:8:8:8 native endian */
>
> #define DRM_FORMAT_XRGB2101010 fourcc_code('X', 'R', '3', '0') /* [31:0] x:R:G:B 2:10:10:10 little endian */
> #define DRM_FORMAT_XBGR2101010 fourcc_code('X', 'B', '3', '0') /* [31:0] x:B:G:R 2:10:10:10 little endian */
These format definitions are directly referenced by Wayland protocol
extension for dmabufs and Mesa (wl_drm), and they have been copied into
the Wayland core protocol for wl_shm. Changing their definition would
be... awkward.
Thanks,
pq
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-04-10 13:12 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-10 10:12 [RfC PATCH] drm: fourcc byteorder: brings header file comments in line with reality Gerd Hoffmann
2017-04-10 12:02 ` Daniel Vetter
2017-04-10 16:28 ` Alex Deucher
2017-04-10 13:12 ` Pekka Paalanen [this message]
2017-04-10 14:17 ` Gerd Hoffmann
2017-04-10 14:45 ` Ilia Mirkin
2017-04-10 16:26 ` Alex Deucher
2017-04-10 15:09 ` Pekka Paalanen
2017-04-10 16:10 ` Ilia Mirkin
2017-04-11 7:31 ` Pekka Paalanen
2017-04-11 11:23 ` Gerd Hoffmann
2017-04-13 7:44 ` Pekka Paalanen
2017-04-11 14:18 ` Ilia Mirkin
2017-04-17 6:43 ` Ilia Mirkin
2017-04-18 2:53 ` Michel Dänzer
2017-04-18 5:04 ` Ilia Mirkin
2017-04-18 5:58 ` Michel Dänzer
2017-04-18 10:14 ` Gerd Hoffmann
2017-04-19 1:01 ` Michel Dänzer
2017-04-19 3:19 ` Ilia Mirkin
2017-04-19 3:28 ` Ilia Mirkin
2017-04-19 7:09 ` Pekka Paalanen
2017-04-19 12:34 ` Gerd Hoffmann
2017-04-18 10:00 ` Gerd Hoffmann
2017-04-18 11:18 ` Pekka Paalanen
2017-04-18 13:39 ` Gerd Hoffmann
2017-04-18 14:01 ` Pekka Paalanen
2017-04-18 20:50 ` Gerd Hoffmann
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=20170410161214.305f5daf@eldfell \
--to=ppaalanen@gmail.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@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