All of lore.kernel.org
 help / color / mirror / Atom feed
* DRM Atomic property for color-space conversion
@ 2017-01-27 17:23 ` Brian Starkey
  0 siblings, 0 replies; 37+ messages in thread
From: Brian Starkey @ 2017-01-27 17:23 UTC (permalink / raw)
  To: dri-devel
  Cc: linux-media, linux-kernel, ville.syrjala, mihail.atanassov, liviu.dudau

Hi,

We're looking to enable the per-plane color management hardware in
Mali-DP with atomic properties, which has sparked some conversation
around how to handle YCbCr formats.

As it stands today, it's assumed that a driver will implicitly "do the
right thing" to display a YCbCr buffer.

YCbCr data often uses different gamma curves and signal ranges (e.g.
BT.609, BT.701, BT.2020, studio range, full-range), so its desirable
to be able to explicitly control the YCbCr to RGB conversion process
from userspace.

We're proposing adding a "CSC" (color-space conversion) property to
control this - primarily per-plane for framebuffer->pipeline CSC, but
perhaps one per CRTC too for devices which have an RGB pipeline and
want to output in YUV to the display:

Name: "CSC"
Type: ENUM | ATOMIC;
Enum values (representative):
"default":
	Same behaviour as now. "Some kind" of YCbCr->RGB conversion
	for YCbCr buffers, bypass for RGB buffers
"disable":
	Explicitly disable all colorspace conversion (i.e. use an
	identity matrix).
"YCbCr to RGB: BT.709":
	Only valid for YCbCr formats. CSC in accordance with BT.709
	using [16..235] for (8-bit) luma values, and [16..240] for
	8-bit chroma values. For 10-bit formats, the range limits are
	multiplied by 4.
"YCbCr to RGB: BT.709 full-swing":
	Only valid for YCbCr formats. CSC in accordance with BT.709,
	but using the full range of each channel.
"YCbCr to RGB: Use CTM":*
	Only valid for YCbCr formats. Use the matrix applied via the
	plane's CTM property
"RGB to RGB: Use CTM":*
	Only valid for RGB formats. Use the matrix applied via the
	plane's CTM property
"Use CTM":*
	Valid for any format. Use the matrix applied via the plane's
	CTM property
... any other values for BT.601, BT.2020, RGB to YCbCr etc. etc. as
they are required.

*This assumes color-management is enabled per-plane. We're currently
working on patches to add this mostly to be able to use per-plane
degamma, but it would be analogous to the CRTC color-management code
and so also be able to expose a per-plane CTM property.

Our hardware implements the color-space conversion as a 3x3 matrix, so
we can implement a helper to convert a CSC enum value to a CTM matrix
for use by any hardware which has a programmable CSC matrix. For any
other hardware, the driver simply needs to map the enum value to
whatever selector bits are available.

It's expected that the "Use CTM" value(s) are *not* the common case,
and most of the time userspace will use one of the provided "standard"
enum values. The three different flavours of "Use CTM" allow us to
support hardware whose CSC hardware can only be used on e.g. YCbCr
data.

Drivers can of course filter the enum list to expose whichever subset
the hardware can support.

Having thrashed this out a bit on IRC with Ville, I think the above
approach is flexible enough to support at least Mali-DP and i915,
without burdening userspace any more than necessary. It also provides
the "default" behaviour which is backwards compatible, and allows for
fully custom CSC matrices where that is supported.

We can obviously implement this as a Mali-DP driver private property,
but it would be good to come up with something to go into the core if
possible.

I'd be happy to hear any feedback,

Thanks,
Brian

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

end of thread, other threads:[~2017-03-20 10:50 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-27 17:23 DRM Atomic property for color-space conversion Brian Starkey
2017-01-27 17:23 ` Brian Starkey
2017-01-30  8:36 ` Daniel Vetter
2017-01-30  8:36   ` Daniel Vetter
2017-01-30 13:35 ` Ville Syrjälä
2017-01-30 13:35   ` Ville Syrjälä
2017-01-31 12:33   ` Brian Starkey
2017-01-31 12:33     ` Brian Starkey
2017-01-31 15:15     ` Ville Syrjälä
2017-01-31 15:55       ` Brian Starkey
2017-01-31 15:55         ` Brian Starkey
2017-03-16 14:07         ` Ville Syrjälä
2017-03-16 14:12           ` Alex Deucher
2017-03-16 14:12             ` Alex Deucher
2017-03-16 14:12             ` Alex Deucher
2017-03-16 14:20           ` Sharma, Shashank
2017-03-16 14:20             ` Sharma, Shashank
2017-03-16 14:30             ` Ville Syrjälä
2017-03-16 14:30               ` Ville Syrjälä
2017-03-16 14:37               ` Local user for Liviu Dudau
2017-03-16 14:37                 ` Local user for Liviu Dudau
2017-03-16 15:14                 ` Sharma, Shashank
2017-03-16 15:14                   ` Sharma, Shashank
2017-03-16 15:55                   ` Brian Starkey
2017-03-16 15:55                     ` Brian Starkey
2017-03-16 17:05                     ` Sharma, Shashank
2017-03-16 17:05                       ` Sharma, Shashank
2017-03-16 17:36                       ` Ville Syrjälä
2017-03-16 17:36                         ` Ville Syrjälä
2017-03-17 10:19                         ` Local user for Liviu Dudau
2017-03-17 10:19                           ` Local user for Liviu Dudau
2017-03-17 10:33                         ` Brian Starkey
2017-03-17 10:33                           ` Brian Starkey
2017-03-17 14:09                           ` Ville Syrjälä
2017-03-17 14:09                             ` Ville Syrjälä
2017-03-20 10:48                             ` Hans Verkuil
2017-03-20 10:48                               ` Hans Verkuil

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.