From: Jani Nikula <jani.nikula@intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
ville.syrjala@linux.intel.com, maarten.lankhorst@linux.intel.com,
lucas.demarchi@intel.com
Subject: Re: [PATCH 5/6] drm/i915/display: add "is" member to struct intel_display
Date: Thu, 20 Jun 2024 16:05:46 +0300 [thread overview]
Message-ID: <87o77vepcl.fsf@intel.com> (raw)
In-Reply-To: <ZnMlKgX7Fd4Edtnf@intel.com>
On Wed, 19 Jun 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Tue, Jun 18, 2024 at 05:22:55PM +0300, Jani Nikula wrote:
>> Facilitate using display->is.HASWELL etc. for identifying platforms and
>> subplatforms. Merge platform and subplatform members together.
>>
>> 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 | 19 +++++++++++++++++++
>> 2 files changed, 22 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_core.h b/drivers/gpu/drm/i915/display/intel_display_core.h
>> index 7715fc329057..35bea92893af 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 identification */
>> + struct intel_display_is is;
>> +
>> /* 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 0c275d85bd30..954caea38005 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
>> @@ -1269,8 +1269,25 @@ find_subplatform_desc(struct pci_dev *pdev, const struct platform_desc *desc)
>> return NULL;
>> }
>>
>> +static void mem_or(void *_dst, const void *_src, size_t size)
>> +{
>> + const u8 *src = _src;
>> + u8 *dst = _dst;
>> + size_t i;
>> +
>> + for (i = 0; i < size; i++)
>> + dst[i] |= src[i];
>
> I confess that here I got a bit lost. But I believe it is just a matter of
> adding a few comments in the code or perhaps adjusting function names...
>
> If my coffee is working well still, what we are doing here is ensuring that:
>
> is.HASWELL returns true regardless the subplatform this is coming from...
> like is.HASWELL_ULT or is.HASWELL_ULX.
>
> But since you are only doing dst |= src and not doing src |= dst and also
> not calling this function for different subplatforms, then individually
> is.HASWELL_ULT is false for ULX platform and vice-versa.
The subplatform stuff here only ever applies to one subplatform, not
multiple. The "ULX is also ULT" is not handled yet, and maybe I'd like
to handle that in some special way, because I like the simplicity of
only having one subplatform in effect at a time.
>
> Perhaps the name 'merge' is not a good one?
>
>> +}
>> +
>> +static void merge_display_is(struct intel_display_is *dst,
>> + const struct intel_display_is *src)
>> +{
>> + mem_or(dst, src, sizeof(*dst));
>
> and/or perhaps we don't need this extra indirection here?
I added the extra indirection only because "mem_or" is something that
could exist as a generic thing. "just do bitwise OR from src to dst".
BR,
Jani.
>
>> +}
>> +
>> 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 = {};
>> @@ -1308,11 +1325,13 @@ void intel_display_device_probe(struct drm_i915_private *i915)
>>
>> drm_WARN_ON(&i915->drm, !desc->platform || !desc->name);
>> DISPLAY_RUNTIME_INFO(i915)->platform = desc->platform;
>> + display->is = desc->is;
>>
>> subdesc = find_subplatform_desc(pdev, desc);
>> if (subdesc) {
>> drm_WARN_ON(&i915->drm, !subdesc->subplatform || !subdesc->name);
>> DISPLAY_RUNTIME_INFO(i915)->subplatform = subdesc->subplatform;
>> + merge_display_is(&display->is, &subdesc->is);
>> }
>>
>> if (ip_ver.ver || ip_ver.rel || ip_ver.step)
>> --
>> 2.39.2
>>
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-06-20 13:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-18 14:22 [PATCH 0/6] drm/i915/display: platform identification with display->is.<PLATFORM> Jani Nikula
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 [this message]
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:51 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/display: platform identification with display->is.<PLATFORM> Patchwork
2024-06-18 14:51 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-06-18 15:00 ` ✓ Fi.CI.BAT: success " Patchwork
2024-06-18 23:47 ` ✗ 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=87o77vepcl.fsf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).