lkml.org 
[lkml]   [2019]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 04/20] drm/fourcc: Pass the format_info pointer to drm_format_plane_width/height
On Wed, Apr 17, 2019 at 12:47:48PM +0200, Maarten Lankhorst wrote:
> > +/**
> > + * drm_format_info_plane_width - width of the plane given the first plane
> > + * @format: pixel format info
> > + * @width: width of the first plane
> > + * @plane: plane index
> > + *
> > + * Returns:
> > + * The width of @plane, given that the width of the first plane is @width.
> > + */
> > +static inline
> > +int drm_format_info_plane_width(const struct drm_format_info *info, int width,
> > + int plane)
> > +{
> > + if (!info || plane >= info->num_planes)
> > + return 0;
> > +
> > + if (plane == 0)
> > + return width;
> > +
> > + return width / info->hsub;
> > +}
> > +
> > +/**
> > + * drm_format_info_plane_height - height of the plane given the first plane
> > + * @format: pixel format info
> > + * @height: height of the first plane
> > + * @plane: plane index
> > + *
> > + * Returns:
> > + * The height of @plane, given that the height of the first plane is @height.
> > + */
> > +static inline
> > +int drm_format_info_plane_height(const struct drm_format_info *info, int height,
> > + int plane)
> > +{
> > + if (!info || plane >= info->num_planes)
> > + return 0;
> > +
> > + if (plane == 0)
> > + return height;
> > +
> > + return height / info->vsub;
> > +}
>
> Why the null checks? None of the other inlines for drm_format_info
> perform them.

Unless I'm mistaken, the subsampling only applies to the planes with
the chrominance, which are always >= 1. Therefore the plane 0 is
always the luminance, to which the subsampling doesn't apply.

Or are you talking about something else?

Maxime

--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-04-17 13:03    [W:0.227 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site