From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 7/8] drm/i915: Move programming plane scaler to its own function.
Date: Fri, 21 Sep 2018 18:29:20 +0300 [thread overview]
Message-ID: <20180921152920.GD5565@intel.com> (raw)
In-Reply-To: <20180920102711.4184-8-maarten.lankhorst@linux.intel.com>
On Thu, Sep 20, 2018 at 12:27:10PM +0200, Maarten Lankhorst wrote:
> This cleans the code up slightly, and will make other changes easier.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_sprite.c | 90 +++++++++++++++++------------
> 1 file changed, 52 insertions(+), 38 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index d4c8e10fc90b..7d3c7469d271 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -280,13 +280,63 @@ skl_plane_max_stride(struct intel_plane *plane,
> return min(8192 * cpp, 32768);
> }
>
> +static void
> +skl_program_scaler(struct drm_i915_private *dev_priv,
> + struct intel_plane *plane,
Could have dug these out from the states rather than passing in
explicitly. I prefer minimlism when it comes to function arguments.
> + const struct intel_crtc_state *crtc_state,
> + const struct intel_plane_state *plane_state)
> +{
> + enum plane_id plane_id = plane->id;
> + enum pipe pipe = plane->pipe;
> + int scaler_id = plane_state->scaler_id;
> + const struct intel_scaler *scaler =
> + &crtc_state->scaler_state.scalers[scaler_id];
> + int crtc_x = plane_state->base.dst.x1;
> + int crtc_y = plane_state->base.dst.y1;
> + uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
> + uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
> + u16 y_hphase, uv_rgb_hphase;
> + u16 y_vphase, uv_rgb_vphase;
> +
> + /* Sizes are 0 based */
> + crtc_w--;
> + crtc_h--;
> +
> + /* TODO: handle sub-pixel coordinates */
> + if (plane_state->base.fb->format->format == DRM_FORMAT_NV12) {
> + y_hphase = skl_scaler_calc_phase(1, false);
> + y_vphase = skl_scaler_calc_phase(1, false);
> +
> + /* MPEG2 chroma siting convention */
> + uv_rgb_hphase = skl_scaler_calc_phase(2, true);
> + uv_rgb_vphase = skl_scaler_calc_phase(2, false);
> + } else {
> + /* not used */
> + y_hphase = 0;
> + y_vphase = 0;
> +
> + uv_rgb_hphase = skl_scaler_calc_phase(1, false);
> + uv_rgb_vphase = skl_scaler_calc_phase(1, false);
> + }
> +
> + I915_WRITE_FW(SKL_PS_CTRL(pipe, scaler_id),
> + PS_SCALER_EN | PS_PLANE_SEL(plane_id) | scaler->mode);
> + I915_WRITE_FW(SKL_PS_PWR_GATE(pipe, scaler_id), 0);
> + I915_WRITE_FW(SKL_PS_VPHASE(pipe, scaler_id),
> + PS_Y_PHASE(y_vphase) | PS_UV_RGB_PHASE(uv_rgb_vphase));
> + I915_WRITE_FW(SKL_PS_HPHASE(pipe, scaler_id),
> + PS_Y_PHASE(y_hphase) | PS_UV_RGB_PHASE(uv_rgb_hphase));
> + I915_WRITE_FW(SKL_PS_WIN_POS(pipe, scaler_id), (crtc_x << 16) | crtc_y);
> + I915_WRITE_FW(SKL_PS_WIN_SZ(pipe, scaler_id),
> + ((crtc_w + 1) << 16)|(crtc_h + 1));
> +}
> +
> void
> skl_update_plane(struct intel_plane *plane,
> const struct intel_crtc_state *crtc_state,
> const struct intel_plane_state *plane_state)
> {
> struct drm_i915_private *dev_priv = to_i915(plane->base.dev);
> - const struct drm_framebuffer *fb = plane_state->base.fb;
> enum plane_id plane_id = plane->id;
> enum pipe pipe = plane->pipe;
> u32 plane_ctl = plane_state->ctl;
> @@ -296,8 +346,6 @@ skl_update_plane(struct intel_plane *plane,
> u32 aux_stride = skl_plane_stride(plane_state, 1);
> int crtc_x = plane_state->base.dst.x1;
> int crtc_y = plane_state->base.dst.y1;
> - uint32_t crtc_w = drm_rect_width(&plane_state->base.dst);
> - uint32_t crtc_h = drm_rect_height(&plane_state->base.dst);
> uint32_t x = plane_state->color_plane[0].x;
> uint32_t y = plane_state->color_plane[0].y;
> uint32_t src_w = drm_rect_width(&plane_state->base.src) >> 16;
> @@ -307,8 +355,6 @@ skl_update_plane(struct intel_plane *plane,
> /* Sizes are 0 based */
> src_w--;
> src_h--;
> - crtc_w--;
> - crtc_h--;
>
> spin_lock_irqsave(&dev_priv->uncore.lock, irqflags);
>
> @@ -333,39 +379,7 @@ skl_update_plane(struct intel_plane *plane,
>
> /* program plane scaler */
> if (plane_state->scaler_id >= 0) {
> - int scaler_id = plane_state->scaler_id;
> - const struct intel_scaler *scaler =
> - &crtc_state->scaler_state.scalers[scaler_id];
> - u16 y_hphase, uv_rgb_hphase;
> - u16 y_vphase, uv_rgb_vphase;
> -
> - /* TODO: handle sub-pixel coordinates */
> - if (fb->format->format == DRM_FORMAT_NV12) {
> - y_hphase = skl_scaler_calc_phase(1, false);
> - y_vphase = skl_scaler_calc_phase(1, false);
> -
> - /* MPEG2 chroma siting convention */
> - uv_rgb_hphase = skl_scaler_calc_phase(2, true);
> - uv_rgb_vphase = skl_scaler_calc_phase(2, false);
> - } else {
> - /* not used */
> - y_hphase = 0;
> - y_vphase = 0;
> -
> - uv_rgb_hphase = skl_scaler_calc_phase(1, false);
> - uv_rgb_vphase = skl_scaler_calc_phase(1, false);
> - }
> -
> - I915_WRITE_FW(SKL_PS_CTRL(pipe, scaler_id),
> - PS_SCALER_EN | PS_PLANE_SEL(plane_id) | scaler->mode);
> - I915_WRITE_FW(SKL_PS_PWR_GATE(pipe, scaler_id), 0);
> - I915_WRITE_FW(SKL_PS_VPHASE(pipe, scaler_id),
> - PS_Y_PHASE(y_vphase) | PS_UV_RGB_PHASE(uv_rgb_vphase));
> - I915_WRITE_FW(SKL_PS_HPHASE(pipe, scaler_id),
> - PS_Y_PHASE(y_hphase) | PS_UV_RGB_PHASE(uv_rgb_hphase));
> - I915_WRITE_FW(SKL_PS_WIN_POS(pipe, scaler_id), (crtc_x << 16) | crtc_y);
> - I915_WRITE_FW(SKL_PS_WIN_SZ(pipe, scaler_id),
> - ((crtc_w + 1) << 16)|(crtc_h + 1));
> + skl_program_scaler(dev_priv, plane, crtc_state, plane_state);
>
> I915_WRITE_FW(PLANE_POS(pipe, plane_id), 0);
> } else {
> --
> 2.18.0
>
> _______________________________________________
> 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
next prev parent reply other threads:[~2018-09-21 15:29 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 10:27 [PATCH 0/8] drm/i915: Preparations for adding gen11 planar formats Maarten Lankhorst
2018-09-20 10:27 ` [PATCH 1/8] drm/i915: Clean up casts to crtc_state in intel_atomic_commit_tail() Maarten Lankhorst
2018-09-20 10:27 ` [PATCH 2/8] drm/i915: Handle cursor updating active_planes correctly, v2 Maarten Lankhorst
2018-09-20 23:18 ` Matt Roper
2018-09-21 9:41 ` Maarten Lankhorst
2018-09-20 10:27 ` [PATCH 3/8] drm/i915: Unconditionally clear plane visibility, v2 Maarten Lankhorst
2018-09-20 23:18 ` Matt Roper
2018-09-21 15:26 ` Ville Syrjälä
2018-09-21 16:00 ` Maarten Lankhorst
2018-09-21 16:15 ` Ville Syrjälä
2018-09-21 16:20 ` Maarten Lankhorst
2018-09-21 16:24 ` Ville Syrjälä
2018-09-20 10:27 ` [PATCH 4/8] drm/i915: Make intel_crtc_disable_planes() use active planes mask Maarten Lankhorst
2018-09-20 10:27 ` [PATCH 5/8] drm/i915: Replace call to commit_planes_on_crtc with internal update, v2 Maarten Lankhorst
2018-09-20 10:27 ` [PATCH 6/8] drm/i915: Clean up scaler setup Maarten Lankhorst
2018-09-20 23:19 ` Matt Roper
2018-09-21 14:44 ` [PATCH] drm/i915: Clean up scaler setup, v2 Maarten Lankhorst
2018-09-21 16:40 ` Matt Roper
2018-09-21 17:32 ` Maarten Lankhorst
2018-09-20 10:27 ` [PATCH 7/8] drm/i915: Move programming plane scaler to its own function Maarten Lankhorst
2018-09-20 23:19 ` Matt Roper
2018-09-21 15:29 ` Ville Syrjälä [this message]
2018-09-20 10:27 ` [PATCH 8/8] drm/i915: Force planar YUV coordinates to be a multiple of 2, v2 Maarten Lankhorst
2018-09-20 23:19 ` Matt Roper
2018-09-20 10:49 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Preparations for adding gen11 planar formats Patchwork
2018-09-20 10:52 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-09-20 11:14 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-20 12:10 ` ✗ Fi.CI.IGT: failure " Patchwork
2018-09-21 15:00 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: Preparations for adding gen11 planar formats. (rev2) Patchwork
2018-09-21 15:03 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-09-21 15:21 ` ✓ Fi.CI.BAT: success " Patchwork
2018-09-21 16:23 ` ✓ Fi.CI.IGT: " Patchwork
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=20180921152920.GD5565@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=maarten.lankhorst@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox