Re: [PATCH 1/1] drm: use drm_warn() in validate_blend_mode_for_alpha_formats()

From: Leandro Ribeiro

Date: Thu Jul 30 2026 - 14:47:29 EST




On 7/30/26 6:14 AM, Jani Nikula wrote:
> On Wed, 29 Jul 2026, Leandro Ribeiro <leandro.ribeiro@xxxxxxxxxxxxx> wrote:
>> Commit 860e748bddcc ("drm: ensure blend mode supported if pixel format
>> with alpha exposed") introduced a WARN() to let driver developers know
>> that a previously valid behavior should now be changed.
>
> I should've chimed in way back when, but in retrospect it's a bit
> presumptuous to add a commit that puts the burden of the change on the
> driver developers, without so much as identifying which drivers or
> getting an ack from them.
>
> This is really not unlike the __deprecated attribute, see commit
> 771c035372a0 ("deprecate the '__deprecated' attribute warnings entirely
> and for good"), but this one's runtime not build.
>

I agree. I hadn't considered the driver coordination aspect when
proposing that change.

>> But WARN() should not be used for that, as it's a kernel warning report
>> mechanism for conditions that are not expected to happen. It also
>> produces a stack trace. Instead, a simple warning-level log message
>> should have been used, as drivers were expected to trigger the
>> condition.
>>
>> This is causing problems for fuzzers, as they may stop when encountering
>> a "BUG:" or "WARNING:" in the logs.
>>
>> Replace WARN() with drm_warn() in this function, avoiding these issues.
>
> Fixes: 860e748bddcc ("drm: ensure blend mode supported if pixel format with alpha exposed")
>
>> Signed-off-by: Leandro Ribeiro <leandro.ribeiro@xxxxxxxxxxxxx>
>> ---
>> drivers/gpu/drm/drm_mode_config.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
>> index 3bcc7bf0900c..3d9c554e08a8 100644
>> --- a/drivers/gpu/drm/drm_mode_config.c
>> +++ b/drivers/gpu/drm/drm_mode_config.c
>> @@ -869,8 +869,9 @@ static void validate_blend_mode_for_alpha_formats(struct drm_plane *plane)
>> for (i = 0; i < plane->format_count; i++) {
>> fmt = drm_format_info(plane->format_types[i]);
>> if (fmt->has_alpha) {
>> - WARN(1, "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
>> - plane->base.id, plane->name);
>> + drm_warn(plane->dev,
>> + "[PLANE:%d:%s] pixel format with alpha exposed but blend mode not setup",
>> + plane->base.id, plane->name);
>> break;
>> }
>> }
>

--
Leandro Ribeiro