Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2567100rdb; Mon, 12 Feb 2024 08:50:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IEwGwzMv1K8HnMzl/W0YXvBDeG33IgFHkCYdudX8VI4umkuzkiI/HW0c7wMbH9MKH+K41h5 X-Received: by 2002:a05:6a20:d48f:b0:19e:a271:ea8d with SMTP id im15-20020a056a20d48f00b0019ea271ea8dmr6308724pzb.26.1707756645966; Mon, 12 Feb 2024 08:50:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707756645; cv=pass; d=google.com; s=arc-20160816; b=h0GdRRkmZFOdi0Iocsqjd3zX9OaZie7LoKenQbmnrb3dJDzB6uHr+qhP5NA+/qwPjk tgoEW5bc7zZZOCP8uinyqcRPBHWgcZMqNqlfV1Lhi26ZZSpy2+g3g9J3MaFzm/T3YuD+ hSyCW1ulaU4HgM9z3xM16l8U4PYt5nCRGJuuZvg9rLVrCiwhMI0pv5sG1Un0gPg4alDb i1/TZvWkN3d0g0qKSRGFaHPUCpgGDqar+vUmFT5zT6VS1Ei2AmNJiJlzQ3oZHxqKDLZl rPsTM+y7KLZNBUg1oPOMGdJV4bua4Ik74jMGeO+htjaPR6aWE8cmIVY6IdEZSGefbLYA G+wA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=+Jm+IFmVmUOnPBegSpPhg2JpNflC7UbRbpvWaRnsbxc=; fh=MN/awdZCja3WBWxDi5Mq8GujvG6JOiFPoPuW2lE0S1c=; b=HFO0PWveHkI6JIk7js0KL2903SeQPZIJDenrmYeY/64CyOkoiYALqJ7FKxHgArxZ5L 4EPvjjIbhQjW5xdlouUKoaSO34hTIJhWtDRPbx01G5wnHfBFdvvkg8JADTjyIcOTCKf6 dA6B2F2b0JGVDTzM9K3xs94hYLPN0jA6OR3xjRQftEtYRdX/RVNxjT7wNrTLFImDaShu SGrh1JxS4EGC5VuvlwYmPLvt2qZWhDBErsxU3PZoxDKWAbGlM73v/DIqYst62QiysNE7 iUDFEcupA0nem0GzVIJOnXItDZjxysitBfnYxDrdizafxglXVtPJTxaClBjpDt2l6Y2R iwBQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-61996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61996-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl X-Forwarded-Encrypted: i=2; AJvYcCVK8gmrkfuX+w4IoElepPkzIKU+mWhpKxuLqD1UjGBLs6HL+Bbe2SJJlYnr+5Og5RxEXyARk5wzvepawIPxZC/+aKBoUA8D5MlNwCDZ0Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id l23-20020a637017000000b005dbec97f04fsi481225pgc.589.2024.02.12.08.50.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 08:50:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-61996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-61996-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-61996-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A58C4286D41 for ; Mon, 12 Feb 2024 16:42:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 753113E48C; Mon, 12 Feb 2024 16:39:10 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90064210E4; Mon, 12 Feb 2024 16:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755949; cv=none; b=BLQijGk579GezfelYXtFv27Iv6GwelCP/WgjtDFtUsH+ubvQEYy5agizWNS56vnL12HEauv/3rVhYALQDG3ty8EBM5mtArEJtPhP3aPW6NL6ZMrer62q+lQQ6YMRwmdzCtAldRogEA1dCDZfEYahsEMlZrgmpHk2cpm/3epuFds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707755949; c=relaxed/simple; bh=vcordRo2KvlABpChEq+Z7OeNWOiTzGB0Zd1pEepkQ9A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ppGFFNJJWnPF8DFkrVH1/6osfz9NJ0qtAcJoETyvVD6rhUUkpNeuJwAkb37sXnETTQorss+s5T3ia5UBAW26ReZuV+p+bQzyPsUp/ip/M+PfRFfg0ZRN3TxcIUK6IjPEox8y6/jfAIEgi1Q3b3qN7SplZEAS6ZZImP1fWoAchR0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C339C433C7; Mon, 12 Feb 2024 16:39:05 +0000 (UTC) Message-ID: <0b3e31e6-34ae-46e3-a43d-bc4895542d8a@xs4all.nl> Date: Mon, 12 Feb 2024 17:39:03 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 08/44] drm/connector: hdmi: Add Broadcast RGB property Content-Language: en-US, nl To: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Maxime Ripard Cc: Sebastian Wick , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Emma Anholt , Jonathan Corbet , Sandy Huang , =?UTF-8?Q?Heiko_St=C3=BCbner?= , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-rockchip@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org References: <20231207-kms-hdmi-connector-state-v5-8-6538e19d634d@kernel.org> <20240115143308.GA159345@toolbox> <20240115143720.GA160656@toolbox> <73peztbeeikb3fg6coxu3punxllgtyrmgco34tnxkojtsjbr3s@26bud3sjbcez> <20240209203435.GB996172@toolbox> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceD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+unyp4dRlyryAeqEuISykhvjZCVHk/woaMZv c1Dm4Uvkv0Ilelt3Pb9J7zhcx6sm5T7v16VceF96jG61bnJ2GFS+QZerZp3PY27XgtPxRxYj AmFUeF486PHx/2Yi4u1rQpIpC5inPxIgR1+ZFvQrAV36SvLFfuMhyCAxV6WBlQc85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 12/02/2024 16:49, Ville Syrjälä wrote: > On Mon, Feb 12, 2024 at 11:01:07AM +0100, Maxime Ripard wrote: >> On Fri, Feb 09, 2024 at 09:34:35PM +0100, Sebastian Wick wrote: >>> On Mon, Feb 05, 2024 at 10:39:38AM +0100, Maxime Ripard wrote: >>>> On Fri, Feb 02, 2024 at 06:37:52PM +0200, Ville Syrjälä wrote: >>>>> On Fri, Feb 02, 2024 at 04:59:30PM +0100, Maxime Ripard wrote: >>>>>> On Fri, Feb 02, 2024 at 05:40:47PM +0200, Ville Syrjälä wrote: >>>>>>> On Fri, Feb 02, 2024 at 02:01:39PM +0100, Maxime Ripard wrote: >>>>>>>> Hi, >>>>>>>> >>>>>>>> On Mon, Jan 15, 2024 at 03:37:20PM +0100, Sebastian Wick wrote: >>>>>>>>>>> /** >>>>>>>>>>> * DOC: HDMI connector properties >>>>>>>>>>> * >>>>>>>>>>> + * Broadcast RGB >>>>>>>>>>> + * Indicates the RGB Quantization Range (Full vs Limited) used. >>>>>>>>>>> + * Infoframes will be generated according to that value. >>>>>>>>>>> + * >>>>>>>>>>> + * The value of this property can be one of the following: >>>>>>>>>>> + * >>>>>>>>>>> + * Automatic: >>>>>>>>>>> + * RGB Range is selected automatically based on the mode >>>>>>>>>>> + * according to the HDMI specifications. >>>>>>>>>>> + * >>>>>>>>>>> + * Full: >>>>>>>>>>> + * Full RGB Range is forced. >>>>>>>>>>> + * >>>>>>>>>>> + * Limited 16:235: >>>>>>>>>>> + * Limited RGB Range is forced. Unlike the name suggests, >>>>>>>>>>> + * this works for any number of bits-per-component. >>>>>>>>>>> + * >>>>>>>>>>> + * Drivers can set up this property by calling >>>>>>>>>>> + * drm_connector_attach_broadcast_rgb_property(). >>>>>>>>>>> + * >>>>>>>>>> >>>>>>>>>> This is a good time to document this in more detail. There might be two >>>>>>>>>> different things being affected: >>>>>>>>>> >>>>>>>>>> 1. The signalling (InfoFrame/SDP/...) >>>>>>>>>> 2. The color pipeline processing >>>>>>>>>> >>>>>>>>>> All values of Broadcast RGB always affect the color pipeline processing >>>>>>>>>> such that a full-range input to the CRTC is converted to either full- or >>>>>>>>>> limited-range, depending on what the monitor is supposed to accept. >>>>>>>>>> >>>>>>>>>> When automatic is selected, does that mean that there is no signalling, >>>>>>>>>> or that the signalling matches what the monitor is supposed to accept >>>>>>>>>> according to the spec? Also, is this really HDMI specific? >>>>>>>>>> >>>>>>>>>> When full or limited is selected and the monitor doesn't support the >>>>>>>>>> signalling, what happens? >>>>>>>>> >>>>>>>>> Forgot to mention: user-space still has no control over RGB vs YCbCr on >>>>>>>>> the cable, so is this only affecting RGB? If not, how does it affect >>>>>>>>> YCbCr? >>>>>>>> >>>>>>>> So I dug a bit into both the i915 and vc4 drivers, and it looks like if >>>>>>>> we're using a YCbCr format, i915 will always use a limited range while >>>>>>>> vc4 will follow the value of the property. >>>>>>> >>>>>>> The property is literally called "Broadcast *RGB*". >>>>>>> That should explain why it's only affecting RGB. >>>>>> >>>>>> Right. And the limited range option is called "Limited 16:235" despite >>>>>> being usable on bpc > 8 bits. Naming errors occurs, and history happens >>>>>> to make names inconsistent too, that's fine and not an argument in >>>>>> itself. >>>>>> >>>>>>> Full range YCbCr is a much rarer beast so we've never bothered >>>>>>> to enable it. >>>>>> >>>>>> vc4 supports it. >>>>> >>>>> Someone implemented it incorrectly then. >>>> >>>> Incorrectly according to what documentation / specification? I'm sorry, >>>> but I find it super ironic that i915 gets to do its own thing, not >>>> document any of it, and when people try to clean things up they get told >>>> that we got it all wrong. >>> >>> FWIW, this was an i915 property and if another driver uses the same >>> property name it must have the same behavior. Yes, it isn't standardized >>> and yes, it's not documented (hence this effort here) but it's still on >>> vc4 to make the property compatible. >> >> How is it not compatible? It's a superset of what i915 provides, but >> it's strictly compatible with it. > > No it is not. Eg. what happens if you set the thing to full range for > RGB (which you must on many broken monitors), and then the kernel > automagically switches to YCbCr (for whatever reason) but the monitor > doesn't support full range YCbCr? Answer: you get crap output. The Broadcast RGB setting is really specific to RGB output. That's where you need it, since due to messed up standards in the past it is common to have to override this. For YCbCr it is not needed since it is always limited range in practice. If there is ever a need to support full range YCbCr, then a new "Broadcast YCbCr" setting should be created. The only place were you see full range YCbCr being used is in combination with JPEG codecs, since JPEG uses full range YCbCr. But it does not normally occur on video output interfaces. Regards, Hans > >> >> I would argue that i915 is the broken one since userspace could force a >> full range output, but since the driver takes the YUV vs RGB decision >> itself and only supports limited range for YUV, the driver would >> effectively ignore that user-space property, without the user-space >> being able to tell it was ignored in the first place. >> >>> Trying to make the property handle YCbCr is very much in the "let's try >>> to fix the property" territory that I want to avoid, so I'm in favor of >>> adjusting vc4. >> >> Breaking the ABI in the process. For something that is explicitly >> supported by the spec, the driver, and the hardware. On a property that >> never said it wasn't meant to be used that way, and with semantics based >> on a driver that never provided a way to check those restrictions in the >> first place. >> >> And it's not like i915 is going to use that code anyway. >> >> Maxime > > >