From: "Noralf Trønnes" <noralf@tronnes.org>
To: Peter Stuge <peter@stuge.se>
Cc: hudson@trmm.net, markus@raatikainen.cc,
Daniel Vetter <daniel.vetter@ffwll.ch>,
linux-usb@vger.kernel.org, dri-devel@lists.freedesktop.org,
th020394@gmail.com, lkundrak@v3.sk, pontus.fuchs@gmail.com,
sam@ravnborg.org
Subject: Re: [PATCH v7 3/3] drm: Add GUD USB Display driver
Date: Wed, 10 Mar 2021 12:43:26 +0100 [thread overview]
Message-ID: <1894f3f7-bd1d-493e-8d7f-8c10917da51b@tronnes.org> (raw)
In-Reply-To: <20210310045544.28961.qmail@stuge.se>
Den 10.03.2021 05.55, skrev Peter Stuge:
> Noralf Trønnes wrote:
>>> Depending on how long it takes for the DMA mask dependency patch to show
>>> up in drm-misc-next, I will either publish a new version or apply the
>>> current and provide patches with the necessary fixes.
>>
>> In case I apply this version, are you happy enough with it that you want
>> to give an ack or r-b?
>
> I've now tested R1 and RGB111 and I think I've found two more things:
>
> I didn't receive the expected bits/bytes for RGB111 on the bulk endpoint,
> I think because of how components were extracted in gud_xrgb8888_to_color().
>
> Changing to the following gets me the expected (X R1 G1 B1 X R2 G2 B2) bytes:
>
> r = (*pix32 >> 8) & 0xff;
> g = (*pix32 >> 16) & 0xff;
> b = (*pix32++ >> 24) & 0xff;
>
We're accessing the whole word here through pix32, no byte access, so
endianess doesn't come into play. This change will flip r and b, which
gives: XRGB8888 -> XBGR1111
BGR is a common thing on controllers, are you sure yours are set to RGB
and not BGR?
And the 0xff masking isn't necessary since we're assigning to a byte, right?
I haven't got a native R1G1B1 display so I have emulated and I do get
the expected colors. This is the conversion function I use on the device
which I think is correct:
static size_t rgb111_to_rgb565(uint16_t *dst, uint8_t *src,
uint16_t src_width, uint16_t src_height)
{
uint8_t rgb111, val = 0;
size_t len = 0;
for (uint16_t y = 0; y < src_height; y++) {
for (uint16_t x = 0; x < src_width; x++) {
if (!(x % 2))
val = *src++;
rgb111 = val >> 4;
*dst++ = ((rgb111 & 0x04) << 13) | ((rgb111 & 0x02) << 9) |
((rgb111 & 0x01) << 4);
len += sizeof(*dst);
val <<= 4;
}
}
return len;
}
>
> Then, gud_xrgb8888_to_color() and maybe even gud_xrgb8888_to_r124() seem
> to be host endian dependent, at least because of that pix32, but maybe more?
> I don't know whether drm guarantees "native" XRGB byte sequence in memory,
> then I guess the pix32 is okay? Please take a look?
>
>
> Finally my very last ask: Please consider renaming GUD_PIXEL_FORMAT_RGB111
> to GUD_PIXEL_FORMAT_XRGB1111?
>
It has crossed my mind, I'll change it.
Noralf.
next prev parent reply other threads:[~2021-03-10 11:44 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 [this message]
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
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=1894f3f7-bd1d-493e-8d7f-8c10917da51b@tronnes.org \
--to=noralf@tronnes.org \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=hudson@trmm.net \
--cc=linux-usb@vger.kernel.org \
--cc=lkundrak@v3.sk \
--cc=markus@raatikainen.cc \
--cc=peter@stuge.se \
--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).