diff mbox

[8/8] drm/sti: use valid video mode

Message ID 1473946905-4374-9-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabien DESSENNE Sept. 15, 2016, 1:41 p.m. UTC
In atomic mode the crtc_xxx (eg crtc_hdisplay) members of the mode
structure may be unset before calling atomic_check/commit for planes.
Instead of, use xxx members which are actually set.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/gpu/drm/sti/sti_gdp.c   | 8 ++++----
 drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++----
 drivers/gpu/drm/sti/sti_vid.c   | 4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

Comments

Vincent Abriou Sept. 15, 2016, 3:29 p.m. UTC | #1
Acked-by: Vincent Abriou <vincent.abriou@st.com>


On 09/15/2016 03:41 PM, Fabien Dessenne wrote:
> In atomic mode the crtc_xxx (eg crtc_hdisplay) members of the mode
> structure may be unset before calling atomic_check/commit for planes.
> Instead of, use xxx members which are actually set.
>
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/gpu/drm/sti/sti_gdp.c   | 8 ++++----
>  drivers/gpu/drm/sti/sti_hqvdp.c | 8 ++++----
>  drivers/gpu/drm/sti/sti_vid.c   | 4 ++--
>  3 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
> index 824020f..3297f3b 100644
> --- a/drivers/gpu/drm/sti/sti_gdp.c
> +++ b/drivers/gpu/drm/sti/sti_gdp.c
> @@ -631,8 +631,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
>  	mode = &crtc_state->mode;
>  	dst_x = state->crtc_x;
>  	dst_y = state->crtc_y;
> -	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> -	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> +	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> +	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>  	/* src_x are in 16.16 format */
>  	src_x = state->src_x >> 16;
>  	src_y = state->src_y >> 16;
> @@ -736,8 +736,8 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
>  	mode = &crtc->mode;
>  	dst_x = state->crtc_x;
>  	dst_y = state->crtc_y;
> -	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> -	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> +	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> +	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>  	/* src_x are in 16.16 format */
>  	src_x = state->src_x >> 16;
>  	src_y = state->src_y >> 16;
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index 9dd13fd..31fa7ae 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1026,8 +1026,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
>  	mode = &crtc_state->mode;
>  	dst_x = state->crtc_x;
>  	dst_y = state->crtc_y;
> -	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> -	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> +	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> +	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>  	/* src_x are in 16.16 format */
>  	src_x = state->src_x >> 16;
>  	src_y = state->src_y >> 16;
> @@ -1115,8 +1115,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
>  	mode = &crtc->mode;
>  	dst_x = state->crtc_x;
>  	dst_y = state->crtc_y;
> -	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> -	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> +	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> +	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>  	/* src_x are in 16.16 format */
>  	src_x = state->src_x >> 16;
>  	src_y = state->src_y >> 16;
> diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
> index 47634a0..2ad5989 100644
> --- a/drivers/gpu/drm/sti/sti_vid.c
> +++ b/drivers/gpu/drm/sti/sti_vid.c
> @@ -142,8 +142,8 @@ void sti_vid_commit(struct sti_vid *vid,
>  	struct drm_display_mode *mode = &crtc->mode;
>  	int dst_x = state->crtc_x;
>  	int dst_y = state->crtc_y;
> -	int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
> -	int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
> +	int dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
> +	int dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
>  	int src_h = state->src_h >> 16;
>  	u32 val, ydo, xdo, yds, xds;
>
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c
index 824020f..3297f3b 100644
--- a/drivers/gpu/drm/sti/sti_gdp.c
+++ b/drivers/gpu/drm/sti/sti_gdp.c
@@ -631,8 +631,8 @@  static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
 	mode = &crtc_state->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
@@ -736,8 +736,8 @@  static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index 9dd13fd..31fa7ae 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1026,8 +1026,8 @@  static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
 	mode = &crtc_state->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
@@ -1115,8 +1115,8 @@  static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;
-	dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	/* src_x are in 16.16 format */
 	src_x = state->src_x >> 16;
 	src_y = state->src_y >> 16;
diff --git a/drivers/gpu/drm/sti/sti_vid.c b/drivers/gpu/drm/sti/sti_vid.c
index 47634a0..2ad5989 100644
--- a/drivers/gpu/drm/sti/sti_vid.c
+++ b/drivers/gpu/drm/sti/sti_vid.c
@@ -142,8 +142,8 @@  void sti_vid_commit(struct sti_vid *vid,
 	struct drm_display_mode *mode = &crtc->mode;
 	int dst_x = state->crtc_x;
 	int dst_y = state->crtc_y;
-	int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x);
-	int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y);
+	int dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
+	int dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
 	int src_h = state->src_h >> 16;
 	u32 val, ydo, xdo, yds, xds;