From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17DD730E83C for ; Fri, 6 Feb 2026 20:53:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770411191; cv=none; b=u+adx57IXkALPN2GF6odg1EiRXlA6G1bkdeSuL0fDw6XF3LcJrRwjoorSmHuW9BnzH5PEKiYzf6vJfQ87C4JG3JXT8Xgc2aTR6r2ANvTViwykJCHWnIBKSA0PhtHHnMHKC+6I+FnqrM72eIL7/Z/sEJcGsL0jnBwwwGUnYx417I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770411191; c=relaxed/simple; bh=Up2Rq3OaAmdR3tNG5Gtt9djGS3FeZ4a8/+Kj03Csy94=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=jCaUAdhiQgjIXMR2hXah/68igdt7OH3B0xWtabi3i0zsT8POtMfa++Sd9daNIbvD+PMvPAmhzQvKk2tr5fLf47Y0nDAvUk4zt31JsE8OUTPpCsCUewHrodwKw7uMeOftKEMIRQCejf9WtNcDNuiwUigoelsbnMauTf+Pla5iI8Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=IGPp0jKL; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IGPp0jKL" Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-b8ea0a386cdso32905766b.2 for ; Fri, 06 Feb 2026 12:53:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770411189; x=1771015989; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding :disposition-notification-to:references:in-reply-to:date:cc:to:from :subject:message-id:from:to:cc:subject:date:message-id:reply-to; bh=8nCuBzBCWXvAq1q08nO5/bP5KSwKUp+J/Q3o6/S7644=; b=IGPp0jKLdr/ADWuVOhOhgv87/5nQVwx28a4sn2lYkL0FtjxZE5AgBVA5DEIibCMIqI RZK2zbdp9fw9gNRlcGvzUJVuigUhnU8YwzZ9DXv0L1k2g2ezhMQoAufHGjVmTPJaZ/NJ vuL9jZBYFBmdjQX7Zg3atMc1ki+hPQehxSU6y0Zhn2bxLJVb6CN7Vpq6kQQ4q5yBgtuW ancNG8Iv04CVIBeAcHW4jH5oBgMWV2pkMhLbqj86ds1iE8BoiJv0Us80WrFfDtcmmD1k YjjlKe26N1WST/bK7v+f3rnSRkrt+zeGiMKaBYk4bcIrp5OIIQUfORc+Dj6QEecZqysi ZkCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770411189; x=1771015989; h=mime-version:user-agent:content-transfer-encoding :disposition-notification-to:references:in-reply-to:date:cc:to:from :subject:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=8nCuBzBCWXvAq1q08nO5/bP5KSwKUp+J/Q3o6/S7644=; b=XL1lSHL6WBxhc7InpmLtFhEuRXsDTyhbl5Wwj69g3pjWiIWkah6E1ov6ekgQ4s6rLI j3C5nEYTmFf0a6LFlOAwP7vTl9PpwMxzxYDLqJlC/14kLXRkPXuOOI5Bj0SwCyc8dzPN Nr7EmjwFvTtAH5+UzygM8Djp+VKdzZTYSimFn4LGiz1ce3XGP5ey8LZ/n2aLV8/Z3WPc J2Z+pAXlzHAF4gdEat9Jrvx9k+aOX88gR2JKb3NeF0fnCK/7d1c/RcmoP1F4Y48gO+cc ctCHmPArxkf4+tzSagdPNo3x9ZHa1a+zjfjRs/KCRKwI0d2asIwot+9xDsQeBu6P2B2h +zWw== X-Forwarded-Encrypted: i=1; AJvYcCWn3T1Ndhh2niw7+WBxCt4GRH5x2uw2l672uZKPIy1s2dx3Jxdkz4EfI8pjJg+QoAT1TyuhV11RhzlWJEc=@vger.kernel.org X-Gm-Message-State: AOJu0YwVdMn1j5MwngfCe+rHZXALru4mOXEDsGXphM4AQPATi8fO3K9b kPnREYFMLm+MpfzxRIaThDG0J6zRJSNb4rh36+ab9zaq/SRKDl2UUPmQ X-Gm-Gg: AZuq6aIa70vc5jyc8M+SL9fzKqI62PvJ/aWB8mHc+u3QL0jTLLK8Ensg85iTvCqEoS8 g/Kh83lGCE++3NwPz2mqZrMhodpBBDn89eEwWccfFE4haedx9te5EKV6CZBEPQUkoopmzsEyWM2 kjSQMhdMqUUMKQkPJu8AdZlqDb+AkAg5j/tcafleBjFZItAuDl6Fd5juzfTlWm08k+lXyRDcmzb N0cbnPP510+hQDLLrDuIgbteDzXcqJXFlf3M+ryqFxx7VjtbhSaV/yigzRvdsxDqRLzACupib3B VZpNvhQqnqUW8jxLfuk3xf7nvytkGtf5PocL8TV3J4zVvqwQMmEhzv8ELw5ZWFtAF9Sr6jTwVBs 9lwEj/gbPZhQNuYof927VJsX9ZhAj874ShCPOPgeL0v9+hDdD73msdNNaRgKUbZCIj0RLLMwQso /JskiBu4ZOEWZkX/1h6oh7K9uA/IX3oeXzA07nbFeGnoJX0CTXg+Ie56qKPVmwjHoNzAUvSJQ= X-Received: by 2002:a17:906:f5a1:b0:b8a:f5a1:32f0 with SMTP id a640c23a62f3a-b8edf4eac8bmr130916166b.3.1770411189198; Fri, 06 Feb 2026 12:53:09 -0800 (PST) Received: from [192.168.1.239] (87-205-5-123.static.ip.netia.com.pl. [87.205.5.123]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8eda748254sm109746166b.5.2026.02.06.12.52.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 12:52:59 -0800 (PST) Message-ID: <79264ab170e48e1372b3b847d75f4635dcc57aa6.camel@gmail.com> Subject: Re: [PATCH v3 16/19] drm/amd/display: Add parameter to control ALLM behavior From: Tomasz =?UTF-8?Q?Paku=C5=82a?= To: Harry Wentland , alexander.deucher@amd.com, sunpeng.li@amd.com Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, simona@ffwll.ch, siqueira@igalia.com, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, bernhard.berger@gmail.com, michel.daenzer@mailbox.org, daniel@fooishbar.org, admin@ptr1337.dev Date: Fri, 06 Feb 2026 21:52:57 +0100 In-Reply-To: References: <20260203185626.55428-1-tomasz.pakula.oficjalny@gmail.com> <20260203185626.55428-17-tomasz.pakula.oficjalny@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Fri, 2026-02-06 at 13:52 -0500, Harry Wentland wrote: > On 2026-02-03 13:56, Tomasz Paku=C5=82a wrote: > > [Why] > > Some users prefer to always manually control ALLM/Gaming mode while > > others might want it permanently forced on. > >=20 > > [How] > > Since there isn't yet an API to control this, expose module parameter > >=20 > > Changes in v3: > > - Include a fix for possible NULL pointer dereference by Peter > >=20 > > Closes: https://github.com/CachyOS/linux-cachyos/issues/680 > >=20 > > Co-developed-by: Peter Jung > > Signed-off-by: Peter Jung > > Signed-off-by: Tomasz Paku=C5=82a > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + > > drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 +++++- > > .../gpu/drm/amd/display/dc/core/dc_resource.c | 7 +-- > > .../amd/display/modules/inc/mod_info_packet.h | 1 + > > .../display/modules/info_packet/info_packet.c | 46 ++++++++++++++++--- > > 5 files changed, 56 insertions(+), 13 deletions(-) > >=20 > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/= amdgpu/amdgpu.h > > index 447e734c362b..312aa32064d5 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > > @@ -268,6 +268,7 @@ extern int amdgpu_rebar; > > =20 > > extern int amdgpu_wbrf; > > extern int amdgpu_user_queue; > > +extern uint amdgpu_allm_mode; > > =20 > > extern uint amdgpu_hdmi_hpd_debounce_delay_ms; > > =20 > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/= amd/amdgpu/amdgpu_drv.c > > index d6d0a6e34c6b..4b038c8bbf9f 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c > > @@ -248,6 +248,7 @@ int amdgpu_umsch_mm_fwlog; > > int amdgpu_rebar =3D -1; /* auto */ > > int amdgpu_user_queue =3D -1; > > uint amdgpu_hdmi_hpd_debounce_delay_ms; > > +uint amdgpu_allm_mode =3D 1; > > =20 > > DECLARE_DYNDBG_CLASSMAP(drm_debug_classes, DD_CLASS_TYPE_DISJOINT_BITS= , 0, > > "DRM_UT_CORE", > > @@ -1124,7 +1125,7 @@ module_param_named(rebar, amdgpu_rebar, int, 0444= ); > > MODULE_PARM_DESC(user_queue, "Enable user queues (-1 =3D auto (default= ), 0 =3D disable, 1 =3D enable, 2 =3D enable UQs and disable KQs)"); > > module_param_named(user_queue, amdgpu_user_queue, int, 0444); > > =20 > > -/* > > +/** > > * DOC: hdmi_hpd_debounce_delay_ms (uint) > > * HDMI HPD disconnect debounce delay in milliseconds. > > * > > @@ -1134,6 +1135,17 @@ module_param_named(user_queue, amdgpu_user_queue= , int, 0444); > > MODULE_PARM_DESC(hdmi_hpd_debounce_delay_ms, "HDMI HPD disconnect debo= unce delay in milliseconds (0 to disable (by default), 1500 is common)"); > > module_param_named(hdmi_hpd_debounce_delay_ms, amdgpu_hdmi_hpd_debounc= e_delay_ms, uint, 0644); > > =20 > > +/** > > + * DOC: allm_mode (int) > > + * Changes ALLM triggering mode (if sink supports ALLM). Possible valu= es: > > + * > > + * - 0 =3D ALLM disabled > > + * - 1 =3D ALLM dynamically triggered based on VRR state / Game Conten= t Type Hint > > + * - 2 =3D ALLM forced always on > > + */ > > +MODULE_PARM_DESC(allm_mode, "Changes ALLM trigger mode (0 =3D disable,= 1 =3D enable (default), 2 =3D force enable)"); > > +module_param_named(allm_mode, amdgpu_allm_mode, uint, 0644); > > + > > /* These devices are not supported by amdgpu. > > * They are supported by the mach64, r128, radeon drivers > > */ > > diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/driver= s/gpu/drm/amd/display/dc/core/dc_resource.c > > index 4a7c9f810e35..b779aac28dfa 100644 > > --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > > +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c > > @@ -44,6 +44,7 @@ > > #include "clk_mgr.h" > > #include "dc_state_priv.h" > > #include "dc_stream_priv.h" > > +#include "modules/inc/mod_info_packet.h" >=20 > Architecturally DC can't have a dependency on modules. > Is there a different way we can handle this? >=20 > Could we do the determination in amdgpu_dm (with help of > the module) and then set a flag on the stream? >=20 > Harry Sure. I don't have any opinion on how it should be done. I think I only did this like that because I wanted it to be easily changeable at runtime, but the value of having this RW is next to none. >=20 > > =20 > > #include "virtual/virtual_link_hwss.h" > > #include "link/hwss/link_hwss_dio.h" > > @@ -4503,8 +4504,6 @@ static void set_avi_info_frame( > > unsigned int vic =3D pipe_ctx->stream->timing.vic; > > unsigned int rid =3D pipe_ctx->stream->timing.rid; > > unsigned int fr_ind =3D pipe_ctx->stream->timing.fr_index; > > - enum dc_timing_3d_format format; > > - bool allm; > > =20 > > if (stream->avi_infopacket.valid) { > > *info_packet =3D stream->avi_infopacket; > > @@ -4658,10 +4657,8 @@ static void set_avi_info_frame( > > ///VIC > > if (pipe_ctx->stream->timing.hdmi_vic !=3D 0) > > vic =3D 0; > > - format =3D stream->timing.timing_3d_format; > > - allm =3D stream->link->local_sink->edid_caps.allm; > > /*todo, add 3DStereo support*/ > > - if ((format !=3D TIMING_3D_FORMAT_NONE) || allm) { > > + if (!is_hdmi_vic_mode(pipe_ctx->stream)) { > > // Based on HDMI specs hdmi vic needs to be converted to cea vic whe= n 3D is enabled > > switch (pipe_ctx->stream->timing.hdmi_vic) { > > case 1: > > diff --git a/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h = b/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h > > index 306eb7355c25..9ec123ecc7c4 100644 > > --- a/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h > > +++ b/drivers/gpu/drm/amd/display/modules/inc/mod_info_packet.h > > @@ -41,6 +41,7 @@ void set_vsc_packet_colorimetry_data( > > enum dc_color_space cs, > > enum color_transfer_func tf); > > =20 > > +bool is_hdmi_vic_mode(const struct dc_stream_state *stream); > > void mod_build_vsc_infopacket(const struct dc_stream_state *stream, > > struct dc_info_packet *info_packet, > > enum dc_color_space cs, > > diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packe= t.c b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c > > index 53e488fdb4ea..829cce9455db 100644 > > --- a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c > > +++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c > > @@ -23,12 +23,13 @@ > > * > > */ > > =20 > > -#include "mod_info_packet.h" > > +#include "amdgpu.h" > > #include "core_types.h" > > -#include "dc_types.h" > > -#include "mod_shared.h" > > -#include "mod_freesync.h" > > #include "dc.h" > > +#include "dc_types.h" > > +#include "mod_freesync.h" > > +#include "mod_info_packet.h" > > +#include "mod_shared.h" > > =20 > > enum vsc_packet_revision { > > vsc_packet_undefined =3D 0, > > @@ -54,6 +55,12 @@ enum vsc_packet_revision { > > #define HF_VSIF_3D_BIT 0 > > #define HF_VSIF_ALLM_BIT 1 > > =20 > > +enum allm_trigger_mode { > > + ALLM_MODE_DISABLED =3D 0, > > + ALLM_MODE_ENABLED_DYNAMIC =3D 1, > > + ALLM_MODE_ENABLED_FORCED =3D 2, > > +}; > > + > > // VTEM Byte Offset > > #define VTEM_PB0 0 > > #define VTEM_PB1 1 > > @@ -499,7 +506,32 @@ void mod_build_vsc_infopacket(const struct dc_stre= am_state *stream, > > } > > } > > =20 > > -static bool is_hdmi_vic_mode(const struct dc_stream_state *stream) > > +static bool is_hdmi_allm_mode(const struct dc_stream_state *stream) > > +{ > > + /* No local sink */ > > + if (!stream->link->local_sink) > > + return false; > > + > > + /* Sink doesn't expose ALLM support in edid */ > > + if (!stream->link->local_sink->edid_caps.allm) > > + return false; > > + > > + switch (amdgpu_allm_mode) { > > + case ALLM_MODE_DISABLED: > > + return false; > > + > > + case ALLM_MODE_ENABLED_DYNAMIC: > > + break; > > + > > + case ALLM_MODE_ENABLED_FORCED: > > + return true; > > + } > > + > > + return stream->content_type =3D=3D DISPLAY_CONTENT_TYPE_GAME || > > + stream->vrr_active_variable; > > +} > > + > > +bool is_hdmi_vic_mode(const struct dc_stream_state *stream) > > { > > if (stream->timing.hdmi_vic =3D=3D 0) > > return false; > > @@ -512,7 +544,7 @@ static bool is_hdmi_vic_mode(const struct dc_stream= _state *stream) > > if (stream->view_format !=3D VIEW_3D_FORMAT_NONE) > > return false; > > =20 > > - if (stream->link->local_sink->edid_caps.allm) > > + if (is_hdmi_allm_mode(stream)) > > return false; > > =20 > > return true; > > @@ -541,7 +573,7 @@ void mod_build_hf_vsif_infopacket(const struct dc_s= tream_state *stream, > > =20 > > info_packet->valid =3D false; > > =20 > > - allm =3D stream->link->local_sink->edid_caps.allm; > > + allm =3D is_hdmi_allm_mode(stream); > > format =3D stream->view_format =3D=3D VIEW_3D_FORMAT_NONE ? > > TIMING_3D_FORMAT_NONE : > > stream->timing.timing_3d_format;