wlroots icon indicating copy to clipboard operation
wlroots copied to clipboard

drm backend: set "Broadcast RGB" = "Full" for all connections

Open akvadrako opened this issue 4 years ago • 24 comments

I have a new monitor which has three similar modes:

  • 3840x2160 @ 59.939999 Hz
  • 3840x2160 @ 60.000000 Hz
  • 3840x2160 @ 59.997002 Hz

The last one works fine, but the first two have issues displaying colors, because the "Broadcast RGB" property on the connector defaults to "Auto" which means "Limited 16:235", squashing the dynamic range.

Since there is really no way for a sway user to know that 3840x2160@60Hz displays colors poorly, while [email protected] will be fine, I was using the wrong mode for weeks.

This patch causes wlroots to always set "Broadcast RGB" = "Full", which I think most people want.

akvadrako avatar Jun 30 '20 17:06 akvadrako

  1. It doesn't seem like switching to "Full" unconditionally is a good idea, as TVs tend to use "Limited" instead.
  2. "Broadcast RGB" is an Intel-specific property.

emersion avatar Jun 30 '20 21:06 emersion

1. It doesn't seem like switching to "Full" unconditionally is a good idea, as TVs tend to use "Limited" instead.

If it won't be the default, then it would be nice if sway could inform the user which modes use the limited mode; looking at the driver the logic seems to be in drm_default_rgb_quant_range(); it seems like userspace can only guess unless it copied all that logic. The aspect ratio flags seem to be a clue.

Do you have any other ideas for how it might be done? Perhaps setting full just for DP.

2. "Broadcast RGB" is an Intel-specific property.

Yes, I wonder how other drivers handle it. In regards to the patch, if the property doesn't exist it won't cause an issue.

akvadrako avatar Jun 30 '20 22:06 akvadrako

Its still a good idea even on TVs to always use Full. Most TVs will autodetect, since its trivial to do, and adjust accordingly. Some let you override it, but not as many as you think always assume its always going to be limited. Furthermore, HDR is a thing now, and a lot of HDR content these days, including all of youtube, is in full range. Hence its not unreasonable to assume HDR TVs would also expect full-range. Losing 10% of your dynamic range (possibly more depending on dithering) with HDR is much more fatal than with bt709 (IEC61966-2.1) gamma. Also, a DisplayPort connection is guaranteed to use full range, just like DVI. And embedded, transparent DP <=> HDMI converters exist, which complicates assumptions further. Autodetection will result in more fragile configuration, even if you use EDID parsing. In fact, most TVs have broken/unreliable EDID, and I'd be willing to bet the number is higher than TVs that assume limited range RGB always.. If you need a reference on how much will break, take a look at interlaced modes: wlroots has disabled them for years and no one has complained.

cyanreg avatar Jun 30 '20 22:06 cyanreg

I see there was a proposed DRM_MODE_FLAG_CEA_861_CE_MODE flag, I wonder if it has any chance of being implemented.

akvadrako avatar Jun 30 '20 23:06 akvadrako

23:35 <vsyrjala> yes. "ce" modes use limited range, "it" modes use full range
23:43 <vsyrjala> this is one of those things we can't get it right 100% of the time due to broken displays
23:45 <vsyrjala> and sadly we don't know whether broken or non-broken display are more common

emersion avatar Jul 01 '20 09:07 emersion

Ping? I've been running this for a while without problems.

cyanreg avatar Jul 09 '20 22:07 cyanreg

I'd still like to make this a standard property before starting to use it.

emersion avatar Jul 09 '20 22:07 emersion

I’m sure you are better informed but from here it looks like that patch to lkml that’s adds that standard property from a few months ago has stalled.

akvadrako avatar Jul 09 '20 22:07 akvadrako

Yes, those patches need some work. For reference:

  • Introduces a new standard prop: https://lists.freedesktop.org/archives/dri-devel/2020-April/262153.html
  • Adds a TODO: https://lists.freedesktop.org/archives/dri-devel/2020-June/268149.html

emersion avatar Jul 10 '20 10:07 emersion

Ping again, been running this since it was posted, had no problems, already had to help out one person who was wondering why colors look washed out.

cyanreg avatar Oct 20 '20 09:10 cyanreg

