From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: "Nautiyal, Ankit K" <ankit.k.nautiyal@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"ppaalanen@gmail.com" <ppaalanen@gmail.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH v11 07/11] drm: Add helper functions to handle aspect-ratio flag bits
Date: Mon, 23 Apr 2018 13:13:19 +0300 [thread overview]
Message-ID: <20180423101319.GF13908@intel.com> (raw)
In-Reply-To: <5e2c6605-f5a6-3ed4-94d1-229f2d14ae55@intel.com>
On Mon, Apr 23, 2018 at 10:55:54AM +0530, Nautiyal, Ankit K wrote:
>
>
> On 4/20/2018 7:42 PM, Ville Syrjälä wrote:
> > On Fri, Apr 20, 2018 at 07:01:47PM +0530, Nautiyal, Ankit K wrote:
> >> From: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> >>
> >> This patch adds helper functions for determining if aspect-ratio is
> >> expected in user-mode and for allowing/disallowing the aspect-ratio,
> >> if its not expected.
> >>
> >> Signed-off-by: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
> >> ---
> >> drivers/gpu/drm/drm_modes.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
> >> include/drm/drm_modes.h | 4 ++++
> >> 2 files changed, 51 insertions(+)
> >>
> >> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> >> index c395a24..d6133e8 100644
> >> --- a/drivers/gpu/drm/drm_modes.c
> >> +++ b/drivers/gpu/drm/drm_modes.c
> >> @@ -1759,3 +1759,50 @@ bool drm_mode_is_420(const struct drm_display_info *display,
> >> drm_mode_is_420_also(display, mode);
> >> }
> >> EXPORT_SYMBOL(drm_mode_is_420);
> >> +
> >> +/**
> >> + * drm_mode_aspect_ratio_allowed - checks if the aspect-ratio information
> >> + * is expected from the user-mode.
> >> + *
> >> + * If the user has set aspect-ratio cap, then the flag of the user-mode is
> >> + * allowed to contain aspect-ratio value.
> >> + * If the user does not set aspect-ratio cap, then the only value allowed in the
> >> + * flags bits is aspect-ratio NONE.
> >> + *
> >> + * @file_priv: file private structure to get the user capabilities
> >> + * @umode: drm_mode_modeinfo struct, whose flag carry the aspect ratio
> >> + * information.
> >> + *
> >> + * Returns:
> >> + * true if the aspect-ratio info is allowed in the user-mode flags.
> >> + * false, otherwise.
> >> + */
> >> +bool
> >> +drm_mode_aspect_ratio_allowed(const struct drm_file *file_priv,
> >> + struct drm_mode_modeinfo *umode)
> >> +{
> >> + return file_priv->aspect_ratio_allowed || (umode->flags &
> >> + DRM_MODE_FLAG_PIC_AR_MASK) == DRM_MODE_FLAG_PIC_AR_NONE;
> > Odd line split here. Makes this a bit hard to read.
> > I would split after the ||
>
> Agreed. I wasn't sure how to let it have better readability and less
> than 80 char length
> at the same time. Will fix this.
>
> >
> >> +}
> >> +EXPORT_SYMBOL(drm_mode_aspect_ratio_allowed);
> > Do we actually need to export these? I don't think so.
> >
> > But I might be wrong. It's a bit hard to see with the way
> > you split this patch with the actual users in a different patch.
>
> These helper functions are used in drm_mode_atomic.c, drm_mode_crtc.c,
> and drm_mode_get_connector.c
> The patches are split as to have modes-set handling separate and the
> exposing of connector separate.
> Do you suggest this patch to be merged with the patch for handling
> aspect-ratio in modeset?
Usually if you add a function you should do it in the same patch where
you add the user(s) for said function. Otherwise it's impossibly to
judge whether the new function is any good.
>
> >> +
> >> +/**
> >> + * drm_mode_filter_aspect_ratio_flags - filters the aspect-ratio bits in the
> >> + * user-mode flags.
> >> + *
> >> + * Checks if the aspect-ratio information is allowed. Resets the aspect-ratio
> >> + * bits in the user-mode flags, if aspect-ratio info is not allowed.
> >> + *
> >> + * @file_priv: file private structure to get the user capabilities.
> >> + * @umode: drm_mode_modeinfo struct, whose flags' aspect-ratio bits needs to
> >> + * be filtered.
> >> + *
> >> + */
> >> +void
> >> +drm_mode_filter_aspect_ratio_flags(const struct drm_file *file_priv,
> >> + struct drm_mode_modeinfo *umode)
> >> +{
> >> + if (!drm_mode_aspect_ratio_allowed(file_priv, umode))
> >> + umode->flags &= ~DRM_MODE_FLAG_PIC_AR_MASK;
> >> +}
> >> +EXPORT_SYMBOL(drm_mode_filter_aspect_ratio_flags);
> >> diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
> >> index 2f78b7e..e0b060d 100644
> >> --- a/include/drm/drm_modes.h
> >> +++ b/include/drm/drm_modes.h
> >> @@ -461,6 +461,10 @@ bool drm_mode_is_420_also(const struct drm_display_info *display,
> >> const struct drm_display_mode *mode);
> >> bool drm_mode_is_420(const struct drm_display_info *display,
> >> const struct drm_display_mode *mode);
> >> +bool drm_mode_aspect_ratio_allowed(const struct drm_file *file_priv,
> >> + struct drm_mode_modeinfo *umode);
> >> +void drm_mode_filter_aspect_ratio_flags(const struct drm_file *file_priv,
> >> + struct drm_mode_modeinfo *umode);
> >>
> >> struct drm_display_mode *drm_cvt_mode(struct drm_device *dev,
> >> int hdisplay, int vdisplay, int vrefresh,
> >> --
> >> 2.7.4
>
--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2018-04-23 10:13 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-20 13:31 [PATCH v11 00/11] Aspect ratio support in DRM layer Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 01/11] drm/modes: Introduce drm_mode_match() Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 02/11] drm/edid: Use drm_mode_match_no_clocks_no_stereo() for consistentcy Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 03/11] drm/edid: Fix cea mode aspect ratio handling Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 04/11] drm/edid: Don't send bogus aspect ratios in AVI infoframes Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 05/11] video/hdmi: Reject illegal picture aspect ratios Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 06/11] drm: Add DRM client cap for aspect-ratio Nautiyal, Ankit K
2018-04-20 14:07 ` Ville Syrjälä
2018-04-23 5:13 ` Nautiyal, Ankit K
2018-04-23 10:11 ` Ville Syrjälä
2018-04-26 14:23 ` [Intel-gfx] " Ville Syrjälä
2018-04-20 13:31 ` [PATCH v11 07/11] drm: Add helper functions to handle aspect-ratio flag bits Nautiyal, Ankit K
2018-04-20 14:12 ` Ville Syrjälä
2018-04-23 5:25 ` Nautiyal, Ankit K
2018-04-23 10:13 ` Ville Syrjälä [this message]
2018-04-24 4:10 ` Nautiyal, Ankit K
2018-04-23 10:22 ` Jani Nikula
2018-04-24 4:01 ` Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 08/11] drm: Handle aspect ratio info in legacy and atomic modeset paths Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 09/11] drm: Expose modes with aspect ratio, only if requested Nautiyal, Ankit K
2018-04-20 14:22 ` Ville Syrjälä
2018-04-23 5:49 ` Nautiyal, Ankit K
2018-04-23 10:16 ` Ville Syrjälä
2018-04-20 13:31 ` [PATCH v11 10/11] drm: Add aspect ratio parsing in DRM layer Nautiyal, Ankit K
2018-04-20 13:31 ` [PATCH v11 11/11] drm: Add and handle new aspect ratios " Nautiyal, Ankit K
2018-04-20 16:34 ` ✗ Fi.CI.CHECKPATCH: warning for Aspect ratio support " Patchwork
2018-04-20 16:58 ` ✓ Fi.CI.BAT: success " Patchwork
2018-04-20 18:03 ` ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180423101319.GF13908@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=ankit.k.nautiyal@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ppaalanen@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox