All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Matt Roper <matthew.d.roper@intel.com>,
	intel-xe@lists.freedesktop.org,
	Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [Intel-gfx] [Intel-xe] [PATCH v2 4/6] drm/i915/display: Make display responsible for probing its own IP
Date: Tue, 23 May 2023 15:58:52 +0300	[thread overview]
Message-ID: <87fs7nkxv7.fsf@intel.com> (raw)
In-Reply-To: <20230522202314.3939499-5-matthew.d.roper@intel.com>

On Mon, 22 May 2023, Matt Roper <matthew.d.roper@intel.com> wrote:
> +static const struct intel_display_device_info xe_lpdp_display = {
> +	XE_LPD_FEATURES,
> +	.has_cdclk_crawl = 1,
> +	.has_cdclk_squash = 1,
> +
> +	.__runtime_defaults.ip.ver = 14,
> +	.__runtime_defaults.fbc_mask = BIT(INTEL_FBC_A) | BIT(INTEL_FBC_B),
> +	.__runtime_defaults.cpu_transcoder_mask =
> +		BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
> +		BIT(TRANSCODER_C) | BIT(TRANSCODER_D),
> +};
> +
> +static const struct pci_device_id intel_display_ids[] = {

Since this is not used for MODULE_DEVICE_TABLE(), there's no requirement
for the array to be struct pci_device_id.

You can either have a struct with compatible members, or just undef and
redefine INTEL_VGA_DEVICE() to initialize a struct with pci id and const
struct intel_display_device_info *, so you can avoid the cast in
intel_display_device_probe().

See what's done with subplatform init arrays in intel_device_info.c.

This too is nitpicking, and can be fixed later.

> +	INTEL_I830_IDS(&i830_display),
> +	INTEL_I845G_IDS(&i845_display),
> +	INTEL_I85X_IDS(&i85x_display),
> +	INTEL_I865G_IDS(&i865g_display),
> +	INTEL_I915G_IDS(&i915g_display),
> +	INTEL_I915GM_IDS(&i915gm_display),
> +	INTEL_I945G_IDS(&i945g_display),
> +	INTEL_I945GM_IDS(&i945gm_display),
> +	INTEL_I965G_IDS(&i965g_display),
> +	INTEL_G33_IDS(&g33_display),
> +	INTEL_I965GM_IDS(&i965gm_display),
> +	INTEL_GM45_IDS(&gm45_display),
> +	INTEL_G45_IDS(&g45_display),
> +	INTEL_PINEVIEW_G_IDS(&g33_display),
> +	INTEL_PINEVIEW_M_IDS(&g33_display),
> +	INTEL_IRONLAKE_D_IDS(&ilk_d_display),
> +	INTEL_IRONLAKE_M_IDS(&ilk_m_display),
> +	INTEL_SNB_D_IDS(&snb_display),
> +	INTEL_SNB_M_IDS(&snb_display),
> +	INTEL_IVB_Q_IDS(NULL),		/* must be first IVB in list */
> +	INTEL_IVB_M_IDS(&ivb_display),
> +	INTEL_IVB_D_IDS(&ivb_display),
> +	INTEL_HSW_IDS(&hsw_display),
> +	INTEL_VLV_IDS(&vlv_display),
> +	INTEL_BDW_IDS(&bdw_display),
> +	INTEL_CHV_IDS(&chv_display),
> +	INTEL_SKL_IDS(&skl_display),
> +	INTEL_BXT_IDS(&bxt_display),
> +	INTEL_GLK_IDS(&glk_display),
> +	INTEL_KBL_IDS(&skl_display),
> +	INTEL_CFL_IDS(&skl_display),
> +	INTEL_ICL_11_IDS(&gen11_display),
> +	INTEL_EHL_IDS(&gen11_display),
> +	INTEL_JSL_IDS(&gen11_display),
> +	INTEL_TGL_12_IDS(&tgl_display),
> +	INTEL_DG1_IDS(&tgl_display),
> +	INTEL_RKL_IDS(&rkl_display),
> +	INTEL_ADLS_IDS(&adl_s_display),
> +	INTEL_RPLS_IDS(&adl_s_display),
> +	INTEL_ADLP_IDS(&xe_lpd_display),
> +	INTEL_ADLN_IDS(&xe_lpd_display),
> +	INTEL_RPLP_IDS(&xe_lpd_display),
> +	INTEL_DG2_IDS(&xe_hpd_display),
> +
> +	/* FIXME: Replace this with a GMD_ID lookup */
> +	INTEL_MTL_IDS(&xe_lpdp_display),
> +};
> +
> +const struct intel_display_device_info *
> +intel_display_device_probe(u16 pci_devid)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(intel_display_ids); i++) {
> +		if (intel_display_ids[i].device == pci_devid)
> +			return (struct intel_display_device_info *)intel_display_ids[i].driver_data;
> +	}
> +

