All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "Javier Martinez Canillas" <javierm@redhat.com>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Simon Ser" <contact@emersion.fr>,
	"Linux PWM List" <linux-pwm@vger.kernel.org>,
	"Linux Fbdev development list" <linux-fbdev@vger.kernel.org>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"David Airlie" <airlied@linux.ie>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"DRI Development" <dri-devel@lists.freedesktop.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Maxime Ripard" <maxime@cerno.tech>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH 0/4] drm/tiny: Add driver for Solomon SSD1307 OLED displays
Date: Wed, 2 Feb 2022 11:55:34 +0100	[thread overview]
Message-ID: <CAMuHMdVvUO3rWfvM0M0EdTNdJ4AabT_cN--T9Kv5ZZx5u1U2=g@mail.gmail.com> (raw)
In-Reply-To: <20220202111954.6ee9a10c@eldfell>

Hi Pekka,

On Wed, Feb 2, 2022 at 10:20 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> On Tue, 1 Feb 2022 12:07:07 +0100
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, Feb 1, 2022 at 11:42 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> > > On Tue, 1 Feb 2022 10:49:03 +0100
> > > Javier Martinez Canillas <javierm@redhat.com> wrote:
> > > > On 2/1/22 09:38, Daniel Vetter wrote:
> > > > > On Tue, Feb 1, 2022 at 9:34 AM Simon Ser <contact@emersion.fr> wrote:
> > > > >> On Tuesday, February 1st, 2022 at 09:26, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > >>> What's the story with the Rn formats?
> > > > >>>
> > > > >>> The comments say "n bpp Red", while this is a monochrome (even
> > > > >>> inverted) display?
> > > > >>
> > > > >> I don't think the color matters that much. "Red" was picked just because it was
> > > > >> an arbitrary color, to make the difference with e.g. C8. Or am I mistaken?
> > > > >
> > > > > The red comes from gl, where with shaders it really doesn't matter
> > > > > what meaning you attach to channels, but really just how many you
> > > > > have. So 2-channel formats are called RxGx, 3-channel RxGxBx,
> > > > > 4-channel RxGxBxAx and single-channel Rx. And we use drm_fourcc for
> > > > > interop in general, hence why these exist.
> > > > >
> > > > > We should probably make a comment that this really isn't a red channel
> > > > > when used for display it's a greyscale/intensity format. Aside from
> > > > > that documentation gap I think reusing Rx formats for
> > > > > greyscale/intensity for display makes perfect sense.
> > > > > -Daniel
> > > >
> > > > To sump up the conversation in the #dri-devel channel, these drivers
> > > > should support the following formats:
> > > >
> > > > 1) Dx (Daniel suggested that for darkness, but inverted mono)
> > >
> > > Did you consider format C1 instead?
> >
> > That would be a 2-color display, which is not necessarily black
> > and white. Cfr. Amiga or Atari bit planes with bpp=1.
> > That's why fbdev has separate visuals for monochrome.
>
> Yes, that is exactly what I was aiming at: to draft a plan for panels
> that have a fixed and arbitrary palette. From the discussions I
> understood that the panel in question here requires somehow reversed
> colors ("inverted mono"), which didn't really sound to be like "normal
> monochrome".
>
> > > I have no idea how this would map to fbdev API though.
> >
> >     #define FB_VISUAL_MONO01                0       /* Monochr.
> > 1=Black 0=White */
> >     #define FB_VISUAL_MONO10                1       /* Monochr.
> > 1=White 0=Black */
> >     #define FB_VISUAL_TRUECOLOR             2       /* True color   */
> >
> > The above is RGB (or grayscale, see below).
> >
> >     #define FB_VISUAL_PSEUDOCOLOR           3       /* Pseudo color
> > (like atari) */
> >
> > Palette
> >
> >     #define FB_VISUAL_DIRECTCOLOR           4       /* Direct color */
> >
> > Usually used as RGB with gamma correction, but the actual hardware
> > is more flexible.
> >
> >     #define FB_VISUAL_STATIC_PSEUDOCOLOR    5       /* Pseudo color readonly */
> >
> > Fixed palette
> >
> > And:
> >
> >     struct fb_var_screeninfo {
> >             ...
> >             __u32 grayscale;                /* 0 = color, 1 = grayscale,    */
>
> DRM has pixel formats, but no visuals so far. Maybe it needs to grow
> the concept of visuals in some form? However, care should be taken to
> not clash with existing colorimetry features. I would hope that the
> colorimetry feature set could be extended to cover the above as well.
> Well, only if there would be any users for it.

Fbdev has separate (orthogonal) settings for
  1. Frame buffer layout (FB_TYPE_*),
  2. Pixel format (depth and fb_bitfields),
  3. Visual.
DRM combines all of the above in a fourcc value.

Nowadays most frame buffer layouts are packed, so using a shadow
frame buffer to support other layouts is very helpful, as it means
applications no longer have to care about legacy frame buffer layouts.

> My silly attempt with Cx formats (e.g. DRM_FORMAT_C8) was a stab in that
> direction, but maybe not flexible enough for the above.
>
> If on the other hand the panel is "grayscale" but with an arbitrary
> color (white, green, orange or other on black), the IRC consensus seems
> to be that one should use Rx formats (e.g. DRM_FORMAT_R8) for it,
> regardless of the actual color. That would convey that the pixel value
> has a monotonic (increasing) mapping to brightness, unlike with
> paletted formats. I agree with this, but wonder how reversed brightness

Agreed, the only thing that matters is a monotonic mapping, and
whether it's increasing or decreasing.

> should be dealt with - or just have the driver invert the pixel values
> before sending them to display?

That's an option. If the data has to be copied anyway, inversion is
a cheap operation. Else I think you need new fourcc types.

> Cx formats with a read-only palette could be used to represent
> "grayscale" and "reversed grayscale" too, but people seem to think that
> is too complicated to analyse and use for KMS userspace.

Yeah, it's complicated, but rather rare. Most desktop hardware
(even from the nineties ;-) does support a programmable palette.
Exceptions are CGA, the C64 (no Linux support yet ;-), and eInk
displays that support e.g. white, black, and red.

If you do want to support it, perhaps introduce Fx (F = fixed)
fourcc types?

> Other #dri-devel IRC mumblings were about maybe adding a DRM pixel
> format for grayscale or intensity or luminance so that one would not
> need to use "red" color channel for something that doesn't look red.
> That is, do not use Cx formats because those produce completely
> arbitrary colors, and do not use Rx formats because the display is not
> redscale. Personally I'd be fine with Rx formats.

Fine, as said above, monotonic mapping is what matters.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

WARNING: multiple messages have this Message-ID (diff)
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "Linux PWM List" <linux-pwm@vger.kernel.org>,
	"Linux Fbdev development list" <linux-fbdev@vger.kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Mark Brown" <broonie@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"DRI Development" <dri-devel@lists.freedesktop.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Maxime Ripard" <maxime@cerno.tech>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Lee Jones" <lee.jones@linaro.org>
Subject: Re: [PATCH 0/4] drm/tiny: Add driver for Solomon SSD1307 OLED displays
Date: Wed, 2 Feb 2022 11:55:34 +0100	[thread overview]
Message-ID: <CAMuHMdVvUO3rWfvM0M0EdTNdJ4AabT_cN--T9Kv5ZZx5u1U2=g@mail.gmail.com> (raw)
In-Reply-To: <20220202111954.6ee9a10c@eldfell>

Hi Pekka,

On Wed, Feb 2, 2022 at 10:20 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> On Tue, 1 Feb 2022 12:07:07 +0100
> Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, Feb 1, 2022 at 11:42 AM Pekka Paalanen <ppaalanen@gmail.com> wrote:
> > > On Tue, 1 Feb 2022 10:49:03 +0100
> > > Javier Martinez Canillas <javierm@redhat.com> wrote:
> > > > On 2/1/22 09:38, Daniel Vetter wrote:
> > > > > On Tue, Feb 1, 2022 at 9:34 AM Simon Ser <contact@emersion.fr> wrote:
> > > > >> On Tuesday, February 1st, 2022 at 09:26, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > > >>> What's the story with the Rn formats?
> > > > >>>
> > > > >>> The comments say "n bpp Red", while this is a monochrome (even
> > > > >>> inverted) display?
> > > > >>
> > > > >> I don't think the color matters that much. "Red" was picked just because it was
> > > > >> an arbitrary color, to make the difference with e.g. C8. Or am I mistaken?
> > > > >
> > > > > The red comes from gl, where with shaders it really doesn't matter
> > > > > what meaning you attach to channels, but really just how many you
> > > > > have. So 2-channel formats are called RxGx, 3-channel RxGxBx,
> > > > > 4-channel RxGxBxAx and single-channel Rx. And we use drm_fourcc for
> > > > > interop in general, hence why these exist.
> > > > >
> > > > > We should probably make a comment that this really isn't a red channel
> > > > > when used for display it's a greyscale/intensity format. Aside from
> > > > > that documentation gap I think reusing Rx formats for
> > > > > greyscale/intensity for display makes perfect sense.
> > > > > -Daniel
> > > >
> > > > To sump up the conversation in the #dri-devel channel, these drivers
> > > > should support the following formats:
> > > >
> > > > 1) Dx (Daniel suggested that for darkness, but inverted mono)
> > >
> > > Did you consider format C1 instead?
> >
> > That would be a 2-color display, which is not necessarily black
> > and white. Cfr. Amiga or Atari bit planes with bpp=1.
> > That's why fbdev has separate visuals for monochrome.
>
> Yes, that is exactly what I was aiming at: to draft a plan for panels
> that have a fixed and arbitrary palette. From the discussions I
> understood that the panel in question here requires somehow reversed
> colors ("inverted mono"), which didn't really sound to be like "normal
> monochrome".
>
> > > I have no idea how this would map to fbdev API though.
> >
> >     #define FB_VISUAL_MONO01                0       /* Monochr.
> > 1=Black 0=White */
> >     #define FB_VISUAL_MONO10                1       /* Monochr.
> > 1=White 0=Black */
> >     #define FB_VISUAL_TRUECOLOR             2       /* True color   */
> >
> > The above is RGB (or grayscale, see below).
> >
> >     #define FB_VISUAL_PSEUDOCOLOR           3       /* Pseudo color
> > (like atari) */
> >
> > Palette
> >
> >     #define FB_VISUAL_DIRECTCOLOR           4       /* Direct color */
> >
> > Usually used as RGB with gamma correction, but the actual hardware
> > is more flexible.
> >
> >     #define FB_VISUAL_STATIC_PSEUDOCOLOR    5       /* Pseudo color readonly */
> >
> > Fixed palette
> >
> > And:
> >
> >     struct fb_var_screeninfo {
> >             ...
> >             __u32 grayscale;                /* 0 = color, 1 = grayscale,    */
>
> DRM has pixel formats, but no visuals so far. Maybe it needs to grow
> the concept of visuals in some form? However, care should be taken to
> not clash with existing colorimetry features. I would hope that the
> colorimetry feature set could be extended to cover the above as well.
> Well, only if there would be any users for it.

Fbdev has separate (orthogonal) settings for
  1. Frame buffer layout (FB_TYPE_*),
  2. Pixel format (depth and fb_bitfields),
  3. Visual.
DRM combines all of the above in a fourcc value.

Nowadays most frame buffer layouts are packed, so using a shadow
frame buffer to support other layouts is very helpful, as it means
applications no longer have to care about legacy frame buffer layouts.

> My silly attempt with Cx formats (e.g. DRM_FORMAT_C8) was a stab in that
> direction, but maybe not flexible enough for the above.
>
> If on the other hand the panel is "grayscale" but with an arbitrary
> color (white, green, orange or other on black), the IRC consensus seems
> to be that one should use Rx formats (e.g. DRM_FORMAT_R8) for it,
> regardless of the actual color. That would convey that the pixel value
> has a monotonic (increasing) mapping to brightness, unlike with
> paletted formats. I agree with this, but wonder how reversed brightness

Agreed, the only thing that matters is a monotonic mapping, and
whether it's increasing or decreasing.

> should be dealt with - or just have the driver invert the pixel values
> before sending them to display?

That's an option. If the data has to be copied anyway, inversion is
a cheap operation. Else I think you need new fourcc types.

> Cx formats with a read-only palette could be used to represent
> "grayscale" and "reversed grayscale" too, but people seem to think that
> is too complicated to analyse and use for KMS userspace.

Yeah, it's complicated, but rather rare. Most desktop hardware
(even from the nineties ;-) does support a programmable palette.
Exceptions are CGA, the C64 (no Linux support yet ;-), and eInk
displays that support e.g. white, black, and red.

If you do want to support it, perhaps introduce Fx (F = fixed)
fourcc types?

> Other #dri-devel IRC mumblings were about maybe adding a DRM pixel
> format for grayscale or intensity or luminance so that one would not
> need to use "red" color channel for something that doesn't look red.
> That is, do not use Cx formats because those produce completely
> arbitrary colors, and do not use Rx formats because the display is not
> redscale. Personally I'd be fine with Rx formats.

Fine, as said above, monotonic mapping is what matters.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2022-02-02 10:55 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 20:12 [PATCH 0/4] drm/tiny: Add driver for Solomon SSD1307 OLED displays Javier Martinez Canillas
2022-01-31 20:12 ` Javier Martinez Canillas
2022-01-31 20:12 ` [PATCH 1/4] drm: Add I2C connector type Javier Martinez Canillas
2022-01-31 20:12   ` Javier Martinez Canillas
2022-01-31 20:52   ` Sam Ravnborg
2022-01-31 23:26     ` Javier Martinez Canillas
2022-01-31 23:26       ` Javier Martinez Canillas
2022-02-01 12:58     ` Noralf Trønnes
2022-02-01 12:58       ` Noralf Trønnes
2022-02-01 13:06       ` Javier Martinez Canillas
2022-02-01 13:20         ` Noralf Trønnes
2022-02-01 13:55           ` Javier Martinez Canillas
2022-02-01 13:38       ` Simon Ser
2022-02-01 13:38         ` Simon Ser
2022-02-01 14:20         ` Noralf Trønnes
2022-02-01 14:20           ` Noralf Trønnes
2022-02-01 20:57       ` Sam Ravnborg
2022-02-01 22:29         ` Simon Ser
2022-02-01 22:29           ` Simon Ser
2022-02-02  8:46           ` Javier Martinez Canillas
2022-02-02  8:46             ` Javier Martinez Canillas
2022-02-02  9:14       ` Thomas Zimmermann
2022-02-02  9:14         ` Thomas Zimmermann
2022-02-02  9:45         ` Noralf Trønnes
2022-02-02  9:45           ` Noralf Trønnes
2022-02-02 15:04           ` Pekka Paalanen
2022-02-02 15:04             ` Pekka Paalanen
2022-02-02 16:00             ` Noralf Trønnes
2022-02-02 16:00               ` Noralf Trønnes
2022-01-31 20:12 ` [PATCH 2/4] drm/format-helper: Add drm_fb_gray8_to_mono_reversed() Javier Martinez Canillas
2022-01-31 20:12   ` Javier Martinez Canillas
2022-02-01  9:59   ` Thomas Zimmermann
2022-02-01  9:59     ` Thomas Zimmermann
2022-02-01 11:13     ` Pekka Paalanen
2022-02-01 11:13       ` Pekka Paalanen
2022-02-01 11:48     ` Javier Martinez Canillas
2022-02-01 11:48       ` Javier Martinez Canillas
2022-03-14 13:40   ` Geert Uytterhoeven
2022-03-14 13:40     ` Geert Uytterhoeven
2022-03-14 14:07     ` Javier Martinez Canillas
2022-03-14 14:07       ` Javier Martinez Canillas
2022-01-31 20:36 ` [PATCH 0/4] drm/tiny: Add driver for Solomon SSD1307 OLED displays Simon Ser
2022-01-31 20:36   ` Simon Ser
2022-01-31 20:39   ` Simon Ser
2022-01-31 20:39     ` Simon Ser
2022-01-31 23:21     ` Javier Martinez Canillas
2022-01-31 23:21       ` Javier Martinez Canillas
2022-02-01  8:26     ` Geert Uytterhoeven
2022-02-01  8:26       ` Geert Uytterhoeven
2022-02-01  8:34       ` Simon Ser
2022-02-01  8:34         ` Simon Ser
2022-02-01  8:36         ` Geert Uytterhoeven
2022-02-01  8:36           ` Geert Uytterhoeven
2022-02-01 10:08           ` Thomas Zimmermann
2022-02-01 10:08             ` Thomas Zimmermann
2022-02-01 10:11             ` Simon Ser
2022-02-01 10:11               ` Simon Ser
2022-02-01 10:17               ` Thomas Zimmermann
2022-02-01 10:17                 ` Thomas Zimmermann
2022-02-01  8:38         ` Daniel Vetter
2022-02-01  8:38           ` Daniel Vetter
2022-02-01  9:49           ` Javier Martinez Canillas
2022-02-01  9:49             ` Javier Martinez Canillas
2022-02-01 10:42             ` Pekka Paalanen
2022-02-01 10:42               ` Pekka Paalanen
2022-02-01 11:07               ` Geert Uytterhoeven
2022-02-01 11:07                 ` Geert Uytterhoeven
2022-02-02  9:19                 ` Pekka Paalanen
2022-02-02  9:19                   ` Pekka Paalanen
2022-02-02 10:55                   ` Geert Uytterhoeven [this message]
2022-02-02 10:55                     ` Geert Uytterhoeven
2022-01-31 20:56 ` Sam Ravnborg
2022-01-31 23:37   ` Javier Martinez Canillas
2022-01-31 23:37     ` Javier Martinez Canillas
2022-02-01  9:37   ` Andy Shevchenko
2022-02-01  9:37     ` Andy Shevchenko
2022-02-01 11:31     ` Javier Martinez Canillas
2022-02-01 11:31       ` Javier Martinez Canillas
2022-02-01 11:38       ` Geert Uytterhoeven
2022-02-01 11:38         ` Geert Uytterhoeven
2022-02-01 13:09         ` Javier Martinez Canillas
2022-02-01 13:09           ` Javier Martinez Canillas
2022-02-01 14:14           ` Geert Uytterhoeven
2022-02-01 14:14             ` Geert Uytterhoeven
2022-02-01 15:03             ` Javier Martinez Canillas
2022-02-01 15:03               ` Javier Martinez Canillas
2022-02-01 20:40               ` Sam Ravnborg
2022-02-01 20:40                 ` Sam Ravnborg
2022-02-02  8:38                 ` Javier Martinez Canillas
2022-02-02  8:38                   ` Javier Martinez Canillas
2022-02-02 11:06                   ` Andy Shevchenko
2022-02-02 11:06                     ` Andy Shevchenko
2022-02-02 11:39                     ` Javier Martinez Canillas
2022-02-02 11:39                       ` Javier Martinez Canillas
2022-02-02 11:50                       ` Andy Shevchenko
2022-02-02 11:50                         ` Andy Shevchenko
2022-02-02 11:54                         ` Javier Martinez Canillas
2022-02-02 11:54                           ` Javier Martinez Canillas
2022-02-02 12:21                           ` Andy Shevchenko
2022-02-02 12:21                             ` Andy Shevchenko
2022-02-01  8:43 ` Geert Uytterhoeven
2022-02-01  8:43   ` Geert Uytterhoeven
2022-02-01  9:27   ` Simon Ser
2022-02-01  9:27     ` Simon Ser
2022-02-01 10:36   ` Javier Martinez Canillas
2022-02-01 10:36     ` Javier Martinez Canillas

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='CAMuHMdVvUO3rWfvM0M0EdTNdJ4AabT_cN--T9Kv5ZZx5u1U2=g@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=airlied@linux.ie \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=contact@emersion.fr \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=javierm@redhat.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=maxime@cerno.tech \
    --cc=noralf@tronnes.org \
    --cc=ppaalanen@gmail.com \
    --cc=thierry.reding@gmail.com \
    --cc=tzimmermann@suse.de \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.