diff mbox

[1/4] drm: add picture aspect ratio flags

Message ID 1470221788-30808-2-git-send-email-shashank.sharma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sharma, Shashank Aug. 3, 2016, 10:56 a.m. UTC
This patch adds drm flag bits for aspect ratio information

Currently drm flag bits don't have field for mode's picture
aspect ratio. This field will help the driver to pick mode with
right aspect ratio, and help in setting right VIC field in avi
infoframes.

Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 include/uapi/drm/drm_mode.h | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

Comments

Sean Paul Aug. 3, 2016, 5:40 p.m. UTC | #1
On Wed, Aug 3, 2016 at 6:56 AM, Shashank Sharma
<shashank.sharma@intel.com> wrote:
> This patch adds drm flag bits for aspect ratio information
>
> Currently drm flag bits don't have field for mode's picture
> aspect ratio. This field will help the driver to pick mode with
> right aspect ratio, and help in setting right VIC field in avi
> infoframes.
>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  include/uapi/drm/drm_mode.h | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
> index 49a7265..cd66a95 100644
> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h
> @@ -77,6 +77,19 @@ extern "C" {
>  #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM       (7<<14)
>  #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF    (8<<14)
>
> +/* Picture aspect ratio options */
> +#define DRM_MODE_PICTURE_ASPECT_NONE           0
> +#define DRM_MODE_PICTURE_ASPECT_4_3            1
> +#define DRM_MODE_PICTURE_ASPECT_16_9           2
> +
> +/* Aspect ratio flag bitmask (4 bits 22:19) */
> +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
> +#define  DRM_MODE_FLAG_PARNONE \
> +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)

While I prefer the spaces in between the << operator, it seems like
convention in this file is to not have them.

> +#define  DRM_MODE_FLAG_PAR4_3 \
> +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
> +#define  DRM_MODE_FLAG_PAR16_9 \
> +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)

Not crazy about "PAR". Perhaps DRM_MODE_FLAG_ASPECT_BLAH would be more
descriptive?

>
>  /* DPMS flags */
>  /* bit compatible with the xorg definitions. */
> @@ -92,11 +105,6 @@ extern "C" {
>  #define DRM_MODE_SCALE_CENTER          2 /* Centered, no scaling */
>  #define DRM_MODE_SCALE_ASPECT          3 /* Full screen, preserve aspect */
>
> -/* Picture aspect ratio options */
> -#define DRM_MODE_PICTURE_ASPECT_NONE   0
> -#define DRM_MODE_PICTURE_ASPECT_4_3    1
> -#define DRM_MODE_PICTURE_ASPECT_16_9   2
> -
>  /* Dithering mode options */
>  #define DRM_MODE_DITHERING_OFF 0
>  #define DRM_MODE_DITHERING_ON  1
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Sharma, Shashank Aug. 4, 2016, 9:19 a.m. UTC | #2
Thanks for the review, Sean.

My comments, inline.

Regards
Shashank
On 8/3/2016 11:10 PM, Sean Paul wrote:
> On Wed, Aug 3, 2016 at 6:56 AM, Shashank Sharma
> <shashank.sharma@intel.com> wrote:
>> This patch adds drm flag bits for aspect ratio information
>>
>> Currently drm flag bits don't have field for mode's picture
>> aspect ratio. This field will help the driver to pick mode with
>> right aspect ratio, and help in setting right VIC field in avi
>> infoframes.
>>
>> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
>> ---
>>   include/uapi/drm/drm_mode.h | 18 +++++++++++++-----
>>   1 file changed, 13 insertions(+), 5 deletions(-)
>>
>> diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
>> index 49a7265..cd66a95 100644
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> @@ -77,6 +77,19 @@ extern "C" {
>>   #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM       (7<<14)
>>   #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF    (8<<14)
>>
>> +/* Picture aspect ratio options */
>> +#define DRM_MODE_PICTURE_ASPECT_NONE           0
>> +#define DRM_MODE_PICTURE_ASPECT_4_3            1
>> +#define DRM_MODE_PICTURE_ASPECT_16_9           2
>> +
>> +/* Aspect ratio flag bitmask (4 bits 22:19) */
>> +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
>> +#define  DRM_MODE_FLAG_PARNONE \
>> +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)
> While I prefer the spaces in between the << operator, it seems like
> convention in this file is to not have them.
I agree, I will remove the spaces.
>
>> +#define  DRM_MODE_FLAG_PAR4_3 \
>> +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
>> +#define  DRM_MODE_FLAG_PAR16_9 \
>> +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
> Not crazy about "PAR". Perhaps DRM_MODE_FLAG_ASPECT_BLAH would be more
> descriptive?
Ok, let me come up with something which rhymes with BLAH :)

Regards
Shashank
>>   /* DPMS flags */
>>   /* bit compatible with the xorg definitions. */
>> @@ -92,11 +105,6 @@ extern "C" {
>>   #define DRM_MODE_SCALE_CENTER          2 /* Centered, no scaling */
>>   #define DRM_MODE_SCALE_ASPECT          3 /* Full screen, preserve aspect */
>>
>> -/* Picture aspect ratio options */
>> -#define DRM_MODE_PICTURE_ASPECT_NONE   0
>> -#define DRM_MODE_PICTURE_ASPECT_4_3    1
>> -#define DRM_MODE_PICTURE_ASPECT_16_9   2
>> -
>>   /* Dithering mode options */
>>   #define DRM_MODE_DITHERING_OFF 0
>>   #define DRM_MODE_DITHERING_ON  1
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Emil Velikov Aug. 4, 2016, 9:42 a.m. UTC | #3
On 3 August 2016 at 11:56, Shashank Sharma <shashank.sharma@intel.com> wrote:

> --- a/include/uapi/drm/drm_mode.h
> +++ b/include/uapi/drm/drm_mode.h

> +
> +/* Aspect ratio flag bitmask (4 bits 22:19) */
> +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
> +#define  DRM_MODE_FLAG_PARNONE \
> +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)
> +#define  DRM_MODE_FLAG_PAR4_3 \
> +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
> +#define  DRM_MODE_FLAG_PAR16_9 \
> +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
>
Afaict all these flags are internal/implementation specific thus we
shouldn't expose them to userspace. Right ?

-Emil
Sharma, Shashank Aug. 4, 2016, 10:16 a.m. UTC | #4
Hello Emil,

Thanks for your time.

I have got mixed opinion on this.

IMHO we should expose them to userspace too, as UI agents like Hardware 
composer/X/Wayland must know what does these

flags means, so that they can display them on the end user screen (like 
settings menu)

But few people even think thats its too complex to be exposed to 
userspace agents.

So your suggestions are welcome.

Regards
Shashank

On 8/4/2016 3:12 PM, Emil Velikov wrote:
> On 3 August 2016 at 11:56, Shashank Sharma <shashank.sharma@intel.com> wrote:
>
>> --- a/include/uapi/drm/drm_mode.h
>> +++ b/include/uapi/drm/drm_mode.h
>> +
>> +/* Aspect ratio flag bitmask (4 bits 22:19) */
>> +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
>> +#define  DRM_MODE_FLAG_PARNONE \
>> +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)
>> +#define  DRM_MODE_FLAG_PAR4_3 \
>> +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
>> +#define  DRM_MODE_FLAG_PAR16_9 \
>> +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
>>
> Afaict all these flags are internal/implementation specific thus we
> shouldn't expose them to userspace. Right ?
>
> -Emil
Daniel Vetter Aug. 4, 2016, 10:36 a.m. UTC | #5
On Thu, Aug 04, 2016 at 03:46:09PM +0530, Sharma, Shashank wrote:
> Hello Emil,
> 
> Thanks for your time.
> 
> I have got mixed opinion on this.
> 
> IMHO we should expose them to userspace too, as UI agents like Hardware
> composer/X/Wayland must know what does these
> 
> flags means, so that they can display them on the end user screen (like
> settings menu)
> 
> But few people even think thats its too complex to be exposed to userspace
> agents.
> 
> So your suggestions are welcome.

These are flags for the internal mode representation, not for the uapi
one. They really don't belong into the uapi header, but instead into
include/drm/drm_modes.h. I.e. I fully concur with Emil.
-Daniel

> 
> Regards
> Shashank
> 
> On 8/4/2016 3:12 PM, Emil Velikov wrote:
> > On 3 August 2016 at 11:56, Shashank Sharma <shashank.sharma@intel.com> wrote:
> > 
> > > --- a/include/uapi/drm/drm_mode.h
> > > +++ b/include/uapi/drm/drm_mode.h
> > > +
> > > +/* Aspect ratio flag bitmask (4 bits 22:19) */
> > > +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
> > > +#define  DRM_MODE_FLAG_PARNONE \
> > > +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)
> > > +#define  DRM_MODE_FLAG_PAR4_3 \
> > > +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
> > > +#define  DRM_MODE_FLAG_PAR16_9 \
> > > +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
> > > 
> > Afaict all these flags are internal/implementation specific thus we
> > shouldn't expose them to userspace. Right ?
> > 
> > -Emil
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Emil Velikov Aug. 4, 2016, 11:34 a.m. UTC | #6
On 4 August 2016 at 11:16, Sharma, Shashank <shashank.sharma@intel.com> wrote:
> Hello Emil,
>
> Thanks for your time.
>
> I have got mixed opinion on this.
>
> IMHO we should expose them to userspace too, as UI agents like Hardware
> composer/X/Wayland must know what does these
>
> flags means, so that they can display them on the end user screen (like
> settings menu)
>
> But few people even think thats its too complex to be exposed to userspace
> agents.
>
If we want these/such flags passed between kernel and user space one must:
 - Provide a kernel interface how to do that
 - Provide a userspace (acked by respective developers/maintainers)
that the approach is sane and proves useful.

Since the above can take some time, I'd suggest dropping those from
the UAPI header(s)... for now.

-Emil
Sharma, Shashank Aug. 4, 2016, 1:05 p.m. UTC | #7
Thanks Daniel.

My comments, inline.

Regards
Shashank
On 8/4/2016 4:06 PM, Daniel Vetter wrote:
> On Thu, Aug 04, 2016 at 03:46:09PM +0530, Sharma, Shashank wrote:
>> Hello Emil,
>>
>> Thanks for your time.
>>
>> I have got mixed opinion on this.
>>
>> IMHO we should expose them to userspace too, as UI agents like Hardware
>> composer/X/Wayland must know what does these
>>
>> flags means, so that they can display them on the end user screen (like
>> settings menu)
>>
>> But few people even think thats its too complex to be exposed to userspace
>> agents.
>>
>> So your suggestions are welcome.
> These are flags for the internal mode representation, not for the uapi
> one. They really don't belong into the uapi header, but instead into
> include/drm/drm_modes.h. I.e. I fully concur with Emil.
> -Daniel
Please correct me if I am missing anything, but In that case, how will 
HWC/X apply a modeset
1920x1080@60 16:9 (Not 1920x1080@60 4:3)

Regards
Shashank
>> Regards
>> Shashank
>>
>> On 8/4/2016 3:12 PM, Emil Velikov wrote:
>>> On 3 August 2016 at 11:56, Shashank Sharma <shashank.sharma@intel.com> wrote:
>>>
>>>> --- a/include/uapi/drm/drm_mode.h
>>>> +++ b/include/uapi/drm/drm_mode.h
>>>> +
>>>> +/* Aspect ratio flag bitmask (4 bits 22:19) */
>>>> +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
>>>> +#define  DRM_MODE_FLAG_PARNONE \
>>>> +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)
>>>> +#define  DRM_MODE_FLAG_PAR4_3 \
>>>> +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
>>>> +#define  DRM_MODE_FLAG_PAR16_9 \
>>>> +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
>>>>
>>> Afaict all these flags are internal/implementation specific thus we
>>> shouldn't expose them to userspace. Right ?
>>>
>>> -Emil
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Sharma, Shashank Aug. 4, 2016, 1:15 p.m. UTC | #8
Regards

Shashank


On 8/4/2016 5:04 PM, Emil Velikov wrote:
> On 4 August 2016 at 11:16, Sharma, Shashank <shashank.sharma@intel.com> wrote:
>> Hello Emil,
>>
>> Thanks for your time.
>>
>> I have got mixed opinion on this.
>>
>> IMHO we should expose them to userspace too, as UI agents like Hardware
>> composer/X/Wayland must know what does these
>>
>> flags means, so that they can display them on the end user screen (like
>> settings menu)
>>
>> But few people even think thats its too complex to be exposed to userspace
>> agents.
>>
> If we want these/such flags passed between kernel and user space one must:
>   - Provide a kernel interface how to do that
>   - Provide a userspace (acked by respective developers/maintainers)
> that the approach is sane and proves useful.
>
> Since the above can take some time, I'd suggest dropping those from
> the UAPI header(s)... for now.
>
> -Emil
Please guide me a bit more on this problem, Emil, Daniel.
The reason why I want to pass this to userspace is, so that, HWC/X/any 
other UI manager, can send a modeset
which is accurate upto aspect ratio.

Please think of this complete scenario:
- HDMI compliance testing is going on, and we need to apply a CEA mode 
(for example, VIC=3, mode - 720x480@60Hz aspect 16:9)
- But HWC doesnt pass the aspect ratio  information, and passed only 
720x480@60Hz
- Kernel gets the first matching mode, from edid_cea_modes, which is 
VIC=2 720x480@60Hz (aspect 4:3)
- Kernel does the modeset of VIC = 2, and AVI IF contain VIC=2
- Compliance equipment expects VIC = 3, so fails the test case.

In this case, its essential that the userspace, which is triggering the 
modeset, must know about the aspect ratio field too.
So does this make it a reason to pass this information to usp ?

Regards
Shashank
Emil Velikov Aug. 4, 2016, 2:31 p.m. UTC | #9
On 4 August 2016 at 14:15, Sharma, Shashank <shashank.sharma@intel.com> wrote:
> On 8/4/2016 5:04 PM, Emil Velikov wrote:
>>
>> On 4 August 2016 at 11:16, Sharma, Shashank <shashank.sharma@intel.com>
>> wrote:
>>>
>>> Hello Emil,
>>>
>>> Thanks for your time.
>>>
>>> I have got mixed opinion on this.
>>>
>>> IMHO we should expose them to userspace too, as UI agents like Hardware
>>> composer/X/Wayland must know what does these
>>>
>>> flags means, so that they can display them on the end user screen (like
>>> settings menu)
>>>
>>> But few people even think thats its too complex to be exposed to
>>> userspace
>>> agents.
>>>
>> If we want these/such flags passed between kernel and user space one must:
>>   - Provide a kernel interface how to do that
>>   - Provide a userspace (acked by respective developers/maintainers)
>> that the approach is sane and proves useful.
>>
>> Since the above can take some time, I'd suggest dropping those from
>> the UAPI header(s)... for now.
>>
>> -Emil
>
> Please guide me a bit more on this problem, Emil, Daniel.
> The reason why I want to pass this to userspace is, so that, HWC/X/any other
> UI manager, can send a modeset
> which is accurate upto aspect ratio.
>
Nobody(?) is arguing that you don't to pass such information to/from
userspace :-)
Your series does the internal parsing/management of the attribute and
has no actual UAPI implementation and/or userspace references (to
code/discussions). Thus the UAPI changes should _not_ be part of these
patches.

Daniel's blog [1] has many educational materials why and how things
are done upstream. I would kindly invite you to give them (another?)
courtesy read.

Regards,
Emil

[1] http://blog.ffwll.ch/
Daniel Vetter Aug. 4, 2016, 4:04 p.m. UTC | #10
On Thu, Aug 04, 2016 at 06:35:52PM +0530, Sharma, Shashank wrote:
> Thanks Daniel.
> 
> My comments, inline.
> 
> Regards
> Shashank
> On 8/4/2016 4:06 PM, Daniel Vetter wrote:
> > On Thu, Aug 04, 2016 at 03:46:09PM +0530, Sharma, Shashank wrote:
> > > Hello Emil,
> > > 
> > > Thanks for your time.
> > > 
> > > I have got mixed opinion on this.
> > > 
> > > IMHO we should expose them to userspace too, as UI agents like Hardware
> > > composer/X/Wayland must know what does these
> > > 
> > > flags means, so that they can display them on the end user screen (like
> > > settings menu)
> > > 
> > > But few people even think thats its too complex to be exposed to userspace
> > > agents.
> > > 
> > > So your suggestions are welcome.
> > These are flags for the internal mode representation, not for the uapi
> > one. They really don't belong into the uapi header, but instead into
> > include/drm/drm_modes.h. I.e. I fully concur with Emil.
> > -Daniel
> Please correct me if I am missing anything, but In that case, how will HWC/X
> apply a modeset
> 1920x1080@60 16:9 (Not 1920x1080@60 4:3)

Argh sorry, I mixed up the two mode structures again. You're correct.
-Daniel

> 
> Regards
> Shashank
> > > Regards
> > > Shashank
> > > 
> > > On 8/4/2016 3:12 PM, Emil Velikov wrote:
> > > > On 3 August 2016 at 11:56, Shashank Sharma <shashank.sharma@intel.com> wrote:
> > > > 
> > > > > --- a/include/uapi/drm/drm_mode.h
> > > > > +++ b/include/uapi/drm/drm_mode.h
> > > > > +
> > > > > +/* Aspect ratio flag bitmask (4 bits 22:19) */
> > > > > +#define DRM_MODE_FLAG_PARMASK                  (0x0F<<19)
> > > > > +#define  DRM_MODE_FLAG_PARNONE \
> > > > > +                       (DRM_MODE_PICTURE_ASPECT_NONE << 19)
> > > > > +#define  DRM_MODE_FLAG_PAR4_3 \
> > > > > +                       (DRM_MODE_PICTURE_ASPECT_4_3 << 19)
> > > > > +#define  DRM_MODE_FLAG_PAR16_9 \
> > > > > +                       (DRM_MODE_PICTURE_ASPECT_16_9 << 19)
> > > > > 
> > > > Afaict all these flags are internal/implementation specific thus we
> > > > shouldn't expose them to userspace. Right ?
> > > > 
> > > > -Emil
> > > _______________________________________________
> > > Intel-gfx mailing list
> > > Intel-gfx@lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
Daniel Vetter Aug. 4, 2016, 4:09 p.m. UTC | #11
On Thu, Aug 04, 2016 at 03:31:45PM +0100, Emil Velikov wrote:
> On 4 August 2016 at 14:15, Sharma, Shashank <shashank.sharma@intel.com> wrote:
> > On 8/4/2016 5:04 PM, Emil Velikov wrote:
> >>
> >> On 4 August 2016 at 11:16, Sharma, Shashank <shashank.sharma@intel.com>
> >> wrote:
> >>>
> >>> Hello Emil,
> >>>
> >>> Thanks for your time.
> >>>
> >>> I have got mixed opinion on this.
> >>>
> >>> IMHO we should expose them to userspace too, as UI agents like Hardware
> >>> composer/X/Wayland must know what does these
> >>>
> >>> flags means, so that they can display them on the end user screen (like
> >>> settings menu)
> >>>
> >>> But few people even think thats its too complex to be exposed to
> >>> userspace
> >>> agents.
> >>>
> >> If we want these/such flags passed between kernel and user space one must:
> >>   - Provide a kernel interface how to do that
> >>   - Provide a userspace (acked by respective developers/maintainers)
> >> that the approach is sane and proves useful.
> >>
> >> Since the above can take some time, I'd suggest dropping those from
> >> the UAPI header(s)... for now.
> >>
> >> -Emil
> >
> > Please guide me a bit more on this problem, Emil, Daniel.
> > The reason why I want to pass this to userspace is, so that, HWC/X/any other
> > UI manager, can send a modeset
> > which is accurate upto aspect ratio.
> >
> Nobody(?) is arguing that you don't to pass such information to/from
> userspace :-)
> Your series does the internal parsing/management of the attribute and
> has no actual UAPI implementation and/or userspace references (to
> code/discussions). Thus the UAPI changes should _not_ be part of these
> patches.
> 
> Daniel's blog [1] has many educational materials why and how things
> are done upstream. I would kindly invite you to give them (another?)
> courtesy read.

It reuses the already existing uapi mode structure. And since it extends
them both on the probe side and on the modeset set this means userspace
can just pass through the right probed mode and it'll all magically work.
At least that's the idea.

Now if you actually care about the different bits then you can select the
right mode, but that's about it. So if you want to compensate for the
non-square pixels in rendering then you need to look at it, but otherwise
it's just a case of select the mode you want. I don't see what new
userspace we'd need for that really, current one should all work nicely
as-is. At least the entire point of doing this was seamless support with
existing userspace.
-Daniel
Sharma, Shashank Aug. 5, 2016, 3:37 a.m. UTC | #12
Regards

Shashank


On 8/4/2016 9:39 PM, Daniel Vetter wrote:
> On Thu, Aug 04, 2016 at 03:31:45PM +0100, Emil Velikov wrote:
>> On 4 August 2016 at 14:15, Sharma, Shashank <shashank.sharma@intel.com> wrote:
>>> On 8/4/2016 5:04 PM, Emil Velikov wrote:
>>>> On 4 August 2016 at 11:16, Sharma, Shashank <shashank.sharma@intel.com>
>>>> wrote:
>>>>> Hello Emil,
>>>>>
>>>>> Thanks for your time.
>>>>>
>>>>> I have got mixed opinion on this.
>>>>>
>>>>> IMHO we should expose them to userspace too, as UI agents like Hardware
>>>>> composer/X/Wayland must know what does these
>>>>>
>>>>> flags means, so that they can display them on the end user screen (like
>>>>> settings menu)
>>>>>
>>>>> But few people even think thats its too complex to be exposed to
>>>>> userspace
>>>>> agents.
>>>>>
>>>> If we want these/such flags passed between kernel and user space one must:
>>>>    - Provide a kernel interface how to do that
>>>>    - Provide a userspace (acked by respective developers/maintainers)
>>>> that the approach is sane and proves useful.
>>>>
>>>> Since the above can take some time, I'd suggest dropping those from
>>>> the UAPI header(s)... for now.
>>>>
>>>> -Emil
>>> Please guide me a bit more on this problem, Emil, Daniel.
>>> The reason why I want to pass this to userspace is, so that, HWC/X/any other
>>> UI manager, can send a modeset
>>> which is accurate upto aspect ratio.
>>>
>> Nobody(?) is arguing that you don't to pass such information to/from
>> userspace :-)
>> Your series does the internal parsing/management of the attribute and
>> has no actual UAPI implementation and/or userspace references (to
>> code/discussions). Thus the UAPI changes should _not_ be part of these
>> patches.
>>
>> Daniel's blog [1] has many educational materials why and how things
>> are done upstream. I would kindly invite you to give them (another?)
>> courtesy read.
> It reuses the already existing uapi mode structure. And since it extends
> them both on the probe side and on the modeset set this means userspace
> can just pass through the right probed mode and it'll all magically work.
> At least that's the idea.
>
> Now if you actually care about the different bits then you can select the
> right mode, but that's about it. So if you want to compensate for the
> non-square pixels in rendering then you need to look at it, but otherwise
> it's just a case of select the mode you want. I don't see what new
> userspace we'd need for that really, current one should all work nicely
> as-is. At least the entire point of doing this was seamless support with
> existing userspace.
> -Daniel
Thanks Daniel, you explained the zest of this series better than me :)

Regards
Shashank
Jose Abreu Aug. 9, 2016, 1:12 p.m. UTC | #13
Hi Sharma,


On 05-08-2016 04:37, Sharma, Shashank wrote:
> Regards
>
> Shashank
>
>
> On 8/4/2016 9:39 PM, Daniel Vetter wrote:
>> On Thu, Aug 04, 2016 at 03:31:45PM +0100, Emil Velikov wrote:
>>> On 4 August 2016 at 14:15, Sharma, Shashank
>>> <shashank.sharma@intel.com> wrote:
>>>> On 8/4/2016 5:04 PM, Emil Velikov wrote:
>>>>> On 4 August 2016 at 11:16, Sharma, Shashank
>>>>> <shashank.sharma@intel.com>
>>>>> wrote:
>>>>>> Hello Emil,
>>>>>>
>>>>>> Thanks for your time.
>>>>>>
>>>>>> I have got mixed opinion on this.
>>>>>>
>>>>>> IMHO we should expose them to userspace too, as UI agents
>>>>>> like Hardware
>>>>>> composer/X/Wayland must know what does these
>>>>>>
>>>>>> flags means, so that they can display them on the end user
>>>>>> screen (like
>>>>>> settings menu)
>>>>>>
>>>>>> But few people even think thats its too complex to be
>>>>>> exposed to
>>>>>> userspace
>>>>>> agents.
>>>>>>
>>>>> If we want these/such flags passed between kernel and user
>>>>> space one must:
>>>>>    - Provide a kernel interface how to do that
>>>>>    - Provide a userspace (acked by respective
>>>>> developers/maintainers)
>>>>> that the approach is sane and proves useful.
>>>>>
>>>>> Since the above can take some time, I'd suggest dropping
>>>>> those from
>>>>> the UAPI header(s)... for now.
>>>>>
>>>>> -Emil
>>>> Please guide me a bit more on this problem, Emil, Daniel.
>>>> The reason why I want to pass this to userspace is, so that,
>>>> HWC/X/any other
>>>> UI manager, can send a modeset
>>>> which is accurate upto aspect ratio.
>>>>
>>> Nobody(?) is arguing that you don't to pass such information
>>> to/from
>>> userspace :-)
>>> Your series does the internal parsing/management of the
>>> attribute and
>>> has no actual UAPI implementation and/or userspace references
>>> (to
>>> code/discussions). Thus the UAPI changes should _not_ be part
>>> of these
>>> patches.
>>>
>>> Daniel's blog [1] has many educational materials why and how
>>> things
>>> are done upstream. I would kindly invite you to give them
>>> (another?)
>>> courtesy read.
>> It reuses the already existing uapi mode structure. And since
>> it extends
>> them both on the probe side and on the modeset set this means
>> userspace
>> can just pass through the right probed mode and it'll all
>> magically work.
>> At least that's the idea.
>>
>> Now if you actually care about the different bits then you can
>> select the
>> right mode, but that's about it. So if you want to compensate
>> for the
>> non-square pixels in rendering then you need to look at it,
>> but otherwise
>> it's just a case of select the mode you want. I don't see what
>> new
>> userspace we'd need for that really, current one should all
>> work nicely
>> as-is. At least the entire point of doing this was seamless
>> support with
>> existing userspace.
>> -Daniel
> Thanks Daniel, you explained the zest of this series better
> than me :)
>
> Regards
> Shashank
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Will you send a new version of these patches? I have a patch
ready that adds the new HDMI 2.0 modes to the CEA modes list in
DRM but these modes require the addition of the new picture
aspect ratio flags (64:27, 256:135). I can either wait that your
patches get accepted or I can add to my patch set one that adds
the new PAR flags.

