All of lore.kernel.org
 help / color / mirror / Atom feed
* How to specify panel bit order in driver?
@ 2024-06-28  3:54 John Watts
  2024-06-28  7:45 ` Jani Nikula
  0 siblings, 1 reply; 4+ messages in thread
From: John Watts @ 2024-06-28  3:54 UTC (permalink / raw)
  To: dri-devel

Hello there,

A while ago I added support for the FS035VG158 panel to the kernel, with its
use case being on a Allwinner T113 board.

While troubleshooting some other issue (I will be posting about that this
weekend) I found that I need to tell the panel controller to use a bit depth of
18-bit in order for the panel to work correctly.

I plan to add another panel to the kernel that also requires setting the bit
depth, but has more configurations than just 24, 18, 16, it also supports
packing 18 of the bits together.

How all of this is configured depends on how the board and panel are wired
together, it can't be determined at runtime based on pixel formats or anything
like that. It seems to me that this needs to be specified in the device tree.

My question is: How would I represent this? A property like 'bit-depth'?
'color-mapping'? Or is there already some subsystem or convention designed for
this?

John.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to specify panel bit order in driver?
  2024-06-28  3:54 How to specify panel bit order in driver? John Watts
@ 2024-06-28  7:45 ` Jani Nikula
  2024-06-28 16:39   ` John Watts
  0 siblings, 1 reply; 4+ messages in thread
From: Jani Nikula @ 2024-06-28  7:45 UTC (permalink / raw)
  To: John Watts, dri-devel

On Fri, 28 Jun 2024, John Watts <contact@jookia.org> wrote:
> Hello there,
>
> A while ago I added support for the FS035VG158 panel to the kernel, with its
> use case being on a Allwinner T113 board.

Might be helpful to actually point at the source code or commits or
something.

> While troubleshooting some other issue (I will be posting about that this
> weekend) I found that I need to tell the panel controller to use a bit depth of
> 18-bit in order for the panel to work correctly.
>
> I plan to add another panel to the kernel that also requires setting the bit
> depth, but has more configurations than just 24, 18, 16, it also supports
> packing 18 of the bits together.
>
> How all of this is configured depends on how the board and panel are wired
> together, it can't be determined at runtime based on pixel formats or anything
> like that. It seems to me that this needs to be specified in the device tree.
>
> My question is: How would I represent this? A property like 'bit-depth'?
> 'color-mapping'? Or is there already some subsystem or convention designed for
> this?

Maybe look at include/uapi/drm/drm_fourcc.h, and how the DRM_FORMAT_*
macros are used.

Can't help you with device tree, but maybe this gives you pointers to
other places for examples.


HTH,
Jani.


-- 
Jani Nikula, Intel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to specify panel bit order in driver?
  2024-06-28  7:45 ` Jani Nikula
@ 2024-06-28 16:39   ` John Watts
  2024-07-02 11:30     ` Dmitry Baryshkov
  0 siblings, 1 reply; 4+ messages in thread
From: John Watts @ 2024-06-28 16:39 UTC (permalink / raw)
  To: Jani Nikula; +Cc: dri-devel

Hi Jani,

On Fri, Jun 28, 2024 at 10:45:48AM +0300, Jani Nikula wrote:
> Might be helpful to actually point at the source code or commits or
> something.

The source code is here: drivers/gpu/drm/panel/panel-newvision-nv3052c.c
It's just a standard MIPI DBI panel. It reports using an RGB888 bus format.

> Maybe look at include/uapi/drm/drm_fourcc.h, and how the DRM_FORMAT_*
> macros are used.
> 
> Can't help you with device tree, but maybe this gives you pointers to
> other places for examples.

Currently it works like this:

- DRM uses 24-bit depth
- CRTC puts out a 24-bit signal
- This gets output over LCD pins
- The PCB drops 2 bits per channel by wiring 6 pins to GND
- The panel is told to only use 18 bits

Getting DRM to use MEDIA_BUS_FMT_RGB666_1X18 would be nice and allow the panel
to auto-detect which bits to use. But the bus format is set in the panel :(

Where is the bus format usually set for cases where a board only supports a
physical format?

> HTH,
> Jani.
> 
> 
> -- 
> Jani Nikula, Intel

John.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to specify panel bit order in driver?
  2024-06-28 16:39   ` John Watts
@ 2024-07-02 11:30     ` Dmitry Baryshkov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2024-07-02 11:30 UTC (permalink / raw)
  To: John Watts; +Cc: Jani Nikula, dri-devel

On Sat, Jun 29, 2024 at 02:39:16AM GMT, John Watts wrote:
> Hi Jani,
> 
> On Fri, Jun 28, 2024 at 10:45:48AM +0300, Jani Nikula wrote:
> > Might be helpful to actually point at the source code or commits or
> > something.
> 
> The source code is here: drivers/gpu/drm/panel/panel-newvision-nv3052c.c
> It's just a standard MIPI DBI panel. It reports using an RGB888 bus format.
> 
> > Maybe look at include/uapi/drm/drm_fourcc.h, and how the DRM_FORMAT_*
> > macros are used.
> > 
> > Can't help you with device tree, but maybe this gives you pointers to
> > other places for examples.
> 
> Currently it works like this:
> 
> - DRM uses 24-bit depth
> - CRTC puts out a 24-bit signal
> - This gets output over LCD pins
> - The PCB drops 2 bits per channel by wiring 6 pins to GND
> - The panel is told to only use 18 bits
> 
> Getting DRM to use MEDIA_BUS_FMT_RGB666_1X18 would be nice and allow the panel
> to auto-detect which bits to use. But the bus format is set in the panel :(
> 
> Where is the bus format usually set for cases where a board only supports a
> physical format?

This is usally the panel driver.

We have been discussing adding a proper atomic_* support to the
drm_panel. This should allow panel drivers to actually negotiate what is
going on. Marijn started looking at it, but the patches never hit the
ML.

So, if the static configuration fits you, then just set it in the panel
config. If not, you might have either to implement some hacks (like
having a DT property describing how the panel is actually wired).

> 
> > HTH,
> > Jani.
> > 
> > 
> > -- 
> > Jani Nikula, Intel
> 
> John.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-07-02 11:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28  3:54 How to specify panel bit order in driver? John Watts
2024-06-28  7:45 ` Jani Nikula
2024-06-28 16:39   ` John Watts
2024-07-02 11:30     ` Dmitry Baryshkov

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.