Re: [PATCH 01/37] drm/doc: move printf helpers out of drmP.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/24/2017 04:51 PM, Daniel Vetter wrote:
> And document them lightly. Unfortunately kernel-doc isn't the most
> awesome for documenting #defines that don't look like functions, it
> makes functions out of them :-/
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxxx>
> ---
>  include/drm/drmP.h      | 17 -----------------
>  include/drm/drm_modes.h | 17 +++++++++++++++++
>  include/drm/drm_rect.h  | 27 +++++++++++++++++++++++++++
>  3 files changed, 44 insertions(+), 17 deletions(-)
> 
> diff --git a/include/drm/drmP.h b/include/drm/drmP.h
> index b9b5566acfe6..575b29b47811 100644
> --- a/include/drm/drmP.h
> +++ b/include/drm/drmP.h
> @@ -292,23 +292,6 @@ struct pci_controller;
>  /* Format strings and argument splitters to simplify printing
>   * various "complex" objects
>   */
> -#define DRM_MODE_FMT    "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
> -#define DRM_MODE_ARG(m) \
> -	(m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \
> -	(m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
> -	(m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
> -	(m)->type, (m)->flags
> -
> -#define DRM_RECT_FMT    "%dx%d%+d%+d"
> -#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
> -
> -/* for rect's in fixed-point format: */
> -#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
> -#define DRM_RECT_FP_ARG(r) \
> -		drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
> -		drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
> -		(r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
> -		(r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
>  
>  /*@}*/
>  
> diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h
> index 6dd34280e892..94ac771fe460 100644
> --- a/include/drm/drm_modes.h
> +++ b/include/drm/drm_modes.h
> @@ -197,6 +197,8 @@ enum drm_mode_status {
>   * there's the hardware timings, which are corrected for interlacing,
>   * double-clocking and similar things. They are provided as a convenience, and
>   * can be appropriately computed using drm_mode_set_crtcinfo().
> + *
> + * For printing you can use %DRM_MODE_FMT and DRM_MODE_ARG().
>   */
>  struct drm_display_mode {
>  	/**
> @@ -407,6 +409,21 @@ struct drm_display_mode {
>  	enum hdmi_picture_aspect picture_aspect_ratio;
>  };
>  
> +/**
> + * DRM_MODE_FMT - printf string for &struct drm_display_mode
> + */
> +#define DRM_MODE_FMT    "%d:\"%s\" %d %d %d %d %d %d %d %d %d %d 0x%x 0x%x"
> +
> +/**
> + * DRM_MODE_ARG - printf arguments for &struct drm_display_mode
> + * @m: display mode
> + */
> +#define DRM_MODE_ARG(m) \
> +	(m)->base.id, (m)->name, (m)->vrefresh, (m)->clock, \
> +	(m)->hdisplay, (m)->hsync_start, (m)->hsync_end, (m)->htotal, \
> +	(m)->vdisplay, (m)->vsync_start, (m)->vsync_end, (m)->vtotal, \
> +	(m)->type, (m)->flags
> +
>  #define obj_to_mode(x) container_of(x, struct drm_display_mode, base)
>  
>  /**
> diff --git a/include/drm/drm_rect.h b/include/drm/drm_rect.h
> index 83bb156d4356..44bc122b9ee0 100644
> --- a/include/drm/drm_rect.h
> +++ b/include/drm/drm_rect.h
> @@ -43,6 +43,33 @@ struct drm_rect {
>  };
>  
>  /**
> + * DRM_RECT_FMT - printf string for &struct drm_rect
> + */
> +#define DRM_RECT_FMT    "%dx%d%+d%+d"
> +/**
> + * DRM_RECT_ARG - printf arguments for &struct drm_rect
> + * @r: rectangle struct
> + */
> +#define DRM_RECT_ARG(r) drm_rect_width(r), drm_rect_height(r), (r)->x1, (r)->y1
> +
> +/**
> + * DRM_RECT_FP_FMT - printf string for &struct drm_rect in 16.16 fixed point
> + */
> +#define DRM_RECT_FP_FMT "%d.%06ux%d.%06u%+d.%06u%+d.%06u"
> +/**
> + * DRM_RECT_FP_ARG - printf arguments for &struct drm_rect in 16.16 fixed point
> + * @r: rectangle struct
> + *
> + * This is useful for e.g. printing plane source rectangles, which are in 16.16
> + * fixed point.
> + */
> +#define DRM_RECT_FP_ARG(r) \
> +		drm_rect_width(r) >> 16, ((drm_rect_width(r) & 0xffff) * 15625) >> 10, \
> +		drm_rect_height(r) >> 16, ((drm_rect_height(r) & 0xffff) * 15625) >> 10, \
> +		(r)->x1 >> 16, (((r)->x1 & 0xffff) * 15625) >> 10, \
> +		(r)->y1 >> 16, (((r)->y1 & 0xffff) * 15625) >> 10
> +
> +/**
>   * drm_rect_adjust_size - adjust the size of the rectangle
>   * @r: rectangle to be adjusted
>   * @dw: horizontal adjustment
> 

Reviewed-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux