All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Yannick FERTRE - foss <yannick.fertre@foss.st.com>,
	Philippe CORNU - foss <philippe.cornu@foss.st.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre TORGUE - foss <alexandre.torgue@foss.st.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-stm32@st-md-mailman.stormreply.com" 
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Yannick FERTRE <yannick.fertre@st.com>,
	Raphael GALLAIS-POU <raphael.gallais-pou@st.com>,
	Philippe CORNU <philippe.cornu@st.com>
Subject: Re: [PATCH 1/2] drm: add crtc background color property
Date: Fri, 9 Jul 2021 18:23:26 +0200	[thread overview]
Message-ID: <3c8331cf-fded-b6e6-3e25-666634f4b87a@foss.st.com> (raw)
In-Reply-To: <20210709110459.79ca406a@eldfell>


On 7/9/21 10:04 AM, Pekka Paalanen wrote:
> On Wed, 7 Jul 2021 08:48:47 +0000
> Raphael GALLAIS-POU - foss <raphael.gallais-pou@foss.st.com> wrote:
>
>> Some display controllers can be programmed to present non-black colors
>> for pixels not covered by any plane (or pixels covered by the
>> transparent regions of higher planes).  Compositors that want a UI with
>> a solid color background can potentially save memory bandwidth by
>> setting the CRTC background property and using smaller planes to display
>> the rest of the content.
>>
>> To avoid confusion between different ways of encoding RGB data, we
>> define a standard 64-bit format that should be used for this property's
>> value.  Helper functions and macros are provided to generate and dissect
>> values in this standard format with varying component precision values.
>>
>> Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
>> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>> ---
>>   drivers/gpu/drm/drm_atomic_state_helper.c |  1 +
>>   drivers/gpu/drm/drm_atomic_uapi.c         |  4 +++
>>   drivers/gpu/drm/drm_blend.c               | 34 +++++++++++++++++++++--
>>   drivers/gpu/drm/drm_mode_config.c         |  6 ++++
>>   include/drm/drm_blend.h                   |  1 +
>>   include/drm/drm_crtc.h                    | 12 ++++++++
>>   include/drm/drm_mode_config.h             |  5 ++++
>>   include/uapi/drm/drm_mode.h               | 28 +++++++++++++++++++
>>   8 files changed, 89 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
>> index ddcf5c2c8e6a..1b95a4ecdb2b 100644
>> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
>> @@ -72,6 +72,7 @@ __drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
>>   				     struct drm_crtc *crtc)
>>   {
>>   	crtc_state->crtc = crtc;
>> +	crtc_state->bgcolor = drm_argb(16, 0xffff, 0, 0, 0);
>>   }
>>   EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
>>   
>> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 438e9585b225..fea68f8f17f8 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -483,6 +483,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>>   		set_out_fence_for_crtc(state->state, crtc, fence_ptr);
>>   	} else if (property == crtc->scaling_filter_property) {
>>   		state->scaling_filter = val;
>> +	} else if (property == config->bgcolor_property) {
>> +		state->bgcolor = val;
>>   	} else if (crtc->funcs->atomic_set_property) {
>>   		return crtc->funcs->atomic_set_property(crtc, state, property, val);
>>   	} else {
>> @@ -520,6 +522,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
>>   		*val = 0;
>>   	else if (property == crtc->scaling_filter_property)
>>   		*val = state->scaling_filter;
>> +	else if (property == config->bgcolor_property)
>> +		*val = state->bgcolor;
>>   	else if (crtc->funcs->atomic_get_property)
>>   		return crtc->funcs->atomic_get_property(crtc, state, property, val);
>>   	else
>> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
>> index ec37cbfabb50..6692d6a6db22 100644
>> --- a/drivers/gpu/drm/drm_blend.c
>> +++ b/drivers/gpu/drm/drm_blend.c
>> @@ -186,8 +186,7 @@
>>    *		 assumed to be 1.0
>>    *
>>    * Note that all the property extensions described here apply either to the
>> - * plane or the CRTC (e.g. for the background color, which currently is not
>> - * exposed and assumed to be black).
>> + * plane or the CRTC.
>>    *
>>    * SCALING_FILTER:
>>    *     Indicates scaling filter to be used for plane scaler
>> @@ -201,6 +200,21 @@
>>    *
>>    * Drivers can set up this property for a plane by calling
>>    * drm_plane_create_scaling_filter_property
>> + *
> Hi,


Hi Pekka,


Many thanks for your feedback, your comments are taken into account for 
a v2.


>
> I assume the below block is the UAPI documentation of this new property
> and that it would appear with the other UAPI docs.
>
>> + * BACKGROUND_COLOR:
>> + *	Defines the ARGB color of a full-screen layer that exists below all
>> + *	planes.  This color will be used for pixels not covered by any plane
>> + *	and may also be blended with plane contents as allowed by a plane's
>> + *	alpha values.  The background color defaults to black, and is assumed
>> + *	to be black for drivers that do not expose this property.
> All good up to here.
>
>>   Although
>> + *	background color isn't a plane, it is assumed that the color provided
>> + *	here undergoes the same pipe-level degamma/CSC/gamma transformations
>> + *	that planes undergo.
> This sounds to me like it refers to the per-plane degamma/csc/gamma
> which are new properties in development. I believe you do not mean
> that, but you mean the CRTC degamma/csc/gamma and everything else which
> apply *after* the blending of planes. So the wording here would need
> clarification.


Yes, I was not sure about this, but it is effectively the general CRTC 
color correction which is applicable to the background color.

>
>>   Note that the color value provided here includes
>> + *	an alpha channel...non-opaque background color values are allowed,
>> + *	but are generally only honored in special cases (e.g., when a memory
>> + *	writeback connector is in use).
> This could be read as: if you use a non-opaque color value, it will
> usually be completely ignored (and the background will be e.g. black
> instead). Is that your intention?
>
> I think a more useful definition would be that the alpha is used in
> blending as always, but because we do not yet have physically
> transparent monitors, the final alpha value may not reach the video
> sink or the video sink may ignore it.

In our case, the hardware does not support alpha channel (as you can see 
the DRM_ARGB_TO_LTDC_RGB24 macro in the second patch).

For chip vendors who does support this feature, the video sink would get 
this transparency parameter. In the case where it is not, alpha channel 
would be ignored.


>> + *
>> + *	This property is setup with drm_crtc_add_bgcolor_property().
> You forgot to document the value format of this property. The ARGB color
> format needs to be defined at least to the same detail as all pixel
> formats in drm_fourcc.h are. If there is a suitable DRM_FORMAT_*
> definition already, simply saying the color is in that format would be
> enough.


Will do ! :)

I was thinking about the FourCC AR4H format. Have you something else in 
mind ?

>
> Another thing to document is whether this color value is alpha
> pre-multiplied or not. Planes can have the property "pixel blend mode",
> but because the background color is not on a plane, that property
> cannot apply here.
>
> The difference it makes is that if background color is both non-opaque
> and pre-multiplied, then the question arises what pixel values will
> actually be transmitted to video sink for the background. Will the
> alpha pre-multiplication be undone?
>
> Btw. note that "pixel blend mode" property does not document the use of
> background alpha at all. So if the background color can have non-opaque
> alpha, then you need to document the behavior in "pixel blend mode". It
> also does not document what alpha value will result from blending, for
> blending the next plane.

Those are questions that did not crossed my mind at all.

What would you suggest ? Instinctively I would say that in the case 
where there is a non-opaque background color,

alpha pre-multiplication would not be taken into account, although it is 
maybe not the best solution.

As I am not quite sure, I will lookup for this.


>
> The question about full vs. limited range seems unnecessary to me, as
> the background color will be used as-is in the blending stage, so
> userspace can just program the correct value that fits the pipeline it
> is setting up.
>
> One more question is, as HDR exists, could we need background colors
> with component values greater than 1.0?

AR4H color format should cover that case, isn't it ?



Regards,

Raphaël

>
> Scanout of FP16 formats exists.
>
>>    */
>
> Thanks,
> pq

WARNING: multiple messages have this Message-ID (diff)
From: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Yannick FERTRE - foss <yannick.fertre@foss.st.com>,
	Philippe CORNU - foss <philippe.cornu@foss.st.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Alexandre TORGUE - foss <alexandre.torgue@foss.st.com>,
	Matt Roper <matthew.d.roper@intel.com>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Yannick FERTRE <yannick.fertre@st.com>,
	Raphael GALLAIS-POU <raphael.gallais-pou@st.com>,
	Philippe CORNU <philippe.cornu@st.com>
