Re: Dynamically change enumeration list of DRM enumeration property

2020-06-05 Thread Pekka Paalanen
On Wed, 03 Jun 2020 20:20:44 + (UTC)
Jonas Karlman  wrote:

> Hi,
> 
> On 2020-06-03 11:12, Pekka Paalanen wrote:
> > On Wed, 3 Jun 2020 10:50:28 +0530
> > Yogish Kulkarni  wrote:
> >   

...

> >> The primary reason for why content producer masters video/gfx content as
> >> limited range is for compatibility with sinks which only support limited
> >> range, and not because video decoders are not capable of decoding
> >> full-range content.  
> > 
> > What I was asking is, even if the video content is limited range, why
> > would one not decode it into full-range pixels always and if the sink
> > need limited range, then convert again in hardware? When done right, it
> > makes no difference in output compared to using limited range
> > through-out if both content and sink use limited range.  
> 
> For the Allwinner/Amlogic/Rockchip arm devices I mainly play with the
> video decoder does not support range conversion (to my knowledge) and will
> produce NV12/YU12 framebuffers in the range the video was encoded in.
> 
> These devices typically lack a high-performance GPU/3D-accelerator
> and may have limited CSC capabilities in the display controller.
> The HDMI block can usually do simple RGB/YUV and full/limited conversions,
> but using these conversions typically produce banding effects.
> 
> Being able to passthrough decoded framebuffers in the entire pipeline from
> decoder, display controller and hdmi block typically produce best results.

This is very helpful. It means I really do need to take range into
account in Wayland protocol and make sure it can be communicated.


Thanks,
pq


pgpepNdQ3HDtN.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-06-03 Thread Jonas Karlman
Hi,

On 2020-06-03 11:12, Pekka Paalanen wrote:
> On Wed, 3 Jun 2020 10:50:28 +0530
> Yogish Kulkarni  wrote:
> 
>> Inline..
>>
>> On Mon, Jun 1, 2020 at 2:19 PM Pekka Paalanen  wrote:
>>
>>> On Mon, 1 Jun 2020 09:22:27 +0530
>>> Yogish Kulkarni  wrote:
>>>  
 Hi,

 For letting DRM clients to select output encoding:
 Sink can support certain display timings with high output bit-depths  
>>> using  
 multiple output encodings, e.g. sink can support a particular timing with
 RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may want  
>>> to  
 select YCbCr422 10-bit over RBG 10-bit output to reduce the link  
>>> bandwidth  
 (and in turn reduce power/voltage). If DRM driver automatically selects
 output encoding then we are restricting DRM clients from making  
>>> appropriate  
 choice.  
>>>
>>> Hi,
>>>
>>> right, that seems to be another reason.
>>>  
 For selectable output color range:
 Certain applications (typically graphics) usually rendered in full range
 while some applications (typically video) have limited range content.  
>>> Since  
 content can change dynamically, DRM driver does not have enough  
>>> information  
 to choose correct quantization. Only DRM client can correctly select  
>>> which  
 quantization to set (to preserve artist's intent).  
>>>
>>> Now this is an interesting topic for me. As far as I know, there is no
>>> window system protocol to tell the display server whether the
>>> application provided content is using full or limited range. This means
>>> that the display server cannot tell DRM about full vs. limited range
>>> either. It also means that when not fullscreen, the display server
>>> cannot show the limited range video content correctly, because it would
>>> have to be converted to full-range (or vice versa).
>>>
>> Right, but there could be DRM client which doesn't use window system (e.g.  
>> Gstreamer video sink) and wants to select between full/limited color range.
>> I agree that there is no window system protocol yet but maybe Wayland
>> protocol could be added/extended for this purpose once we finalize things
>> that needs to be done in DRM.
> 
> Hi,
> 
> right. If you have that use case and a userspace project welcomes such
> feature, you're good.

Kodi is a userspace application that is very interested in being able to
control or set preferred HDMI output format (rgb444/yuv444/422/420) and
quantization range (full/limited).

Main reason is to allow end-users to make overrides when sink EDID don't
fully match the TV/AVR features or when drm driver makes a bad automatic
choice. Hans Verkuil's conclusion in HDMI RGB Quantization Range Lessons
at [1] hold ture, it is total chaos.

Right now, Kodi set the COLOR_ENCODING and COLOR_RANGE plane properties
to let kernel know color encoding and color range of a YUV framebuffer.

A single active plane showing a YUV framebuffer with limited range
could hint a drm driver that end-user might want to use YUV and limited
range output to prevent any banding effect when watching a movie.
But in the case of when there is a second overlay plane for OSD or subtitles
it may become very hard to guess what configuration works best for end-user.

I have piggybacked on the "content type" connector property in [2] for my
personal use to signal my drm driver if YUV (Movie) or RGB (Graphics) output
is preferred this far but proper drm properties would really help :-)

[1] https://elinux.org/images/5/53/Elce2017_0-hdmi.pdf
[2] https://github.com/xbmc/xbmc/pull/14358

> 
> If you propose a KMS property for this, I would hope the patches
> document or have links pointing to answers to all my questions here.
> That would help both driver and userspace implementations to get into
> the same mindset.
> 
>>> But why would an application produce limited range pixels anyway? Is it
>>> common that hardware video decoders are unable to produce full-range
>>> pixels?
>>>  
>>
>> The primary reason for why content producer masters video/gfx content as
>> limited range is for compatibility with sinks which only support limited
>> range, and not because video decoders are not capable of decoding
>> full-range content.
> 
> What I was asking is, even if the video content is limited range, why
> would one not decode it into full-range pixels always and if the sink
> need limited range, then convert again in hardware? When done right, it
> makes no difference in output compared to using limited range
> through-out if both content and sink use limited range.

For the Allwinner/Amlogic/Rockchip arm devices I mainly play with the
video decoder does not support range conversion (to my knowledge) and will
produce NV12/YU12 framebuffers in the range the video was encoded in.

These devices typically lack a high-performance GPU/3D-accelerator
and may have limited CSC capabilities in the display controller.
The HDMI block can usually do simple RGB/YUV and full/limited conversions,

Re: Dynamically change enumeration list of DRM enumeration property

2020-06-03 Thread Emil Velikov
Hi all,

On Wed, 3 Jun 2020 at 10:57, Ville Syrjälä
 wrote:
>
> On Wed, Jun 03, 2020 at 12:12:23PM +0300, Pekka Paalanen wrote:
> > On Wed, 3 Jun 2020 10:50:28 +0530
> > Yogish Kulkarni  wrote:
> >
> > > Inline..
> > >
> > > On Mon, Jun 1, 2020 at 2:19 PM Pekka Paalanen  wrote:
> > >
> > > > On Mon, 1 Jun 2020 09:22:27 +0530
> > > > Yogish Kulkarni  wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > For letting DRM clients to select output encoding:
> > > > > Sink can support certain display timings with high output bit-depths
> > > > using
> > > > > multiple output encodings, e.g. sink can support a particular timing 
> > > > > with
> > > > > RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may 
> > > > > want
> > > > to
> > > > > select YCbCr422 10-bit over RBG 10-bit output to reduce the link
> > > > bandwidth
> > > > > (and in turn reduce power/voltage). If DRM driver automatically 
> > > > > selects
> > > > > output encoding then we are restricting DRM clients from making
> > > > appropriate
> > > > > choice.
> > > >
> > > > Hi,
> > > >
> > > > right, that seems to be another reason.
> > > >
> > > > > For selectable output color range:
> > > > > Certain applications (typically graphics) usually rendered in full 
> > > > > range
> > > > > while some applications (typically video) have limited range content.
> > > > Since
> > > > > content can change dynamically, DRM driver does not have enough
> > > > information
> > > > > to choose correct quantization. Only DRM client can correctly select
> > > > which
> > > > > quantization to set (to preserve artist's intent).
> > > >
> > > > Now this is an interesting topic for me. As far as I know, there is no
> > > > window system protocol to tell the display server whether the
> > > > application provided content is using full or limited range. This means
> > > > that the display server cannot tell DRM about full vs. limited range
> > > > either. It also means that when not fullscreen, the display server
> > > > cannot show the limited range video content correctly, because it would
> > > > have to be converted to full-range (or vice versa).
> > > >
> > > Right, but there could be DRM client which doesn't use window system (e.g.
> > > Gstreamer video sink) and wants to select between full/limited color 
> > > range.
> > > I agree that there is no window system protocol yet but maybe Wayland
> > > protocol could be added/extended for this purpose once we finalize things
> > > that needs to be done in DRM.
> >
> > Hi,
> >
> > right. If you have that use case and a userspace project welcomes such
> > feature, you're good.
> >
> > If you propose a KMS property for this, I would hope the patches
> > document or have links pointing to answers to all my questions here.
> > That would help both driver and userspace implementations to get into
> > the same mindset.
> >
> > > > But why would an application produce limited range pixels anyway? Is it
> > > > common that hardware video decoders are unable to produce full-range
> > > > pixels?
> > > >
> > >
> > > The primary reason for why content producer masters video/gfx content as
> > > limited range is for compatibility with sinks which only support limited
> > > range, and not because video decoders are not capable of decoding
> > > full-range content.
> >
> > What I was asking is, even if the video content is limited range, why
> > would one not decode it into full-range pixels always and if the sink
> > need limited range, then convert again in hardware? When done right, it
> > makes no difference in output compared to using limited range
> > through-out if both content and sink use limited range.
> >
> > > Also, certain cinema-related content (e.g., movies) may
> > > be better suited for limited range encoding due to the level of detail 
> > > that
> > > they need to present/hide (see "Why does limited RGB even exist?" section
> > > in
> > > https://www.benq.com/en-us/knowledge-center/knowledge/full-rgb-vs-limited-rgb-is-there-a-difference.html#:~:text=Full%20RGB%20means%20the%20ability,less%20dark)%20than%20full%20RGB
> > > ).
> >
> > That is a very nice link, thanks!
> >
> > But to me it seems the section "Why is this a problem?" gets "crushed
> > blacks" backwards, so maybe I just don't get it.
> >
> > I would assume that if the source (computer) sends full-range pixel
> > values on the wire and the sink (monitor) works in limited-range mode,
> > then you would get crushed blacks and crushed whites.
> >
> > But if the source sends limited-range data and the sink works in
> > full-range more, you'd get the "washed out" image.
> >
> > My thinking comes from the mapping of channel values: if 0-16 and
> > 235-255 ranges show no difference within them, I'd call that "crushed".
> > Similarly if one assumes 16 is darkest black and it's actually not,
> > you'd get "washed out" (I might call it compressed instead, because it
> > affects both black and white ends, unable to achieve both the darkest
> > black 

Re: Dynamically change enumeration list of DRM enumeration property

2020-06-03 Thread Ville Syrjälä
On Wed, Jun 03, 2020 at 12:12:23PM +0300, Pekka Paalanen wrote:
> On Wed, 3 Jun 2020 10:50:28 +0530
> Yogish Kulkarni  wrote:
> 
> > Inline..
> > 
> > On Mon, Jun 1, 2020 at 2:19 PM Pekka Paalanen  wrote:
> > 
> > > On Mon, 1 Jun 2020 09:22:27 +0530
> > > Yogish Kulkarni  wrote:
> > >  
> > > > Hi,
> > > >
> > > > For letting DRM clients to select output encoding:
> > > > Sink can support certain display timings with high output bit-depths  
> > > using  
> > > > multiple output encodings, e.g. sink can support a particular timing 
> > > > with
> > > > RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may want 
> > > >  
> > > to  
> > > > select YCbCr422 10-bit over RBG 10-bit output to reduce the link  
> > > bandwidth  
> > > > (and in turn reduce power/voltage). If DRM driver automatically selects
> > > > output encoding then we are restricting DRM clients from making  
> > > appropriate  
> > > > choice.  
> > >
> > > Hi,
> > >
> > > right, that seems to be another reason.
> > >  
> > > > For selectable output color range:
> > > > Certain applications (typically graphics) usually rendered in full range
> > > > while some applications (typically video) have limited range content.  
> > > Since  
> > > > content can change dynamically, DRM driver does not have enough  
> > > information  
> > > > to choose correct quantization. Only DRM client can correctly select  
> > > which  
> > > > quantization to set (to preserve artist's intent).  
> > >
> > > Now this is an interesting topic for me. As far as I know, there is no
> > > window system protocol to tell the display server whether the
> > > application provided content is using full or limited range. This means
> > > that the display server cannot tell DRM about full vs. limited range
> > > either. It also means that when not fullscreen, the display server
> > > cannot show the limited range video content correctly, because it would
> > > have to be converted to full-range (or vice versa).
> > >
> > Right, but there could be DRM client which doesn't use window system (e.g.  
> > Gstreamer video sink) and wants to select between full/limited color range.
> > I agree that there is no window system protocol yet but maybe Wayland
> > protocol could be added/extended for this purpose once we finalize things
> > that needs to be done in DRM.
> 
> Hi,
> 
> right. If you have that use case and a userspace project welcomes such
> feature, you're good.
> 
> If you propose a KMS property for this, I would hope the patches
> document or have links pointing to answers to all my questions here.
> That would help both driver and userspace implementations to get into
> the same mindset.
> 
> > > But why would an application produce limited range pixels anyway? Is it
> > > common that hardware video decoders are unable to produce full-range
> > > pixels?
> > >  
> > 
> > The primary reason for why content producer masters video/gfx content as
> > limited range is for compatibility with sinks which only support limited
> > range, and not because video decoders are not capable of decoding
> > full-range content.
> 
> What I was asking is, even if the video content is limited range, why
> would one not decode it into full-range pixels always and if the sink
> need limited range, then convert again in hardware? When done right, it
> makes no difference in output compared to using limited range
> through-out if both content and sink use limited range.
> 
> > Also, certain cinema-related content (e.g., movies) may
> > be better suited for limited range encoding due to the level of detail that
> > they need to present/hide (see "Why does limited RGB even exist?" section
> > in
> > https://www.benq.com/en-us/knowledge-center/knowledge/full-rgb-vs-limited-rgb-is-there-a-difference.html#:~:text=Full%20RGB%20means%20the%20ability,less%20dark)%20than%20full%20RGB
> > ).
> 
> That is a very nice link, thanks!
> 
> But to me it seems the section "Why is this a problem?" gets "crushed
> blacks" backwards, so maybe I just don't get it.
> 
> I would assume that if the source (computer) sends full-range pixel
> values on the wire and the sink (monitor) works in limited-range mode,
> then you would get crushed blacks and crushed whites.
> 
> But if the source sends limited-range data and the sink works in
> full-range more, you'd get the "washed out" image.
> 
> My thinking comes from the mapping of channel values: if 0-16 and
> 235-255 ranges show no difference within them, I'd call that "crushed".
> Similarly if one assumes 16 is darkest black and it's actually not,
> you'd get "washed out" (I might call it compressed instead, because it
> affects both black and white ends, unable to achieve both the darkest
> black and the brightest white).
> 
> Anyway, I believe I do understand that if you have content in one
> range and the sink assumes a different range, the content will show
> poorly. I don't doubt that.
> 
> My question instead is: why would it be bad to always 

Re: Dynamically change enumeration list of DRM enumeration property

2020-06-03 Thread Pekka Paalanen
On Wed, 3 Jun 2020 10:50:28 +0530
Yogish Kulkarni  wrote:

> Inline..
> 
> On Mon, Jun 1, 2020 at 2:19 PM Pekka Paalanen  wrote:
> 
> > On Mon, 1 Jun 2020 09:22:27 +0530
> > Yogish Kulkarni  wrote:
> >  
> > > Hi,
> > >
> > > For letting DRM clients to select output encoding:
> > > Sink can support certain display timings with high output bit-depths  
> > using  
> > > multiple output encodings, e.g. sink can support a particular timing with
> > > RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may want  
> > to  
> > > select YCbCr422 10-bit over RBG 10-bit output to reduce the link  
> > bandwidth  
> > > (and in turn reduce power/voltage). If DRM driver automatically selects
> > > output encoding then we are restricting DRM clients from making  
> > appropriate  
> > > choice.  
> >
> > Hi,
> >
> > right, that seems to be another reason.
> >  
> > > For selectable output color range:
> > > Certain applications (typically graphics) usually rendered in full range
> > > while some applications (typically video) have limited range content.  
> > Since  
> > > content can change dynamically, DRM driver does not have enough  
> > information  
> > > to choose correct quantization. Only DRM client can correctly select  
> > which  
> > > quantization to set (to preserve artist's intent).  
> >
> > Now this is an interesting topic for me. As far as I know, there is no
> > window system protocol to tell the display server whether the
> > application provided content is using full or limited range. This means
> > that the display server cannot tell DRM about full vs. limited range
> > either. It also means that when not fullscreen, the display server
> > cannot show the limited range video content correctly, because it would
> > have to be converted to full-range (or vice versa).
> >
> Right, but there could be DRM client which doesn't use window system (e.g.  
> Gstreamer video sink) and wants to select between full/limited color range.
> I agree that there is no window system protocol yet but maybe Wayland
> protocol could be added/extended for this purpose once we finalize things
> that needs to be done in DRM.

Hi,

right. If you have that use case and a userspace project welcomes such
feature, you're good.

If you propose a KMS property for this, I would hope the patches
document or have links pointing to answers to all my questions here.
That would help both driver and userspace implementations to get into
the same mindset.

> > But why would an application produce limited range pixels anyway? Is it
> > common that hardware video decoders are unable to produce full-range
> > pixels?
> >  
> 
> The primary reason for why content producer masters video/gfx content as
> limited range is for compatibility with sinks which only support limited
> range, and not because video decoders are not capable of decoding
> full-range content.

What I was asking is, even if the video content is limited range, why
would one not decode it into full-range pixels always and if the sink
need limited range, then convert again in hardware? When done right, it
makes no difference in output compared to using limited range
through-out if both content and sink use limited range.

> Also, certain cinema-related content (e.g., movies) may
> be better suited for limited range encoding due to the level of detail that
> they need to present/hide (see "Why does limited RGB even exist?" section
> in
> https://www.benq.com/en-us/knowledge-center/knowledge/full-rgb-vs-limited-rgb-is-there-a-difference.html#:~:text=Full%20RGB%20means%20the%20ability,less%20dark)%20than%20full%20RGB
> ).

That is a very nice link, thanks!

But to me it seems the section "Why is this a problem?" gets "crushed
blacks" backwards, so maybe I just don't get it.

I would assume that if the source (computer) sends full-range pixel
values on the wire and the sink (monitor) works in limited-range mode,
then you would get crushed blacks and crushed whites.

But if the source sends limited-range data and the sink works in
full-range more, you'd get the "washed out" image.

My thinking comes from the mapping of channel values: if 0-16 and
235-255 ranges show no difference within them, I'd call that "crushed".
Similarly if one assumes 16 is darkest black and it's actually not,
you'd get "washed out" (I might call it compressed instead, because it
affects both black and white ends, unable to achieve both the darkest
black and the brightest white).

Anyway, I believe I do understand that if you have content in one
range and the sink assumes a different range, the content will show
poorly. I don't doubt that.

My question instead is: why would it be bad to always convert
everything to full-range inside the source (e.g. decoder -> app ->
display server all in full-range), and then convert for the wire into
what the sink expects?

Because that is how Wayland color management is going to handle
differing color spaces, more or less. (Actually, quite likely the

Re: Dynamically change enumeration list of DRM enumeration property

2020-06-02 Thread Yogish Kulkarni
Inline..

On Mon, Jun 1, 2020 at 2:19 PM Pekka Paalanen  wrote:

> On Mon, 1 Jun 2020 09:22:27 +0530
> Yogish Kulkarni  wrote:
>
> > Hi,
> >
> > For letting DRM clients to select output encoding:
> > Sink can support certain display timings with high output bit-depths
> using
> > multiple output encodings, e.g. sink can support a particular timing with
> > RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may want
> to
> > select YCbCr422 10-bit over RBG 10-bit output to reduce the link
> bandwidth
> > (and in turn reduce power/voltage). If DRM driver automatically selects
> > output encoding then we are restricting DRM clients from making
> appropriate
> > choice.
>
> Hi,
>
> right, that seems to be another reason.
>
> > For selectable output color range:
> > Certain applications (typically graphics) usually rendered in full range
> > while some applications (typically video) have limited range content.
> Since
> > content can change dynamically, DRM driver does not have enough
> information
> > to choose correct quantization. Only DRM client can correctly select
> which
> > quantization to set (to preserve artist's intent).
>
> Now this is an interesting topic for me. As far as I know, there is no
> window system protocol to tell the display server whether the
> application provided content is using full or limited range. This means
> that the display server cannot tell DRM about full vs. limited range
> either. It also means that when not fullscreen, the display server
> cannot show the limited range video content correctly, because it would
> have to be converted to full-range (or vice versa).
>
> Right, but there could be DRM client which doesn't use window system (e.g.
Gstreamer video sink) and wants to select between full/limited color range.
I agree that there is no window system protocol yet but maybe Wayland
protocol could be added/extended for this purpose once we finalize things
that needs to be done in DRM.

But why would an application produce limited range pixels anyway? Is it
> common that hardware video decoders are unable to produce full-range
> pixels?
>

The primary reason for why content producer masters video/gfx content as
limited range is for compatibility with sinks which only support limited
range, and not because video decoders are not capable of decoding
full-range content. Also, certain cinema-related content (e.g., movies) may
be better suited for limited range encoding due to the level of detail that
they need to present/hide (see "Why does limited RGB even exist?" section
in
https://www.benq.com/en-us/knowledge-center/knowledge/full-rgb-vs-limited-rgb-is-there-a-difference.html#:~:text=Full%20RGB%20means%20the%20ability,less%20dark)%20than%20full%20RGB
).

I am asking, because I have a request to add limited vs. full range
> information to Wayland.
>
> What about video sinks, including monitors? Are there devices that
> accept limited-range only, full-range only, or switchable?
>

Yes, there are sinks which support selectable quantization range and there
are sinks which don't. If the quantization range is not selectable, then in
general, sources should output full-range for IT timings, and output
limited for CE timings. At a high-level, IT timings are part of a standard
developed by VESA for computer monitor-like displays. CE (Consumer
Electronics) timings are a separate standard for timings more applicable to
sinks like consumer TVs, etc.

>
> Why not just always use full-range everywhere?
>
> Or if a sink supports only limited-range, have the display chip
> automatically convert from full-range, so that software doesn't have to
> convert in software.
>

I think it is ok to convert from limited range to full range in display HW
pipeline. By "automatically" if you mean display HW or DRM driver should
look at the content to figure out whether it is limited range content and
then program display pipeline to do the conversion, I don't think that is a
good idea since we would need to inspect each pixel. Also, there may be
some post-processing done to full-range content that happens to cause the
pixel component values to fall within the limited quantization range. How
about adding a new DRM KMS plane property to let client convey the driver
about input content range? More details on this below.

>
> If you actually have a DRM KMS property for the range, does it mean that:
> - the sink is configured to accept that range, and the pixels in the
>   framebuffer need to comply, or
> - the display chip converts to that range while framebuffer remains in
>   full-range?
>

I would imagine this as:
(1) Add new read DRM KMS connector property which DRM client will read to
know whether sink support selectable quantization range.
(2) Add new read/write DRM KMS connector property which DRM client will
write to set output quantization range and read to know the current output
quantization range.
(3) Add new read/write DRM KMS plane property which DRM client will write
to set 

Re: Dynamically change enumeration list of DRM enumeration property

2020-06-01 Thread Pekka Paalanen
On Mon, 1 Jun 2020 09:22:27 +0530
Yogish Kulkarni  wrote:

> Hi,
> 
> For letting DRM clients to select output encoding:
> Sink can support certain display timings with high output bit-depths using
> multiple output encodings, e.g. sink can support a particular timing with
> RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may want to
> select YCbCr422 10-bit over RBG 10-bit output to reduce the link bandwidth
> (and in turn reduce power/voltage). If DRM driver automatically selects
> output encoding then we are restricting DRM clients from making appropriate
> choice.

Hi,

right, that seems to be another reason.

> For selectable output color range:
> Certain applications (typically graphics) usually rendered in full range
> while some applications (typically video) have limited range content. Since
> content can change dynamically, DRM driver does not have enough information
> to choose correct quantization. Only DRM client can correctly select which
> quantization to set (to preserve artist's intent).

Now this is an interesting topic for me. As far as I know, there is no
window system protocol to tell the display server whether the
application provided content is using full or limited range. This means
that the display server cannot tell DRM about full vs. limited range
either. It also means that when not fullscreen, the display server
cannot show the limited range video content correctly, because it would
have to be converted to full-range (or vice versa).

But why would an application produce limited range pixels anyway? Is it
common that hardware video decoders are unable to produce full-range
pixels?

I am asking, because I have a request to add limited vs. full range
information to Wayland.

What about video sinks, including monitors? Are there devices that
accept limited-range only, full-range only, or switchable?

Why not just always use full-range everywhere?

Or if a sink supports only limited-range, have the display chip
automatically convert from full-range, so that software doesn't have to
convert in software.

If you actually have a DRM KMS property for the range, does it mean that:
- the sink is configured to accept that range, and the pixels in the
  framebuffer need to comply, or
- the display chip converts to that range while framebuffer remains in
  full-range?

If we look at I915 driver's "Broadcast RGB" property, it seems to say
to me that the framebuffer is always primarily assumed to be in
full-range, and the conversion to limited-range happens in the scanout
circuitry. So that property would not help with video content that is
already in limited-range.

To recap, there are two orthogonal things: application content or
framebuffer range, and video sink / monitor range. The display server
between the two, at last if it is a Wayland compositor, would be able to
convert as necessary.

> For how to use selectable output encoding with Weston:
> I was thinking that DRM should have separate property to list the encodings
> supported by sink and Weston will present this list to its client. Your

Not client. A configuration tool perhaps, but not generically to all
Wayland clients, not as a directly settable knob at least.

> idea to validate encodings using TEST_ONLY commit and present a list of
> timings along with encodings supported by particular timing seems better.
> Instead of validating all possible encodings, does it make sense to
> validate  only those supported by sink? Irrespective of this we would

Yes, having a list of what the sink actually supports would be nice.

As for Wayland clients, there is an extension brewing at
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/8
that would allow suggesting the optimal encoding (pixel format and
modifier really) in flight.

That said, we are talking about the two different things here:
framebuffer format vs. encoding on the wire. Whether making them match
has benefits is another matter.

> anyway need some mechanism which will allow user to select particular
> encoding for a particular mode. I was thinking to allow this using new DRM
> property "Encoding". Do you have anything better in mind?

I think that is a reasonable and useful goal and idea. Just remember to
document it when proposing, even if it seems obvious. The details on
how to formulate that into UAPI is up for debate.

As said, changing KMS properties after they have been exposed to
userspace won't really work from either kernel or userspace point of
view. So you'd probably need to expose one blob type property listing
the encodings that may work as an array, and another property for
setting the one to use. IN_FORMATS property is somewhat similar,
although more complicated because it is the combination of format and
modifier.

> (Since I am using my Gmail Id, I feel I should mention that I work at
> Nvidia)

Nice to know the source of interest. :-)


Thanks,
pq

> 
> Thanks,
> -Yogish
> 
> On Thu, May 28, 2020 at 6:18 PM Pekka 

Re: Dynamically change enumeration list of DRM enumeration property

2020-05-31 Thread Yogish Kulkarni
Hi,

For letting DRM clients to select output encoding:
Sink can support certain display timings with high output bit-depths using
multiple output encodings, e.g. sink can support a particular timing with
RGB 10-bit, YCbCr422 10-bit and YCbCr420 10-bit. So DRM client may want to
select YCbCr422 10-bit over RBG 10-bit output to reduce the link bandwidth
(and in turn reduce power/voltage). If DRM driver automatically selects
output encoding then we are restricting DRM clients from making appropriate
choice.

For selectable output color range:
Certain applications (typically graphics) usually rendered in full range
while some applications (typically video) have limited range content. Since
content can change dynamically, DRM driver does not have enough information
to choose correct quantization. Only DRM client can correctly select which
quantization to set (to preserve artist's intent).

For how to use selectable output encoding with Weston:
I was thinking that DRM should have separate property to list the encodings
supported by sink and Weston will present this list to its client. Your
idea to validate encodings using TEST_ONLY commit and present a list of
timings along with encodings supported by particular timing seems better.
Instead of validating all possible encodings, does it make sense to
validate  only those supported by sink? Irrespective of this we would
anyway need some mechanism which will allow user to select particular
encoding for a particular mode. I was thinking to allow this using new DRM
property "Encoding". Do you have anything better in mind?

(Since I am using my Gmail Id, I feel I should mention that I work at
Nvidia)

Thanks,
-Yogish

On Thu, May 28, 2020 at 6:18 PM Pekka Paalanen  wrote:

> On Thu, 28 May 2020 17:38:59 +0530
> Yogish Kulkarni  wrote:
>
> > I am trying to find a way through Weston which will allow setting
> specific
> > encoding at display output.
>
> Hi,
>
> why do *you* want to control that?
>
> Why not let the driver always choose the highest possible encoding
> given the video mode and hardware capability?
>
> I can understand userspace wanting to know what it got, but why should
> userspace be able to control it?
>
> Would people want to pick the encoding first, and then go for the
> highest possible video mode?
>
> > Could you please elaborate on  why it is best
> > to let DRM driver automatically configure which encoding to choose rather
> > than making it selectable by DRM client ? I am not able to find reference
> > to past discussion about this. I was only able to find a proposed change
> -
> > https://lists.freedesktop.org/archives/intel-gfx/2017-April/125451.html
> but
> > am not able to find why it got rejected.
> >
> > Alternatively, is there existing way through which DRM clients can
> specify
> > preference for output encoding ? Or currently it's all up to the DRM
> driver
> > to choose what output encoding to use.
>
> There must be some reason why userspace needs to be able to control it.
> I'm also asking as a Weston maintainer, since I'm interested in how
> this affects e.g. color reproduction or HDR support.
>
> One thing that comes to my mind is using atomic TEST_ONLY commits to
> probe all the possible video modes × encodings for presenting a list to
> the user to choose from, if you have a display configuration GUI. E.g
> with some TV use cases, maybe the user wants to avoid sub-sampling, use
> the native resolution, but limit refresh rate to what's actually
> possible. Or any other combination of the three.
>
>
> Thanks,
> pq
>
> >
> > Thanks,
> > -Yogish
> >
> > On Thu, May 28, 2020 at 1:54 PM Daniel Vetter  wrote:
> >
> > > On Thu, May 28, 2020 at 12:29:43PM +0530, Yogish Kulkarni wrote:
> > > > For creating new source property, is it good to follow
> > > > "drm_mode_create_hdmi_colorspace_property()"  as an example ? It
> seems
> > > that
> > > > currently there is no standard DRM property which allows DRM client
> to
> > > set
> > > > a specific output encoding (like YUV420, YUV422 etc). Also, there is
> no
> > > > standard property for letting client select YUV/RGB color range. I
> see
> > > > there are two ways to introduce new properties, 1. do something like
> > > > drm_mode_create_hdmi_colorspace_property 2. create custom property
> > > similar
> > > > to "Broadcast RGB". Is there opinion on which is a preferable way
> to
> > > expose
> > > > encoding and color rage selection property ?
> > >
> > > I guess first question is "why?" Thus far we've gone with the opinion
> that
> > > automatically configuring output stuff as much as possible is best.
> What's
> > > the use-case where the driver can't select this?
> > > -Daniel
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-28 Thread Pekka Paalanen
On Thu, 28 May 2020 17:38:59 +0530
Yogish Kulkarni  wrote:

> I am trying to find a way through Weston which will allow setting specific
> encoding at display output.

Hi,

why do *you* want to control that?

Why not let the driver always choose the highest possible encoding
given the video mode and hardware capability?

I can understand userspace wanting to know what it got, but why should
userspace be able to control it?

Would people want to pick the encoding first, and then go for the
highest possible video mode?

> Could you please elaborate on  why it is best
> to let DRM driver automatically configure which encoding to choose rather
> than making it selectable by DRM client ? I am not able to find reference
> to past discussion about this. I was only able to find a proposed change -
> https://lists.freedesktop.org/archives/intel-gfx/2017-April/125451.html but
> am not able to find why it got rejected.
> 
> Alternatively, is there existing way through which DRM clients can specify
> preference for output encoding ? Or currently it's all up to the DRM driver
> to choose what output encoding to use.

There must be some reason why userspace needs to be able to control it.
I'm also asking as a Weston maintainer, since I'm interested in how
this affects e.g. color reproduction or HDR support.

One thing that comes to my mind is using atomic TEST_ONLY commits to
probe all the possible video modes × encodings for presenting a list to
the user to choose from, if you have a display configuration GUI. E.g
with some TV use cases, maybe the user wants to avoid sub-sampling, use
the native resolution, but limit refresh rate to what's actually
possible. Or any other combination of the three.


Thanks,
pq

> 
> Thanks,
> -Yogish
> 
> On Thu, May 28, 2020 at 1:54 PM Daniel Vetter  wrote:
> 
> > On Thu, May 28, 2020 at 12:29:43PM +0530, Yogish Kulkarni wrote:  
> > > For creating new source property, is it good to follow
> > > "drm_mode_create_hdmi_colorspace_property()"  as an example ? It seems  
> > that  
> > > currently there is no standard DRM property which allows DRM client to  
> > set  
> > > a specific output encoding (like YUV420, YUV422 etc). Also, there is no
> > > standard property for letting client select YUV/RGB color range. I see
> > > there are two ways to introduce new properties, 1. do something like
> > > drm_mode_create_hdmi_colorspace_property 2. create custom property  
> > similar  
> > > to "Broadcast RGB". Is there opinion on which is a preferable way to  
> > expose  
> > > encoding and color rage selection property ?  
> >
> > I guess first question is "why?" Thus far we've gone with the opinion that
> > automatically configuring output stuff as much as possible is best. What's
> > the use-case where the driver can't select this?
> > -Daniel


pgpOB1bCPb_Bt.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-28 Thread Yogish Kulkarni
I am trying to find a way through Weston which will allow setting specific
encoding at display output. Could you please elaborate on  why it is best
to let DRM driver automatically configure which encoding to choose rather
than making it selectable by DRM client ? I am not able to find reference
to past discussion about this. I was only able to find a proposed change -
https://lists.freedesktop.org/archives/intel-gfx/2017-April/125451.html but
am not able to find why it got rejected.

Alternatively, is there existing way through which DRM clients can specify
preference for output encoding ? Or currently it's all up to the DRM driver
to choose what output encoding to use.

Thanks,
-Yogish

On Thu, May 28, 2020 at 1:54 PM Daniel Vetter  wrote:

> On Thu, May 28, 2020 at 12:29:43PM +0530, Yogish Kulkarni wrote:
> > For creating new source property, is it good to follow
> > "drm_mode_create_hdmi_colorspace_property()"  as an example ? It seems
> that
> > currently there is no standard DRM property which allows DRM client to
> set
> > a specific output encoding (like YUV420, YUV422 etc). Also, there is no
> > standard property for letting client select YUV/RGB color range. I see
> > there are two ways to introduce new properties, 1. do something like
> > drm_mode_create_hdmi_colorspace_property 2. create custom property
> similar
> > to "Broadcast RGB". Is there opinion on which is a preferable way to
> expose
> > encoding and color rage selection property ?
>
> I guess first question is "why?" Thus far we've gone with the opinion that
> automatically configuring output stuff as much as possible is best. What's
> the use-case where the driver can't select this?
> -Daniel
>
> >
> > Thanks,
> > -Yogish
> >
> > On Tue, May 26, 2020 at 5:44 PM Daniel Vetter  wrote:
> >
> > > On Tue, May 26, 2020 at 9:39 AM Pekka Paalanen 
> > > wrote:
> > > >
> > > > On Tue, 26 May 2020 10:01:23 +0530
> > > > Yogish Kulkarni  wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > Is it possible to dynamically change enumeration list of  DRM
> > > enumeration
> > > > > property ? Motivation behind this question is to understand
> whether it
> > > is
> > > > > possible to create connector enum property (e.g a property which
> will
> > > list
> > > > > supported output encodings -  like yuv420, yuv422 etc) whose list
> of
> > > > > supported enum values could be changed dynamically e.g. based on
> which
> > > sink
> > > > > is connected.
> > > > >
> > > > > I think there is existing EDID connector property whose value
> changes
> > > based
> > > > > on connected sink. EDID is a BLOB property, I am trying to
> understand
> > > if
> > > > > this is also possible for ENUM type property. There is
> > > > > "drm_property_replace_blob" to replace blob but I wasn't able to
> find
> > > any
> > > > > API which could replace list of supported enums. Alternatively,
> would
> > > it be
> > > > > good idea to destroy custom enum property created by a driver and
> > > create
> > > > > new enum property with new list of supported enums e.g when there
> is a
> > > > > HOTPLUG event.
> > > >
> > > > Hi,
> > > >
> > > > looking at Weston code, it *might* cope with it. A hotplug event does
> > > > cause Weston to re-discover all properties of a connector. This is
> > > > specific to connectors only.
> > >
> > > Currently the kernel doesn't cope with that. Only objects which can be
> > > added/removed are connectors, blobs and fbs (iow the refcounted ones).
> > > Adding/removing properties isn't supported, nor is adding/removing
> > > which properties are attached to which object while that object is
> > > life.
> > >
> > > Also I think the uapi risk for this is way too big, see my other reply
> > > for what we've done in the past for stuff like this.
> > > -Daniel
> > >
> > > > The race exists though: userspace might be poking at KMS after you
> > > > changed the property in the kernel but before userspace handles the
> > > > hotplug event. You'd have to check that does not cause regressions. I
> > > > guess for a completely new property, the risk seems low, as userspace
> > > > does not know to poke at it (risk of using outdated property

Re: Dynamically change enumeration list of DRM enumeration property

2020-05-28 Thread Daniel Vetter
On Thu, May 28, 2020 at 12:29:43PM +0530, Yogish Kulkarni wrote:
> For creating new source property, is it good to follow
> "drm_mode_create_hdmi_colorspace_property()"  as an example ? It seems that
> currently there is no standard DRM property which allows DRM client to set
> a specific output encoding (like YUV420, YUV422 etc). Also, there is no
> standard property for letting client select YUV/RGB color range. I see
> there are two ways to introduce new properties, 1. do something like
> drm_mode_create_hdmi_colorspace_property 2. create custom property similar
> to "Broadcast RGB". Is there opinion on which is a preferable way to expose
> encoding and color rage selection property ?

I guess first question is "why?" Thus far we've gone with the opinion that
automatically configuring output stuff as much as possible is best. What's
the use-case where the driver can't select this?
-Daniel

> 
> Thanks,
> -Yogish
> 
> On Tue, May 26, 2020 at 5:44 PM Daniel Vetter  wrote:
> 
> > On Tue, May 26, 2020 at 9:39 AM Pekka Paalanen 
> > wrote:
> > >
> > > On Tue, 26 May 2020 10:01:23 +0530
> > > Yogish Kulkarni  wrote:
> > >
> > > > Hi,
> > > >
> > > > Is it possible to dynamically change enumeration list of  DRM
> > enumeration
> > > > property ? Motivation behind this question is to understand whether it
> > is
> > > > possible to create connector enum property (e.g a property which will
> > list
> > > > supported output encodings -  like yuv420, yuv422 etc) whose list of
> > > > supported enum values could be changed dynamically e.g. based on which
> > sink
> > > > is connected.
> > > >
> > > > I think there is existing EDID connector property whose value changes
> > based
> > > > on connected sink. EDID is a BLOB property, I am trying to understand
> > if
> > > > this is also possible for ENUM type property. There is
> > > > "drm_property_replace_blob" to replace blob but I wasn't able to find
> > any
> > > > API which could replace list of supported enums. Alternatively, would
> > it be
> > > > good idea to destroy custom enum property created by a driver and
> > create
> > > > new enum property with new list of supported enums e.g when there is a
> > > > HOTPLUG event.
> > >
> > > Hi,
> > >
> > > looking at Weston code, it *might* cope with it. A hotplug event does
> > > cause Weston to re-discover all properties of a connector. This is
> > > specific to connectors only.
> >
> > Currently the kernel doesn't cope with that. Only objects which can be
> > added/removed are connectors, blobs and fbs (iow the refcounted ones).
> > Adding/removing properties isn't supported, nor is adding/removing
> > which properties are attached to which object while that object is
> > life.
> >
> > Also I think the uapi risk for this is way too big, see my other reply
> > for what we've done in the past for stuff like this.
> > -Daniel
> >
> > > The race exists though: userspace might be poking at KMS after you
> > > changed the property in the kernel but before userspace handles the
> > > hotplug event. You'd have to check that does not cause regressions. I
> > > guess for a completely new property, the risk seems low, as userspace
> > > does not know to poke at it (risk of using outdated property or value
> > > IDs causing unexpected atomic commit failure). Also I'm not aware of
> > > any KMS program that would yet attempt blind KMS state save & restore
> > > to sanitize the KMS state after dropping and re-gaining DRM master.
> > >
> > > You'd have to check all other KMS using programs too: every Wayland
> > > compositor, Xorg, DRM Vulkan WSI(?), ...
> > >
> > >
> > > Thanks,
> > > pq
> > > ___
> > > dri-devel mailing list
> > > dri-devel@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dri-devel
> >
> >
> >
> > --
> > Daniel Vetter
> > Software Engineer, Intel Corporation
> > +41 (0) 79 365 57 48 - http://blog.ffwll.ch
> >

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-28 Thread Yogish Kulkarni
For creating new source property, is it good to follow
"drm_mode_create_hdmi_colorspace_property()"  as an example ? It seems that
currently there is no standard DRM property which allows DRM client to set
a specific output encoding (like YUV420, YUV422 etc). Also, there is no
standard property for letting client select YUV/RGB color range. I see
there are two ways to introduce new properties, 1. do something like
drm_mode_create_hdmi_colorspace_property 2. create custom property similar
to "Broadcast RGB". Is there opinion on which is a preferable way to expose
encoding and color rage selection property ?

Thanks,
-Yogish

On Tue, May 26, 2020 at 5:44 PM Daniel Vetter  wrote:

> On Tue, May 26, 2020 at 9:39 AM Pekka Paalanen 
> wrote:
> >
> > On Tue, 26 May 2020 10:01:23 +0530
> > Yogish Kulkarni  wrote:
> >
> > > Hi,
> > >
> > > Is it possible to dynamically change enumeration list of  DRM
> enumeration
> > > property ? Motivation behind this question is to understand whether it
> is
> > > possible to create connector enum property (e.g a property which will
> list
> > > supported output encodings -  like yuv420, yuv422 etc) whose list of
> > > supported enum values could be changed dynamically e.g. based on which
> sink
> > > is connected.
> > >
> > > I think there is existing EDID connector property whose value changes
> based
> > > on connected sink. EDID is a BLOB property, I am trying to understand
> if
> > > this is also possible for ENUM type property. There is
> > > "drm_property_replace_blob" to replace blob but I wasn't able to find
> any
> > > API which could replace list of supported enums. Alternatively, would
> it be
> > > good idea to destroy custom enum property created by a driver and
> create
> > > new enum property with new list of supported enums e.g when there is a
> > > HOTPLUG event.
> >
> > Hi,
> >
> > looking at Weston code, it *might* cope with it. A hotplug event does
> > cause Weston to re-discover all properties of a connector. This is
> > specific to connectors only.
>
> Currently the kernel doesn't cope with that. Only objects which can be
> added/removed are connectors, blobs and fbs (iow the refcounted ones).
> Adding/removing properties isn't supported, nor is adding/removing
> which properties are attached to which object while that object is
> life.
>
> Also I think the uapi risk for this is way too big, see my other reply
> for what we've done in the past for stuff like this.
> -Daniel
>
> > The race exists though: userspace might be poking at KMS after you
> > changed the property in the kernel but before userspace handles the
> > hotplug event. You'd have to check that does not cause regressions. I
> > guess for a completely new property, the risk seems low, as userspace
> > does not know to poke at it (risk of using outdated property or value
> > IDs causing unexpected atomic commit failure). Also I'm not aware of
> > any KMS program that would yet attempt blind KMS state save & restore
> > to sanitize the KMS state after dropping and re-gaining DRM master.
> >
> > You'd have to check all other KMS using programs too: every Wayland
> > compositor, Xorg, DRM Vulkan WSI(?), ...
> >
> >
> > Thanks,
> > pq
> > ___
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
>
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - http://blog.ffwll.ch
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-26 Thread Daniel Vetter
On Tue, May 26, 2020 at 9:39 AM Pekka Paalanen  wrote:
>
> On Tue, 26 May 2020 10:01:23 +0530
> Yogish Kulkarni  wrote:
>
> > Hi,
> >
> > Is it possible to dynamically change enumeration list of  DRM enumeration
> > property ? Motivation behind this question is to understand whether it is
> > possible to create connector enum property (e.g a property which will list
> > supported output encodings -  like yuv420, yuv422 etc) whose list of
> > supported enum values could be changed dynamically e.g. based on which sink
> > is connected.
> >
> > I think there is existing EDID connector property whose value changes based
> > on connected sink. EDID is a BLOB property, I am trying to understand if
> > this is also possible for ENUM type property. There is
> > "drm_property_replace_blob" to replace blob but I wasn't able to find any
> > API which could replace list of supported enums. Alternatively, would it be
> > good idea to destroy custom enum property created by a driver and create
> > new enum property with new list of supported enums e.g when there is a
> > HOTPLUG event.
>
> Hi,
>
> looking at Weston code, it *might* cope with it. A hotplug event does
> cause Weston to re-discover all properties of a connector. This is
> specific to connectors only.

Currently the kernel doesn't cope with that. Only objects which can be
added/removed are connectors, blobs and fbs (iow the refcounted ones).
Adding/removing properties isn't supported, nor is adding/removing
which properties are attached to which object while that object is
life.

Also I think the uapi risk for this is way too big, see my other reply
for what we've done in the past for stuff like this.
-Daniel

> The race exists though: userspace might be poking at KMS after you
> changed the property in the kernel but before userspace handles the
> hotplug event. You'd have to check that does not cause regressions. I
> guess for a completely new property, the risk seems low, as userspace
> does not know to poke at it (risk of using outdated property or value
> IDs causing unexpected atomic commit failure). Also I'm not aware of
> any KMS program that would yet attempt blind KMS state save & restore
> to sanitize the KMS state after dropping and re-gaining DRM master.
>
> You'd have to check all other KMS using programs too: every Wayland
> compositor, Xorg, DRM Vulkan WSI(?), ...
>
>
> Thanks,
> pq
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel



-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-26 Thread Yogish Kulkarni
Thanks, Daniel & Pekka.

It might be bad idea to destroy and re-create the connector enum property
from HOTPLUG handler in DRM. But if this is done through
DRM_IOCTL_MODE_GETCONNECTOR, there won't be race, right ? From code walk
through it seems that Weston will call this IOCTL for newly connected
display found through HOTPLUG event and DRM driver will update the EDID
through the call sequence triggered by this IOCTL. On the similar line if
existing connector property is destroyed and re-created with new enmu list
through this IOCTL call chain, then there won't be race ?

Thanks,
-Yogish

On Tue, May 26, 2020 at 1:09 PM Pekka Paalanen  wrote:

> On Tue, 26 May 2020 10:01:23 +0530
> Yogish Kulkarni  wrote:
>
> > Hi,
> >
> > Is it possible to dynamically change enumeration list of  DRM enumeration
> > property ? Motivation behind this question is to understand whether it is
> > possible to create connector enum property (e.g a property which will
> list
> > supported output encodings -  like yuv420, yuv422 etc) whose list of
> > supported enum values could be changed dynamically e.g. based on which
> sink
> > is connected.
> >
> > I think there is existing EDID connector property whose value changes
> based
> > on connected sink. EDID is a BLOB property, I am trying to understand if
> > this is also possible for ENUM type property. There is
> > "drm_property_replace_blob" to replace blob but I wasn't able to find any
> > API which could replace list of supported enums. Alternatively, would it
> be
> > good idea to destroy custom enum property created by a driver and create
> > new enum property with new list of supported enums e.g when there is a
> > HOTPLUG event.
>
> Hi,
>
> looking at Weston code, it *might* cope with it. A hotplug event does
> cause Weston to re-discover all properties of a connector. This is
> specific to connectors only.
>
> The race exists though: userspace might be poking at KMS after you
> changed the property in the kernel but before userspace handles the
> hotplug event. You'd have to check that does not cause regressions. I
> guess for a completely new property, the risk seems low, as userspace
> does not know to poke at it (risk of using outdated property or value
> IDs causing unexpected atomic commit failure). Also I'm not aware of
> any KMS program that would yet attempt blind KMS state save & restore
> to sanitize the KMS state after dropping and re-gaining DRM master.
>
> You'd have to check all other KMS using programs too: every Wayland
> compositor, Xorg, DRM Vulkan WSI(?), ...
>
>
> Thanks,
> pq
>
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-26 Thread Pekka Paalanen
On Tue, 26 May 2020 10:01:23 +0530
Yogish Kulkarni  wrote:

> Hi,
> 
> Is it possible to dynamically change enumeration list of  DRM enumeration
> property ? Motivation behind this question is to understand whether it is
> possible to create connector enum property (e.g a property which will list
> supported output encodings -  like yuv420, yuv422 etc) whose list of
> supported enum values could be changed dynamically e.g. based on which sink
> is connected.
> 
> I think there is existing EDID connector property whose value changes based
> on connected sink. EDID is a BLOB property, I am trying to understand if
> this is also possible for ENUM type property. There is
> "drm_property_replace_blob" to replace blob but I wasn't able to find any
> API which could replace list of supported enums. Alternatively, would it be
> good idea to destroy custom enum property created by a driver and create
> new enum property with new list of supported enums e.g when there is a
> HOTPLUG event.

Hi,

looking at Weston code, it *might* cope with it. A hotplug event does
cause Weston to re-discover all properties of a connector. This is
specific to connectors only.

The race exists though: userspace might be poking at KMS after you
changed the property in the kernel but before userspace handles the
hotplug event. You'd have to check that does not cause regressions. I
guess for a completely new property, the risk seems low, as userspace
does not know to poke at it (risk of using outdated property or value
IDs causing unexpected atomic commit failure). Also I'm not aware of
any KMS program that would yet attempt blind KMS state save & restore
to sanitize the KMS state after dropping and re-gaining DRM master.

You'd have to check all other KMS using programs too: every Wayland
compositor, Xorg, DRM Vulkan WSI(?), ...


Thanks,
pq


pgpj4PR91PW3k.pgp
Description: OpenPGP digital signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: Dynamically change enumeration list of DRM enumeration property

2020-05-26 Thread Daniel Vetter
On Tue, May 26, 2020 at 6:31 AM Yogish Kulkarni
 wrote:
>
> Hi,
>
> Is it possible to dynamically change enumeration list of  DRM enumeration 
> property ? Motivation behind this question is to understand whether it is 
> possible to create connector enum property (e.g a property which will list 
> supported output encodings -  like yuv420, yuv422 etc) whose list of 
> supported enum values could be changed dynamically e.g. based on which sink 
> is connected.
>
> I think there is existing EDID connector property whose value changes based 
> on connected sink. EDID is a BLOB property, I am trying to understand if this 
> is also possible for ENUM type property. There is "drm_property_replace_blob" 
> to replace blob but I wasn't able to find any API which could replace list of 
> supported enums. Alternatively, would it be good idea to destroy custom enum 
> property created by a driver and create new enum property with new list of 
> supported enums e.g when there is a HOTPLUG event.

Neither works, properties and their value ranges are static. Also
generally the idea is that the properties on the drm_connector reflect
what the source side can do, irrespective of the sink capabilities.
Since a lot of sinks have bad EDID and you might want to overwrite
what the sink claims works.

Usually how we do this is a second property that the kernel sets, and
userspace can only read, which shows what the sink is capable of.
Sometimes we also just let userspace re-decode the EDID and figure
that out itself, but that's kinda a bad interface.

Also for anything new, please keep in mind our rules for new uapi:
https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#open-source-userspace-requirements
https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#testing-and-validation

Cheers, Daniel

-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Dynamically change enumeration list of DRM enumeration property

2020-05-25 Thread Yogish Kulkarni
Hi,

Is it possible to dynamically change enumeration list of  DRM enumeration
property ? Motivation behind this question is to understand whether it is
possible to create connector enum property (e.g a property which will list
supported output encodings -  like yuv420, yuv422 etc) whose list of
supported enum values could be changed dynamically e.g. based on which sink
is connected.

I think there is existing EDID connector property whose value changes based
on connected sink. EDID is a BLOB property, I am trying to understand if
this is also possible for ENUM type property. There is
"drm_property_replace_blob" to replace blob but I wasn't able to find any
API which could replace list of supported enums. Alternatively, would it be
good idea to destroy custom enum property created by a driver and create
new enum property with new list of supported enums e.g when there is a
HOTPLUG event.

Thanks,
-Yogish
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel