Intel-GFX Archive on 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>,
	<maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH v4 07/15] drm/i915/display: add platform member to struct intel_display
Date: Tue, 22 Oct 2024 13:51:35 -0400	[thread overview]
Message-ID: <ZxfmJ2n0T-3Xsgjy@intel.com> (raw)
In-Reply-To: <bfc651942b227b35d5e6a6c2649530c47db9d207.1729518793.git.jani.nikula@intel.com>

On Mon, Oct 21, 2024 at 04:54:08PM +0300, Jani Nikula wrote:
> Facilitate using display->platform.haswell and
> display->platform.haswell_ult etc. for identifying platforms and
> subplatforms.
> 
> Merge the platform and subplatform bitmaps together, and check that
> there's no overlap.
> 
> v4:
> - Lower case, s/is/platform/
> 
> v3:
> - Fix sanity check on display->is after merging subplatform members
> 
> v2:
> - Use bitmap ops
> - Add some sanity checks with warnings
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

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

> ---
>  .../gpu/drm/i915/display/intel_display_core.h |  3 ++
>  .../drm/i915/display/intel_display_device.c   | 35 +++++++++++++++++--
>  2 files changed, 36 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 45697af25fa9..45b7c6900adc 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_core.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_core.h
> @@ -284,6 +284,9 @@ struct intel_display {
>  	/* drm device backpointer */
>  	struct drm_device *drm;
>  
> +	/* Platform (and subplatform, if any) identification */
> +	struct intel_display_platforms platform;
> +
>  	/* 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 0e835f714bf5..c124df204166 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
> @@ -1525,6 +1525,25 @@ static enum intel_step get_pre_gmdid_step(struct intel_display *display,
>  	return step;
>  }
>  
> +/* 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;
> @@ -1564,13 +1583,25 @@ 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));
>  	DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
>  
> +	display->platform = 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));
>  		DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
> +
> +		display_platforms_or(&display->platform, &subdesc->platforms);
> +
> +		/* Ensure platform and subplatform are distinct */
> +		drm_WARN_ON(&i915->drm,
> +			    display_platforms_weight(&display->platform) !=
> +			    display_platforms_weight(&desc->platforms) +
> +			    display_platforms_weight(&subdesc->platforms));
>  	}
>  
>  	if (ip_ver.ver || ip_ver.rel || ip_ver.step) {
> -- 
> 2.39.5
> 

  reply	other threads:[~2024-10-22 17:51 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21 13:54 [PATCH v4 00/15] drm/i915/display: platform identification with display->platform.<platform> Jani Nikula
2024-10-21 13:54 ` [PATCH v4 01/15] drm/i915/display: reindent subplatform initialization Jani Nikula
2024-10-21 13:54 ` [PATCH v4 02/15] drm/i915/display: use a macro to initialize subplatforms Jani Nikula
2024-10-21 13:54 ` [PATCH v4 03/15] drm/i915/display: use a macro to define platform enumerations Jani Nikula
2024-10-21 13:54 ` [PATCH v4 04/15] drm/i915/display: join the platform and subplatform enums Jani Nikula
2024-10-21 13:54 ` [PATCH v4 05/15] drm/i915/display: convert display platforms to lower case Jani Nikula
2024-10-21 13:54 ` [PATCH v4 06/15] drm/i915/display: add display platforms structure with platform members Jani Nikula
2024-10-22 17:52   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 07/15] drm/i915/display: add platform member to struct intel_display Jani Nikula
2024-10-22 17:51   ` Rodrigo Vivi [this message]
2024-10-21 13:54 ` [PATCH v4 08/15] drm/i915/display: remove the display platform enum as unnecessary Jani Nikula
2024-10-22 17:49   ` Rodrigo Vivi
2024-10-23 13:09     ` Jani Nikula
2024-10-23 14:40       ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 09/15] drm/i915/display: add platform group for g4x Jani Nikula
2024-10-22 17:45   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 10/15] drm/i915/display: add subplatform group for HSW/BDW ULT Jani Nikula
2024-10-23 15:08   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 11/15] drm/i915/bios: use display->platform.<platform> instead of IS_<PLATFORM>() Jani Nikula
2024-10-22 17:45   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 12/15] drm/i915/pps: " Jani Nikula
2024-10-22 17:43   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 13/15] drm/i915/tv: " Jani Nikula
2024-10-22 17:43   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 14/15] drm/i915/vga: " Jani Nikula
2024-10-22 17:42   ` Rodrigo Vivi
2024-10-21 13:54 ` [PATCH v4 15/15] drm/i915/vblank: " Jani Nikula
2024-10-22 17:42   ` Rodrigo Vivi
2024-10-21 14:41 ` ✗ Fi.CI.SPARSE: warning for drm/i915/display: platform identification with display->platform.<platform> (rev2) Patchwork
2024-10-21 15:06 ` ✓ Fi.CI.BAT: success " Patchwork
2024-10-21 18:53 ` ✗ Fi.CI.IGT: 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=ZxfmJ2n0T-3Xsgjy@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=maarten.lankhorst@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox