RE: [Intel-gfx] [RFC v5 2/8] drm: Add Plane Degamma properties
>-Original Message- >From: Roper, Matthew D >Sent: Wednesday, November 14, 2018 6:39 AM >To: Shankar, Uma >Cc: intel-...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; >dcasta...@chromium.org; alexandru-cosmin.gheor...@arm.com; >seanp...@chromium.org; Syrjala, Ville ; >harry.wentl...@amd.com; Lankhorst, Maarten >Subject: Re: [Intel-gfx] [RFC v5 2/8] drm: Add Plane Degamma properties > >On Sun, Sep 16, 2018 at 01:45:25PM +0530, Uma Shankar wrote: >> Add Plane Degamma as a blob property and plane degamma size as a range >> property. >> >> v2: Rebase >> >> v3: Fixed Sean, Paul's review comments. Moved the property from >> mode_config to drm_plane. Created a helper function to instantiate >> these properties and removed from drm_mode_create_standard_properties >> Added property documentation as suggested by Daniel, Vetter. >> >> v4: Rebase >> >> v5: Added "Display Color Hardware Pipeline" flow to kernel >> documentation as suggested by "Ville Syrjala" and "Brian Starkey". >> Moved the property creation to drm_color_mgmt.c file to consolidate >> all color operations at one place. >> >> Signed-off-by: Uma Shankar >> Reviewed-by: Alexandru Gheorghe >> --- >> Documentation/gpu/drm-kms.rst | 90 >+ >> drivers/gpu/drm/drm_atomic.c| 13 ++ >> drivers/gpu/drm/drm_atomic_helper.c | 6 +++ >> drivers/gpu/drm/drm_color_mgmt.c| 44 -- >> include/drm/drm_plane.h | 24 ++ >> 5 files changed, 174 insertions(+), 3 deletions(-) >> >> diff --git a/Documentation/gpu/drm-kms.rst >> b/Documentation/gpu/drm-kms.rst index f8f5bf1..253d546 100644 >> --- a/Documentation/gpu/drm-kms.rst >> +++ b/Documentation/gpu/drm-kms.rst >> @@ -551,12 +551,102 @@ Plane Composition Properties Color Management >> Properties >> --- >> >> +Below is how a typical hardware pipeline for color will look like: >> + >> +.. kernel-render:: DOT >> + :alt: Display Color Pipeline >> + :caption: Display Color Pipeline Overview >> + >> + digraph "KMS" { >> + node [shape=box] >> + >> + subgraph cluster_static { >> + style=dashed >> + label="Display Color Hardware Blocks" >> + >> + node [bgcolor=grey style=filled] >> + "Plane Degamma A" -> "Plane CSC/CTM A" >> + "Plane CSC/CTM A" -> "Plane Gamma A" >> + "Pipe Blender" [color=lightblue,style=filled, width=5.25, >> height=0.75]; >> + "Plane Gamma A" -> "Pipe Blender" >> + "Pipe Blender" -> "Pipe DeGamma" >> + "Pipe DeGamma" -> "Pipe CSC/CTM" >> + "Pipe CSC/CTM" -> "Pipe Gamma" >> + "Pipe Gamma" -> "Pipe Output" >> + } >> + >> + subgraph cluster_static { >> + style=dashed >> + >> + node [shape=box] >> + "Plane Degamma B" -> "Plane CSC/CTM B" >> + "Plane CSC/CTM B" -> "Plane Gamma B" >> + "Plane Gamma B" -> "Pipe Blender" >> + } >> + >> + subgraph cluster_static { >> + style=dashed >> + >> + node [shape=box] >> + "Plane Degamma C" -> "Plane CSC/CTM C" >> + "Plane CSC/CTM C" -> "Plane Gamma C" >> + "Plane Gamma C" -> "Pipe Blender" >> + } >> + >> + subgraph cluster_fb { >> + style=dashed >> + label="RAM" >> + >> + node [shape=box width=1.7 height=0.2] >> + >> + "FB 1" -> "Plane Degamma A" >> + "FB 2" -> "Plane Degamma B" >> + "FB 3" -> "Plane Degamma C" >> + } >> + } >> + >> +In real world usecases, >> + >> +1. Plane Degamma can be used to linearize a non linear gamma encoded >> +framebuffer. This is needed to do any linear math like color space >> +conversion. For ex, linearize frames encoded in SRGB or by HDR curve. >> + >> +2. Later Plane CTM block can convert the content to some different >> +colorspace. For ex, SRGB to BT2020 etc. &
Re: [Intel-gfx] [RFC v5 2/8] drm: Add Plane Degamma properties
On Sun, Sep 16, 2018 at 01:45:25PM +0530, Uma Shankar wrote: > Add Plane Degamma as a blob property and plane degamma size as > a range property. > > v2: Rebase > > v3: Fixed Sean, Paul's review comments. Moved the property from > mode_config to drm_plane. Created a helper function to instantiate > these properties and removed from drm_mode_create_standard_properties > Added property documentation as suggested by Daniel, Vetter. > > v4: Rebase > > v5: Added "Display Color Hardware Pipeline" flow to kernel > documentation as suggested by "Ville Syrjala" and "Brian Starkey". > Moved the property creation to drm_color_mgmt.c file to consolidate > all color operations at one place. > > Signed-off-by: Uma Shankar > Reviewed-by: Alexandru Gheorghe > --- > Documentation/gpu/drm-kms.rst | 90 > + > drivers/gpu/drm/drm_atomic.c| 13 ++ > drivers/gpu/drm/drm_atomic_helper.c | 6 +++ > drivers/gpu/drm/drm_color_mgmt.c| 44 -- > include/drm/drm_plane.h | 24 ++ > 5 files changed, 174 insertions(+), 3 deletions(-) > > diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst > index f8f5bf1..253d546 100644 > --- a/Documentation/gpu/drm-kms.rst > +++ b/Documentation/gpu/drm-kms.rst > @@ -551,12 +551,102 @@ Plane Composition Properties > Color Management Properties > --- > > +Below is how a typical hardware pipeline for color > +will look like: > + > +.. kernel-render:: DOT > + :alt: Display Color Pipeline > + :caption: Display Color Pipeline Overview > + > + digraph "KMS" { > + node [shape=box] > + > + subgraph cluster_static { > + style=dashed > + label="Display Color Hardware Blocks" > + > + node [bgcolor=grey style=filled] > + "Plane Degamma A" -> "Plane CSC/CTM A" > + "Plane CSC/CTM A" -> "Plane Gamma A" > + "Pipe Blender" [color=lightblue,style=filled, width=5.25, > height=0.75]; > + "Plane Gamma A" -> "Pipe Blender" > + "Pipe Blender" -> "Pipe DeGamma" > + "Pipe DeGamma" -> "Pipe CSC/CTM" > + "Pipe CSC/CTM" -> "Pipe Gamma" > + "Pipe Gamma" -> "Pipe Output" > + } > + > + subgraph cluster_static { > + style=dashed > + > + node [shape=box] > + "Plane Degamma B" -> "Plane CSC/CTM B" > + "Plane CSC/CTM B" -> "Plane Gamma B" > + "Plane Gamma B" -> "Pipe Blender" > + } > + > + subgraph cluster_static { > + style=dashed > + > + node [shape=box] > + "Plane Degamma C" -> "Plane CSC/CTM C" > + "Plane CSC/CTM C" -> "Plane Gamma C" > + "Plane Gamma C" -> "Pipe Blender" > + } > + > + subgraph cluster_fb { > + style=dashed > + label="RAM" > + > + node [shape=box width=1.7 height=0.2] > + > + "FB 1" -> "Plane Degamma A" > + "FB 2" -> "Plane Degamma B" > + "FB 3" -> "Plane Degamma C" > + } > + } > + > +In real world usecases, > + > +1. Plane Degamma can be used to linearize a non linear gamma > +encoded framebuffer. This is needed to do any linear math like > +color space conversion. For ex, linearize frames encoded in SRGB > +or by HDR curve. > + > +2. Later Plane CTM block can convert the content to some different > +colorspace. For ex, SRGB to BT2020 etc. > + > +3. Plane Gamma block can be used later to re-apply the non-linear > +curve. This can also be used to apply Tone Mapping for HDR usecases. > + > +All the layers or framebuffers need to be converted to same color > +space and format before blending. The plane color hardware blocks > +can help with this. Once the Data is blended, similar color processing > +can be done on blended output using pipe color hardware blocks. > + > +DRM Properties have been created to define and expose all these > +hardware blocks to userspace. A userspace application (compositor > +or any color app) can use these interfaces and define policies to > +efficiently use the display hardware for such color operations. > + > +Pipe Color Management Properties > +- > + > .. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c > :doc: overview > > .. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c > :export: > > +Plane Color Management Properties > +- > + > +.. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c > + :doc: Plane Color Properties > + > +.. kernel-doc:: drivers/gpu/drm/drm_color_mgmt.c > + :doc: export > + > Tile Group Property > --- > > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c > index d0478ab..e716614 100644 > --- a/drivers/gpu/drm/drm_atomic.c > +++ b/drivers/gpu/drm/drm_atomic.c > @@ -857,6 +857,8 @@ static int drm_atomic_plane_set_property(struct drm_plane > *plane, > { > struct drm_device *dev = plane->dev; > struct drm