This email thread also suggests that we should stick to full range unconditionally (especially when we'll implement color management): https://lists.freedesktop.org/archives/dri-devel/2020-October/283396.html

This PR is still blocked on registering the property as a standard one.

emersion avatar Oct 20 '20 14:10 emersion

More info on turning "Broadcast RGB" into a generic prop: https://dri.freedesktop.org/docs/drm/gpu/todo.html#consolidate-custom-driver-modeset-properties

emersion avatar Oct 21 '20 08:10 emersion

This email thread also suggests that we should stick to full range unconditionally (especially when we'll implement color management): https://lists.freedesktop.org/archives/dri-devel/2020-October/283396.html

This PR is still blocked on registering the property as a standard one.

Is this the only blockage for this patch?

Because in this patchset https://lkml.org/lkml/2021/6/18/294, I standardized "Broadcast RGB" and implemented it for Intel and AMD. And if you say this MR is ready to be merged once the patch got accepted it would help with: https://www.kernel.org/doc/html/v5.12/gpu/drm-uapi.html#open-source-userspace-requirements

Matombo avatar Jun 22 '21 16:06 Matombo

Yes, this is the only blocker. I trust @cyanreg that this is the correct thing to do. This patch also needs to be rebased.

emersion avatar Jun 22 '21 16:06 emersion

I'm still using this locally and rebasing if needed. Repo is https://github.com/cyanreg/wlroots if you need it for now.

cyanreg avatar Jun 22 '21 20:06 cyanreg

Yes, this is the only blocker. I trust @cyanreg that this is the correct thing to do. This patch also needs to be rebased.

rebased

akvadrako avatar Jun 22 '21 22:06 akvadrako

A few minor comments

Thanks, I've applied the feedback and squashed.

akvadrako avatar Jul 10 '21 19:07 akvadrako

Furthermore, HDR is a thing now, and a lot of HDR content these days, including all of youtube, is in full range.

All HDR content on Youtube is limited range. All Blu-rays are limited. All DVDs. Also streams. Only some masters and stuff and Dolby Vision profile 5 is full.

ValZapod avatar Aug 20 '21 03:08 ValZapod

Not all HDR on youtube is limited-range, some is full range. Not all Blu-Rays are limited-range, since some Dolby Vision HDR is full range. Who cares about DVDs, it's 2021. They're badly-mastered interlaced garbage anyway. Not all streams are limited-range, twitch happily accepts full-range, and in fact, AMD hardware encoders by default encode in full-range. I estimate about 20-30% of twitch streams are full-range.

And finally, All computer monitors are full-range. All. Not some. All. If they accept RGB, and are a monitor meant for computers, they operate on full-range. All TVs made in the past 15 years with a digital input accept full-range. All of them also autodetect its presence and adjust their settings accordingly. In fact, outputting limited-range is more likely to create confusion on our side, since nothing to do with computers accepts or even acknowledges limited-range RGB. No codec, including AV1 nor VP9, can signal limited-range RGB either, only full-range.

cyanreg avatar Aug 20 '21 10:08 cyanreg

Not all Blu-Rays are limited-range, since some Dolby Vision HDR is full range.

Blu-rays' Dolby Vision does not support full range, since profile 5 of DV is not supported on Blu-ray.

some is full range.

Please give me a link. Most HDR content is limited, so I doubt anybody uses full.

They're badly-mastered interlaced garbage anyway.

Most are progressive inside fake interlaced container. Google soft telecine flags.

All computer monitors are full-range

This has nothing to with range of BTW mostly YCbCr HDR.

nothing to do with computers accepts or even acknowledges limited-range RGB.

That is a bug in ffmpeg.

No codec, including AV1 nor VP9, can signal limited-range RGB either, only full-range.

You really know nothing do you? See https://trac.ffmpeg.org/ticket/9374#comment:3 You are a ffmpeg dev after all, it is crazy to not know that.

ValZapod avatar Aug 20 '21 12:08 ValZapod

You really know nothing do you?

Please remain civil. This tone is not appropriate.

emersion avatar Aug 20 '21 12:08 emersion

This tone is not appropriate.

I think he knows all it, because he is active ffmpeg dev.

ValZapod avatar Aug 20 '21 12:08 ValZapod

  1. There's no "he".
  2. That's enough. If you're coming here just to bash people, you're not welcome.

emersion avatar Aug 20 '21 12:08 emersion

wlroots has migrated to gitlab.freedesktop.org. This pull request has been moved to:

https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/2310

emersion avatar Nov 01 '21 16:11 emersion