Subject: Re: [PATCH 1/2] drm: add crtc background color property
Date: Fri, 9 Jul 2021 18:23:26 +0200	[thread overview]
Message-ID: <3c8331cf-fded-b6e6-3e25-666634f4b87a@foss.st.com> (raw)
In-Reply-To: <20210709110459.79ca406a@eldfell>


On 7/9/21 10:04 AM, Pekka Paalanen wrote:
> On Wed, 7 Jul 2021 08:48:47 +0000
> Raphael GALLAIS-POU - foss <raphael.gallais-pou@foss.st.com> wrote:
>
>> Some display controllers can be programmed to present non-black colors
>> for pixels not covered by any plane (or pixels covered by the
>> transparent regions of higher planes).  Compositors that want a UI with
>> a solid color background can potentially save memory bandwidth by
>> setting the CRTC background property and using smaller planes to display
>> the rest of the content.
>>
>> To avoid confusion between different ways of encoding RGB data, we
>> define a standard 64-bit format that should be used for this property's
>> value.  Helper functions and macros are provided to generate and dissect
>> values in this standard format with varying component precision values.
>>
>> Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
>> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>> ---
>>   drivers/gpu/drm/drm_atomic_state_helper.c |  1 +
>>   drivers/gpu/drm/drm_atomic_uapi.c         |  4 +++
>>   drivers/gpu/drm/drm_blend.c               | 34 +++++++++++++++++++++--
>>   drivers/gpu/drm/drm_mode_config.c         |  6 ++++
>>   include/drm/drm_blend.h                   |  1 +
>>   include/drm/drm_crtc.h                    | 12 ++++++++
>>   include/drm/drm_mode_config.h             |  5 ++++
>>   include/uapi/drm/drm_mode.h               | 28 +++++++++++++++++++
>>   8 files changed, 89 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
>> index ddcf5c2c8e6a..1b95a4ecdb2b 100644
>> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
>> @@ -72,6 +72,7 @@ __drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
>>   				     struct drm_crtc *crtc)
>>   {
>>   	crtc_state->crtc = crtc;
>> +	crtc_state->bgcolor = drm_argb(16, 0xffff, 0, 0, 0);
>>   }
>>   EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
>>   
>> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 438e9585b225..fea68f8f17f8 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -483,6 +483,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>>   		set_out_fence_for_crtc(state->state, crtc, fence_ptr);
>>   	} else if (property == crtc->scaling_filter_property) {
>>   		state->scaling_filter = val;
>> +	} else if (property == config->bgcolor_property) {
>> +		state->bgcolor = val;
>>   	} else if (crtc->funcs->atomic_set_property) {
>>   		return crtc->funcs->atomic_set_property(crtc, state, property, val);
>>   	} else {
>> @@ -520,6 +522,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
>>   		*val = 0;
>>   	else if (property == crtc->scaling_filter_property)
>>   		*val = state->scaling_filter;
>> +	else if (property == config->bgcolor_property)
>> +		*val = state->bgcolor;
>>   	else if (crtc->funcs->atomic_get_property)
>>   		return crtc->funcs->atomic_get_property(crtc, state, property, val);
>>   	else
>> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
>> index ec37cbfabb50..6692d6a6db22 100644
>> --- a/drivers/gpu/drm/drm_blend.c
>> +++ b/drivers/gpu/drm/drm_blend.c
>> @@ -186,8 +186,7 @@
>>    *		 assumed to be 1.0
>>    *
>>    * Note that all the property extensions described here apply either to the
>> - * plane or the CRTC (e.g. for the background color, which currently is not
>> - * exposed and assumed to be black).
>> + * plane or the CRTC.
>>    *
>>    * SCALING_FILTER:
>>    *     Indicates scaling filter to be used for plane scaler
>> @@ -201,6 +200,21 @@
>>    *
>>    * Drivers can set up this property for a plane by calling
>>    * drm_plane_create_scaling_filter_property
>> + *
> Hi,


Hi Pekka,


Many thanks for your feedback, your comments are taken into account for 
a v2.


>
> I assume the below block is the UAPI documentation of this new property
> and that it would appear with the other UAPI docs.
>
>> + * BACKGROUND_COLOR:
>> + *	Defines the ARGB color of a full-screen layer that exists below all
>> + *	planes.  This color will be used for pixels not covered by any plane
>> + *	and may also be blended with plane contents as allowed by a plane's
>> + *	alpha values.  The background color defaults to black, and is assumed
>> + *	to be black for drivers that do not expose this property.
> All good up to here.
>
>>   Although
>> + *	background color isn't a plane, it is assumed that the color provided
>> + *	here undergoes the same pipe-level degamma/CSC/gamma transformations
>> + *	that planes undergo.
> This sounds to me like it refers to the per-plane degamma/csc/gamma
> which are new properties in development. I believe you do not mean
> that, but you mean the CRTC degamma/csc/gamma and everything else which
> apply *after* the blending of planes. So the wording here would need
> clarification.


Yes, I was not sure about this, but it is effectively the general CRTC 
color correction which is applicable to the background color.

>
>>   Note that the color value provided here includes
>> + *	an alpha channel...non-opaque background color values are allowed,
>> + *	but are generally only honored in special cases (e.g., when a memory
>> + *	writeback connector is in use).
> This could be read as: if you use a non-opaque color value, it will
> usually be completely ignored (and the background will be e.g. black
> instead). Is that your intention?
>
> I think a more useful definition would be that the alpha is used in
> blending as always, but because we do not yet have physically
> transparent monitors, the final alpha value may not reach the video
> sink or the video sink may ignore it.

In our case, the hardware does not support alpha channel (as you can see 
the DRM_ARGB_TO_LTDC_RGB24 macro in the second patch).

For chip vendors who does support this feature, the video sink would get 
this transparency parameter. In the case where it is not, alpha channel 
would be ignored.


>> + *
>> + *	This property is setup with drm_crtc_add_bgcolor_property().
> You forgot to document the value format of this property. The ARGB color
> format needs to be defined at least to the same detail as all pixel
> formats in drm_fourcc.h are. If there is a suitable DRM_FORMAT_*
> definition already, simply saying the color is in that format would be
> enough.


Will do ! :)

