All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Cc: Intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/7] drm/i915/skl: Query display address through a wrapper
Date: Thu, 19 Mar 2015 15:03:49 +0200	[thread overview]
Message-ID: <1426770229.3473.30.camel@jlahtine-mobl1> (raw)
In-Reply-To: <1426607117-10626-7-git-send-email-tvrtko.ursulin@linux.intel.com>

On ti, 2015-03-17 at 15:45 +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Need to do this in order to support 90/270 rotated display.
> 
> v2: Pass in drm_plane instead of plane index to intel_obj_display_address.
> 
> v3:
>     * Renamed intel_obj_display_address to intel_plane_obj_offset.
>       (Chris Wilson)
>     * Simplified rotation check to bitwise AND. (Chris Wilson)
> 
> v4:
>     * Extracted 90/270 rotation check into a helper function. (Michel Thierry)
> 
> v5:
>     * Rebased for ggtt view changes.
> 
> For: VIZ-4545
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Reviewed-by: Michel Thierry <michel.thierry@intel.com>

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> (v5)

> ---
>  drivers/gpu/drm/i915/intel_display.c | 23 +++++++++++++++++------
>  drivers/gpu/drm/i915/intel_drv.h     |  9 +++++++++
>  drivers/gpu/drm/i915/intel_sprite.c  |  5 ++++-
>  3 files changed, 30 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index c2c3a76..9af73b1 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -2263,8 +2263,7 @@ int intel_fill_fb_ggtt_view(struct i915_ggtt_view *view,
>  	if (!plane_state)
>  		return 0;
>  
> -	if (!(plane_state->rotation &
> -	    (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270))))
> +	if (!intel_rotation_90_or_270(plane_state->rotation))
>  		return 0;
>  
>  	*view = rotated_view;
> @@ -2862,6 +2861,17 @@ u32 intel_fb_stride_alignment(struct drm_device *dev, uint64_t fb_modifier,
>  	}
>  }
>  
> +unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
> +				     struct drm_i915_gem_object *obj)
> +{
> +	enum i915_ggtt_view_type view = I915_GGTT_VIEW_NORMAL;
> +
> +	if (intel_rotation_90_or_270(intel_plane->base.state->rotation))
> +		view = I915_GGTT_VIEW_ROTATED;
> +
> +	return i915_gem_obj_ggtt_offset_view(obj, view);
> +}
> +
>  static void skylake_update_primary_plane(struct drm_crtc *crtc,
>  					 struct drm_framebuffer *fb,
>  					 int x, int y)
> @@ -2872,6 +2882,7 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
>  	struct drm_i915_gem_object *obj;
>  	int pipe = intel_crtc->pipe;
>  	u32 plane_ctl, stride_div;
> +	unsigned long surf_addr;
>  
>  	if (!intel_crtc->primary_enabled) {
>  		I915_WRITE(PLANE_CTL(pipe, 0), 0);
> @@ -2938,16 +2949,16 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
>  	obj = intel_fb_obj(fb);
>  	stride_div = intel_fb_stride_alignment(dev, fb->modifier[0],
>  					       fb->pixel_format);
> +	surf_addr = intel_plane_obj_offset(to_intel_plane(crtc->primary), obj);
>  
>  	I915_WRITE(PLANE_CTL(pipe, 0), plane_ctl);
> -
>  	I915_WRITE(PLANE_POS(pipe, 0), 0);
>  	I915_WRITE(PLANE_OFFSET(pipe, 0), (y << 16) | x);
>  	I915_WRITE(PLANE_SIZE(pipe, 0),
>  		   (intel_crtc->config->pipe_src_h - 1) << 16 |
>  		   (intel_crtc->config->pipe_src_w - 1));
>  	I915_WRITE(PLANE_STRIDE(pipe, 0), fb->pitches[0] / stride_div);
> -	I915_WRITE(PLANE_SURF(pipe, 0), i915_gem_obj_ggtt_offset(obj));
> +	I915_WRITE(PLANE_SURF(pipe, 0), surf_addr);
>  
>  	POSTING_READ(PLANE_SURF(pipe, 0));
>  }
> @@ -10039,8 +10050,8 @@ static int intel_crtc_page_flip(struct drm_crtc *crtc,
>  	if (ret)
>  		goto cleanup_pending;
>  
> -	work->gtt_offset =
> -		i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset;
> +	work->gtt_offset = intel_plane_obj_offset(to_intel_plane(primary), obj)
> +						  + intel_crtc->dspaddr_offset;
>  
>  	if (use_mmio_flip(ring, obj)) {
>  		ret = intel_queue_mmio_flip(dev, crtc, fb, obj, ring,
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 53a1372..ae28fb4 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -991,6 +991,12 @@ unsigned int
>  intel_tile_height(struct drm_device *dev, uint32_t pixel_format,
>  		  uint64_t fb_format_modifier);
>  
> +static inline bool
> +intel_rotation_90_or_270(unsigned int rotation)
> +{
> +	return rotation & (BIT(DRM_ROTATE_90) | BIT(DRM_ROTATE_270));
> +}
> +
>  /* shared dpll functions */
>  struct intel_shared_dpll *intel_crtc_to_shared_dpll(struct intel_crtc *crtc);
>  void assert_shared_dpll(struct drm_i915_private *dev_priv,
> @@ -1045,6 +1051,9 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode,
>  void intel_crtc_wait_for_pending_flips(struct drm_crtc *crtc);
>  void intel_modeset_preclose(struct drm_device *dev, struct drm_file *file);
>  
> +unsigned long intel_plane_obj_offset(struct intel_plane *intel_plane,
> +				     struct drm_i915_gem_object *obj);
> +
>  /* intel_dp.c */
>  void intel_dp_init(struct drm_device *dev, int output_reg, enum port port);
>  bool intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index a828736..d960572 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -191,6 +191,7 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>  	const int plane = intel_plane->plane + 1;
>  	u32 plane_ctl, stride_div;
>  	int pixel_size = drm_format_plane_cpp(fb->pixel_format, 0);
> +	unsigned long surf_addr;
>  
>  	plane_ctl = I915_READ(PLANE_CTL(pipe, plane));
>  
> @@ -280,12 +281,14 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>  	crtc_w--;
>  	crtc_h--;
>  
> +	surf_addr = intel_plane_obj_offset(intel_plane, obj);
> +
>  	I915_WRITE(PLANE_OFFSET(pipe, plane), (y << 16) | x);
>  	I915_WRITE(PLANE_STRIDE(pipe, plane), fb->pitches[0] / stride_div);
>  	I915_WRITE(PLANE_POS(pipe, plane), (crtc_y << 16) | crtc_x);
>  	I915_WRITE(PLANE_SIZE(pipe, plane), (crtc_h << 16) | crtc_w);
>  	I915_WRITE(PLANE_CTL(pipe, plane), plane_ctl);
> -	I915_WRITE(PLANE_SURF(pipe, plane), i915_gem_obj_ggtt_offset(obj));
> +	I915_WRITE(PLANE_SURF(pipe, plane), surf_addr);
>  	POSTING_READ(PLANE_SURF(pipe, plane));
>  }
>  


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-03-19 13:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-17 15:45 [PATCH v4 0/7] Skylake 90/270 display rotation Tvrtko Ursulin
2015-03-17 15:45 ` [PATCH 1/7] drm/i915/skl: Extract tile height code into a helper function Tvrtko Ursulin
2015-03-18 12:50   ` Joonas Lahtinen
2015-03-17 15:45 ` [PATCH 2/7] drm/i915: Use GGTT view when (un)pinning objects to planes Tvrtko Ursulin
2015-03-18 13:52   ` Joonas Lahtinen
2015-03-18 13:57     ` Daniel Vetter
2015-03-17 15:45 ` [PATCH 3/7] drm/i915: Pass in plane state when (un)pinning frame buffers Tvrtko Ursulin
2015-03-18 14:01   ` Joonas Lahtinen
2015-03-17 15:45 ` [PATCH 4/7] drm/i915: Helper function to determine GGTT view from plane state Tvrtko Ursulin
2015-03-18 14:10   ` Joonas Lahtinen
2015-03-17 15:45 ` [PATCH 5/7] drm/i915/skl: Support secondary (rotated) frame buffer mapping Tvrtko Ursulin
2015-03-19 13:02   ` Joonas Lahtinen
2015-03-19 15:07     ` Tvrtko Ursulin
2015-03-20 12:01       ` Joonas Lahtinen
2015-03-20 12:11         ` Tvrtko Ursulin
2015-03-20 13:31           ` Joonas Lahtinen
2015-03-20 13:44             ` Tvrtko Ursulin
2015-03-17 15:45 ` [PATCH 6/7] drm/i915/skl: Query display address through a wrapper Tvrtko Ursulin
2015-03-19 13:03   ` Joonas Lahtinen [this message]
2015-03-17 15:45 ` [PATCH 7/7] drm/i915/skl: Take 90/270 rotation into account in watermark calculations Tvrtko Ursulin
2015-03-19 14:05   ` Joonas Lahtinen
  -- strict thread matches above, loose matches on Subject: below --
2015-03-23 11:10 [PATCH v5 0/7] Skylake 90/270 display rotation Tvrtko Ursulin
2015-03-23 11:10 ` [PATCH 6/7] drm/i915/skl: Query display address through a wrapper Tvrtko Ursulin
2015-03-05 14:07 [PATCH v3 0/7] Skylake 90/270 display rotation Tvrtko Ursulin
2015-03-05 14:07 ` [PATCH 6/7] drm/i915/skl: Query display address through a wrapper Tvrtko Ursulin

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=1426770229.3473.30.camel@jlahtine-mobl1 \
    --to=joonas.lahtinen@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.