<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>If the block diagram is not aligned due to mail client, please
refer to the attached .txt file. Hope thats slightly better :). <br>
</p>
<p>Regards</p>
<p>Shashank<br>
</p>
<div class="moz-cite-prefix">On 1/10/2019 8:32 PM, Sharma, Shashank
wrote:<br>
</div>
<blockquote
cite="mid:1ff3ad88-ef1e-dcab-23a4-034929db490f@intel.com"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Hello All, <br>
<br>
This mail is to propose a design for enabling HDR support in
Wayland/Weston stack, using display engine capabilities, and get
more feedback and input from community. <br>
Here are few points (you might already know these), about HDR
framebuffers, videos and displays:<br>
- HDR content/buffers are composed in REC2020 colorspace, with bit
depth 10/12/16 BPC. Some of the popular formats are
P010,P012,P016. <br>
- HDR content come with their own Metadata to be applied to get
the right luminance at the display device. <br>
- The metadata can be of two type 1. static 2. dynamic . For
simplicity, this solution is focusing on static HDR only (HDR10
standard)<br>
- HDR content also provide its supported EOTF (electro optical
transfer function) information, which is a curve (like SRGB gamma
curve). One popular EOTF is PQ(ST2084). <br>
- HDR capable displays mention their EOTF and HDR metadata support
information in EDID CEA-861-G blocks. <span style="color:
rgb(34, 34, 34); font-family: arial, sans-serif; font-size:
xx-large; font-style: normal; font-variant-ligatures: normal;
font-variant-caps: normal; font-weight: 100; letter-spacing:
normal; orphans: 2; text-align: left; text-indent: 0px;
text-transform: none; white-space: normal; widows: 2;
word-spacing: 0px; -webkit-text-stroke-width: 0px;
background-color: rgb(255, 255, 255); text-decoration-style:
initial; text-decoration-color: initial; display: inline
!important; float: none;"></span><br>
- Normal SRGB buffers are composed in SRGB color space following
REC709 specifications. <br>
- For accurate blending in display engines, we need to make sure
following:<br>
- All the buffers are in same colorspace (Rec 709 or Rec 2020)<br>
- All the buffers are liner (gamma/EOTF removed)<br>
- All the buffers are tone mapped in same zone (HDR or SDR)<br>
<br>
Please refer to the block diagram below, which presents a simple
case of a HDR P010 movie playback, with HDR buffers as video
buffers, and SDR buffers as subtitles. The subsystem looks and
works like this:<br>
- A client decodes the buffer (using FFMpeg for example) and gets
the two buffers, one with video (HDR) and one subtitles (SDR)<br>
- Client passes following information to the compositor:<br>
- The actual buffers <br>
- Their colorspace infromation, BT2020 for HDR buffer, REC709
for SDR buffer (planning to add a new protocol extension for this)<br>
- The HDR metadata of the content (planning to add new
protocol for this)<br>
<br>
- Compositors actions:<br>
- Reads the End display's HDR capabilities from display EDID.
Assume its an HDR HDMI monitor. <br>
- Compositor tone maps every view's framebuffer to match tone
of end display, applying a libVA filter. In this example:<br>
- The SDR subtitles frame will go through SDR to HDR tone
mapping (called S2H)<br>
- The HDR video frame will go through HDR to HDR tone
mapping (called H2H) if the HDR capabilities of monitor and
content are different.<br>
- Now both the buffers and the monitor are in the same
tone mapped range. <br>
- As the end display is HDR capable, and one of the content
frame is HDR, the compositor will prepare all other planes for
color space conversion (CSC) from REC709->REC2020 using plane
CSC property. <br>
- As the CSC and blending should be done in liner space,
compositor will also use plane level degamma to make the buffers
linear.<br>
- These actions will make sure that, during blending:<br>
- All the buffers are in same colorspace (REC2020)<br>
- All the buffers are linear <br>
- All the buffers are tone mapped (HDR)<br>
- The plane level color properties patch, for DRM can be
found here: <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="https://patchwork.freedesktop.org/series/30875/">https://patchwork.freedesktop.org/series/30875/</a>
<br>
- Now, in order to re-apply the HDR curve, compositor will
apply CRTC level gamma, so that the output buffer is non-linear
again. <br>
- To pass the output HDR information to kernel, so that it can
create and send AVI-info-frames to HDMI, compositor will set
Connector HDR metadata property.<br>
- Code for the same can be found here: <a
moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://patchwork.freedesktop.org/series/25091/">https://patchwork.freedesktop.org/series/25091/</a><br>
- And they will ever live happily after :). <br>
<br>
Please provide inputs, feedbacks and suggestions for this design
and plan, so that we can improve out half cooked solution, and
start sending the patches. <br>
<br>
+------------------+
+-------------------+<br>
| SDR Buffer subtitles | HDR Buffer
video<br>
| (REC 709 colorsp) | (REC 2020
colorsp |<br>
| |
| |<br>
+-------+----------+
+-------+-----------+<br>
| |<br>
| |<br>
| |<br>
+------v---------------------------v------------+
+--------------+<br>
| Compositor:
v | | LibVA |<br>
| - assigns views to
overlays +---------> Tone mapping |<br>
| - prepare plane/CRTC color
properties <---------+ SDR to HDR |<br>
| for linear blending in
display | | HDR to SDR |<br>
+------+-----------------------------+----------+
+--------------+<br>
| |<br>
| Tone mapped | Tone
mapped<br>
| non-linear-Rec709 |
non-linear Rec2020<br>
+------v------+
+-------v--------+<br>
SRGB Degamma | |EOTF as
degamma |<br>
|(Plane) |
|(Plane) |<br>
| |
| |<br>
+------+------+
+-------+--------+<br>
Tone mapped linear Rec 709 | |<br>
+------v------+ | Tone
mapped<br>
| CSC/CTM | |
non-linear Rec2020<br>
| REC709->2020| |<br>
| | |<br>
+------+------+ |<br>
| Tone mapped linear |<br>
| Rec 2020 |<br>
+------v-----------------------------v---------+<br>
|
Blender |<br>
| |<br>
+--------------------+-------------------------+<br>
| Tone mapped linear
Rec2020<br>
+--------------------v-------------------------+ Tone mapped<br>
| OETF(CRTC Gamma, post
blending) | non-linear Rec2020 +------------------+<br>
|
+----------------> | HDMI monitor |<br>
+----------------------------------------------+
+------------------+<br>
<br>
<br>
<br>
</blockquote>
<br>
</body>
</html>