From: Mahesh Kumar Subject: Re: [PATCH 2/2] drm/i915: Simplify scaler init during CRTC HW readout Date: Fri, 21 Jul 2017 19:36:22 +0530 Message-ID: <725e4fe5-a167-de97-0af9-0381c450d11e@intel.com> References: <20170719225057.20131-1-imre.deak@intel.com> <20170719225057.20131-2-imre.deak@intel.com> <9f98ab21-cbb4-43d8-8069-3245a9cc5ef8@intel.com> <20170721132653.ws2kc34so4aodaz4@ideak-desk.fi.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0107454166==" Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id AED876E7EE for ; Fri, 21 Jul 2017 14:02:00 +0000 (UTC) In-Reply-To: <20170721132653.ws2kc34so4aodaz4@ideak-desk.fi.intel.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: imre.deak@intel.com Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --===============0107454166== Content-Type: multipart/alternative; boundary="------------817481480A8E5CDC5583716F" Content-Language: en-US This is a multi-part message in MIME format. --------------817481480A8E5CDC5583716F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, On Friday 21 July 2017 06:56 PM, Imre Deak wrote: > On Fri, Jul 21, 2017 at 06:44:24PM +0530, Mahesh Kumar wrote: >> Hi, >> >> >> On Thursday 20 July 2017 04:20 AM, Imre Deak wrote: >>> The crtc state starts out being bzero'd, so no need to clear >>> scaler_users. Also intel_crtc_init_scalers() knows already which >>> platforms have scalers, so no need for the platform check here. >>> Similarly intel_crtc_init_scalers() will init scaler_id as required, >>> so no need to do it here separately. >>> >>> Cc: Chandra Konduru >>> Cc: Matt Roper >>> Signed-off-by: Imre Deak >>> --- >>> drivers/gpu/drm/i915/intel_display.c | 7 +------ >>> 1 file changed, 1 insertion(+), 6 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c >>> index 8a38e64b1931..7210f418e9c0 100644 >>> --- a/drivers/gpu/drm/i915/intel_display.c >>> +++ b/drivers/gpu/drm/i915/intel_display.c >>> @@ -9132,12 +9132,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc, >>> u64 power_domain_mask; >>> bool active; >>> - if (INTEL_GEN(dev_priv) >= 9) { >>> - intel_crtc_init_scalers(crtc, pipe_config); >>> - >>> - pipe_config->scaler_state.scaler_id = -1; >>> - pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX); >>> - } >>> + intel_crtc_init_scalers(crtc, pipe_config); >> If we are removing gen check, then IMHO we should initialize "scaler_id = >> -1" even before !crtc->num_scalers check in intel_crtc_init_scalers >> function, just to make sure scaler state doesn't have wrong value in >> platforms where we don't have any scalers. > I agree that setting scaler_id to -1 on all platforms is a good idea, > but it's unrelated to removing here the GEN check. intel_crtc_init_scalers() > is already called for all platforms in intel_crtc_init(). So this change won't > make a difference for platforms without scalers: we leave scaler_id zeroed > on those already now (they have num_scalers set to 0). This isn't either > a problem since we allocate scalers only on GEN9+. > > So we could do what you suggest but imo as a follow-up. sounds good, But if you are going to write a cleanup patch, will that be possible for you to do following change also. 0 indicates no scaler is used & non-zero +ve value indicates used scaler id. in any case Reviewed-by: Mahesh Kumar -Mahesh > > --Imre --------------817481480A8E5CDC5583716F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Hi,


On Friday 21 July 2017 06:56 PM, Imre Deak wrote:
On Fri, Jul 21, 2017 at 06:44:24PM +0530, Mahesh Kumar wrote:
Hi,


On Thursday 20 July 2017 04:20 AM, Imre Deak wrote:
The crtc state starts out being bzero'd, so no need to clear
scaler_users. Also intel_crtc_init_scalers() knows already which
platforms have scalers, so no need for the platform check here.
Similarly intel_crtc_init_scalers() will init scaler_id as required,
so no need to do it here separately.

Cc: Chandra Konduru <chandra.konduru@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
---
  drivers/gpu/drm/i915/intel_display.c | 7 +------
  1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8a38e64b1931..7210f418e9c0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -9132,12 +9132,7 @@ static bool haswell_get_pipe_config(struct intel_crtc *crtc,
  	u64 power_domain_mask;
  	bool active;
-	if (INTEL_GEN(dev_priv) >= 9) {
-		intel_crtc_init_scalers(crtc, pipe_config);
-
-		pipe_config->scaler_state.scaler_id = -1;
-		pipe_config->scaler_state.scaler_users &= ~(1 << SKL_CRTC_INDEX);
-	}
+	intel_crtc_init_scalers(crtc, pipe_config);
If we are removing gen check, then IMHO we should initialize "scaler_id =
-1" even before !crtc->num_scalers check in intel_crtc_init_scalers
function, just to make sure scaler state doesn't have wrong value in
platforms where we don't have any scalers.
I agree that setting scaler_id to -1 on all platforms is a good idea,
but it's unrelated to removing here the GEN check. intel_crtc_init_scalers()
is already called for all platforms in intel_crtc_init(). So this change won't
make a difference for platforms without scalers: we leave scaler_id zeroed
on those already now (they have num_scalers set to 0). This isn't either
a problem since we allocate scalers only on GEN9+.

So we could do what you suggest but imo as a follow-up.
sounds good, But if you are going to write a cleanup patch, will that be possible for you to do following change also.
    0 indicates no scaler is used & non-zero +ve value indicates used scaler id.
in any case

Reviewed-by: Mahesh Kumar <mahesh1.kumar@intel.com>

-Mahesh

--Imre

--------------817481480A8E5CDC5583716F-- --===============0107454166== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============0107454166==--