I was thinking about the FourCC AR4H format. Have you something else in 
mind ?

>
> Another thing to document is whether this color value is alpha
> pre-multiplied or not. Planes can have the property "pixel blend mode",
> but because the background color is not on a plane, that property
> cannot apply here.
>
> The difference it makes is that if background color is both non-opaque
> and pre-multiplied, then the question arises what pixel values will
> actually be transmitted to video sink for the background. Will the
> alpha pre-multiplication be undone?
>
> Btw. note that "pixel blend mode" property does not document the use of
> background alpha at all. So if the background color can have non-opaque
> alpha, then you need to document the behavior in "pixel blend mode". It
> also does not document what alpha value will result from blending, for
> blending the next plane.

Those are questions that did not crossed my mind at all.

What would you suggest ? Instinctively I would say that in the case 
where there is a non-opaque background color,

alpha pre-multiplication would not be taken into account, although it is 
maybe not the best solution.

As I am not quite sure, I will lookup for this.


>
> The question about full vs. limited range seems unnecessary to me, as
> the background color will be used as-is in the blending stage, so
> userspace can just program the correct value that fits the pipeline it
> is setting up.
>
> One more question is, as HDR exists, could we need background colors
> with component values greater than 1.0?

AR4H color format should cover that case, isn't it ?



Regards,

Raphaël

>
> Scanout of FP16 formats exists.
>
>>    */
>
> Thanks,
> pq

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
To: Pekka Paalanen <ppaalanen@gmail.com>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Benjamin Gaignard <benjamin.gaignard@linaro.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Raphael GALLAIS-POU <raphael.gallais-pou@st.com>,
	David Airlie <airlied@linux.ie>,
	Yannick FERTRE - foss <yannick.fertre@foss.st.com>,
	Alexandre TORGUE - foss <alexandre.torgue@foss.st.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yannick FERTRE <yannick.fertre@st.com>,
	Philippe CORNU - foss <philippe.cornu@foss.st.com>,
	Philippe CORNU <philippe.cornu@st.com>,
	"linux-stm32@st-md-mailman.stormreply.com"
	<linux-stm32@st-md-mailman.stormreply.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 1/2] drm: add crtc background color property
Date: Fri, 9 Jul 2021 18:23:26 +0200	[thread overview]
Message-ID: <3c8331cf-fded-b6e6-3e25-666634f4b87a@foss.st.com> (raw)
In-Reply-To: <20210709110459.79ca406a@eldfell>


