Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915: Add rotation readout for plane initial config
Date: Wed, 21 Nov 2018 14:13:23 +0200	[thread overview]
Message-ID: <20181121121323.GD9144@intel.com> (raw)
In-Reply-To: <20181120222014.GA2515@intel.com>

On Tue, Nov 20, 2018 at 02:20:14PM -0800, Rodrigo Vivi wrote:
> On Tue, Nov 20, 2018 at 03:54:50PM +0200, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > If we need to force a full plane update before userspace/fbdev
> > have given us a proper plane state we should try to maintain the
> > current plane state as much as possible (apart from the parts
> > of the state we're trying to fix up with the plane update).
> > To that end add basic readout for the plane rotation and
> > maintain it during the initial fb takeover.
> > 
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Fixes: 516a49cc1946 ("drm/i915: Fix assert_plane() warning on bootup with external display")
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/i915/intel_display.c | 27 +++++++++++++++++++++++++++
> >  drivers/gpu/drm/i915/intel_drv.h     |  1 +
> >  2 files changed, 28 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> > index 60c1e54285c1..4d339f54559c 100644
> > --- a/drivers/gpu/drm/i915/intel_display.c
> > +++ b/drivers/gpu/drm/i915/intel_display.c
> > @@ -2831,6 +2831,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc,
> >  	return;
> >  
> >  valid_fb:
> > +	intel_state->base.rotation = plane_config->rotation;
> >  	intel_fill_fb_ggtt_view(&intel_state->view, fb,
> >  				intel_state->base.rotation);
> >  	intel_state->color_plane[0].stride =
> > @@ -7787,8 +7788,15 @@ i9xx_get_initial_plane_config(struct intel_crtc *crtc,
> >  			plane_config->tiling = I915_TILING_X;
> >  			fb->modifier = I915_FORMAT_MOD_X_TILED;
> >  		}
> > +
> > +		if (val & DISPPLANE_ROTATE_180)
> > +			plane_config->rotation = DRM_MODE_ROTATE_180;
> >  	}
> >  
> > +	if (IS_CHERRYVIEW(dev_priv) && pipe == PIPE_B &&
> > +	    val & DISPPLANE_MIRROR)
> > +		plane_config->rotation |= DRM_MODE_REFLECT_X;
> > +
> >  	pixel_format = val & DISPPLANE_PIXFORMAT_MASK;
> >  	fourcc = i9xx_format_to_fourcc(pixel_format);
> >  	fb->format = drm_format_info(fourcc);
> > @@ -8898,6 +8906,25 @@ skylake_get_initial_plane_config(struct intel_crtc *crtc,
> >  		goto error;
> >  	}
> >  
> > +	switch (val & PLANE_CTL_ROTATE_MASK) {
> > +	case PLANE_CTL_ROTATE_0:
> > +		plane_config->rotation = DRM_MODE_ROTATE_0;
> > +		break;
> > +	case PLANE_CTL_ROTATE_90:
> > +		plane_config->rotation = DRM_MODE_ROTATE_270;
> 
> we should add that comment that DRM_MODE_ROTATE_ is counter clockwise
> to avoid later confusion.

I copied over the comment from the other place, and pushed the series
to dinq. Thanks for the reviews, testing, and tracking down the bug
initially.

> 
> Also I wonder if we shouldn't move all the cases to a unique
> map function.
> 
> Anyways,
> 
> 
> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
> 
> 
> 
> > +		break;
> > +	case PLANE_CTL_ROTATE_180:
> > +		plane_config->rotation = DRM_MODE_ROTATE_180;
> > +		break;
> > +	case PLANE_CTL_ROTATE_270:
> > +		plane_config->rotation = DRM_MODE_ROTATE_90;
> > +		break;
> > +	}
> > +
> > +	if (INTEL_GEN(dev_priv) >= 10 &&
> > +	    val & PLANE_CTL_FLIP_HORIZONTAL)
> > +		plane_config->rotation |= DRM_MODE_REFLECT_X;
> > +
> >  	base = I915_READ(PLANE_SURF(pipe, plane_id)) & 0xfffff000;
> >  	plane_config->base = base;
> >  
> > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> > index f575ba2a59da..a7d9ac912125 100644
> > --- a/drivers/gpu/drm/i915/intel_drv.h
> > +++ b/drivers/gpu/drm/i915/intel_drv.h
> > @@ -572,6 +572,7 @@ struct intel_initial_plane_config {
> >  	unsigned int tiling;
> >  	int size;
> >  	u32 base;
> > +	u8 rotation;
> >  };
> >  
> >  #define SKL_MIN_SRC_W 8
> > -- 
> > 2.18.1
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2018-11-21 12:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-20 13:54 [PATCH 1/2] drm/i915: Force a LUT update in intel_initial_commit() Ville Syrjala
2018-11-20 13:54 ` [PATCH 2/2] drm/i915: Add rotation readout for plane initial config Ville Syrjala
2018-11-20 22:20   ` Rodrigo Vivi
2018-11-21 11:34     ` Maarten Lankhorst
2018-11-21 12:13     ` Ville Syrjälä [this message]
2018-11-20 14:29 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Force a LUT update in intel_initial_commit() Patchwork
2018-11-20 18:34 ` [PATCH 1/2] " Hans de Goede
2018-11-20 20:54 ` ✓ Fi.CI.IGT: success for series starting with [1/2] " Patchwork
2018-11-20 22:25 ` [PATCH 1/2] " Rodrigo Vivi
2018-11-21 11:40   ` Ville Syrjälä

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181121121323.GD9144@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=hdegoede@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox