[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <2a8ab8c3-36ae-46bd-8f98-6b3760532cb5@collabora.com>
Date: Tue, 2 Sep 2025 19:26:01 +0300
From: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
To: Ville Syrjälä <ville.syrjala@...ux.intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
Sandy Huang <hjc@...k-chips.com>, Heiko Stübner
<heiko@...ech.de>, Andy Yan <andy.yan@...k-chips.com>, kernel@...labora.com,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-rockchip@...ts.infradead.org,
Matt Roper <matthew.d.roper@...el.com>
Subject: Re: [PATCH 1/2] drm: Add CRTC background color property
On 9/2/25 4:36 PM, Ville Syrjälä wrote:
> On Tue, Sep 02, 2025 at 12:27:56PM +0300, Cristian Ciocaltea wrote:
>> Some display controllers can be hardware programmed to show non-black
>> colors for pixels that are either not covered by any plane or are
>> exposed through transparent regions of higher planes. This feature can
>> help reduce memory bandwidth usage, e.g. in compositors managing a UI
>> with a solid background color while using smaller planes to render the
>> remaining content.
>>
>> To support this capability, introduce the BACKGROUND_COLOR standard DRM
>> mode property, which can be attached to a CRTC through the
>> drm_crtc_attach_background_color_property() helper function.
>>
>> Additionally, define a 64-bit ARGB format value to be built with the
>> help of a dedicated drm_argb64() utility macro. Individual color
>> components can be extracted with desired precision using the
>> corresponding DRM_ARGB64_*() macros.
>>
>> Co-developed-by: Matt Roper <matthew.d.roper@...el.com>
>> Signed-off-by: Matt Roper <matthew.d.roper@...el.com>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@...labora.com>
>> ---
>> drivers/gpu/drm/drm_atomic_state_helper.c | 1 +
>> drivers/gpu/drm/drm_atomic_uapi.c | 4 ++++
>> drivers/gpu/drm/drm_blend.c | 37 +++++++++++++++++++++++++++----
>> drivers/gpu/drm/drm_mode_config.c | 6 +++++
>> include/drm/drm_blend.h | 4 +++-
>> include/drm/drm_crtc.h | 12 ++++++++++
>> include/drm/drm_mode_config.h | 5 +++++
>> include/uapi/drm/drm_mode.h | 30 +++++++++++++++++++++++++
>> 8 files changed, 94 insertions(+), 5 deletions(-)
[...]
>> +/*
>> + * Put 16-bit ARGB values into a standard 64-bit representation that
>> + * can be used for ioctl parameters, inter-driver communication, etc.
>> + */
>> +static inline __u64
>> +drm_argb64(__u16 alpha, __u16 red, __u16 green, __u16 blue)
>> +{
>> + return (__u64)alpha << 48 | (__u64)red << 32 | (__u64)green << 16 | blue;
>> +}
>> +
>> +/*
>> + * Extract the specified number of least-significant bits of a specific
>> + * color component from a standard 64-bit ARGB value.
>
> Why would you ever want the least significant bits?
Right, that's useless - will replace with proper helpers dealing with custom
precision.
Thanks,
Cristian
>> + */
>> +#define DRM_ARGB64_COMP(c, shift, numlsb) \
>> + ((__u16)(((c) >> (shift)) & ((1UL << (numlsb) % 17) - 1)))
>> +#define DRM_ARGB64_ALPHA_LSB(c, numlsb) DRM_ARGB64_COMP(c, 48, numlsb)
>> +#define DRM_ARGB64_RED_LSB(c, numlsb) DRM_ARGB64_COMP(c, 32, numlsb)
>> +#define DRM_ARGB64_GREEN_LSB(c, numlsb) DRM_ARGB64_COMP(c, 16, numlsb)
>> +#define DRM_ARGB64_BLUE_LSB(c, numlsb) DRM_ARGB64_COMP(c, 0, numlsb)
>> +
>> +/*
>> + * Convenience wrappers to extract all 16 bits of a specific color
>> + * component from a standard 64-bit ARGB value.
>> + */
>> +#define DRM_ARGB64_ALPHA(c) DRM_ARGB64_ALPHA_LSB(c, 16)
>> +#define DRM_ARGB64_RED(c) DRM_ARGB64_RED_LSB(c, 16)
>> +#define DRM_ARGB64_GREEN(c) DRM_ARGB64_GREEN_LSB(c, 16)
>> +#define DRM_ARGB64_BLUE(c) DRM_ARGB64_BLUE_LSB(c, 16)
>> +
>> #if defined(__cplusplus)
>> }
>> #endif
>>
>> --
>> 2.51.0
>
Powered by blists - more mailing lists