From: "Thulasimani, Sivakumar" <sivakumar.thulasimani@intel.com>
To: ville.syrjala@linux.intel.com, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/12] drm/i915: Move SKL hw stride calculation into a helper
Date: Thu, 5 May 2016 13:50:55 +0530 [thread overview]
Message-ID: <572B0267.8000505@intel.com> (raw)
In-Reply-To: <1462290001-9246-4-git-send-email-ville.syrjala@linux.intel.com>
Reviewed-by: Sivakumar Thulasimani <sivakumar.thulasimani@intel.com>
On 5/3/2016 9:09 PM, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> We repeat the SKL stride register value calculations a several places.
> Move it into a small helper function.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_display.c | 52 +++++++++++++++++-------------------
> drivers/gpu/drm/i915/intel_drv.h | 2 ++
> drivers/gpu/drm/i915/intel_sprite.c | 12 ++-------
> 3 files changed, 29 insertions(+), 37 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 16ac14a93776..87b783c56533 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3059,6 +3059,28 @@ static void skl_detach_scalers(struct intel_crtc *intel_crtc)
> }
> }
>
> +u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
> + unsigned int rotation)
> +{
> + const struct drm_i915_private *dev_priv = to_i915(fb->dev);
> + u32 stride = intel_fb_pitch(fb, plane, rotation);
> +
> + /*
> + * The stride is either expressed as a multiple of 64 bytes chunks for
> + * linear buffers or in number of tiles for tiled buffers.
> + */
> + if (intel_rotation_90_or_270(rotation)) {
> + int cpp = drm_format_plane_cpp(fb->pixel_format, plane);
> +
> + stride /= intel_tile_height(dev_priv, fb->modifier[0], cpp);
> + } else {
> + stride /= intel_fb_stride_alignment(dev_priv, fb->modifier[0],
> + fb->pixel_format);
> + }
> +
> + return stride;
> +}
> +
> u32 skl_plane_ctl_format(uint32_t pixel_format)
> {
> switch (pixel_format) {
> @@ -3149,8 +3171,9 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc_state->base.crtc);
> struct drm_framebuffer *fb = plane_state->base.fb;
> int pipe = intel_crtc->pipe;
> - u32 plane_ctl, stride;
> + u32 plane_ctl;
> unsigned int rotation = plane_state->base.rotation;
> + u32 stride = skl_plane_stride(fb, 0, rotation);
> u32 surf_addr;
> int scaler_id = plane_state->scaler_id;
> int src_x = plane_state->src.x1 >> 16;
> @@ -3178,8 +3201,6 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
> .y1 = src_y,
> .y2 = src_y + src_h,
> };
> - int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
> - struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
>
> /* Rotate src coordinates to match rotated GTT view */
> drm_rect_rotate(&r, fb->width, fb->height, BIT(DRM_ROTATE_270));
> @@ -3188,13 +3209,6 @@ static void skylake_update_primary_plane(struct drm_plane *plane,
> src_y = r.y1;
> src_w = drm_rect_width(&r);
> src_h = drm_rect_height(&r);
> -
> - stride = intel_fb->rotated[0].pitch /
> - intel_tile_height(dev_priv, fb->modifier[0], cpp);
> - } else {
> - stride = fb->pitches[0] /
> - intel_fb_stride_alignment(dev_priv, fb->modifier[0],
> - fb->pixel_format);
> }
>
> intel_add_fb_offsets(&src_x, &src_y, fb, 0, rotation);
> @@ -11432,7 +11446,7 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc,
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct drm_framebuffer *fb = intel_crtc->base.primary->fb;
> const enum pipe pipe = intel_crtc->pipe;
> - u32 ctl, stride;
> + u32 ctl, stride = skl_plane_stride(fb, 0, rotation);
>
> ctl = I915_READ(PLANE_CTL(pipe, 0));
> ctl &= ~PLANE_CTL_TILED_MASK;
> @@ -11453,22 +11467,6 @@ static void skl_do_mmio_flip(struct intel_crtc *intel_crtc,
> }
>
> /*
> - * The stride is either expressed as a multiple of 64 bytes chunks for
> - * linear buffers or in number of tiles for tiled buffers.
> - */
> - if (intel_rotation_90_or_270(rotation)) {
> - int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
> - struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
> -
> - stride = intel_fb->rotated[0].pitch /
> - intel_tile_height(dev_priv, fb->modifier[0], cpp);
> - } else {
> - stride = fb->pitches[0] /
> - intel_fb_stride_alignment(dev_priv, fb->modifier[0],
> - fb->pixel_format);
> - }
> -
> - /*
> * Both PLANE_CTL and PLANE_STRIDE are not updated on vblank but on
> * PLANE_SURF updates, the update is then guaranteed to be atomic.
> */
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index 5045fea0c1c5..42b21c54a646 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1287,6 +1287,8 @@ u32 intel_fb_gtt_offset(struct drm_framebuffer *fb, unsigned int rotation);
> u32 skl_plane_ctl_format(uint32_t pixel_format);
> u32 skl_plane_ctl_tiling(uint64_t fb_modifier);
> u32 skl_plane_ctl_rotation(unsigned int rotation);
> +u32 skl_plane_stride(const struct drm_framebuffer *fb, int plane,
> + unsigned int rotation);
>
> /* intel_csr.c */
> void intel_csr_ucode_init(struct drm_i915_private *);
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 3fb565bfc0db..22a2ba0c21b0 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -186,13 +186,13 @@ skl_update_plane(struct drm_plane *drm_plane,
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_plane *intel_plane = to_intel_plane(drm_plane);
> struct drm_framebuffer *fb = plane_state->base.fb;
> - struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
> const int pipe = intel_plane->pipe;
> const int plane = intel_plane->plane + 1;
> - u32 plane_ctl, stride;
> + u32 plane_ctl;
> const struct drm_intel_sprite_colorkey *key = &plane_state->ckey;
> u32 surf_addr;
> unsigned int rotation = plane_state->base.rotation;
> + u32 stride = skl_plane_stride(fb, 0, rotation);
> int crtc_x = plane_state->dst.x1;
> int crtc_y = plane_state->dst.y1;
> uint32_t crtc_w = drm_rect_width(&plane_state->dst);
> @@ -231,7 +231,6 @@ skl_update_plane(struct drm_plane *drm_plane,
> .y1 = y,
> .y2 = y + src_h,
> };
> - unsigned int cpp = drm_format_plane_cpp(fb->pixel_format, 0);
>
> /* Rotate src coordinates to match rotated GTT view */
> drm_rect_rotate(&r, fb->width, fb->height, BIT(DRM_ROTATE_270));
> @@ -240,13 +239,6 @@ skl_update_plane(struct drm_plane *drm_plane,
> y = r.y1;
> src_w = drm_rect_width(&r);
> src_h = drm_rect_height(&r);
> -
> - stride = intel_fb->rotated[0].pitch /
> - intel_tile_height(dev_priv, fb->modifier[0], cpp);
> - } else {
> - stride = fb->pitches[0] /
> - intel_fb_stride_alignment(dev_priv, fb->modifier[0],
> - fb->pixel_format);
> }
>
> intel_add_fb_offsets(&x, &y, fb, 0, rotation);
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-05-05 8:20 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 15:39 [PATCH v4 00/12] drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v4) ville.syrjala
2016-05-03 15:39 ` [PATCH v5 01/12] drm/i915: Rewrite fb rotation GTT handling ville.syrjala
2016-05-05 8:12 ` Thulasimani, Sivakumar
2016-05-05 8:14 ` Thulasimani, Sivakumar
2016-05-03 15:39 ` [PATCH v3 02/12] drm/i915: Don't pass pitch to intel_compute_page_offset() ville.syrjala
2016-05-05 8:17 ` Thulasimani, Sivakumar
2016-05-03 15:39 ` [PATCH 03/12] drm/i915: Move SKL hw stride calculation into a helper ville.syrjala
2016-05-04 11:53 ` Matthew Auld
2016-05-05 8:20 ` Thulasimani, Sivakumar [this message]
2016-05-03 15:39 ` [PATCH 04/12] drm/i915: Pass around plane_state instead of fb+rotation ville.syrjala
2016-05-05 8:21 ` Thulasimani, Sivakumar
2016-05-03 15:39 ` [PATCH v2 05/12] drm/i915: Use fb modifiers for display tiling decisions ville.syrjala
2016-05-03 15:39 ` [PATCH v2 06/12] drm/i915: Adjust obj tiling vs. fb modifier rules ville.syrjala
2016-05-03 15:39 ` [PATCH 07/12] drm/i915: Limit fb x offset due to fences ville.syrjala
2016-05-05 10:19 ` Sivakumar Thulasimani
2016-05-03 15:39 ` [PATCH 08/12] drm/i915: Allow calling intel_adjust_tile_offset() multiple times ville.syrjala
2016-05-27 8:23 ` Ville Syrjälä
2016-05-30 10:14 ` Thulasimani, Sivakumar
2016-05-03 15:39 ` [PATCH 09/12] drm/i915: Make intel_adjust_tile_offset() work for linear buffers ville.syrjala
2016-05-09 9:24 ` Sivakumar Thulasimani
2016-05-03 15:39 ` [PATCH 10/12] drm/i915: Compute display surface offset in the plane check hook for SKL+ ville.syrjala
2016-05-09 10:30 ` Sivakumar Thulasimani
2016-05-03 15:40 ` [PATCH 11/12] drm/i915: Deal with NV12 CbCr plane AUX surface on SKL+ ville.syrjala
2016-05-03 15:40 ` [PATCH v2 12/12] drm/i915: Make sure fb offset is (macro)pixel aligned ville.syrjala
2016-05-03 16:25 ` ✗ Fi.CI.BAT: failure for drm/i915: Handle fb->offsets[] and rewrite fb rotation handling to be more generic (v4) Patchwork
2016-05-27 11:43 ` Ville Syrjälä
2016-05-27 11:49 ` Chris Wilson
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=572B0267.8000505@intel.com \
--to=sivakumar.thulasimani@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@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.