mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Rob Clark <robin.clark@oss.qualcomm.com>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jessica.zhang@oss.qualcomm.com>,
	Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND 2/2] drm/msm/dpu: use full scale alpha in _dpu_crtc_setup_blend_cfg()
Date: Wed, 19 Nov 2025 10:14:41 +0100	[thread overview]
Message-ID: <bd6b2ae7-71e0-4c65-bae2-81240bd2515f@oss.qualcomm.com> (raw)
In-Reply-To: <ogiiqha5ak5z4atck7ykyvbzw4juegsn4z7nazkkstiep3duwe@6qc5ag3kobj3>

On 11/19/25 8:50 AM, Dmitry Baryshkov wrote:
> On Tue, Nov 18, 2025 at 04:02:03PM +0100, Konrad Dybcio wrote:
>> On 11/18/25 3:51 PM, Dmitry Baryshkov wrote:
>>> Both _dpu_crtc_setup_blend_cfg() and setup_blend_config_alpha()
>>> callbacks embed knowledge about platform's alpha range (8-bit or
>>> 10-bit). Make _dpu_crtc_setup_blend_cfg() use full 16-bit values for
>>> alpha and reduce alpha only in DPU-specific callbacks.
>>>
>>> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
>>> ---
>>
>> [...]
>>
>>> -	const_alpha = (bg_alpha & 0xFF) | ((fg_alpha & 0xFF) << 16);
>>> +	const_alpha = ((bg_alpha >> 8) & 0xff) |
>>> +		(((fg_alpha >> 8) & 0xff) << 16);
>>
>> This begs for some bitfield.h
> 
> Which one(s) would you recommend? Ideally it should be something like
> 'get N top bits', but I don't see one.

Perhaps we can create one.. there's include/linux/wordpart.h
with upper/lower_16/32_bits().. Maybe we could add

#define lower_n_bits(x, n) (FIELD_GET(GENMASK((n - 1), 0), x)

// register def
#define CONST_ALPHA_BG	GENMASK(,)
#define CONST_ALPHA_FG	GENMASK(,)

const_alpha = FIELD_GET(CONST_ALPHA_BG, lower_n_bits(bg_alpha, 8)) |
	      FIELD_GET(CONST_ALPHA_FG, lower_n_bits(fg_alpha, 8));

At which point it arguably becomes equally difficult to read.. but I
think the rule of thumb is that syntax sugar is better than raw bitops ;)

Konrad

      reply	other threads:[~2025-11-19  9:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-18 14:51 [PATCH RESEND 0/2] drm/msm/dpu: use full scale alpha in generic code Dmitry Baryshkov
2025-11-18 14:51 ` [PATCH RESEND 1/2] drm/msm/dpu: simplify bg_alpha selection Dmitry Baryshkov
2025-11-18 14:55   ` Konrad Dybcio
2025-11-18 14:51 ` [PATCH RESEND 2/2] drm/msm/dpu: use full scale alpha in _dpu_crtc_setup_blend_cfg() Dmitry Baryshkov
2025-11-18 15:02   ` Konrad Dybcio
2025-11-19  7:50     ` Dmitry Baryshkov
2025-11-19  9:14       ` Konrad Dybcio [this message]

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=bd6b2ae7-71e0-4c65-bae2-81240bd2515f@oss.qualcomm.com \
    --to=konrad.dybcio@oss.qualcomm.com \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jessica.zhang@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lumag@kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=robin.clark@oss.qualcomm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    /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®