mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: "Ville Syrjälä" <ville.syrjala@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>,
	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>
Subject: Re: [PATCH 1/2] drm: Add CRTC background color property
Date: Tue, 2 Sep 2025 19:26:01 +0300	[thread overview]
Message-ID: <2a8ab8c3-36ae-46bd-8f98-6b3760532cb5@collabora.com> (raw)
In-Reply-To: <aLby6OPxgubt7kd_@intel.com>

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@intel.com>
>> Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
>> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.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
> 


  reply	other threads:[~2025-09-02 16:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  9:27 [PATCH 0/2] Introduce BACKGROUND_COLOR DRM CRTC property Cristian Ciocaltea
2025-09-02  9:27 ` [PATCH 1/2] drm: Add CRTC background color property Cristian Ciocaltea
2025-09-02 13:36   ` Ville Syrjälä
2025-09-02 16:26     ` Cristian Ciocaltea [this message]
2025-09-02  9:27 ` [PATCH 2/2] drm/rockchip: vop2: Support setting custom background color Cristian Ciocaltea
2025-09-02 13:19 ` [PATCH 0/2] Introduce BACKGROUND_COLOR DRM CRTC property Raphael Gallais-Pou
2025-09-02 16:04   ` Cristian Ciocaltea
  -- strict thread matches above, loose matches on Subject: below --
2021-07-07  8:48 [PATCH 0/2] Add "BACKGROUND_COLOR" drm property Raphael GALLAIS-POU - foss
2021-07-07  8:48 ` [PATCH 1/2] drm: add crtc background color property Raphael GALLAIS-POU - foss
2021-07-09  8:04   ` Pekka Paalanen
2021-07-09 16:23     ` Raphael Gallais-Pou
2021-07-12  8:03       ` Pekka Paalanen
2021-07-12 16:15         ` Harry Wentland
2021-07-13  7:52           ` Pekka Paalanen
2021-07-13 13:54             ` Harry Wentland
2021-07-14  7:35               ` Pekka Paalanen
2021-07-14 16:13                 ` Harry Wentland
2021-07-15  9:34                   ` Pekka Paalanen
2021-07-15 18:10                     ` Harry Wentland

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=2a8ab8c3-36ae-46bd-8f98-6b3760532cb5@collabora.com \
    --to=cristian.ciocaltea@collabora.com \
    --cc=airlied@gmail.com \
    --cc=andy.yan@rock-chips.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.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=maarten.lankhorst@linux.intel.com \
    --cc=matthew.d.roper@intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=ville.syrjala@linux.intel.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 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®