dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/22] drm: Add drm_format_plane_width() and drm_format_plane_height()
       [not found] <1444840154-7804-1-git-send-email-ville.syrjala@linux.intel.com>
@ 2015-10-14 16:28 ` ville.syrjala
  2015-10-21  9:53   ` Daniel Vetter
  0 siblings, 1 reply; 2+ messages in thread
From: ville.syrjala @ 2015-10-14 16:28 UTC (permalink / raw)
  To: intel-gfx; +Cc: dri-devel

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Add a few helpers to get the dimensions of the chroma plane(s).

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 include/drm/drm_crtc.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 33ddedd..317baf9 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -1497,6 +1497,18 @@ extern int drm_format_num_planes(uint32_t format);
 extern int drm_format_plane_cpp(uint32_t format, int plane);
 extern int drm_format_horz_chroma_subsampling(uint32_t format);
 extern int drm_format_vert_chroma_subsampling(uint32_t format);
+static inline int drm_format_plane_width(int width, uint32_t format, int plane)
+{
+	if (plane == 0)
+		return width;
+	return width / drm_format_horz_chroma_subsampling(format);
+}
+static inline int drm_format_plane_height(int height, uint32_t format, int plane)
+{
+	if (plane == 0)
+		return height;
+	return height / drm_format_vert_chroma_subsampling(format);
+}
 extern const char *drm_get_format_name(uint32_t format);
 extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
 							      unsigned int supported_rotations);
-- 
2.4.9

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 01/22] drm: Add drm_format_plane_width() and drm_format_plane_height()
  2015-10-14 16:28 ` [PATCH 01/22] drm: Add drm_format_plane_width() and drm_format_plane_height() ville.syrjala
@ 2015-10-21  9:53   ` Daniel Vetter
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2015-10-21  9:53 UTC (permalink / raw)
  To: ville.syrjala; +Cc: intel-gfx, dri-devel

On Wed, Oct 14, 2015 at 07:28:53PM +0300, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Add a few helpers to get the dimensions of the chroma plane(s).
> 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  include/drm/drm_crtc.h | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
> index 33ddedd..317baf9 100644
> --- a/include/drm/drm_crtc.h
> +++ b/include/drm/drm_crtc.h
> @@ -1497,6 +1497,18 @@ extern int drm_format_num_planes(uint32_t format);
>  extern int drm_format_plane_cpp(uint32_t format, int plane);
>  extern int drm_format_horz_chroma_subsampling(uint32_t format);
>  extern int drm_format_vert_chroma_subsampling(uint32_t format);
> +static inline int drm_format_plane_width(int width, uint32_t format, int plane)
> +{
> +	if (plane == 0)
> +		return width;
> +	return width / drm_format_horz_chroma_subsampling(format);
> +}
> +static inline int drm_format_plane_height(int height, uint32_t format, int plane)
> +{
> +	if (plane == 0)
> +		return height;
> +	return height / drm_format_vert_chroma_subsampling(format);
> +}

A bit of kerneldoc would be neat. Either way Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>  extern const char *drm_get_format_name(uint32_t format);
>  extern struct drm_property *drm_mode_create_rotation_property(struct drm_device *dev,
>  							      unsigned int supported_rotations);
> -- 
> 2.4.9
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-21  9:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1444840154-7804-1-git-send-email-ville.syrjala@linux.intel.com>
2015-10-14 16:28 ` [PATCH 01/22] drm: Add drm_format_plane_width() and drm_format_plane_height() ville.syrjala
2015-10-21  9:53   ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox