All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Chandra Konduru <chandra.konduru@intel.com>
Cc: daniel.vetter@intel.com, intel-gfx@lists.freedesktop.org,
	ville.syrjala@intel.com
Subject: Re: [PATCH 14/15] drm/i915: skl nv12 workarounds
Date: Fri, 4 Sep 2015 14:26:04 +0300	[thread overview]
Message-ID: <20150904112604.GJ29811@intel.com> (raw)
In-Reply-To: <1440032556-9920-15-git-send-email-chandra.konduru@intel.com>

On Wed, Aug 19, 2015 at 06:02:35PM -0700, Chandra Konduru wrote:
> Adding driver workarounds for nv12.
> 
> Signed-off-by: Chandra Konduru <chandra.konduru@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_reg.h      |   20 ++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_csr.c     |    2 +-
>  drivers/gpu/drm/i915/intel_display.c |   31 +++++++++++++++++++++++++++++++
>  drivers/gpu/drm/i915/intel_drv.h     |    1 +
>  drivers/gpu/drm/i915/intel_sprite.c  |    7 +++++++
>  5 files changed, 60 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
> index c4d732f..3192837 100644
> --- a/drivers/gpu/drm/i915/i915_reg.h
> +++ b/drivers/gpu/drm/i915/i915_reg.h
> @@ -5354,6 +5354,26 @@ enum skl_disp_power_wells {
>  #define PLANE_NV12_BUF_CFG(pipe, plane)	\
>  	_PLANE(plane, _PLANE_NV12_BUF_CFG_1(pipe), _PLANE_NV12_BUF_CFG_2(pipe))
>  
> +/*
> + * Skylake Chicken registers
> + */
> +#define _CHICKEN_PIPESL_A          0x420B0
> +#define _CHICKEN_PIPESL_B          0x420B4
> +#define _CHICKEN_PIPESL_C          0x420B8
> +#define  DISABLE_STREAMER_FIX      (1 << 22)
> +#define CHICKEN_PIPESL(pipe) _PIPE(pipe, _CHICKEN_PIPESL_A, _CHICKEN_PIPESL_B)
> +
> +#define CHICKEN_DCPR_1             0x46430
> +#define IDLE_WAKEMEM_MASK          (1 << 13)
> +
> +#define CLKGATE_DIS_PSL_A        0x46520
> +#define CLKGATE_DIS_PSL_B        0x46524
> +#define CLKGATE_DIS_PSL_C        0x46528
> +#define DUPS1_GATING_DIS         (1 << 15)
> +#define DUPS2_GATING_DIS         (1 << 19)
> +#define DUPS3_GATING_DIS         (1 << 23)
> +#define CLKGATE_DIS_PSL(pipe)  _PIPE(pipe, CLKGATE_DIS_PSL_A, CLKGATE_DIS_PSL_B)
> +
>  /* SKL new cursor registers */
>  #define _CUR_BUF_CFG_A				0x7017c
>  #define _CUR_BUF_CFG_B				0x7117c
> diff --git a/drivers/gpu/drm/i915/intel_csr.c b/drivers/gpu/drm/i915/intel_csr.c
> index ba1ae03..559a7f5 100644
> --- a/drivers/gpu/drm/i915/intel_csr.c
> +++ b/drivers/gpu/drm/i915/intel_csr.c
> @@ -181,7 +181,7 @@ static const struct stepping_info skl_stepping_info[] = {
>  		{'G', '0'}, {'H', '0'}, {'I', '0'}
>  };
>  
> -static char intel_get_stepping(struct drm_device *dev)
> +char intel_get_stepping(struct drm_device *dev)
>  {
>  	if (IS_SKYLAKE(dev) && (dev->pdev->revision <
>  			ARRAY_SIZE(skl_stepping_info)))
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 419660d..2158b8f 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -3196,6 +3196,16 @@ static void skylake_update_primary_plane(struct drm_crtc *crtc,
>  	I915_WRITE(PLANE_AUX_DIST(pipe, 0), aux_dist | aux_stride);
>  	I915_WRITE(PLANE_AUX_OFFSET(pipe, 0), aux_y_offset << 16 | aux_x_offset);
>  
> +	DRM_DEBUG_KMS("KCM: is_skl = %d is_bxt = %d\n",
> +		IS_SKYLAKE(dev), IS_BROXTON(dev));
> +
> +	if (((IS_SKYLAKE(dev) && intel_get_stepping(dev) == 'C') ||
> +		(IS_BROXTON(dev) && intel_get_stepping(dev) == 'A')) &&
> +		fb->pixel_format == DRM_FORMAT_NV12) {
> +			I915_WRITE(CHICKEN_PIPESL(pipe),
> +				I915_READ(CHICKEN_PIPESL(pipe)) | DISABLE_STREAMER_FIX);
> +	}

According to Bspec this would need to be disabled for render
compression. And to do that we'd need to add some vblank waits to make
sure we don't disable it too soon. But since it's pre-production
hardware anyway I guess we might not care too much.

I would probably drop SKL from these since I'd assume almost everyone
has D+ by now. And maybe just stuff it in init_clock_gating for BXT
since we're going to eliminate it soonish anyway.

> +
>  	if (scaler_id >= 0) {
>  		uint32_t ps_ctrl = 0;
>  
> @@ -5004,6 +5014,21 @@ static bool hsw_crtc_supports_ips(struct intel_crtc *crtc)
>  	return HAS_IPS(crtc->base.dev) && crtc->pipe == PIPE_A;
>  }
>  
> +
> +static void skl_wa_clkgate(struct drm_i915_private *dev_priv,
> +	int pipe, int enable)
> +{
> +	if (pipe == PIPE_A || pipe == PIPE_B) {
> +		if (enable)
> +			I915_WRITE(CLKGATE_DIS_PSL(pipe),
> +				DUPS1_GATING_DIS | DUPS2_GATING_DIS);
> +		else
> +			I915_WRITE(CLKGATE_DIS_PSL(pipe),
> +				I915_READ(CLKGATE_DIS_PSL(pipe) &
> +				~(DUPS1_GATING_DIS|DUPS2_GATING_DIS)));
> +	}
> +}
> +
>  static void haswell_crtc_enable(struct drm_crtc *crtc)
>  {
>  	struct drm_device *dev = crtc->dev;
> @@ -5094,6 +5119,9 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)
>  		intel_wait_for_vblank(dev, hsw_workaround_pipe);
>  		intel_wait_for_vblank(dev, hsw_workaround_pipe);
>  	}
> +
> +	/* workaround for NV12 */
> +	skl_wa_clkgate(dev_priv, pipe, 1);

I wonder what's the cost of having this
a) always enabled
b) enabled when the pipe is enabled
c) enabled only when NV12 is used
?

>  }
>  
>  static void ironlake_pfit_disable(struct intel_crtc *crtc)
> @@ -5211,6 +5239,9 @@ static void haswell_crtc_disable(struct drm_crtc *crtc)
>  
>  	intel_crtc->active = false;
>  	intel_update_watermarks(crtc);
> +
> +	/* workaround for NV12 */
> +	skl_wa_clkgate(dev_priv, intel_crtc->pipe, 0);
>  }
>  
>  static void i9xx_pfit_enable(struct intel_crtc *crtc)
> diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
> index d50b8cb..63750d5 100644
> --- a/drivers/gpu/drm/i915/intel_drv.h
> +++ b/drivers/gpu/drm/i915/intel_drv.h
> @@ -1158,6 +1158,7 @@ void intel_csr_load_status_set(struct drm_i915_private *dev_priv,
>  					enum csr_state state);
>  void intel_csr_load_program(struct drm_device *dev);
>  void intel_csr_ucode_fini(struct drm_device *dev);
> +char intel_get_stepping(struct drm_device *dev);
>  void assert_csr_loaded(struct drm_i915_private *dev_priv);
>  
>  /* intel_dp.c */
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index 0ea9273..9d1c5b9 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -278,6 +278,13 @@ skl_update_plane(struct drm_plane *drm_plane, struct drm_crtc *crtc,
>  	I915_WRITE(PLANE_AUX_DIST(pipe, plane), aux_dist | aux_stride);
>  	I915_WRITE(PLANE_AUX_OFFSET(pipe, plane), aux_y_offset<<16 | aux_x_offset);
>  
> +	if (((IS_SKYLAKE(dev) && intel_get_stepping(dev) == 'C') ||
> +		(IS_BROXTON(dev) && intel_get_stepping(dev) == 'A')) &&
> +		fb->pixel_format == DRM_FORMAT_NV12) {
> +			I915_WRITE(CHICKEN_PIPESL(pipe),
> +				I915_READ(CHICKEN_PIPESL(pipe)) | DISABLE_STREAMER_FIX);
> +	}
> +
>  	/* program plane scaler */
>  	if (scaler_id >= 0) {
>  		uint32_t ps_ctrl = 0;
> -- 
> 1.7.9.5
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

  parent reply	other threads:[~2015-09-04 11:26 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-20  1:02 [PATCH 00/15] drm/i915: Adding NV12 for skylake display Chandra Konduru
2015-08-20  1:02 ` [PATCH 01/15] drm/i915: Allocate min dbuf blocks per bspec Chandra Konduru
2015-09-04  8:17   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 02/15] drm/i915: In DBUF/WM calcs for 90/270, swap w & h Chandra Konduru
2015-09-04  8:31   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 03/15] drm/i915: Add register definitions for NV12 support Chandra Konduru
2015-09-04  8:40   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 04/15] drm/i915: Set scaler mode for NV12 Chandra Konduru
2015-09-04  8:53   ` Ville Syrjälä
2015-09-04 15:03     ` Daniel Vetter
2015-08-20  1:02 ` [PATCH 05/15] drm/i915: Stage scaler request for NV12 as src format Chandra Konduru
2015-09-04 10:17   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 06/15] drm/i915: Update format_is_yuv() to include NV12 Chandra Konduru
2015-09-04 10:17   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 07/15] drm/i915: Upscale scaler max scale for NV12 Chandra Konduru
2015-09-04 10:22   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 08/15] drm/i915: Add NV12 as supported format for primary plane Chandra Konduru
2015-08-26  8:40   ` Daniel Vetter
2015-08-27  1:40     ` Konduru, Chandra
2015-08-20  1:02 ` [PATCH 09/15] drm/i915: Add NV12 as supported format for sprite plane Chandra Konduru
2015-09-04 10:28   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 10/15] drm/i915: Add NV12 support to intel_framebuffer_init Chandra Konduru
2015-09-04 10:40   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 11/15] drm/i915: Add NV12 to primary plane programming Chandra Konduru
2015-09-04 11:09   ` Ville Syrjälä
2015-09-04 15:06     ` Daniel Vetter
2015-09-05  1:10     ` Konduru, Chandra
2015-09-05 14:59       ` Ville Syrjälä
2015-09-08 23:30         ` Konduru, Chandra
2015-09-09 11:41           ` Ville Syrjälä
2015-09-09 17:12             ` Konduru, Chandra
2015-09-09 18:05               ` Ville Syrjälä
2015-09-09 20:10                 ` Konduru, Chandra
2015-09-09 20:40                   ` Ville Syrjälä
2015-09-09 21:09                     ` Konduru, Chandra
2015-09-09 22:27                       ` Ville Syrjälä
2015-09-09 23:31                         ` Konduru, Chandra
2015-08-20  1:02 ` [PATCH 12/15] drm/i915: Add NV12 to sprite " Chandra Konduru
2015-08-20  1:02 ` [PATCH 13/15] drm/i915: Set initial phase & trip for NV12 scaler Chandra Konduru
2015-09-04 11:15   ` Ville Syrjälä
2015-08-20  1:02 ` [PATCH 14/15] drm/i915: skl nv12 workarounds Chandra Konduru
2015-08-26  8:42   ` Daniel Vetter
2015-08-27  1:44     ` Konduru, Chandra
2015-09-02  8:02       ` Daniel Vetter
2015-09-03 18:33         ` Konduru, Chandra
2015-09-04  7:40           ` Daniel Vetter
2015-09-05  2:09             ` Konduru, Chandra
2015-09-04 11:26   ` Ville Syrjälä [this message]
2015-09-05  1:28     ` Konduru, Chandra
2015-09-05 14:52       ` Ville Syrjälä
2015-09-08 23:51         ` Konduru, Chandra
2015-09-09 11:46           ` Ville Syrjälä
2015-09-09 17:20             ` Konduru, Chandra
2015-08-20  1:02 ` [PATCH 15/15] drm/i915: Add 90/270 rotation for NV12 format Chandra Konduru
2015-09-04 11:30   ` Ville Syrjälä
2015-09-05  1:38     ` Konduru, Chandra
2015-09-05 14:48       ` 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=20150904112604.GJ29811@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=chandra.konduru@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=ville.syrjala@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.