public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: "Hans Verkuil" <hverkuil@xs4all.nl>,
	"Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Christoph Manszewski <c.manszewski@samsung.com>,
	intel-gfx@lists.freedesktop.org,
	Russell King - ARM Linux <linux@armlinux.org.uk>,
	dri-devel@lists.freedesktop.org
Subject: Re: [v2, 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane
Date: Mon, 3 Dec 2018 13:51:47 +0100	[thread overview]
Message-ID: <a88a003f-a5d5-dc8a-8941-eb24bfabc6bb@samsung.com> (raw)
In-Reply-To: <27f6e670-31a7-a3d5-7c97-cd893039971b@xs4all.nl>

On 03.12.2018 12:52, Hans Verkuil wrote:
> On 12/03/2018 12:23 PM, Andrzej Hajda wrote:
>> On 30.11.2018 15:48, Hans Verkuil wrote:
>>> On 11/30/18 15:29, Ville Syrjälä wrote:
>>>> On Fri, Nov 30, 2018 at 03:20:59PM +0100, Andrzej Hajda wrote:
>>>>> Hi Ville,
>>>>>
>>>>> As Christoph cannot respond till middle next week I can try to respond
>>>>> in his absence, as I am familiar with the subject.
>>>>>
>>>>> On 30.11.2018 14:25, Ville Syrjälä wrote:
>>>>>> On Fri, Nov 30, 2018 at 02:08:11PM +0100, Christoph Manszewski wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I am looking for a way to export the color encoding and range selection
>>>>>>> to user space. I came across those properties and am wondering, why
>>>>>>> they are meant only for non RGB color encodings. Would it be okay, to
>>>>>>> modify them and use with RGB formats as well?
>>>>>> What you trying to do? Input limited range RGB data and expand to full
>>>>>> range?
>>>>> For example. But there are two more general questions, which
>>>>> surprisingly we have not found answer for.
>>>>>
>>>>> 1. What color encoding and range drm should expect on its input RGB
>>>>> buffers by default?
>>>> RGB is just RGB. There is no encoding. 
>>
>> OK, Now I see I have confused encoding with colorspace, Hans thanks for
>> the documentation.
>>
>> As I understand drm by default should expect sRGB colorspace, also for
>> Y'CbCr buffers, and currently there are no standard ways to specify
>> buffer colorspace.
>>
>> Looking at current users of drm_plane_create_color_properties for Y'CbCr
>> buffers it seems default range should be LIMITED.
> Right. There is support for YCbCr quantization range signaling in HDMI,
> but that is for all intents and purposes broken in the standard. Don't
> use it, just output limited range YCbCr.
>
> On the other hand, RGB Quantization range signaling should *always* be
> used if the EDID signals support for it. I believe that's what drm does
> today already (this certainly works for i915).
>
>> But default encoding is different: mali, armada, nouveau use
>> DRM_COLOR_YCBCR_BT601, i915 uses DRM_COLOR_YCBCR_BT709 - shouldn't this
>> be somehow standardized?
> According to CEA-861 bt.601 should be used for SDTV (PAL/NTSC), 709 for
> everything else. So this is resolution dependent.
>
> Although strictly speaking it is only userspace that knows the right
> encoding, since it depends on the source material. You can have SDTV
> video encoded with 709, or HDTV encoded with 601. But in the absence
> of any information, the default rule above is what should be used.


Since drm plane is not tied to specific crtc default encoding will not
be always known prior to setting mode on crtc and attaching plane to
crtc, probably DRM_COLOR_YCBCR_DEFAULT or similar would solve the issue.


>
>>
>> What I still do not understand is colorspace conversion(not encoding!) -
>> between pipeline input (framebuffers) and output (HDMI connector for
>> example):
>>
>> 1. Since sRGB, SMPTE170M/BT.601, BT.709 colorspaces are 'almost
>> identical in coverage' (according to wikipedia[1]) no colorspace
>> conversion is performed at all.
> That's correct. There is a slight difference between SMPTE170M and
> sRGB/Rec709, but basically invisible to the naked eye unless you see
> it side-by-side, and even then it's is hard to detect.
>
> However, sRGB uses a different transfer function compared to SMPTE170M
> and Rec709, and that difference *is* quite visible. Not all hardware
> (certainly not video capture hardware) is capable of converting between
> different transfer functions, though. I gather that this is more common
> for HDMI output hardware.
>
>> 2. It is performed somewhere by HW, just my IP documentation is not
>> clear about it.
>>
>>
>> Another thing which still bothers me is RGB range in case of HDMI -
>> CEA-861 expects than on CEA modes limited RGB range should be sent, but
>> the pipeline on the particular hardware I have do not perform any
>> conversion of input buffers. So only limited range RGB buffers are
>> displayed correctly. In such case property describing plane with limited
>> RGB would be useful.
> Are you sure? Usually the same block that does YCbCr encoding conversion
> (601 to 709 or vice versa), also deals with limited/full range conversion.
>
> It is typically a 3x3 matrix + a vector adding the needed offsets. It is
> dead cheap to implement in hardware, so it would be very unusual if there
> is no support for this.


Yay, I have unusual hardware :)

There is register in HDMI output block for RGB->YCbCr conversion and I
can specify there input RGB range and encoding, but it is only for cases
where output is YCbCr4:4:4, In case RGB -> RGB no conversion is performed.


Regards

Andrzej


>>
>> [1]: https://en.wikipedia.org/wiki/Rec._709#Primary_chromaticities
>>
>>
>>> It's assumed to be full range 
>>>> because no one really uses anything else.
>>> For simple desktop usage that's true. When dealing with video inputs,
>>> this becomes much more complicated.
>>
>> As I said earlier there are cases where output stream should be limited
>> RGB, and no conversion in pipeline - thus framebuffers also should be
>> 'limited RGB'.
> Whether RGB output should be full or limited range depends entirely on
> the resolution and the EDID. I have tested i915 w.r.t. RGB quantization
> range, and that does it right.
>
> The reality with RGB Quantization Range handling is that 50% of all
> devices do this wrong. So if the EDID signals selectable quantization range
> support, then use it and signal full range RGB.
>
> If it is not available, then the i915 implementation is one I can point
> to that does it 100% correct. (This might be based on core drm code, I'm
> not sure if it is i915 specific or not)
>
> Kudos to the i915 driver developers: the linux implementation is the
> only one that handles this correctly. The Windows implementation doesn't
> honor RGB Selectable Quantization and the macos driver seems to always
> output full range.
>
> The only way to support all three variants in an HDMI receiver is to
> enable YCbCr support in the EDID: the macos driver will now output
> YCbCr, while all the others output RGB (Windows using default RGB
> Quantization rules and Linux explicitly signaling the RGB range).
>
> It's insane.
>
> Regards,
>
> 	Hans
>
>

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-12-03 12:51 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-14 19:23 [PATCH 0/8] drm: Add COLOR_ENCODING and COLOR_RANGE plane properties Ville Syrjala
2018-02-14 19:23 ` [PATCH 1/8] drm: Add optional COLOR_ENCODING and COLOR_RANGE properties to drm_plane Ville Syrjala
2018-02-19 15:04   ` Daniel Vetter
2018-02-19 20:19     ` Ville Syrjälä
2018-02-19 20:38       ` Jyri Sarha
2018-02-19 22:38         ` Daniel Vetter
2018-02-19 20:28   ` [PATCH v2 " Ville Syrjala
2018-02-20 11:24     ` Daniel Vetter
2018-11-30 13:08     ` [v2, " Christoph Manszewski
2018-11-30 13:25       ` Ville Syrjälä
2018-11-30 14:20         ` Andrzej Hajda
2018-11-30 14:29           ` Ville Syrjälä
2018-11-30 14:48             ` Hans Verkuil
2018-11-30 15:16               ` Ville Syrjälä
2018-11-30 15:34                 ` Hans Verkuil
2018-11-30 16:22                   ` Brian Starkey
2018-12-03 11:23               ` Andrzej Hajda
2018-12-03 11:52                 ` Hans Verkuil
2018-12-03 12:51                   ` Andrzej Hajda [this message]
2018-11-30 14:40           ` Hans Verkuil
2018-02-14 19:23 ` [PATCH 2/8] drm: Add BT.2020 constant luminance enum value for the COLOR_ENCODING property Ville Syrjala
2018-03-02 12:40   ` Ville Syrjälä
2018-02-14 19:23 ` [PATCH 3/8] drm/atomic: Include color encoding/range in plane state dump Ville Syrjala
2018-02-19 15:08   ` Daniel Vetter
2018-02-19 20:28   ` [PATCH v2 " Ville Syrjala
2018-02-20 11:25     ` Daniel Vetter
2018-02-20 15:57     ` Harry Wentland
2018-02-14 19:23 ` [PATCH 4/8] drm/i915: Correctly handle limited range YCbCr data on VLV/CHV Ville Syrjala
2018-02-14 19:23 ` [PATCH 5/8] drm/i915: Fix plane YCbCr->RGB conversion for GLK Ville Syrjala
2018-02-28 20:43   ` Imre Deak
2018-02-14 19:23 ` [PATCH 6/8] drm/i915: Add support for the YCbCr COLOR_ENCODING property Ville Syrjala
2018-02-14 19:23 ` [PATCH 7/8] drm/i915: Change the COLOR_ENCODING prop default value to BT.709 Ville Syrjala
2018-02-14 19:23 ` [PATCH 8/8] drm/i915: Add support for the YCbCr COLOR_RANGE property Ville Syrjala
2018-02-14 20:53 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties Patchwork
2018-02-14 20:56 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-02-14 21:09 ` ✓ Fi.CI.BAT: success " Patchwork
2018-02-15  5:34 ` ✓ Fi.CI.IGT: " Patchwork
2018-02-19 15:00 ` [PATCH 0/8] " Daniel Vetter
2018-02-19 15:09 ` Daniel Vetter
2018-02-19 15:52   ` Ville Syrjälä
2018-02-19 20:41 ` ✗ Fi.CI.CHECKPATCH: warning for drm: Add COLOR_ENCODING and COLOR_RANGE plane properties (rev3) Patchwork
2018-02-19 20:43 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-02-19 20:59 ` ✓ Fi.CI.BAT: success " Patchwork
2018-02-20  0:20 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-02-20 11:26 ` [PATCH 0/8] drm: Add COLOR_ENCODING and COLOR_RANGE plane properties Daniel Vetter
2018-02-20 13:42   ` Ville Syrjälä
2018-03-02 13:06 ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a88a003f-a5d5-dc8a-8941-eb24bfabc6bb@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=c.manszewski@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hverkuil@xs4all.nl \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=linux@armlinux.org.uk \
    --cc=ville.syrjala@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox