Re: [PATCH 04/10] drm/i915: Use atomic state when changing cursor visibility.

Ville Syrjälä
2015-09-10T15:46:10Z

On Thu, Sep 10, 2015 at 04:07:59PM +0200, Maarten Lankhorst wrote:
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index b68aa95c5460..bad22cb828c0 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9926,8 +9926,9 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> int pipe = intel_crtc->pipe;
> - int x = crtc->cursor_x;
> - int y = crtc->cursor_y;
> + struct drm_plane_state *cursor_state = crtc->cursor->state;
> + int x = cursor_state->crtc_x;
> + int y = cursor_state->crtc_y;
> u32 base = 0, pos = 0;
>
> if (on)
> @@ -9940,7 +9941,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> base = 0;
>
> if (x < 0) {
> - if (x + intel_crtc->base.cursor->state->crtc_w <= 0)
> + if (x + cursor_state->crtc_w <= 0)
> base = 0;
>
> pos |= CURSOR_POS_SIGN << CURSOR_X_SHIFT;
> @@ -9949,7 +9950,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> pos |= x << CURSOR_X_SHIFT;
>
> if (y < 0) {
> - if (y + intel_crtc->base.cursor->state->crtc_h <= 0)
> + if (y + cursor_state->crtc_h <= 0)
> base = 0;

This whole stuff should be ripped out, and instead we should make sure
the plane state is sane (ie. 'visible' is set when the cursor must be
visible, and not set when the cursor must not be visible).

>
> pos |= CURSOR_POS_SIGN << CURSOR_Y_SHIFT;
> @@ -9965,8 +9966,8 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
> /* ILK+ do this automagically */
> if (HAS_GMCH_DISPLAY(dev) &&
> crtc->cursor->state->rotation == BIT(DRM_ROTATE_180)) {
> - base += (intel_crtc->base.cursor->state->crtc_h *
> - intel_crtc->base.cursor->state->crtc_w - 1) * 4;
> + base += (cursor_state->crtc_h *
> + cursor_state->crtc_w - 1) * 4;
> }
>
> if (IS_845G(dev) || IS_I865G(dev))
> --
> 2.1.0
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

--
Ville Syrjälä
Intel OTC