Re: [PATCH 3/7] drm/tegra: dc: Support rotation property

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

 



On 17.05.2018 18:41, Thierry Reding wrote:
> From: Thierry Reding <treding@xxxxxxxxxx>
> 
> Currently only the DRM_MODE_REFLECT_Y rotation is supported. The driver
> already supports reflection on the Y axis via a custom flag which is not
> very useful because it requires custom userspace. Replace that flag by a
> standard rotation property that supports 0 degree rotation and Y axis
> reflection.
> 
> Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/tegra/dc.c    | 18 +++++++++++++++++-
>  drivers/gpu/drm/tegra/drm.h   |  1 -
>  drivers/gpu/drm/tegra/fb.c    | 10 ----------
>  drivers/gpu/drm/tegra/plane.c |  1 +
>  drivers/gpu/drm/tegra/plane.h |  2 ++
>  5 files changed, 20 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c
> index 9f83a65b5ea9..e2e574202ca3 100644
> --- a/drivers/gpu/drm/tegra/dc.c
> +++ b/drivers/gpu/drm/tegra/dc.c
> @@ -451,6 +451,7 @@ static int tegra_plane_atomic_check(struct drm_plane *plane,
>  				    struct drm_plane_state *state)
>  {
>  	struct tegra_plane_state *plane_state = to_tegra_plane_state(state);
> +	unsigned int rotation = DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y;
>  	struct tegra_bo_tiling *tiling = &plane_state->tiling;
>  	struct tegra_plane *tegra = to_tegra_plane(plane);
>  	struct tegra_dc *dc = to_tegra_dc(state->crtc);
> @@ -498,6 +499,13 @@ static int tegra_plane_atomic_check(struct drm_plane *plane,
>  		return -EINVAL;
>  	}
>  
> +	rotation = drm_rotation_simplify(state->rotation, rotation);
> +
> +	if (rotation & DRM_MODE_REFLECT_Y)
> +		plane_state->bottom_up = true;
> +	else
> +		plane_state->bottom_up = false;
> +
>  	/*
>  	 * Tegra doesn't support different strides for U and V planes so we
>  	 * error out if the user tries to display a framebuffer with such a
> @@ -558,7 +566,7 @@ static void tegra_plane_atomic_update(struct drm_plane *plane,
>  	window.dst.w = drm_rect_width(&plane->state->dst);
>  	window.dst.h = drm_rect_height(&plane->state->dst);
>  	window.bits_per_pixel = fb->format->cpp[0] * 8;
> -	window.bottom_up = tegra_fb_is_bottom_up(fb);
> +	window.bottom_up = state->bottom_up;

This is ABI breakage. For now let's keep the tegra_fb_is_bottom_up() and change
the above line to:

	window.bottom_up = tegra_fb_is_bottom_up(fb) || state->bottom_up;

>  
>  	/* copy from state */
>  	window.zpos = plane->state->normalized_zpos;
> @@ -643,6 +651,14 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm,
>  	if (dc->soc->supports_blending)
>  		drm_plane_create_zpos_property(&plane->base, 0, 0, 255);
>  
> +	err = drm_plane_create_rotation_property(&plane->base,
> +						 DRM_MODE_ROTATE_0,
> +						 DRM_MODE_ROTATE_0 |
> +						 DRM_MODE_REFLECT_Y);
> +	if (err < 0)
> +		dev_err(dc->dev, "failed to create rotation property: %d\n",
> +			err);
> +

The "rotation" property must be created for the overlay planes as well.

I've added "rotation" property support to the GRATE - works fine, so with the
above comments addressed:

Reviewed-by: Dmitry Osipenko <digetx@xxxxxxxxx>
Tested-by: Dmitry Osipenko <digetx@xxxxxxxxx>

>  	return &plane->base;
>  }
>  
> diff --git a/drivers/gpu/drm/tegra/drm.h b/drivers/gpu/drm/tegra/drm.h
> index 4f41aaec8530..84930d13e28d 100644
> --- a/drivers/gpu/drm/tegra/drm.h
> +++ b/drivers/gpu/drm/tegra/drm.h
> @@ -177,7 +177,6 @@ int drm_dp_aux_train(struct drm_dp_aux *aux, struct drm_dp_link *link,
>  /* from fb.c */
>  struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
>  				    unsigned int index);
> -bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer);
>  int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
>  			struct tegra_bo_tiling *tiling);
>  struct drm_framebuffer *tegra_fb_create(struct drm_device *drm,
> diff --git a/drivers/gpu/drm/tegra/fb.c b/drivers/gpu/drm/tegra/fb.c
> index e69434909a42..35827c729462 100644
> --- a/drivers/gpu/drm/tegra/fb.c
> +++ b/drivers/gpu/drm/tegra/fb.c
> @@ -38,16 +38,6 @@ struct tegra_bo *tegra_fb_get_plane(struct drm_framebuffer *framebuffer,
>  	return fb->planes[index];
>  }
>  
> -bool tegra_fb_is_bottom_up(struct drm_framebuffer *framebuffer)
> -{
> -	struct tegra_fb *fb = to_tegra_fb(framebuffer);
> -
> -	if (fb->planes[0]->flags & TEGRA_BO_BOTTOM_UP)
> -		return true;
> -
> -	return false;
> -}
> -
>  int tegra_fb_get_tiling(struct drm_framebuffer *framebuffer,
>  			struct tegra_bo_tiling *tiling)
>  {
> diff --git a/drivers/gpu/drm/tegra/plane.c b/drivers/gpu/drm/tegra/plane.c
> index 176ef46c615c..271729b2c653 100644
> --- a/drivers/gpu/drm/tegra/plane.c
> +++ b/drivers/gpu/drm/tegra/plane.c
> @@ -53,6 +53,7 @@ tegra_plane_atomic_duplicate_state(struct drm_plane *plane)
>  	copy->tiling = state->tiling;
>  	copy->format = state->format;
>  	copy->swap = state->swap;
> +	copy->bottom_up = state->bottom_up;
>  	copy->opaque = state->opaque;
>  
>  	for (i = 0; i < 3; i++)
> diff --git a/drivers/gpu/drm/tegra/plane.h b/drivers/gpu/drm/tegra/plane.h
> index 6938719e7e5d..867b9c32b1b6 100644
> --- a/drivers/gpu/drm/tegra/plane.h
> +++ b/drivers/gpu/drm/tegra/plane.h
> @@ -41,6 +41,8 @@ struct tegra_plane_state {
>  	u32 format;
>  	u32 swap;
>  
> +	bool bottom_up;
> +
>  	/* used for legacy blending support only */
>  	bool opaque;
>  	bool dependent[3];
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux