diff mbox

[2/2] drm/sti: do not post HQVDP command if no update

Message ID 1480950573-24256-3-git-send-email-fabien.dessenne@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabien DESSENNE Dec. 5, 2016, 3:09 p.m. UTC
Do not process update requests with unmodified parameters.

Since the HQVDP command queue is limited to 2, we shall take care of
not posting unneeded commands, which would abusively fill the command
queue leading to frame update skip.
This typically happens when the driver is called with legacy
(non-atomic) IOCTL : in that case atomic_update() is called multiple
times with the same parameters.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/gpu/drm/sti/sti_hqvdp.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Benjamin Gaignard Dec. 7, 2016, 11:11 a.m. UTC | #1
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>

2016-12-05 16:09 GMT+01:00 Fabien Dessenne <fabien.dessenne@st.com>:
> Do not process update requests with unmodified parameters.
>
> Since the HQVDP command queue is limited to 2, we shall take care of
> not posting unneeded commands, which would abusively fill the command
> queue leading to frame update skip.
> This typically happens when the driver is called with legacy
> (non-atomic) IOCTL : in that case atomic_update() is called multiple
> times with the same parameters.
>
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> ---
>  drivers/gpu/drm/sti/sti_hqvdp.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
> index a547723..55cbaea 100644
> --- a/drivers/gpu/drm/sti/sti_hqvdp.c
> +++ b/drivers/gpu/drm/sti/sti_hqvdp.c
> @@ -1117,6 +1117,21 @@ static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
>         if (!crtc || !fb)
>                 return;
>
> +       if ((oldstate->fb == state->fb) &&
> +           (oldstate->crtc_x == state->crtc_x) &&
> +           (oldstate->crtc_y == state->crtc_y) &&
> +           (oldstate->crtc_w == state->crtc_w) &&
> +           (oldstate->crtc_h == state->crtc_h) &&
> +           (oldstate->src_x == state->src_x) &&
> +           (oldstate->src_y == state->src_y) &&
> +           (oldstate->src_w == state->src_w) &&
> +           (oldstate->src_h == state->src_h)) {
> +               /* No change since last update, do not post cmd */
> +               DRM_DEBUG_DRIVER("No change, not posting cmd\n");
> +               plane->status = STI_PLANE_UPDATED;
> +               return;
> +       }
> +
>         mode = &crtc->mode;
>         dst_x = state->crtc_x;
>         dst_y = state->crtc_y;
> --
> 2.7.4
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c
index a547723..55cbaea 100644
--- a/drivers/gpu/drm/sti/sti_hqvdp.c
+++ b/drivers/gpu/drm/sti/sti_hqvdp.c
@@ -1117,6 +1117,21 @@  static void sti_hqvdp_atomic_update(struct drm_plane *drm_plane,
 	if (!crtc || !fb)
 		return;
 
+	if ((oldstate->fb == state->fb) &&
+	    (oldstate->crtc_x == state->crtc_x) &&
+	    (oldstate->crtc_y == state->crtc_y) &&
+	    (oldstate->crtc_w == state->crtc_w) &&
+	    (oldstate->crtc_h == state->crtc_h) &&
+	    (oldstate->src_x == state->src_x) &&
+	    (oldstate->src_y == state->src_y) &&
+	    (oldstate->src_w == state->src_w) &&
+	    (oldstate->src_h == state->src_h)) {
+		/* No change since last update, do not post cmd */
+		DRM_DEBUG_DRIVER("No change, not posting cmd\n");
+		plane->status = STI_PLANE_UPDATED;
+		return;
+	}
+
 	mode = &crtc->mode;
 	dst_x = state->crtc_x;
 	dst_y = state->crtc_y;