All of lore.kernel.org
 help / color / mirror / Atom feed
From: maxime.ripard@free-electrons.com (Maxime Ripard)
To: linux-arm-kernel@lists.infradead.org
Subject: MXS framebuffer driver and 18bits display
Date: Wed, 17 Apr 2013 17:15:48 +0200	[thread overview]
Message-ID: <516EBCA4.1020609@free-electrons.com> (raw)

Hi,

We noticed a strange bug with the 18 bits display found in the
iMX28 CFA-10049, but it should not be specific to it.

Like I said, we have a small 18-bits LCD panel. When further testing
it, it displayed horrible colors with standard jpg images used together
with tools such as fbv, applications written in Qt, etc.

Digging a bit into it, it looks like the mxsfb driver accepts devices
with 18bits interfaces.

However, in such case, the driver registers as a 32bits framebuffer
device, sets up the controller as a 24 bits display, and is actually
asking the controller to drop the 2 upper bits of each color by setting
the DATA_FORMAT_24_BIT bit in the HW_LCDIF_CTRL register.

So basically, applications feed to the framebuffer something like:

+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| R7| R6| R5| R4| R3| R2| R1| R0| G7| G6| G5| G4| G3| G2| G1| G0| B7| B6| B5| B4| B3| B2| B1| B0|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

And what is being sent to the LCD is:

+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| R5| R4| R3| R2| R1| R0| G5| G4| G3| G2| G1| G0| B5| B4| B3| B2| B1| B0|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

And thus, results in colors being horrible because the MSB are dropped.

What I believe the controller should send in theory should be :

+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| R7| R6| R5| R4| R3| R2| G7| G6| G5| G4| G3| G2| B7| B6| B5| B4| B3| B2|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Thus dropping the 2 LSB for each color. However, it doesn't seem that
the controller can be setup that way.

We thought of several solutions for this:
  - Switching to "real" 18 bits color depth
    * It is definitely not a good solution, since it requires the
      applications to handle the 18 bits color depth case, which only a
      few of them do.
  - Using the SHIFT_NUM_BITS bits in the HW_LCDIF_CTRL register
    * It doesn't look like a good solution either, since it seems to be
      shifting the whole 24 bits, and not each color independently, so
      the result will only be worse.
  - Use a 16 bits color depth
    * It doesn't seem possible either, since the 16 bits will be packed
      on two bytes, while the controller expects the 18 bits not to be
      packed.

Do you see a solution for this?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

             reply	other threads:[~2013-04-17 15:15 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17 15:15 Maxime Ripard [this message]
2013-04-18  9:23 ` [PATCH] video: mxsfb: Fix colors display on lower color depth Maxime Ripard
2013-04-18  9:23   ` Maxime Ripard
2013-04-18  9:23   ` Maxime Ripard
2013-04-18 14:00   ` Marek Vasut
2013-04-18 14:00     ` Marek Vasut
2013-04-18 14:00     ` Marek Vasut
2013-04-18 14:48   ` Shawn Guo
2013-04-18 14:48     ` Shawn Guo
2013-04-18 14:48     ` Shawn Guo
2013-04-22  8:07     ` Maxime Ripard
2013-04-22  8:07       ` Maxime Ripard
2013-04-22  8:07       ` Maxime Ripard
2013-04-18 14:47 ` MXS framebuffer driver and 18bits display Shawn Guo

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=516EBCA4.1020609@free-electrons.com \
    --to=maxime.ripard@free-electrons.com \
    --cc=linux-arm-kernel@lists.infradead.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.