On 7/9/21 10:04 AM, Pekka Paalanen wrote:
> On Wed, 7 Jul 2021 08:48:47 +0000
> Raphael GALLAIS-POU - foss <raphael.gallais-pou@foss.st.com> wrote:
>
>> Some display controllers can be programmed to present non-black colors
>> for pixels not covered by any plane (or pixels covered by the
>> transparent regions of higher planes).  Compositors that want a UI with
>> a solid color background can potentially save memory bandwidth by
>> setting the CRTC background property and using smaller planes to display
>> the rest of the content.
>>
>> To avoid confusion between different ways of encoding RGB data, we
>> define a standard 64-bit format that should be used for this property's
>> value.  Helper functions and macros are provided to generate and dissect
>> values in this standard format with varying component precision values.
>>
>> Signed-off-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
>> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>> ---
>>   drivers/gpu/drm/drm_atomic_state_helper.c |  1 +
>>   drivers/gpu/drm/drm_atomic_uapi.c         |  4 +++
>>   drivers/gpu/drm/drm_blend.c               | 34 +++++++++++++++++++++--
>>   drivers/gpu/drm/drm_mode_config.c         |  6 ++++
>>   include/drm/drm_blend.h                   |  1 +
>>   include/drm/drm_crtc.h                    | 12 ++++++++
>>   include/drm/drm_mode_config.h             |  5 ++++
>>   include/uapi/drm/drm_mode.h               | 28 +++++++++++++++++++
>>   8 files changed, 89 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c
>> index ddcf5c2c8e6a..1b95a4ecdb2b 100644
>> --- a/drivers/gpu/drm/drm_atomic_state_helper.c
>> +++ b/drivers/gpu/drm/drm_atomic_state_helper.c
>> @@ -72,6 +72,7 @@ __drm_atomic_helper_crtc_state_reset(struct drm_crtc_state *crtc_state,
>>   				     struct drm_crtc *crtc)
>>   {
>>   	crtc_state->crtc = crtc;
>> +	crtc_state->bgcolor = drm_argb(16, 0xffff, 0, 0, 0);
>>   }
>>   EXPORT_SYMBOL(__drm_atomic_helper_crtc_state_reset);
>>   
>> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
>> index 438e9585b225..fea68f8f17f8 100644
>> --- a/drivers/gpu/drm/drm_atomic_uapi.c
>> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
>> @@ -483,6 +483,8 @@ static int drm_atomic_crtc_set_property(struct drm_crtc *crtc,
>>   		set_out_fence_for_crtc(state->state, crtc, fence_ptr);
>>   	} else if (property == crtc->scaling_filter_property) {
>>   		state->scaling_filter = val;
>> +	} else if (property == config->bgcolor_property) {
>> +		state->bgcolor = val;
>>   	} else if (crtc->funcs->atomic_set_property) {
>>   		return crtc->funcs->atomic_set_property(crtc, state, property, val);
>>   	} else {
>> @@ -520,6 +522,8 @@ drm_atomic_crtc_get_property(struct drm_crtc *crtc,
>>   		*val = 0;
>>   	else if (property == crtc->scaling_filter_property)
>>   		*val = state->scaling_filter;
>> +	else if (property == config->bgcolor_property)
>> +		*val = state->bgcolor;
>>   	else if (crtc->funcs->atomic_get_property)
>>   		return crtc->funcs->atomic_get_property(crtc, state, property, val);
>>   	else
>> diff --git a/drivers/gpu/drm/drm_blend.c b/drivers/gpu/drm/drm_blend.c
>> index ec37cbfabb50..6692d6a6db22 100644
>> --- a/drivers/gpu/drm/drm_blend.c
>> +++ b/drivers/gpu/drm/drm_blend.c
>> @@ -186,8 +186,7 @@
>>    *		 assumed to be 1.0
>>    *
>>    * Note that all the property extensions described here apply either to the
>> - * plane or the CRTC (e.g. for the background color, which currently is not
>> - * exposed and assumed to be black).
>> + * plane or the CRTC.
>>    *
>>    * SCALING_FILTER:
>>    *     Indicates scaling filter to be used for plane scaler
>> @@ -201,6 +200,21 @@
>>    *
>>    * Drivers can set up this property for a plane by calling
>>    * drm_plane_create_scaling_filter_property
>> + *
> Hi,


Hi Pekka,


Many thanks for your feedback, your comments are taken into account for 
a v2.


>
> I assume the below block is the UAPI documentation of this new property
> and that it would appear with the other UAPI docs.
>
>> + * BACKGROUND_COLOR:
>> + *	Defines the ARGB color of a full-screen layer that exists below all
>> + *	planes.  This color will be used for pixels not covered by any plane
>> + *	and may also be blended with plane contents as allowed by a plane's
>> + *	alpha values.  The background color defaults to black, and is assumed
>> + *	to be black for drivers that do not expose this property.
> All good up to here.
>
>>   Although
>> + *	background color isn't a plane, it is assumed that the color provided
>> + *	here undergoes the same pipe-level degamma/CSC/gamma transformations
>> + *	that planes undergo.
> This sounds to me like it refers to the per-plane degamma/csc/gamma
> which are new properties in development. I believe you do not mean
> that, but you mean the CRTC degamma/csc/gamma and everything else which
> apply *after* the blending of planes. So the wording here would need
> clarification.


Yes, I was not sure about this, but it is effectively the general CRTC 
color correction which is applicable to the background color.

>
>>   Note that the color value provided here includes
>> + *	an alpha channel...non-opaque background color values are allowed,
>> + *	but are generally only honored in special cases (e.g., when a memory
>> + *	writeback connector is in use).
> This could be read as: if you use a non-opaque color value, it will
> usually be completely ignored (and the background will be e.g. black
> instead). Is that your intention?
>
> I think a more useful definition would be that the alpha is used in
> blending as always, but because we do not yet have physically
> transparent monitors, the final alpha value may not reach the video
> sink or the video sink may ignore it.

In our case, the hardware does not support alpha channel (as you can see 
the DRM_ARGB_TO_LTDC_RGB24 macro in the second patch).

For chip vendors who does support this feature, the video sink would get 
this transparency parameter. In the case where it is not, alpha channel 
would be ignored.


>> + *
>> + *	This property is setup with drm_crtc_add_bgcolor_property().
> You forgot to document the value format of this property. The ARGB color
> format needs to be defined at least to the same detail as all pixel
> formats in drm_fourcc.h are. If there is a suitable DRM_FORMAT_*
> definition already, simply saying the color is in that format would be
> enough.


Will do ! :)

I was thinking about the FourCC AR4H format. Have you something else in 
mind ?

>
> Another thing to document is whether this color value is alpha
> pre-multiplied or not. Planes can have the property "pixel blend mode",
> but because the background color is not on a plane, that property
> cannot apply here.
>
> The difference it makes is that if background color is both non-opaque
> and pre-multiplied, then the question arises what pixel values will
> actually be transmitted to video sink for the background. Will the
> alpha pre-multiplication be undone?
>
> Btw. note that "pixel blend mode" property does not document the use of
> background alpha at all. So if the background color can have non-opaque
> alpha, then you need to document the behavior in "pixel blend mode". It
> also does not document what alpha value will result from blending, for
> blending the next plane.

Those are questions that did not crossed my mind at all.

What would you suggest ? Instinctively I would say that in the case 
where there is a non-opaque background color,

alpha pre-multiplication would not be taken into account, although it is 
maybe not the best solution.

As I am not quite sure, I will lookup for this.


>
> The question about full vs. limited range seems unnecessary to me, as
> the background color will be used as-is in the blending stage, so
> userspace can just program the correct value that fits the pipeline it
> is setting up.
>
> One more question is, as HDR exists, could we need background colors
> with component values greater than 1.0?

AR4H color format should cover that case, isn't it ?



Regards,

Raphaël

>
> Scanout of FP16 formats exists.
>
>>    */
>
> Thanks,
> pq

  reply	other threads:[~2021-07-09 16:23 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  8:48 [PATCH 0/2] Add "BACKGROUND_COLOR" drm property Raphael GALLAIS-POU - foss
2021-07-07  8:48 ` Raphael GALLAIS-POU - foss
2021-07-07  8:48 ` Raphael GALLAIS-POU - foss
2021-07-07  8:48 ` [PATCH 1/2] drm: add crtc background color property Raphael GALLAIS-POU - foss
2021-07-07  8:48   ` Raphael GALLAIS-POU - foss
2021-07-07  8:48   ` Raphael GALLAIS-POU - foss
2021-07-07 15:07   ` kernel test robot
2021-07-09  8:04   ` Pekka Paalanen
2021-07-09  8:04     ` Pekka Paalanen
2021-07-09  8:04     ` Pekka Paalanen
2021-07-09 16:23     ` Raphael Gallais-Pou [this message]
2021-07-09 16:23       ` Raphael Gallais-Pou
2021-07-09 16:23       ` Raphael Gallais-Pou
2021-07-12  8:03       ` Pekka Paalanen
2021-07-12  8:03         ` Pekka Paalanen
2021-07-12  8:03         ` Pekka Paalanen
2021-07-12 16:15         ` Harry Wentland
2021-07-12 16:15           ` Harry Wentland
2021-07-12 16:15           ` Harry Wentland
2021-07-13  7:52           ` Pekka Paalanen
2021-07-13  7:52             ` Pekka Paalanen
2021-07-13  7:52             ` Pekka Paalanen
2021-07-13 13:54             ` Harry Wentland
2021-07-13 13:54               ` Harry Wentland
2021-07-13 13:54               ` Harry Wentland
2021-07-14  7:35               ` Pekka Paalanen
2021-07-14  7:35                 ` Pekka Paalanen
2021-07-14  7:35                 ` Pekka Paalanen
2021-07-14 16:13                 ` Harry Wentland
2021-07-14 16:13                   ` Harry Wentland
2021-07-14 16:13                   ` Harry Wentland
2021-07-15  9:34                   ` Pekka Paalanen
2021-07-15  9:34                     ` Pekka Paalanen
2021-07-15  9:34                     ` Pekka Paalanen
2021-07-15 18:10                     ` Harry Wentland
2021-07-15 18:10                       ` Harry Wentland
2021-07-15 18:10                       ` Harry Wentland
2021-07-07  8:48 ` [PATCH 2/2] drm/stm: ltdc: add crtc background color property support Raphael GALLAIS-POU - foss
2021-07-07  8:48   ` Raphael GALLAIS-POU - foss
2021-07-07  8:48   ` Raphael GALLAIS-POU - foss
2021-07-09  7:36   ` Pekka Paalanen
2021-07-09  7:36     ` Pekka Paalanen
2021-07-09  7:36     ` Pekka Paalanen
2021-07-07  9:03 ` [PATCH 0/2] Add "BACKGROUND_COLOR" drm property Simon Ser
2021-07-07  9:03   ` Simon Ser
2021-07-07  9:03   ` Simon Ser
2021-07-07 11:42   ` Daniel Vetter
2021-07-07 11:42     ` Daniel Vetter
2021-07-07 11:42     ` Daniel Vetter
2021-07-09  9:09     ` Raphael Gallais-Pou
2021-07-09  9:09       ` Raphael Gallais-Pou
2021-07-09  9:09       ` Raphael Gallais-Pou
2021-07-09  9:23       ` Simon Ser
2021-07-09  9:23         ` Simon Ser
2021-07-09  9:23         ` Simon Ser
2021-07-12 15:50         ` Raphael Gallais-Pou
2021-07-12 15:50           ` Raphael Gallais-Pou
2021-07-12 15:50           ` Raphael Gallais-Pou
  -- strict thread matches above, loose matches on Subject: below --
2018-10-10 23:50 [PATCH 0/2] CRTC background color Matt Roper
2018-10-10 23:50 ` [PATCH 1/2] drm: Add CRTC background color property Matt Roper
2018-10-11 11:30   ` Ville Syrjälä

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=3c8331cf-fded-b6e6-3e25-666634f4b87a@foss.st.com \
    --to=raphael.gallais-pou@foss.st.com \
    --cc=airlied@linux.ie \
    --cc=alexandre.torgue@foss.st.com \
    --cc=benjamin.gaignard@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mripard@kernel.org \
    --cc=philippe.cornu@foss.st.com \
    --cc=philippe.cornu@st.com \
    --cc=ppaalanen@gmail.com \
    --cc=raphael.gallais-pou@st.com \
    --cc=tzimmermann@suse.de \
    --cc=yannick.fertre@foss.st.com \
    --cc=yannick.fertre@st.com \
    /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.