Best regards,
Jose Miguel Abreu
Daniel Vetter Aug. 9, 2016, 1:44 p.m. UTC | #14
On Tue, Aug 9, 2016 at 3:12 PM, Jose Abreu <Jose.Abreu@synopsys.com> wrote:
> Will you send a new version of these patches? I have a patch
> ready that adds the new HDMI 2.0 modes to the CEA modes list in
> DRM but these modes require the addition of the new picture
> aspect ratio flags (64:27, 256:135). I can either wait that your
> patches get accepted or I can add to my patch set one that adds
> the new PAR flags.

Please base your work on top of Sharma's entire patch series - I
suspect that Sharma's patch series already covers all you really need.
With the exception of then correctly encoding the chosen aspect ratio
into the infoframes.
-Daniel
Sharma, Shashank Aug. 9, 2016, 1:57 p.m. UTC | #15
Thanks Daniel.
 
Hi Joes, 
As Daniel mentioned, I have already written a patch which adds all HDMI 2.0 modes in CEA DB, and it also completes all the VICs in the DB from 1-107 (we have 1-64 now).

I was myself waiting for aspect ratio patches to get accepted, as I needed them for the modes. 
Will keep you in CC. 

I am planning to send a new patch set by tonight. 

Regards
Shashank

-----Original Message-----
From: daniel.vetter@ffwll.ch [mailto:daniel.vetter@ffwll.ch] On Behalf Of Daniel Vetter

Sent: Tuesday, August 9, 2016 7:14 PM
To: Jose Abreu <Jose.Abreu@synopsys.com>
Cc: Sharma, Shashank <shashank.sharma@intel.com>; Emil Velikov <emil.l.velikov@gmail.com>; Vetter, Daniel <daniel.vetter@intel.com>; intel-gfx@lists.freedesktop.org; ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH 1/4] drm: add picture aspect ratio flags

On Tue, Aug 9, 2016 at 3:12 PM, Jose Abreu <Jose.Abreu@synopsys.com> wrote:
> Will you send a new version of these patches? I have a patch ready 

> that adds the new HDMI 2.0 modes to the CEA modes list in DRM but 

> these modes require the addition of the new picture aspect ratio flags 

> (64:27, 256:135). I can either wait that your patches get accepted or 

> I can add to my patch set one that adds the new PAR flags.


Please base your work on top of Sharma's entire patch series - I suspect that Sharma's patch series already covers all you really need.
With the exception of then correctly encoding the chosen aspect ratio into the infoframes.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Emil Velikov Aug. 18, 2016, 10:15 a.m. UTC | #16
On 4 August 2016 at 17:09, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Thu, Aug 04, 2016 at 03:31:45PM +0100, Emil Velikov wrote:
>> On 4 August 2016 at 14:15, Sharma, Shashank <shashank.sharma@intel.com> wrote:
>> > On 8/4/2016 5:04 PM, Emil Velikov wrote:
>> >>
>> >> On 4 August 2016 at 11:16, Sharma, Shashank <shashank.sharma@intel.com>
>> >> wrote:
>> >>>
>> >>> Hello Emil,
>> >>>
>> >>> Thanks for your time.
>> >>>
>> >>> I have got mixed opinion on this.
>> >>>
>> >>> IMHO we should expose them to userspace too, as UI agents like Hardware
>> >>> composer/X/Wayland must know what does these
>> >>>
>> >>> flags means, so that they can display them on the end user screen (like
>> >>> settings menu)
>> >>>
>> >>> But few people even think thats its too complex to be exposed to
>> >>> userspace
>> >>> agents.
>> >>>
>> >> If we want these/such flags passed between kernel and user space one must:
>> >>   - Provide a kernel interface how to do that
>> >>   - Provide a userspace (acked by respective developers/maintainers)
>> >> that the approach is sane and proves useful.
>> >>
>> >> Since the above can take some time, I'd suggest dropping those from
>> >> the UAPI header(s)... for now.
>> >>
>> >> -Emil
>> >
>> > Please guide me a bit more on this problem, Emil, Daniel.
>> > The reason why I want to pass this to userspace is, so that, HWC/X/any other
>> > UI manager, can send a modeset
>> > which is accurate upto aspect ratio.
>> >
>> Nobody(?) is arguing that you don't to pass such information to/from
>> userspace :-)
>> Your series does the internal parsing/management of the attribute and
>> has no actual UAPI implementation and/or userspace references (to
>> code/discussions). Thus the UAPI changes should _not_ be part of these
>> patches.
>>
>> Daniel's blog [1] has many educational materials why and how things
>> are done upstream. I would kindly invite you to give them (another?)
>> courtesy read.
>
> It reuses the already existing uapi mode structure. And since it extends
> them both on the probe side and on the modeset set this means userspace
> can just pass through the right probed mode and it'll all magically work.
> At least that's the idea.
>
> Now if you actually care about the different bits then you can select the
> right mode, but that's about it. So if you want to compensate for the
> non-square pixels in rendering then you need to look at it, but otherwise
> it's just a case of select the mode you want. I don't see what new
> userspace we'd need for that really, current one should all work nicely
> as-is. At least the entire point of doing this was seamless support with
> existing userspace.
I failed to click that drm_mode_convert_umode does input validation,
apart from the actual conversion.

Thanks a lot gents and sorry for the noise.
Emil
diff mbox

Patch

diff --git a/include/uapi/drm/drm_mode.h b/include/uapi/drm/drm_mode.h
index 49a7265..cd66a95 100644
--- a/include/uapi/drm/drm_mode.h
+++ b/include/uapi/drm/drm_mode.h
@@ -77,6 +77,19 @@  extern "C" {
 #define  DRM_MODE_FLAG_3D_TOP_AND_BOTTOM	(7<<14)
 #define  DRM_MODE_FLAG_3D_SIDE_BY_SIDE_HALF	(8<<14)
 
+/* Picture aspect ratio options */
+#define DRM_MODE_PICTURE_ASPECT_NONE		0
+#define DRM_MODE_PICTURE_ASPECT_4_3		1
+#define DRM_MODE_PICTURE_ASPECT_16_9		2
+
+/* Aspect ratio flag bitmask (4 bits 22:19) */
+#define DRM_MODE_FLAG_PARMASK			(0x0F<<19)
+#define  DRM_MODE_FLAG_PARNONE \
+			(DRM_MODE_PICTURE_ASPECT_NONE << 19)
+#define  DRM_MODE_FLAG_PAR4_3 \
+			(DRM_MODE_PICTURE_ASPECT_4_3 << 19)
+#define  DRM_MODE_FLAG_PAR16_9 \
+			(DRM_MODE_PICTURE_ASPECT_16_9 << 19)
 
 /* DPMS flags */
 /* bit compatible with the xorg definitions. */
@@ -92,11 +105,6 @@  extern "C" {
 #define DRM_MODE_SCALE_CENTER		2 /* Centered, no scaling */
 #define DRM_MODE_SCALE_ASPECT		3 /* Full screen, preserve aspect */
 
-/* Picture aspect ratio options */
-#define DRM_MODE_PICTURE_ASPECT_NONE	0
-#define DRM_MODE_PICTURE_ASPECT_4_3	1
-#define DRM_MODE_PICTURE_ASPECT_16_9	2
-
 /* Dithering mode options */
 #define DRM_MODE_DITHERING_OFF	0
 #define DRM_MODE_DITHERING_ON	1