All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org
Cc: jani.nikula@intel.com, rodrigo.vivi@intel.com,
	ville.syrjala@linux.intel.com, maarten.lankhorst@linux.intel.com,
	lucas.demarchi@intel.com
Subject: [PATCH 0/6] drm/i915/display: platform identification with display->is.<PLATFORM>
Date: Tue, 18 Jun 2024 17:22:50 +0300	[thread overview]
Message-ID: <cover.1718719962.git.jani.nikula@intel.com> (raw)

Long story short, we'll need to identify platforms in display code using
some other way than i915 core IS_<PLATFORM>() macros if we ever want to
make a strict separation between the display and non-display parts.

I tossed some ideas around (see the bottom of this mail), Lucas liked
something similar to what I have here. Essentially with this, you can
replace platform checks like IS_TIGERLAKE(i915) with
display->is.TIGERLAKE and subplatform checks like IS_RAPTORLAKE_S(i915)
with display->is.ALDERLAKE_S_RAPTORLAKE_S.

It would be possible to drop the ALDERLAKE_S or "parent" platform part
there, but I think it's useful in many cases to be explicit it's a
subplatform we're talking about.

It's also possible to convert all of this to lowercase if desired,
i.e. display->is.tigerlake and display->is.alderlake_s_raptorlake_s.

There's one more wrinkle I didn't address; currently IS_HASWELL_ULT()
and IS_BROADWELL_ULT() also match the ULX variants. This is not the case
here yet.

Thoughts?

BR,
Jani.


void foo(void)
{
	/*
	 * Examples with a platform check (Tigerlake) and a subplatform check
	 * (Alderlake S subplatform Raptorlake S).
	 */

	/*
	 * is_<platform>(display). Same as i915 core, but lowercase.
	 *
	 * Pros:
	 * - Easy to convert
	 * - Short
	 *
	 * Cons:
	 * - Need to keep defining new macros for new platfoms and subplatforms
	 */
	if (is_tigerlake(display) || is_alderlake_s_raptorlake_s(display)) {
	}

	/*
	 * is_platform(display, <platform>) check.
	 *
	 * Alternatively is_plat() or is_display() or something else?
	 *
	 * Pros:
	 * - Can be made to handle both platforms and subplatforms by
	 *   renumbering subplatforms enum
	 * - No need to define new macros for new platforms
	 *
	 * Cons:
	 * - A bit long
	 */
	if (is_platform(display, INTEL_DISPLAY_TIGERLAKE) ||
	    is_platform(display, INTEL_DISPLAY_ALDERLAKE_S_RAPTORLAKE_S)) {
	}

	/*
	 * An is_platform() with a macro wrapper to abbreviate param.
	 *
	 * Pros:
	 * - Shorter
	 *
	 * Cons:
	 * - Throws off cscope and gnu global
	 */
	if (is_platform(display, TIGERLAKE) ||
	    is_platform(display, ALDERLAKE_S_RAPTORLAKE_S)) {
	}

	/*
	 * Functions to return platform/subplatforms.
	 *
	 * Pros:
	 * - No need to define new macros for new platforms
	 *
	 * Cons:
	 * - Long
	 * - Need separate checks for platform/subplatform
	 */
	if (intel_platform(display) == INTEL_DISPLAY_TIGERLAKE ||
	    intel_subplatform(display) == INTEL_DISPLAY_ALDERLAKE_S_RAPTORLAKE_S) {
	}

	/*
	 * Initialize bitfields in display according to platform/subplatform
	 *
	 * Pros:
	 * - Really short
	 * - Does not pollute namespace with is_something
	 *
	 * Cons:
	 * - Pollutes top level struct intel_display
	 * - Kind of belongs in display device or runtime info, but that would
	 *   again be too long to be helpful
	 */
	if (display->is_tigerlake || display->alderlake_s_raptorlake_s) {
	}
}


Jani Nikula (6):
  drm/i915/display: use a macro to initialize subplatforms
  drm/i915/display: use a macro to define platform enumerations
  drm/i915/display: join the platform and subplatform macros
  drm/i915/display: add "display is" structure with platform members
  drm/i915/display: add "is" member to struct intel_display
  drm/i915/display: remove the display platform enum as unnecessary

 .../gpu/drm/i915/display/intel_display_core.h |   3 +
 .../drm/i915/display/intel_display_device.c   |  79 ++++++---
 .../drm/i915/display/intel_display_device.h   | 165 +++++++++---------
 3 files changed, 136 insertions(+), 111 deletions(-)

-- 
2.39.2


             reply	other threads:[~2024-06-18 14:23 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-18 14:22 Jani Nikula [this message]
2024-06-18 14:22 ` [PATCH 1/6] drm/i915/display: use a macro to initialize subplatforms Jani Nikula
2024-06-19 18:29   ` Rodrigo Vivi
2024-06-18 14:22 ` [PATCH 2/6] drm/i915/display: use a macro to define platform enumerations Jani Nikula
2024-06-19 18:29   ` Rodrigo Vivi
2024-06-18 14:22 ` [PATCH 3/6] drm/i915/display: join the platform and subplatform macros Jani Nikula
2024-06-19 18:30   ` Rodrigo Vivi
2024-06-18 14:22 ` [PATCH 4/6] drm/i915/display: add "display is" structure with platform members Jani Nikula
2024-06-19 18:30   ` Rodrigo Vivi
2024-06-27 17:04   ` Lucas De Marchi
2024-06-27 18:48     ` Jani Nikula
2024-06-18 14:22 ` [PATCH 5/6] drm/i915/display: add "is" member to struct intel_display Jani Nikula
2024-06-19 18:36   ` Rodrigo Vivi
2024-06-20 13:05     ` Jani Nikula
2024-06-20 16:09       ` Rodrigo Vivi
2024-06-27 17:06   ` Lucas De Marchi
2024-06-27 18:47     ` Jani Nikula
2024-06-27 21:45       ` Lucas De Marchi
2024-06-27 22:19         ` Jani Nikula
2024-06-18 14:22 ` [PATCH 6/6] drm/i915/display: remove the display platform enum as unnecessary Jani Nikula
2024-06-19 18:30   ` Rodrigo Vivi
2024-06-18 14:28 ` ✓ CI.Patch_applied: success for drm/i915/display: platform identification with display->is.<PLATFORM> Patchwork
2024-06-18 14:28 ` ✗ CI.checkpatch: warning " Patchwork
2024-06-18 14:29 ` ✓ CI.KUnit: success " Patchwork
2024-06-18 14:41 ` ✓ CI.Build: " Patchwork
2024-06-18 14:43 ` ✗ CI.Hooks: failure " Patchwork
2024-06-18 14:44 ` ✗ CI.checksparse: warning " Patchwork
2024-06-18 14:51 ` ✗ Fi.CI.CHECKPATCH: " Patchwork
2024-06-18 14:51 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-06-18 15:00 ` ✓ Fi.CI.BAT: success " Patchwork
2024-06-18 15:07 ` ✓ CI.BAT: " Patchwork
2024-06-18 23:47 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-06-19  4:06 ` ✓ CI.FULL: success " 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=cover.1718719962.git.jani.nikula@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=rodrigo.vivi@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.