[PATCH 1/7] drm/omap: add drm_rotation_to_tiler helper()

Laurent Pinchart laurent.pinchart at ideasonboard.com
Tue May 23 11:19:30 UTC 2017


Hi Tomi,

Thank you for the patch.

On Wednesday 17 May 2017 10:56:38 Tomi Valkeinen wrote:
> Add a helper function to convert DRM rotation to TILER rotation.

You could mention here that the patch drops an error message that could never 
be printed as the DRM core guarantees that the rotation value is valid.

Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> Signed-off-by: Tomi Valkeinen <tomi.valkeinen at ti.com>
> ---
>  drivers/gpu/drm/omapdrm/omap_fb.c | 56 ++++++++++++++++++++----------------
>  1 file changed, 31 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c
> b/drivers/gpu/drm/omapdrm/omap_fb.c index c565f5734a53..4fc5db5d2d29 100644
> --- a/drivers/gpu/drm/omapdrm/omap_fb.c
> +++ b/drivers/gpu/drm/omapdrm/omap_fb.c
> @@ -122,6 +122,36 @@ bool omap_framebuffer_supports_rotation(struct
> drm_framebuffer *fb) return omap_gem_flags(plane->bo) & OMAP_BO_TILED;
>  }
> 
> +/* Note: DRM rotates counter-clockwise, TILER & DSS rotates clockwise */
> +static uint32_t drm_rotation_to_tiler(unsigned int drm_rot)
> +{
> +	uint32_t orient;
> +
> +	switch (drm_rot & DRM_ROTATE_MASK) {
> +	default:
> +	case DRM_ROTATE_0:
> +		orient = 0;
> +		break;
> +	case DRM_ROTATE_90:
> +		orient = MASK_XY_FLIP | MASK_X_INVERT;
> +		break;
> +	case DRM_ROTATE_180:
> +		orient = MASK_X_INVERT | MASK_Y_INVERT;
> +		break;
> +	case DRM_ROTATE_270:
> +		orient = MASK_XY_FLIP | MASK_Y_INVERT;
> +		break;
> +	}
> +
> +	if (drm_rot & DRM_REFLECT_X)
> +		orient ^= MASK_X_INVERT;
> +
> +	if (drm_rot & DRM_REFLECT_Y)
> +		orient ^= MASK_Y_INVERT;
> +
> +	return orient;
> +}
> +
>  /* update ovl info for scanout, handles cases of multi-planar fb's, etc.
>   */
>  void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
> @@ -148,31 +178,7 @@ void omap_framebuffer_update_scanout(struct
> drm_framebuffer *fb, uint32_t w = win->src_w;
>  		uint32_t h = win->src_h;
> 
> -		switch (win->rotation & DRM_ROTATE_MASK) {
> -		default:
> -			dev_err(fb->dev->dev, "invalid rotation: %02x",
> -					(uint32_t)win->rotation);
> -			/* fallthru to default to no rotation */
> -		case 0:
> -		case DRM_ROTATE_0:
> -			orient = 0;
> -			break;
> -		case DRM_ROTATE_90:
> -			orient = MASK_XY_FLIP | MASK_X_INVERT;
> -			break;
> -		case DRM_ROTATE_180:
> -			orient = MASK_X_INVERT | MASK_Y_INVERT;
> -			break;
> -		case DRM_ROTATE_270:
> -			orient = MASK_XY_FLIP | MASK_Y_INVERT;
> -			break;
> -		}
> -
> -		if (win->rotation & DRM_REFLECT_X)
> -			orient ^= MASK_X_INVERT;
> -
> -		if (win->rotation & DRM_REFLECT_Y)
> -			orient ^= MASK_Y_INVERT;
> +		orient = drm_rotation_to_tiler(win->rotation);
> 
>  		/* adjust x,y offset for flip/invert: */
>  		if (orient & MASK_XY_FLIP)

-- 
Regards,

Laurent Pinchart



More information about the dri-devel mailing list