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,
lucas.demarchi@intel.com, maarten.lankhorst@linux.intel.com,
ville.syrjala@linux.intel.com
Subject: Re: [PATCH v3 06/15] drm/i915/display: add display platforms structure with platform members
Date: Tue, 08 Oct 2024 12:36:34 +0300 [thread overview]
Message-ID: <87zfnfq6l9.fsf@intel.com> (raw)
In-Reply-To: <ZwQ8ZVuhUNiUHPyp@intel.com>
On Mon, 07 Oct 2024, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Mon, Sep 30, 2024 at 03:31:07PM +0300, Jani Nikula wrote:
>> Add a structure with a bitfield member for each platform and
>> subplatform, and initialize them in platform and subplatform descs.
>>
>> The structure also contains a bitmap in a union for easier manipulation
>> of the bits.
>>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>> .../drm/i915/display/intel_display_device.c | 4 ++++
>> .../drm/i915/display/intel_display_device.h | 19 +++++++++++++++++++
>> 2 files changed, 23 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.c b/drivers/gpu/drm/i915/display/intel_display_device.c
>> index b2610217f5c5..258660b49eba 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_device.c
>> +++ b/drivers/gpu/drm/i915/display/intel_display_device.c
>> @@ -31,6 +31,7 @@ struct stepping_desc {
>> .step_info.size = ARRAY_SIZE(_map)
>>
>> struct subplatform_desc {
>> + struct intel_display_platforms platforms;
>> enum intel_display_platform subplatform;
>> const char *name;
>> const u16 *pciidlist;
>> @@ -38,10 +39,12 @@ struct subplatform_desc {
>> };
>>
>> #define SUBPLATFORM(_platform, _subplatform) \
>> + .platforms._platform##_##_subplatform = 1, \
>> .subplatform = (INTEL_DISPLAY_##_platform##_##_subplatform), \
>> .name = #_subplatform
>>
>> struct platform_desc {
>> + struct intel_display_platforms platforms;
>> enum intel_display_platform platform;
>> const char *name;
>> const struct subplatform_desc *subplatforms;
>> @@ -50,6 +53,7 @@ struct platform_desc {
>> };
>>
>> #define PLATFORM(_platform) \
>> + .platforms._platform = 1, \
>> .platform = (INTEL_DISPLAY_##_platform), \
>> .name = #_platform
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
>> index c4208c34cc31..f166d4698949 100644
>> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
>> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
>> @@ -6,6 +6,7 @@
>> #ifndef __INTEL_DISPLAY_DEVICE_H__
>> #define __INTEL_DISPLAY_DEVICE_H__
>>
>> +#include <linux/bitops.h>
>> #include <linux/types.h>
>>
>> #include "intel_display_conversion.h"
>> @@ -104,6 +105,24 @@ enum intel_display_platform {
>>
>> #undef __ENUM
>>
>> +#define __MEMBER(name) unsigned long name:1;
>> +#define __COUNT(x) 1 +
>> +
>> +#define __NUM_PLATFORMS (INTEL_DISPLAY_PLATFORMS(__COUNT) 0)
>> +
>> +struct intel_display_platforms {
>> + union {
>> + struct {
>> + INTEL_DISPLAY_PLATFORMS(__MEMBER);
>> + };
>> + DECLARE_BITMAP(bitmap, __NUM_PLATFORMS);
>> + };
>> +};
>> +
>> +#undef __MEMBER
>> +#undef __COUNT
>
> why do we need the count here?
> I'm afraid I didn't fully followed this macro...
"1 +" gets substituted for each platform in INTEL_DISPLAY_PLATFORMS(),
resulting in the number of platforms, stored in __NUM_PLATFORMS.
We use that for the DECLARE_BITMAP() above. And we're using a bitmap to
avoid hand-rolling bitmap_or(). Yeah, it's a bit icky, but a) gets the
job done, b) should not need to be manually updated when the number of
platforms grows.
BR,
Jani.
>
>> +#undef __NUM_PLATFORMS
>> +
>> #define DEV_INFO_DISPLAY_FOR_EACH_FLAG(func) \
>> /* Keep in alphabetical order */ \
>> func(cursor_needs_physical); \
>> --
>> 2.39.5
>>
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-10-08 9:36 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-30 12:31 [PATCH v3 00/15] drm/i915/display: platform identification with display->platform.<platform> Jani Nikula
2024-09-30 12:31 ` [PATCH v3 01/15] drm/i915/display: reindent subplatform initialization Jani Nikula
2024-10-07 19:35 ` Rodrigo Vivi
2024-09-30 12:31 ` [PATCH v3 02/15] drm/i915/display: use a macro to initialize subplatforms Jani Nikula
2024-10-07 19:41 ` Rodrigo Vivi
2024-09-30 12:31 ` [PATCH v3 03/15] drm/i915/display: use a macro to define platform enumerations Jani Nikula
2024-10-07 19:48 ` Rodrigo Vivi
2024-10-07 20:36 ` Michal Wajdeczko
2024-10-08 9:30 ` Jani Nikula
2024-10-08 9:42 ` Michal Wajdeczko
2024-10-08 10:08 ` Jani Nikula
2024-09-30 12:31 ` [PATCH v3 04/15] drm/i915/display: join the platform and subplatform enums Jani Nikula
2024-10-07 19:49 ` Rodrigo Vivi
2024-09-30 12:31 ` [PATCH v3 05/15] drm/i915/display: convert display platforms to lower case Jani Nikula
2024-10-07 19:49 ` Rodrigo Vivi
2024-09-30 12:31 ` [PATCH v3 06/15] drm/i915/display: add display platforms structure with platform members Jani Nikula
2024-10-07 19:54 ` Rodrigo Vivi
2024-10-08 9:36 ` Jani Nikula [this message]
2024-09-30 12:31 ` [PATCH v3 07/15] drm/i915/display: add platform member to struct intel_display Jani Nikula
2024-09-30 12:31 ` [PATCH v3 08/15] drm/i915/display: remove the display platform enum as unnecessary Jani Nikula
2024-09-30 12:31 ` [PATCH v3 09/15] drm/i915/display: add platform group for g4x Jani Nikula
2024-09-30 12:31 ` [PATCH v3 10/15] drm/i915/display: add subplatform group for HSW/BDW ULT Jani Nikula
2024-09-30 12:31 ` [PATCH v3 11/15] drm/i915/bios: use display->platform.<platform> instead of IS_<PLATFORM>() Jani Nikula
2024-09-30 12:31 ` [PATCH v3 12/15] drm/i915/pps: " Jani Nikula
2024-09-30 12:31 ` [PATCH v3 13/15] drm/i915/tv: " Jani Nikula
2024-09-30 12:31 ` [PATCH v3 14/15] drm/i915/vga: " Jani Nikula
2024-09-30 12:31 ` [PATCH v3 15/15] drm/i915/vblank: " Jani Nikula
2024-09-30 16:27 ` ✓ CI.Patch_applied: success for drm/i915/display: platform identification with display->platform.<platform> Patchwork
2024-09-30 16:27 ` ✗ CI.checkpatch: warning " Patchwork
2024-09-30 16:29 ` ✓ CI.KUnit: success " Patchwork
2024-09-30 16:41 ` ✓ CI.Build: " Patchwork
2024-09-30 16:44 ` ✓ CI.Hooks: " Patchwork
2024-09-30 16:45 ` ✗ CI.checksparse: warning " Patchwork
2024-09-30 17:19 ` ✓ CI.BAT: success " Patchwork
2024-09-30 21:50 ` ✗ CI.FULL: failure " Patchwork
2024-10-01 1:45 ` ✗ Fi.CI.SPARSE: warning " Patchwork
2024-10-01 1:53 ` ✓ Fi.CI.BAT: success " Patchwork
2024-10-01 14:34 ` ✗ 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=87zfnfq6l9.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 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.