From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8F05C6FD1D for ; Fri, 17 Mar 2023 16:34:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B358910EF31; Fri, 17 Mar 2023 16:33:55 +0000 (UTC) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9287410E3DC; Fri, 17 Mar 2023 16:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679070832; x=1710606832; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=JCh5RZ3TJML1xtLQUxn6vcsd+yd5VKonVVsz1JKAlpg=; b=bH47IdnHent5nCIEe1yaRsVp6LoznG01JkShnHvnZhA0KFIIYFBFSW21 mPXVLmPM+HBboNtP+sU2LaNuMKirJCktf5/o6xTcLixHL5MW9T/L8jKJ6 dJKyjJlH4KClPaC7/DNxaIO95RX1fGxcTfDzs/s2nLG5beWECsJOFDlqe EIs93N/2Qm806H1R1c+9gVDzICH9cX9B7kKQ7qe1cfNeTBD4A+53Z1KeL 5NaQSJn7F8dKQ8LswldtJBRaYOE9Z1bHE4Y0yM0CvbYFaU3q1LXioPPRO N+P5h41W6JAg4HLnKkQHZ+jMQCl91TkntgurOUyAS6qAs6BdmpSWjf7dw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10652"; a="366006309" X-IronPort-AV: E=Sophos;i="5.98,268,1673942400"; d="scan'208";a="366006309" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2023 09:33:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10652"; a="657607689" X-IronPort-AV: E=Sophos;i="5.98,268,1673942400"; d="scan'208";a="657607689" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.70]) by orsmga006.jf.intel.com with SMTP; 17 Mar 2023 09:33:24 -0700 Received: by stinkbox (sSMTP sendmail emulation); Fri, 17 Mar 2023 18:33:23 +0200 Date: Fri, 17 Mar 2023 18:33:23 +0200 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Pekka Paalanen Subject: Re: [PATCH v3 09/17] drm/amd/display: Register Colorspace property for DP and HDMI Message-ID: References: <20230316133449.26b62760@eldfell> <20230317105335.45d6a629@eldfell> <20230317153553.5b8eb460@eldfell> <20230317173751.49c45929@eldfell> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230317173751.49c45929@eldfell> X-Patchwork-Hint: comment X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sebastian Wick , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Harry Wentland , Joshua Ashton , Vitaly.Prosyak@amd.com Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Fri, Mar 17, 2023 at 05:37:51PM +0200, Pekka Paalanen wrote: > On Fri, 17 Mar 2023 16:14:38 +0200 > Ville Syrjälä wrote: > > > On Fri, Mar 17, 2023 at 03:35:53PM +0200, Pekka Paalanen wrote: > > > On Fri, 17 Mar 2023 14:50:40 +0200 > > > Ville Syrjälä wrote: > > > > > > > On Fri, Mar 17, 2023 at 10:53:35AM +0200, Pekka Paalanen wrote: > > > > > On Fri, 17 Mar 2023 01:01:38 +0200 > > > > > Ville Syrjälä wrote: > > > > > > > > > > > On Thu, Mar 16, 2023 at 10:13:54PM +0100, Sebastian Wick wrote: > > > > > > > On Thu, Mar 16, 2023 at 1:35 PM Ville Syrjälä > > > > > > > wrote: > > > > > > > > > > > > > > > > On Thu, Mar 16, 2023 at 01:34:49PM +0200, Pekka Paalanen wrote: > > > > > > > > > On Thu, 16 Mar 2023 12:47:51 +0200 > > > > > > > > > Ville Syrjälä wrote: > > > > > > > > > > > > > > > > > > > On Thu, Mar 16, 2023 at 12:07:01PM +0200, Pekka Paalanen wrote: > > > > > > > > > > > On Thu, 16 Mar 2023 11:50:27 +0200 > > > > > > > > > > > Ville Syrjälä wrote: > > > > > > > > > > > > > > > > > > > > > > > On Thu, Mar 16, 2023 at 01:37:24AM +0100, Sebastian Wick wrote: > > > > > > > > > > > > > On Tue, Mar 7, 2023 at 4:12 PM Harry Wentland wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > We want compositors to be able to set the output > > > > > > > > > > > > > > colorspace on DP and HDMI outputs, based on the > > > > > > > > > > > > > > caps reported from the receiver via EDID. > > > > > > > > > > > > > > > > > > > > > > > > > > About that... The documentation says that user space has to check the > > > > > > > > > > > > > EDID for what the sink actually supports. So whatever is in > > > > > > > > > > > > > supported_colorspaces is just what the driver/hardware is able to set > > > > > > > > > > > > > but doesn't actually indicate that the sink supports it. > > > > > > > > > > > > > > > > > > > > > > > > > > So the only way to enable bt2020 is by checking if the sink supports > > > > > > > > > > > > > both RGB and YUV variants because both could be used by the driver. > > > > > > > > > > > > > Not great at all. Something to remember for the new property. > > > > > > > > > > > > > > > > > > > > > > > > Hmm. I wonder if that's even legal... Looks like maybe it > > > > > > > > > > > > is since I can't immediately spot anything in CTA-861 to > > > > > > > > > > > > forbid it :/ > > > > > > > > > > > > > > > > > > > > > > Wouldn't the driver do the same EDID check before choosing whether it > > > > > > > > > > > uses RGB or YCbCr signalling? > > > > > > > > > > > > > > > > > > > > I suppose it could. The modeset would then fail, which is perhaps > > > > > > > > > > > > > > > > > > Could? What are they missing? > > > > > > > > > > > > > > > > The fact that the new property that also affects the rgb->ycbcr matrix > > > > > > > > doesn't even exist? > > > > > > > > > > > > > > I think the question was about the current Colorspace property. > > > > > > > > > > Yes. > > > > > > > > > > We need to be able to set ColourPrimaries infoframe field for the sink. > > > > > Only userspace knows what ColourPrimaries it uses, and the driver has > > > > > no need to care at all, other than tell the sink what we have. > > > > > > > > > > When a driver chooses to use YCbCr, it needs to use the > > > > > MatrixCoefficients the sink expects. > > > > > > > > > > If we send the infoframe to the sink telling the signal uses BT.2020 > > > > > ColourPrimaries, does that same bit pattern also tell the sink we are > > > > > using the BT.2020 NCL MatrixCoefficients if the driver chooses YCbCr? > > > > > > > > > > Do drivers actually use BT.2020 NCL MatrixCoefficients in that case? > > > > > > > > No. I think I've repeated this same line a thousand times already: > > > > The current colorspace property *only* affects the infoframe/msa/sdp, > > > > nothing else. > > > > > > That's the problem. I don't know what that means. > > > > > > Does it mean that the sink expects BT.2020 NCL MatrixCoefficients to > > > have been used? > > > > Yes, assuming that is the colorspace property value you picked. > > > > > > > > And the driver will never use BT.2020 NCL MatrixCoefficients in any > > > circumstances? > > > > Correct. > > > > > > > > See the conflict? The sink will be decoding the signal incorrectly, > > > because we are encoding it with the wrong MatrixCoefficients if the > > > driver happens to silently choose YCbCr and userspace wants to send > > > BT2020 ColourPrimaries indicated in the infoframe. > > > > Yes. And hence I thought pretty much everyone already > > agreed that a new property is needed. > > I think I was confused as well with the re-posting of this series, > thinking it could be salvageable somehow and tried to understand how. > Up to Harry, I think I've left enough annoying questions by now. :-) > > > To make sure we actually understand what we're implementing > > I think it should start out very minimal. Eg just three values: > > - unspecified RGB + BT.601 YCbCr > > - unspecified RGB + BT.709 YCbCr > > - BT.2020 RGB + BT.2020 YCbCr NCL > > ColourPrimaries + MatrixCoefficients, respectively. Sounds fine. > > I recall hearing that DP spec actually has something like "unspecified" > while HDMI has only "default colorimetry" which is specified, but I'm > guessing that many monitors and TVs just don't implement it like they > should, so it's effectively unspecified. DP in theory might have default RGB (whatever that might mean) vs. sRGB, although at some point I think it was just vague RGB vs. CEA RGB, which I think in i915 we might be using to indicate limited vs. full quantization range instead. I think that somehow fixed some monitors (while many others still get the quantization range horrible wrong of course). HDMI/CTA-861-? IIRC didn't have anything but just "RGB", and in some footnote CTA-861-? then goes on to talk about the sRGB bit in the EDID. In the end it didn't seem to say anything definitive what the RGB colorimetry really means. > > "unspecified" in UAPI is ok as long as there will be another distinct > value for "HDMI default colorimetry" or such. > > I'm not sure why anyone would want to use "unspecified" but I guess > it's necessary for UAPI backward compatibility. Just because the specs don't really seem to specify anything sensible. We could just call it "RGB" and leave it at that of course. > > > > > And that would control: > > - basic colorimetry metadata transmitted to the sink > > - MatrixCoefficients used for the potential RGB->YCbCr conversion > > > > Transfer funcs, primaries, etc. would be left out (apart from > > the potential metadata aspect). > > Primaries left out? What are your "unspecified RGB" and "BT.2020 RGB" > above then? It all seems too open to interpretation to make it anything but "undefined". > > Asking from another angle, using infoframes, is it possible to tell the > sink to use BT.2020 YCbCr NCL without *also* implying BT.2020 > ColourPrimaries? Joshua seemed to be saying "no". I don't think so. The BT.2020 cases seems to be more strictrly defined. > > > > > > > > > > > > If they don't, then YCbCr BT.2020 has never worked, which is another > > > > > nail in the coffin for "Colorspace" property. > > > > > > > > That is the same nail we've been talking about all along I thought. > > > > > > > > > But it still means that > > > > > RGB BT.2020 may have worked correctly, and then drivers would regress > > > > > if they started picking YCbCr for any reason where they previously used > > > > > RGB. > > > > > > > > The policy has been to use RGB if at all possible. Only falling back > > > > to YCbCr 4:2:0 if absolutely necessary (eg. EDID says 4:2:0 must > > > > be used, or there's not enough bandwidth for 4:4:4, etc.). If the > > > > behaviour suddenly changes then it probably means the driver was > > > > doing something illegal before by using RGB 4:4:4. > > > > > > Ok. > > > > > > > > > > > > > > > > > > > > > I mean, drivers are already automatically choosing between RGB and YCbCr > > > > > > > > > signalling based on e.g. available bandwidth. Surely they already will > > > > > > > > > not attempt to send a signal format to a monitor that does not say it > > > > > > > > > supports that? > > > > > > > > > > > > > > That's exactly what they do. The drivers don't check the EDID for the > > > > > > > colorimetry the sink supports and the responsibility is punted off to > > > > > > > user space. > > > > > > > > > > I suspect there are two different things: > > > > > > > > > > - which of RGB, YCbCr 4:4:4, YCbCr 4:2:0 can the sink take > > > > > - the supported MatrixCoefficients for each of the YCbCr > > > > > > > > > > Surely drivers are already checking the former point? > > > > > > > > Yes. > > > > > > > > > > > > > > I'm not surprised if they are not checking the latter point, but they > > > > > do need to, because it is the driver making the choice between RGB and > > > > > some YCbCr. > > > > > > > > This point has been irrelevant since we always select BT.709 > > > > and there is no optional feature bit in EDID to check for that. > > > > Presumaly it is mandatory for sinks to support both BT.601 and > > > > BT.709 whenever they support YCbCr in general. > > > > > > Ok, so BT.601 and BT.709 MatrixCoefficients are cool. How do you tell > > > the sink which one you used, btw? > > > > Through the same infoframe/msa/sdp stuff. But that only works > > correctly if the colorspace property is left at the default value. > > > > > > > > What about BT.2020 MatrixCoefficients? > > > > It would have to work the same way, if we actually ever used > > this. > > Good. > > > Thanks, > pq -- Ville Syrjälä Intel