From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: "Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Maxime Ripard" <mripard@kernel.org>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Sandy Huang" <hjc@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
"Andy Yan" <andy.yan@rock-chips.com>,
"Louis Chauvet" <louis.chauvet@bootlin.com>,
"Haneen Mohammed" <hamohammed.sa@gmail.com>,
"Melissa Wen" <melissa.srw@gmail.com>,
"Jani Nikula" <jani.nikula@linux.intel.com>,
"Robert Mader" <robert.mader@collabora.com>,
kernel@collabora.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org,
"Matt Roper" <matthew.d.roper@intel.com>,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>,
"Diederik de Haas" <diederik@cknow-tech.com>
Subject: Re: [PATCH v6 2/4] drm: Add CRTC background color property
Date: Wed, 4 Feb 2026 22:32:23 +0200 [thread overview]
Message-ID: <97a4fd2d-62e2-41ad-8ee9-d2551c3ab312@collabora.com> (raw)
In-Reply-To: <aXsp2s5a7sJL7Itp@smile.fi.intel.com>
On 1/29/26 11:37 AM, Andy Shevchenko wrote:
> On Thu, Jan 29, 2026 at 02:58:52AM +0200, 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 couple of dedicated DRM_ARGB64_PREP*() helpers. Individual
>> color components can be extracted with desired precision using the
>> corresponding DRM_ARGB64_GET*() macros.
>
> ...
>
>> +/*
>> + * Put 16-bit ARGB values into a standard 64-bit representation that can be
>> + * used for ioctl parameters, inter-driver communication, etc.
>> + *
>> + * If the component values being provided contain less than 16 bits of
>> + * precision, use a conversion ratio to get a better color approximation.
>> + * The ratio is computed as (2^16 - 1) / (2^bpc - 1), where bpc and 16 are
>> + * the input and output precision, respectively.
>
> Not sure if you should explicitly mention that "bpc must not be 0"
> (it can be derived from the "division by 0" in the given formula,
> but still...).
Comment section updated in v7 [1], though I somehow missed to mention it in the
changelog. :-(
>
>> + */
>> +#define __DRM_ARGB64_PREP(c, shift) \
>> + (((__u64)(c) & __GENMASK(15, 0)) << (shift))
>> +
>> +#define __DRM_ARGB64_PREP_BPC(c, shift, bpc)({ \
>
> Not sure if this is an accepted style in DRM, by I find it difficult
> to follow. I would expect the "({" be on a separate line.
I initially got confused by the plethora of different styles, e.g. in
"include/linux/math.h" we can find:
#define rounddown(x, y) ( \
[...]
#define DIV_ROUND_CLOSEST_ULL(x, divisor)( \
[...]
#define mult_frac(x, n, d) \
({ \
[...]
#define abs_diff(a, b) ({ \
[...]
I agree your option is the most readable one, hence I used it consistently in
v7.
Thanks,
Cristian
[1] https://lore.kernel.org/all/20260204-rk3588-bgcolor-v7-0-78d1d01c5ca1@collabora.com/
next prev parent reply other threads:[~2026-02-04 20:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 0:58 [PATCH v6 0/4] Introduce BACKGROUND_COLOR DRM CRTC property Cristian Ciocaltea
2026-01-29 0:58 ` [PATCH v6 1/4] uapi: Provide DIV_ROUND_CLOSEST() Cristian Ciocaltea
2026-01-29 0:58 ` [PATCH v6 2/4] drm: Add CRTC background color property Cristian Ciocaltea
2026-01-29 9:37 ` Andy Shevchenko
2026-01-29 10:00 ` Andy Shevchenko
2026-02-04 20:32 ` Cristian Ciocaltea [this message]
2026-02-04 21:10 ` Andy Shevchenko
2026-01-29 0:58 ` [PATCH v6 3/4] drm/vkms: Support setting custom background color Cristian Ciocaltea
2026-01-29 0:58 ` [PATCH v6 4/4] drm/rockchip: vop2: " Cristian Ciocaltea
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=97a4fd2d-62e2-41ad-8ee9-d2551c3ab312@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=airlied@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy.yan@rock-chips.com \
--cc=diederik@cknow-tech.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=hamohammed.sa@gmail.com \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=jani.nikula@linux.intel.com \
--cc=kernel@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=louis.chauvet@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.d.roper@intel.com \
--cc=melissa.srw@gmail.com \
--cc=mripard@kernel.org \
--cc=nfraprado@collabora.com \
--cc=robert.mader@collabora.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®