Commit f766c6c8 authored by Fabien Dessenne's avatar Fabien Dessenne Committed by Vincent Abriou

drm/sti: use valid video mode

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: default avatarFabien Dessenne <fabien.dessenne@st.com>
Acked-by: default avatarVincent Abriou <vincent.abriou@st.com>
parent 3bc6b01d
...@@ -628,8 +628,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane, ...@@ -628,8 +628,8 @@ static int sti_gdp_atomic_check(struct drm_plane *drm_plane,
mode = &crtc_state->mode; mode = &crtc_state->mode;
dst_x = state->crtc_x; dst_x = state->crtc_x;
dst_y = state->crtc_y; dst_y = state->crtc_y;
dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x); dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y); dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
/* src_x are in 16.16 format */ /* src_x are in 16.16 format */
src_x = state->src_x >> 16; src_x = state->src_x >> 16;
src_y = state->src_y >> 16; src_y = state->src_y >> 16;
...@@ -727,8 +727,8 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane, ...@@ -727,8 +727,8 @@ static void sti_gdp_atomic_update(struct drm_plane *drm_plane,
mode = &crtc->mode; mode = &crtc->mode;
dst_x = state->crtc_x; dst_x = state->crtc_x;
dst_y = state->crtc_y; dst_y = state->crtc_y;
dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x); dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y); dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
/* src_x are in 16.16 format */ /* src_x are in 16.16 format */
src_x = state->src_x >> 16; src_x = state->src_x >> 16;
src_y = state->src_y >> 16; src_y = state->src_y >> 16;
......
...@@ -1027,8 +1027,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane, ...@@ -1027,8 +1027,8 @@ static int sti_hqvdp_atomic_check(struct drm_plane *drm_plane,
mode = &crtc_state->mode; mode = &crtc_state->mode;
dst_x = state->crtc_x; dst_x = state->crtc_x;
dst_y = state->crtc_y; dst_y = state->crtc_y;
dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x); dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y); dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
/* src_x are in 16.16 format */ /* src_x are in 16.16 format */
src_x = state->src_x >> 16; src_x = state->src_x >> 16;
src_y = state->src_y >> 16; src_y = state->src_y >> 16;
...@@ -1116,8 +1116,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane, ...@@ -1116,8 +1116,8 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
mode = &crtc->mode; mode = &crtc->mode;
dst_x = state->crtc_x; dst_x = state->crtc_x;
dst_y = state->crtc_y; dst_y = state->crtc_y;
dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x); dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y); dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
/* src_x are in 16.16 format */ /* src_x are in 16.16 format */
src_x = state->src_x >> 16; src_x = state->src_x >> 16;
src_y = state->src_y >> 16; src_y = state->src_y >> 16;
......
...@@ -142,8 +142,8 @@ void sti_vid_commit(struct sti_vid *vid, ...@@ -142,8 +142,8 @@ void sti_vid_commit(struct sti_vid *vid,
struct drm_display_mode *mode = &crtc->mode; struct drm_display_mode *mode = &crtc->mode;
int dst_x = state->crtc_x; int dst_x = state->crtc_x;
int dst_y = state->crtc_y; int dst_y = state->crtc_y;
int dst_w = clamp_val(state->crtc_w, 0, mode->crtc_hdisplay - dst_x); int dst_w = clamp_val(state->crtc_w, 0, mode->hdisplay - dst_x);
int dst_h = clamp_val(state->crtc_h, 0, mode->crtc_vdisplay - dst_y); int dst_h = clamp_val(state->crtc_h, 0, mode->vdisplay - dst_y);
int src_h = state->src_h >> 16; int src_h = state->src_h >> 16;
u32 val, ydo, xdo, yds, xds; u32 val, ydo, xdo, yds, xds;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment