Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Anusha Srivatsa <anusha.srivatsa@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 2/8] drm/i915/dmc: Use RUNTIME_INFO->step for DMC
Date: Wed, 07 Jul 2021 12:08:55 +0300	[thread overview]
Message-ID: <87v95m7aoo.fsf@intel.com> (raw)
In-Reply-To: <875yxm8r3b.fsf@intel.com>

On Wed, 07 Jul 2021, Jani Nikula <jani.nikula@linux.intel.com> wrote:
> On Tue, 06 Jul 2021, Anusha Srivatsa <anusha.srivatsa@intel.com> wrote:
>> Instead of adding new table for every new platform, lets ues
>> the stepping info from RUNTIME_INFO(dev_priv)->step
>> This patch uses RUNTIME_INFO->step only for recent
>> platforms.
>>
>> Patches that follow this will address this change for
>> remaining platforms + missing platforms.
>>
>> Signed-off-by: Anusha Srivatsa <anusha.srivatsa@intel.com>
>> ---
>>  drivers/gpu/drm/i915/display/intel_dmc.c | 61 +++++++++++++++++++++---
>>  1 file changed, 54 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_dmc.c b/drivers/gpu/drm/i915/display/intel_dmc.c
>> index f8789d4543bf..a38720f25910 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dmc.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dmc.c
>> @@ -266,10 +266,12 @@ static const struct stepping_info icl_stepping_info[] = {
>>  };
>>  
>>  static const struct stepping_info no_stepping_info = { '*', '*' };
>> +struct stepping_info *display_step;
>
> We can't have driver specific mutable data for this. Almost everything
> has to be either device specific or const. The above would be shared
> between all devices.

I think the solution to your problem is two-fold.

First, I think you should add a *generic* function in intel_step.c to
get the chars or a string for an enum intel_step. Maybe a string,
because it'll also be useful for logging?

const char *intel_step_name(enum intel_step step)
{
	switch (step) {
        case STEP_A0:
		return "A0";
	case STEP_B0;
                /* etc ... */
	default:
		return "??";
        }
}

Second, I think you should modify intel_get_stepping_info() to let you
pass in the struct stepping_info pointer to fill in. Then you can have a
local struct stepping_info si variable in parse_dmc_fw(). We don't need
to store the data anywhere, it's only used once.

static void intel_get_stepping_info(struct drm_i915_private *dev_priv,
       struct stepping_info *si)

There you'd do something like:

	const char *step_name = intel_step_name(step);

	si->stepping = step_name[0];
        si->stepping = step_name[1];

And potentially handle the ?? case separately. Something along those
lines.

BR,
Jani.


>
> BR,
> Jani.
>
>>  
>>  static const struct stepping_info *
>>  intel_get_stepping_info(struct drm_i915_private *dev_priv)
>>  {
>> +	struct intel_step_info step = RUNTIME_INFO(dev_priv)->step;
>>  	const struct stepping_info *si;
>>  	unsigned int size;
>>  
>> @@ -282,15 +284,60 @@ intel_get_stepping_info(struct drm_i915_private *dev_priv)
>>  	} else if (IS_BROXTON(dev_priv)) {
>>  		size = ARRAY_SIZE(bxt_stepping_info);
>>  		si = bxt_stepping_info;
>> -	} else {
>> -		size = 0;
>> -		si = NULL;
>>  	}
>>  
>> -	if (INTEL_REVID(dev_priv) < size)
>> -		return si + INTEL_REVID(dev_priv);
>> -
>> -	return &no_stepping_info;
>> +	if (IS_ICELAKE(dev_priv) || IS_SKYLAKE(dev_priv) || IS_BROXTON(dev_priv))
>> +		return INTEL_REVID(dev_priv) < size ? si + INTEL_REVID(dev_priv) : &no_stepping_info;
>> +
>> +	else {
>> +		switch (step.display_step) {
>> +		case STEP_A0:
>> +			display_step->stepping = 'A';
>> +			display_step->substepping = '0';
>> +			break;
>> +		case STEP_A2:
>> +			display_step->stepping = 'A';
>> +			display_step->substepping = '2';
>> +			break;
>> +		case STEP_B0:
>> +			display_step->stepping = 'B';
>> +			display_step->substepping = '0';
>> +			break;
>> +		case STEP_B1:
>> +			display_step->stepping = 'B';
>> +			display_step->substepping = '1';
>> +			break;
>> +		case STEP_C0:
>> +			display_step->stepping = 'C';
>> +			display_step->substepping = '0';
>> +			break;
>> +		case STEP_D0:
>> +			display_step->stepping = 'D';
>> +			display_step->substepping = '0';
>> +			break;
>> +		case STEP_D1:
>> +			display_step->stepping = 'D';
>> +			display_step->substepping = '1';
>> +			break;
>> +		case STEP_E0:
>> +			display_step->stepping = 'E';
>> +			display_step->substepping = '0';
>> +			break;
>> +		case STEP_F0:
>> +			display_step->stepping = 'F';
>> +			display_step->substepping = '0';
>> +			break;
>> +		case STEP_G0:
>> +			display_step->stepping = 'G';
>> +			display_step->substepping = '0';
>> +			break;
>> +		default:
>> +			display_step->stepping = '*';
>> +			display_step->substepping = '*';
>> +			break;
>> +		}
>> +	}
>> +	return display_step;
>>  }
>>  
>>  static void gen9_set_dc_state_debugmask(struct drm_i915_private *dev_priv)

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2021-07-07  9:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  5:06 [Intel-gfx] [PATCH 0/8] Abstract steppings for all platforms Anusha Srivatsa
2021-07-07  5:06 ` [Intel-gfx] [PATCH 1/8] drm/i915/step: s/<platform>_revid_tbl/<platform>_revids Anusha Srivatsa
2021-07-07  8:24   ` Jani Nikula
2021-07-07  5:06 ` [Intel-gfx] [PATCH 2/8] drm/i915/dmc: Use RUNTIME_INFO->step for DMC Anusha Srivatsa
2021-07-07  8:29   ` Jani Nikula
2021-07-07  9:08     ` Jani Nikula [this message]
2021-07-07  5:06 ` [Intel-gfx] [PATCH 3/8] drm/i915/skl: s/IS_SKL_REVID/IS_SKL_GT_STEP Anusha Srivatsa
2021-07-07  5:06 ` [Intel-gfx] [PATCH 4/8] drm/i915/bxt: s/IS_BXT_REVID/IS_BXT_GT_STEP Anusha Srivatsa
2021-07-07  5:06 ` [Intel-gfx] [PATCH 5/8] drm/i915/icl: s/IS_ICL_REVID/IS_ICL_GT_STEP Anusha Srivatsa
2021-07-07  5:06 ` [Intel-gfx] [PATCH 6/8] drm/i915/glk: s/IS_GLK_REVID/IS_GLK_GT_STEP Anusha Srivatsa
2021-07-07  5:06 ` [Intel-gfx] [PATCH 7/8] drm/i915/rkl: s/IS_RKL_REVID/IS_RKL_GT_STEP Anusha Srivatsa
2021-07-07  5:06 ` [Intel-gfx] [PATCH 8/8] drm/i915/dg1: s/IS_DG1_REVID/IS_DG1_GT_STEP Anusha Srivatsa
2021-07-07  5:26 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Abstract steppings for all platforms Patchwork
2021-07-07  5:28 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2021-07-07  5:57 ` [Intel-gfx] ✗ Fi.CI.BAT: failure " 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=87v95m7aoo.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=anusha.srivatsa@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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