Currently DRM framework doesn't parse aspect ratio of a videomode
while converting it from a umode->kmode or viceversa. This causes
modeset of CEA modes with incorrect aspect ratio.
While running HDMI complaince, tests (like 7-27) expect the DUT
to apply the mode as per the VIC, but as driver does not consider
the aspect ratio part while searching a mode from modedb, we end
up setting mode with a wrong VIC, causing the test to fail.
What this patch set does:
Patch 1-2
- Adds aspect ratio flags in the DRM layer, in form of flags.
- Adds parsing of aspect ratio, during conversion of a umode->kmode
and viceversa.
- Adds aspect ratio check while finding a mode, during modeset.
Patch 3-5
- Adds some new aspect ratio defined in CEA-861-F specs to
support HDMI 2.0 displays, in DRM and I915 layer.
Shashank Sharma (5):
drm: add picture aspect ratio flags
drm: Add aspect ratio parsing in DRM layer
video: Add new aspect ratios for HDMI 2.0
drm: Add flags for new aspect ratios
drm/i915: Add support for new aspect ratios
drivers/gpu/drm/drm_modes.c | 46 +++++++++++++++++++++++++++++++++++++++
drivers/gpu/drm/i915/intel_hdmi.c | 6 +++++
drivers/gpu/drm/i915/intel_sdvo.c | 6 +++++
drivers/video/hdmi.c | 4 ++++
include/linux/hdmi.h | 2 ++
include/uapi/drm/drm_mode.h | 24 +++++++++++++++-----
6 files changed, 83 insertions(+), 5 deletions(-)
--
1.9.1
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 <redacted>
---
include/uapi/drm/drm_mode.h | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
Current DRM layer functions dont parse aspect ratio information
while converting a user mode->kernel mode or viceversa. This
causes modeset to pick mode with wrong aspect ratio, eventually
cauing failures in HDMI compliance test cases, due to wrong VIC.
This patch adds aspect ratio information in DRM's mode conversion
and mode comparision functions, to make sure kernel picks mode
with right aspect ratio (as per the VIC).
Signed-off-by: Shashank Sharma <redacted>
Signed-off-by: Lin, Jia <redacted>
Signed-off-by: Akashdeep Sharma <redacted>
---
drivers/gpu/drm/drm_modes.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
@@ -1514,6 +1534,20 @@ int drm_mode_convert_umode(struct drm_display_mode *out,strncpy(out->name,in->name,DRM_DISPLAY_MODE_LEN);out->name[DRM_DISPLAY_MODE_LEN-1]=0;+/* Clearing picture aspect ratio bits from out flags */+out->flags&=~DRM_MODE_FLAG_PARMASK;++switch(in->flags&DRM_MODE_FLAG_PARMASK){+caseDRM_MODE_FLAG_PAR4_3:+out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_4_3;+break;+caseDRM_MODE_FLAG_PAR16_9:+out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_16_9;+break;+default:+out->picture_aspect_ratio=HDMI_PICTURE_ASPECT_NONE;+}+out->status=drm_mode_validate_basic(out);if(out->status!=MODE_OK)gotoout;
HDMI 2.0/CEA-861-F introduces two new aspect ratios:
- 64:27
- 256:135
This patch adds enumeration for the new aspect ratios
in the existing aspect ratio list.
Signed-off-by: Shashank Sharma <redacted>
---
drivers/video/hdmi.c | 4 ++++
include/linux/hdmi.h | 2 ++
2 files changed, 6 insertions(+)
HDMI 2.0/CEA-861-F introduces two new aspect ratios:
- 64:27
- 256:135
This patch adds DRM flags for the new aspect ratios
in the existing aspect ratio flags.
Signed-off-by: Shashank Sharma <redacted>
---
include/uapi/drm/drm_mode.h | 6 ++++++
1 file changed, 6 insertions(+)
From: Daniel Vetter <hidden> Date: 2016-04-21 15:04:14
On Fri, Mar 25, 2016 at 01:47:35PM +0530, Shashank Sharma wrote:
HDMI 2.0/CEA-861-F introduces two new aspect ratios:
- 64:27
- 256:135
This patch adds support for these aspect ratios in
I915 driver, at various places.
Signed-off-by: Shashank Sharma <redacted>
Ok, we discussed this a bit internally and I had some questions. Reading
this series patches make sense up to this one, but here I have a few
questions/comments.
The trouble with the aspect_ratio prop as currently implemented is that we
currently unconditionally overwrite adjusted_mode->picture_aspect_ratio
with it.
But your patches here move the aspect ratio handling into
drm_mode_modeinfo (uabi) and drm_display_mode (kernel-internal), where it
imo belongs. But we need to figure out how to the interaction with the
property correctly. What's probably needed is a new value in the
aspect_ratio enum called "default", which selects the aspect_ratio from
the mode. Only when userspace overrides (NONE, or one of the CEA aspect
ratios) would we obey the aspect_ratio of the property. Otherwise the
aspect ratio stored in the mode would be lost.
The other bit that I can't find in this series is making sure we compute
the VIC correctly for the new modes. Or does that magically work correctly
since we compare the full mode when selecting VICs?
Thanks, Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
Thanks for the review Daniel.
My comments inline.
Regards
Shashank
On 4/21/2016 8:34 PM, Daniel Vetter wrote:
On Fri, Mar 25, 2016 at 01:47:35PM +0530, Shashank Sharma wrote:
quoted
HDMI 2.0/CEA-861-F introduces two new aspect ratios:
- 64:27
- 256:135
This patch adds support for these aspect ratios in
I915 driver, at various places.
Signed-off-by: Shashank Sharma <redacted>
Ok, we discussed this a bit internally and I had some questions. Reading
this series patches make sense up to this one, but here I have a few
questions/comments.
@@ -1544,6 +1550,12 @@ int drm_mode_convert_umode(struct drm_display_mode *out,caseDRM_MODE_FLAG_PAR16_9:out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_16_9;break;+caseDRM_MODE_FLAG_PAR64_27:+out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_64_27;+break;+caseDRM_MODE_FLAG_PAR256_135:+out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_256_135;+break;default:out->picture_aspect_ratio=HDMI_PICTURE_ASPECT_NONE;}
Above two parts is core enabling, I guess those should be squashed into
the preceeding patch?
Sure, we can do this.
The idea was to create a separate patch for new aspect ratio, so that
one can segregate HDMI 2.0 patches and HDMI 1.4 patches. If you still
recommend this, I can move this part in next patch.
The trouble with the aspect_ratio prop as currently implemented is that we
currently unconditionally overwrite adjusted_mode->picture_aspect_ratio
with it.
But your patches here move the aspect ratio handling into
drm_mode_modeinfo (uabi) and drm_display_mode (kernel-internal), where it
imo belongs. But we need to figure out how to the interaction with the
property correctly. What's probably needed is a new value in the
aspect_ratio enum called "default", which selects the aspect_ratio from
the mode. Only when userspace overrides (NONE, or one of the CEA aspect
ratios) would we obey the aspect_ratio of the property. Otherwise the
aspect ratio stored in the mode would be lost.
This is exactly how we have handled this in Android branch(with NONE as
default), thanks for the suggestion. I will incorporate this in next
patch set.
The other bit that I can't find in this series is making sure we compute
the VIC correctly for the new modes. Or does that magically work correctly
since we compare the full mode when selecting VICs?
Yes, we are saving the right VIC from EDID, so the VIC is now a part of
the mode flags, all we have to do extract this and write during
preparing AVI-IF, we have a small one line patch for that. I will add
that too in the next series.
From: Daniel Vetter <hidden> Date: 2016-04-22 08:09:19
On Fri, Apr 22, 2016 at 10:58:34AM +0530, Sharma, Shashank wrote:
Thanks for the review Daniel.
My comments inline.
Regards
Shashank
On 4/21/2016 8:34 PM, Daniel Vetter wrote:
quoted
On Fri, Mar 25, 2016 at 01:47:35PM +0530, Shashank Sharma wrote:
quoted
HDMI 2.0/CEA-861-F introduces two new aspect ratios:
- 64:27
- 256:135
This patch adds support for these aspect ratios in
I915 driver, at various places.
Signed-off-by: Shashank Sharma <redacted>
Ok, we discussed this a bit internally and I had some questions. Reading
this series patches make sense up to this one, but here I have a few
questions/comments.
@@ -1544,6 +1550,12 @@ int drm_mode_convert_umode(struct drm_display_mode *out,caseDRM_MODE_FLAG_PAR16_9:out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_16_9;break;+caseDRM_MODE_FLAG_PAR64_27:+out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_64_27;+break;+caseDRM_MODE_FLAG_PAR256_135:+out->picture_aspect_ratio|=HDMI_PICTURE_ASPECT_256_135;+break;default:out->picture_aspect_ratio=HDMI_PICTURE_ASPECT_NONE;}
Above two parts is core enabling, I guess those should be squashed into
the preceeding patch?
Sure, we can do this.
The idea was to create a separate patch for new aspect ratio, so that one
can segregate HDMI 2.0 patches and HDMI 1.4 patches. If you still recommend
this, I can move this part in next patch.
Definitely a good idea, and you have that separate patch already in "drm:
Add flags for new aspect ratios". I just think that the above 2 hunks
belong into the core patch, not the i915 enabling patch.
The trouble with the aspect_ratio prop as currently implemented is that we
currently unconditionally overwrite adjusted_mode->picture_aspect_ratio
with it.
But your patches here move the aspect ratio handling into
drm_mode_modeinfo (uabi) and drm_display_mode (kernel-internal), where it
imo belongs. But we need to figure out how to the interaction with the
property correctly. What's probably needed is a new value in the
aspect_ratio enum called "default", which selects the aspect_ratio from
the mode. Only when userspace overrides (NONE, or one of the CEA aspect
ratios) would we obey the aspect_ratio of the property. Otherwise the
aspect ratio stored in the mode would be lost.
This is exactly how we have handled this in Android branch(with NONE as
default), thanks for the suggestion. I will incorporate this in next patch
set.
Yeah, we can't reuse NONE in case someone wants to explicitly have no
aspect ratio (which means we'll not transmit the VIC code in the
infoframes most likely). At least I think adding a new DEFAULT instead of
overloading NONE is the better approach.
quoted
The other bit that I can't find in this series is making sure we compute
the VIC correctly for the new modes. Or does that magically work correctly
since we compare the full mode when selecting VICs?
Yes, we are saving the right VIC from EDID, so the VIC is now a part of the
mode flags, all we have to do extract this and write during preparing
AVI-IF, we have a small one line patch for that. I will add that too in the
next series.
Ah I was a bit unclear. But reading more code it's indeed that we have
aspect-ratio already stored in the edid parsing code for the VIC modes in
the static table. And with your kernel-mode to umode patches it'll show up
in the userspace mode list. And then userspace can request that mode, and
umode to kernel-mode will preserve it. And finally we can compute the
right VIC from that again.
So seems solid, only thing to change is how we take the i915 property into
account. On that topic: Do we really need to keep that property, or could
we just remove it? I assume the only real user is android, and that's
still closed, so we could just nuke it I guess ;-) That would be even
simpler.
And with the new flags userspace still has the option to override the
aspect ratio mode if it wants to.
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch