All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: <intel-gfx@lists.freedesktop.org>,
	<intel-xe@lists.freedesktop.org>, <lucas.demarchi@intel.com>,
	<ville.syrjala@linux.intel.com>
Subject: Re: [PATCH v2 5/9] drm/i915/display: add platforms "is" member to struct intel_display
Date: Wed, 28 Aug 2024 16:47:08 -0400	[thread overview]
Message-ID: <Zs-MzOKeaeX8iwdu@intel.com> (raw)
In-Reply-To: <7219e172b99401458ef6783c67b0b47115c6e772.1724092799.git.jani.nikula@intel.com>

On Mon, Aug 19, 2024 at 09:44:32PM +0300, Jani Nikula wrote:
11;rgb:ffff/ffff/ffff> Facilitate using display->is.HASWELL and display->is.HASWELL_ULT
> etc. for identifying platforms and subplatforms. Merge platform and
> subplatform members together.
> 
> v2:
> - Use bitmap ops
> - Add some sanity checks with warnings
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  .../gpu/drm/i915/display/intel_display_core.h |  3 ++
>  .../drm/i915/display/intel_display_device.c   | 31 +++++++++++++++++--
>  2 files changed, 32 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
> index 0a711114ff2b..b2907894fa28 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_core.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_core.h
> @@ -286,6 +286,9 @@ struct intel_display {
>  	/* drm device backpointer */
>  	struct drm_device *drm;
>  
> +	/* Platform (and subplatform, if any) identification */
> +	struct intel_display_platforms is;

as I told, I don't have a better suggestion I'm afraid, so


Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>


> +
>  	/* Display functions */
>  	struct {
>  		/* Top level crtc-ish functions */
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
> index 55ab1923c8b3..3d3b4ed7940e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> @@ -1269,8 +1269,28 @@ find_subplatform_desc(struct pci_dev *pdev, const struct platform_desc *desc)
>  	return NULL;
>  }
>  
> +/* Size of the entire bitmap, not the number of platforms */
> +static unsigned int display_platforms_num_bits(void)
> +{
> +	return sizeof(((struct intel_display_platforms *)0)->bitmap) * BITS_PER_BYTE;
> +}
> +
> +/* Number of platform bits set */
> +static unsigned int display_platforms_weight(const struct intel_display_platforms *p)
> +{
> +	return bitmap_weight(p->bitmap, display_platforms_num_bits());
> +}
> +
> +/* Merge the subplatform information from src to dst */
> +static void display_platforms_or(struct intel_display_platforms *dst,
> +				 const struct intel_display_platforms *src)
> +{
> +	bitmap_or(dst->bitmap, dst->bitmap, src->bitmap, display_platforms_num_bits());
> +}
> +
>  void intel_display_device_probe(struct drm_i915_private *i915)
>  {
> +	struct intel_display *display = &i915->display;
>  	struct pci_dev *pdev = to_pci_dev(i915->drm.dev);
>  	const struct intel_display_device_info *info;
>  	struct intel_display_ip_ver ip_ver = {};
> @@ -1306,13 +1326,20 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>  	       &DISPLAY_INFO(i915)->__runtime_defaults,
>  	       sizeof(*DISPLAY_RUNTIME_INFO(i915)));
>  
> -	drm_WARN_ON(&i915->drm, !desc->platform || !desc->name);
> +	drm_WARN_ON(&i915->drm, !desc->platform || !desc->name ||
> +		    display_platforms_weight(&desc->platforms) != 1);
>  	DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
> +	display->is = desc->platforms;
>  
>  	subdesc = find_subplatform_desc(pdev, desc);
>  	if (subdesc) {
> -		drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name);
> +		drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name ||
> +			    display_platforms_weight(&subdesc->platforms) != 1);
>  		DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
> +		display_platforms_or(&display->is, &subdesc->platforms);
> +
> +		/* Ensure platform and subplatform are distinct */
> +		drm_WARN_ON(&i915->drm, display_platforms_weight(&subdesc->platforms) == 1);
>  	}
>  
>  	if (ip_ver.ver || ip_ver.rel || ip_ver.step)
> -- 
> 2.39.2
> 

  parent reply	other threads:[~2024-08-28 20:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19 18:44 [PATCH v2 0/9] drm/i915/display: platform identification with display->is.<PLATFORM> Jani Nikula
2024-08-19 18:44 ` [PATCH v2 1/9] drm/i915/display: use a macro to initialize subplatforms Jani Nikula
2024-08-19 18:44 ` [PATCH v2 2/9] drm/i915/display: use a macro to define platform enumerations Jani Nikula
2024-08-19 18:44 ` [PATCH v2 3/9] drm/i915/display: join the platform and subplatform enums Jani Nikula
2024-08-19 18:44 ` [PATCH v2 4/9] drm/i915/display: add display platforms structure with platform members Jani Nikula
2024-08-28 20:46   ` Rodrigo Vivi
2024-08-19 18:44 ` [PATCH v2 5/9] drm/i915/display: add platforms "is" member to struct intel_display Jani Nikula
2024-08-19 18:48   ` [PATCH v3] " Jani Nikula
2024-08-28 20:48     ` Rodrigo Vivi
2024-08-28 20:47   ` Rodrigo Vivi [this message]
2024-08-19 18:44 ` [PATCH v2 6/9] drm/i915/display: remove the display platform enum as unnecessary Jani Nikula
2024-08-28 20:49   ` Rodrigo Vivi
2024-08-19 18:44 ` [PATCH v2 7/9] drm/i915/display: consider HSW/BDW ULX to also be ULT Jani Nikula
2024-08-28 20:50   ` Rodrigo Vivi
2024-08-19 18:44 ` [PATCH v2 8/9] drm/i915/display: keep subplatforms next to their platforms Jani Nikula
2024-08-28 20:52   ` Rodrigo Vivi
2024-08-19 18:44 ` [PATCH v2 9/9] drm/i915/bios: use display->is.PLATFORM instead of IS_PLATFORM() Jani Nikula
2024-08-28 20:52   ` Rodrigo Vivi
2024-08-19 18:51 ` ✓ CI.Patch_applied: success for drm/i915/display: platform identification with display->is.<PLATFORM> (rev2) Patchwork
2024-08-19 18:51 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-19 18:52 ` ✓ CI.KUnit: success " Patchwork
2024-08-19 19:04 ` ✓ CI.Build: " Patchwork
2024-08-19 19:06 ` ✓ CI.Hooks: " Patchwork
2024-08-19 19:08 ` ✗ CI.checksparse: warning " Patchwork
2024-08-19 19:13 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/display: platform identification with display->is.<PLATFORM> (rev3) Patchwork
2024-08-19 19:13 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-08-19 19:15 ` ✓ Fi.CI.BAT: success " Patchwork
2024-08-19 19:30 ` ✗ CI.BAT: failure for drm/i915/display: platform identification with display->is.<PLATFORM> (rev2) Patchwork
2024-08-19 19:35 ` ✓ CI.Patch_applied: success for drm/i915/display: platform identification with display->is.<PLATFORM> (rev3) Patchwork
2024-08-19 19:35 ` ✗ CI.checkpatch: warning " Patchwork
2024-08-19 19:36 ` ✓ CI.KUnit: success " Patchwork
2024-08-19 19:51 ` ✓ CI.Build: " Patchwork
2024-08-19 19:54 ` ✓ CI.Hooks: " Patchwork
2024-08-19 19:56 ` ✗ CI.checksparse: warning " Patchwork
2024-08-19 20:16 ` ✓ CI.BAT: success " Patchwork
2024-08-19 23:31 ` ✗ CI.FULL: failure for drm/i915/display: platform identification with display->is.<PLATFORM> (rev2) Patchwork
2024-08-20  0:25 ` ✗ CI.FULL: failure for drm/i915/display: platform identification with display->is.<PLATFORM> (rev3) Patchwork
2024-08-20  9:51 ` ✗ Fi.CI.IGT: " Patchwork
2024-08-28 20:41 ` [PATCH v2 0/9] drm/i915/display: platform identification with display->is.<PLATFORM> Rodrigo Vivi
2024-08-29 16:03   ` Ville Syrjälä
2024-09-24  9:49     ` Jani Nikula
2024-09-24 13:14       ` Lucas De Marchi
2024-09-24 13:37         ` Jani Nikula
2024-09-24 13:43           ` Ville Syrjälä
2024-09-26 14:58           ` Rodrigo Vivi
2024-09-27 12:16             ` Jani Nikula
2024-09-27 14:49               ` Rodrigo Vivi
2024-09-27 15:01                 ` Jani Nikula
2024-09-27 16:13                   ` Rodrigo Vivi
2024-09-27 18:12                     ` Lucas De Marchi

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=Zs-MzOKeaeX8iwdu@intel.com \
    --to=rodrigo.vivi@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=ville.syrjala@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 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.