Re: [PATCH v8 04/39] drm/connector: Add HDMI 2.0 scrambler infrastructure

Cristian Ciocaltea <[email protected]>
Newsgroups org.infradead.lists.linux-rockchip,org.freedesktop.lists.dri-devel,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 7/22/26 9:51 AM, Dmitry Baryshkov wrote:
> On Thu, Jul 16, 2026 at 03:50:29PM +0200, Maxime Ripard wrote:
>> On Wed, Jul 15, 2026 at 01:46:12PM +0300, Cristian Ciocaltea wrote:
>>> On 7/15/26 11:55 AM, Maxime Ripard wrote:
>>>> On Mon, Jul 13, 2026 at 01:23:00PM +0300, Cristian Ciocaltea wrote:
>>>>> On 7/13/26 11:50 AM, Maxime Ripard wrote:
>>>>>> On Thu, Jul 09, 2026 at 10:25:54PM +0300, Cristian Ciocaltea wrote:
>>>>>>> On 7/3/26 11:54 PM, Cristian Ciocaltea wrote:
>>>>>>>> On 7/3/26 5:34 PM, Dmitry Baryshkov wrote:
>>>>>>>>> On Thu, Jul 02, 2026 at 05:46:17PM +0300, Cristian Ciocaltea wrote:
>>>>>>>>>> Add the connector-level infrastructure to support HDMI 2.0 scrambling:
>>>>>>>>>>
>>>>>>>>>> - A scrambler_supported flag to indicate whether the source supports the
>>>>>>>>>>   scrambling capability, in which case the newly introduced
>>>>>>>>>>   .scrambler_{enable|disable}() callbacks in drm_connector_hdmi_funcs
>>>>>>>>>>   are mandatory
>>>>>>>>>
>>>>>>>>> Do we need a flag? What would it mean if the flag is set, but the
>>>>>>>>> callbacks are not? Can we drop the flag and use the presence of the
>>>>>>>>> callbacks as a way to identify that scrambler is enabled?
>>>>>>>>
>>>>>>>> The flag is intended to be set only within drmm_connector_hdmi_init_with_caps()
>>>>>>>> when drivers advertise HDMI 2.x capability, in which case it also ensures the
>>>>>>>> callbacks are provided.  
>>>>>>>>
>>>>>>>> We could drop the flag and instead have the init helper clear the callbacks if
>>>>>>>> they were provided for HDMI 1.x.  This might slightly reduce code readability,
>>>>>>>> as it relies on checking the presence of individual callbacks - especially since
>>>>>>>> we plan to extend this further with HDMI 2.1 support, providing four or five
>>>>>>>> additional FRL-specific callbacks.
>>>>>>>
>>>>>>> I tried to replace the flag with a helper that checks the presence of (one of)
>>>>>>> the callbacks, but it's not straightforward to unset those for non-HDMI 2.x
>>>>>>> cases since the hdmi_funcs argument is immutable.
>>>>>>
>>>>>> I'm not sure why we would need to unset them. If the driver states that
>>>>>> it support HDMI 2.0, then it needs to be there, if it doesn't, then who
>>>>>> cares? it's not going to be used. We can log a warning that it's
>>>>>> inconsistent I guess, but there's no need to actively remove it.
>>>>>
>>>>> I was trying to address the use case where drivers provide the scrambler
>>>>> callbacks despite not supporting HDMI 2.0.
>>>>
>>>> Scrambling got introduced with HDMI 2.0. That doesn't make sense, but
>>>> it's not a total deal breaker, it's just going to be here unused. Hence
>>>> why I was suggesting to put a warning there if you wanted to.
>>>>
>>>>> If we replace the scrambler_supported flag with a helper checking the
>>>>> presence of the scrambler callbacks, then we would need to ensure the
>>>>> callbacks do not exist in this case.
>>>>
>>>> Keep it simple:
>>>>
>>>> if (hdmi_version >= HDMI_VERSION_2_0)
>>>>    if (funcs->scrambler_enable)
>>>>       hdmi->scramblers_supported = true
>>>>    else
>>>>       return -EINVAL
>>>> else
>>>>     drm_warn(warn, "Inconsistent HDMI version");
>>>>
>>>> We don't need anything more than that.
>>>
>>> I dropped the scrambler_supported flag and introduced a helper:
>>>
>>> static inline bool
>>> drm_connector_hdmi_scrambler_supported(struct drm_connector *connector)
>>> {
>>> 	return connector->hdmi.funcs && connector->hdmi.funcs->scrambler_enable;
>>
>> I'd add disable to that test
> 
> I'd make it an error, if there is only scrambler_enable without
> scrambler_disable (or vice versa).

hdmi_init() already guaranties that both scrambler callbacks must be present
when supported_hdmi_ver indicates HDMI_VERSION_2_0, and neither of them
otherwise.

Regardless, I've already added scrambler_disable to the check above to improve
code readability.

Thanks,
Cristian

_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.