I wonder if a debug message here would be helpful. *shrug*.

> +	return &no_display;
> +}


> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
> index 4d158927c78b..e1507ae59f2d 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.c
> +++ b/drivers/gpu/drm/i915/intel_device_info.c
> @@ -574,7 +574,6 @@ void intel_device_info_driver_create(struct drm_i915_private *i915,
>  {
>  	struct intel_device_info *info;
>  	struct intel_runtime_info *runtime;
> -	struct intel_display_runtime_info *display_runtime;
>  
>  	/* Setup the write-once "constant" device info */
>  	info = mkwrite_device_info(i915);
> @@ -583,9 +582,10 @@ void intel_device_info_driver_create(struct drm_i915_private *i915,
>  	/* Initialize initial runtime info from static const data and pdev. */
>  	runtime = RUNTIME_INFO(i915);
>  	memcpy(runtime, &INTEL_INFO(i915)->__runtime, sizeof(*runtime));
> -	display_runtime = DISPLAY_RUNTIME_INFO(i915);
> -	memcpy(display_runtime, &DISPLAY_INFO(i915)->__runtime_defaults,
> -	       sizeof(*display_runtime));
> +
> +	/* Probe display support */
> +	info->display = intel_display_device_probe(device_id);
> +	*DISPLAY_RUNTIME_INFO(i915) = DISPLAY_INFO(i915)->__runtime_defaults;

I think I'd keep the memcpy.

Acked-by: Jani Nikula <jani.nikula@intel.com>


>  
>  	runtime->device_id = device_id;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center

WARNING: multiple messages have this Message-ID (diff)
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Matt Roper <matthew.d.roper@intel.com>,
	intel-xe@lists.freedesktop.org,
	Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [Intel-xe] [PATCH v2 4/6] drm/i915/display: Make display responsible for probing its own IP
Date: Tue, 23 May 2023 15:58:52 +0300	[thread overview]
Message-ID: <87fs7nkxv7.fsf@intel.com> (raw)
In-Reply-To: <20230522202314.3939499-5-matthew.d.roper@intel.com>

On Mon, 22 May 2023, Matt Roper <matthew.d.roper@intel.com> wrote:
> +static const struct intel_display_device_info xe_lpdp_display = {
> +	XE_LPD_FEATURES,
> +	.has_cdclk_crawl = 1,
> +	.has_cdclk_squash = 1,
> +
> +	.__runtime_defaults.ip.ver = 14,
> +	.__runtime_defaults.fbc_mask = BIT(INTEL_FBC_A) | BIT(INTEL_FBC_B),
> +	.__runtime_defaults.cpu_transcoder_mask =
> +		BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
> +		BIT(TRANSCODER_C) | BIT(TRANSCODER_D),
> +};
> +
> +static const struct pci_device_id intel_display_ids[] = {

Since this is not used for MODULE_DEVICE_TABLE(), there's no requirement
for the array to be struct pci_device_id.

You can either have a struct with compatible members, or just undef and
redefine INTEL_VGA_DEVICE() to initialize a struct with pci id and const
struct intel_display_device_info *, so you can avoid the cast in
intel_display_device_probe().

See what's done with subplatform init arrays in intel_device_info.c.

This too is nitpicking, and can be fixed later.

> +	INTEL_I830_IDS(&i830_display),
> +	INTEL_I845G_IDS(&i845_display),
> +	INTEL_I85X_IDS(&i85x_display),
> +	INTEL_I865G_IDS(&i865g_display),
> +	INTEL_I915G_IDS(&i915g_display),
> +	INTEL_I915GM_IDS(&i915gm_display),
> +	INTEL_I945G_IDS(&i945g_display),
> +	INTEL_I945GM_IDS(&i945gm_display),
> +	INTEL_I965G_IDS(&i965g_display),
> +	INTEL_G33_IDS(&g33_display),
> +	INTEL_I965GM_IDS(&i965gm_display),
> +	INTEL_GM45_IDS(&gm45_display),
> +	INTEL_G45_IDS(&g45_display),
> +	INTEL_PINEVIEW_G_IDS(&g33_display),
> +	INTEL_PINEVIEW_M_IDS(&g33_display),
> +	INTEL_IRONLAKE_D_IDS(&ilk_d_display),
> +	INTEL_IRONLAKE_M_IDS(&ilk_m_display),
> +	INTEL_SNB_D_IDS(&snb_display),
> +	INTEL_SNB_M_IDS(&snb_display),
> +	INTEL_IVB_Q_IDS(NULL),		/* must be first IVB in list */
> +	INTEL_IVB_M_IDS(&ivb_display),
> +	INTEL_IVB_D_IDS(&ivb_display),
> +	INTEL_HSW_IDS(&hsw_display),
> +	INTEL_VLV_IDS(&vlv_display),
> +	INTEL_BDW_IDS(&bdw_display),
> +	INTEL_CHV_IDS(&chv_display),
> +	INTEL_SKL_IDS(&skl_display),
> +	INTEL_BXT_IDS(&bxt_display),
> +	INTEL_GLK_IDS(&glk_display),
> +	INTEL_KBL_IDS(&skl_display),
> +	INTEL_CFL_IDS(&skl_display),
> +	INTEL_ICL_11_IDS(&gen11_display),
> +	INTEL_EHL_IDS(&gen11_display),
> +	INTEL_JSL_IDS(&gen11_display),
> +	INTEL_TGL_12_IDS(&tgl_display),
> +	INTEL_DG1_IDS(&tgl_display),
> +	INTEL_RKL_IDS(&rkl_display),
> +	INTEL_ADLS_IDS(&adl_s_display),
> +	INTEL_RPLS_IDS(&adl_s_display),
> +	INTEL_ADLP_IDS(&xe_lpd_display),
> +	INTEL_ADLN_IDS(&xe_lpd_display),
> +	INTEL_RPLP_IDS(&xe_lpd_display),
> +	INTEL_DG2_IDS(&xe_hpd_display),
> +
> +	/* FIXME: Replace this with a GMD_ID lookup */
> +	INTEL_MTL_IDS(&xe_lpdp_display),
> +};
> +
> +const struct intel_display_device_info *
> +intel_display_device_probe(u16 pci_devid)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(intel_display_ids); i++) {
> +		if (intel_display_ids[i].device == pci_devid)
> +			return (struct intel_display_device_info *)intel_display_ids[i].driver_data;
> +	}
> +

I wonder if a debug message here would be helpful. *shrug*.

> +	return &no_display;
> +}


> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
> index 4d158927c78b..e1507ae59f2d 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.c
> +++ b/drivers/gpu/drm/i915/intel_device_info.c
> @@ -574,7 +574,6 @@ void intel_device_info_driver_create(struct drm_i915_private *i915,
>  {
>  	struct intel_device_info *info;
>  	struct intel_runtime_info *runtime;
> -	struct intel_display_runtime_info *display_runtime;
>  
>  	/* Setup the write-once "constant" device info */
>  	info = mkwrite_device_info(i915);
> @@ -583,9 +582,10 @@ void intel_device_info_driver_create(struct drm_i915_private *i915,
>  	/* Initialize initial runtime info from static const data and pdev. */
>  	runtime = RUNTIME_INFO(i915);
>  	memcpy(runtime, &INTEL_INFO(i915)->__runtime, sizeof(*runtime));
> -	display_runtime = DISPLAY_RUNTIME_INFO(i915);
> -	memcpy(display_runtime, &DISPLAY_INFO(i915)->__runtime_defaults,
> -	       sizeof(*display_runtime));
> +
> +	/* Probe display support */
> +	info->display = intel_display_device_probe(device_id);
> +	*DISPLAY_RUNTIME_INFO(i915) = DISPLAY_INFO(i915)->__runtime_defaults;

I think I'd keep the memcpy.

Acked-by: Jani Nikula <jani.nikula@intel.com>


>  
>  	runtime->device_id = device_id;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2023-05-23 12:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 20:23 [Intel-gfx] [PATCH v2 0/6] i915: Move display identification/probing under display/ Matt Roper
2023-05-22 20:23 ` [Intel-xe] " Matt Roper
2023-05-22 20:23 ` [Intel-gfx] [PATCH v2 1/6] drm/i915/display: Move display device info to header " Matt Roper
2023-05-22 20:23   ` [Intel-xe] " Matt Roper
2023-05-22 20:23 ` [Intel-gfx] [PATCH v2 2/6] drm/i915: Convert INTEL_INFO()->display to a pointer Matt Roper
2023-05-22 20:23   ` [Intel-xe] " Matt Roper
2023-05-23  7:45   ` [Intel-gfx] " Andrzej Hajda
2023-05-23  7:45     ` [Intel-xe] " Andrzej Hajda
2023-05-23 12:47   ` [Intel-gfx] [Intel-xe] " Jani Nikula
2023-05-23 12:47     ` Jani Nikula
2023-05-22 20:23 ` [Intel-gfx] [PATCH v2 3/6] drm/i915/display: Move display runtime info to display structure Matt Roper
2023-05-22 20:23   ` [Intel-xe] " Matt Roper
2023-05-23  7:50   ` [Intel-gfx] " Andrzej Hajda
2023-05-23  7:50     ` [Intel-xe] " Andrzej Hajda
2023-05-23 12:45   ` Jani Nikula
2023-05-23 12:45     ` [Intel-xe] " Jani Nikula
2023-05-22 20:23 ` [Intel-gfx] [PATCH v2 4/6] drm/i915/display: Make display responsible for probing its own IP Matt Roper
2023-05-22 20:23   ` [Intel-xe] " Matt Roper
2023-05-23  7:51   ` [Intel-gfx] " Andrzej Hajda
2023-05-23  7:51     ` [Intel-xe] " Andrzej Hajda
2023-05-23 12:58   ` Jani Nikula [this message]
2023-05-23 12:58     ` [Intel-xe] " Jani Nikula
2023-05-22 20:23 ` [Intel-gfx] [PATCH v2 5/6] drm/i915/display: Handle GMD_ID identification in display code Matt Roper
2023-05-22 20:23   ` [Intel-xe] " Matt Roper
2023-05-23  8:03   ` [Intel-gfx] " Andrzej Hajda
2023-05-23  8:03     ` [Intel-xe] " Andrzej Hajda
2023-05-23 13:02   ` [Intel-gfx] [Intel-xe] " Jani Nikula
2023-05-23 13:02     ` Jani Nikula
2023-05-23 14:43     ` [Intel-gfx] " Matt Roper
2023-05-23 14:43       ` Matt Roper
2023-05-22 20:23 ` [Intel-gfx] [PATCH v2 6/6] drm/i915/display: Move feature test macros to intel_display_device.h Matt Roper
2023-05-22 20:23   ` [Intel-xe] " Matt Roper
2023-05-23  8:06   ` [Intel-gfx] " Andrzej Hajda
2023-05-23  8:06     ` [Intel-xe] " Andrzej Hajda
2023-05-22 21:08 ` [Intel-xe] ✗ CI.Patch_applied: failure for i915: Move display identification/probing under display/ (rev2) Patchwork
2023-05-22 21:36 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning " Patchwork
2023-05-22 21:36 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-05-22 21:46 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-05-23  6:28 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2023-05-23 13:07 ` [Intel-gfx] [PATCH v2 0/6] i915: Move display identification/probing under display/ Jani Nikula
2023-05-23 13:07   ` [Intel-xe] " Jani Nikula

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=87fs7nkxv7.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.d.roper@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.