intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
	Intel-gfx@lists.freedesktop.org
Subject: Re: [RFC 6/7] drm/i915: Introduce subplatform concept
Date: Wed, 14 Nov 2018 00:28:41 +0200	[thread overview]
Message-ID: <877ehgfw86.fsf@intel.com> (raw)
In-Reply-To: <e0f36618-2e1c-9baf-616d-0cc06a6d3be8@linux.intel.com>

On Tue, 13 Nov 2018, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
> On 13/11/2018 11:40, Jani Nikula wrote:
>> On Mon, 12 Nov 2018, Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> wrote:
>>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>>
>>> Introduce subplatform mask to eliminate throughout the code devid checking
>>> sprinkle, mostly courtesy of IS_*_UL[TX] macros.
>>>
>>> Subplatform mask initialization is done at runtime device info init.
>> 
>> I kind of like the concept, and I like the centralization of devid
>> checks in one function, but I've always wanted to take this to one step
>> further: only specify device ids in i915_pciids.h, and *nowhere* else.
>> 
>> It's perhaps too much duplication to create a device info for all these
>> variants, but I think it would be possible to make the subplatform info
>> table driven using macros defined in i915_pciids.h.
>
> It would be much nicer, but how would you do it? Perhaps my imagination 
> is just strong enough today.

So here's an idea.

>
> Simply by splitting the id's into subplatform parts, for instance where 
> we have today:
>
> #define INTEL_BDW_GT1_IDS(info)  \
>          INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \
>          INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \
>          INTEL_VGA_DEVICE(0x160B, info), /* GT1 Iris */ \
>          INTEL_VGA_DEVICE(0x160E, info), /* GT1 ULX */ \
>          INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \
>          INTEL_VGA_DEVICE(0x160D, info)  /* GT1 Workstation */
>
> We'd split to:
>
> #define INTEL_BDW_GT1_ULT_IDS(info)  \
>          INTEL_VGA_DEVICE(0x1602, info), /* GT1 ULT */ \
>          INTEL_VGA_DEVICE(0x1606, info), /* GT1 ULT */ \
>
> #define INTEL_BDW_GT1_ULX_IDS(info)  \
>          INTEL_VGA_DEVICE(0x160E, info), /* GT1 ULX */ \

So far so good.

>
> #define INTEL_BDW_GT1_IDS(info)  \
>          INTEL_VGA_DEVICE(0x160B, info), /* GT1 Iris */ \
>          INTEL_VGA_DEVICE(0x160A, info), /* GT1 Server */ \
>          INTEL_VGA_DEVICE(0x160D, info)  /* GT1 Workstation */

Now include INTEL_BDW_GT1_ULT_IDS(info) and INTEL_BDW_GT1_ULX_IDS(info)
to the above...

>
> Then in i915_pci.c, instead of:
>
> 	...
> 	INTEL_BDW_GT1_IDS(&intel_broadwell_gt1_info),
> 	...
>
> We'd have:
>
> 	...
> 	INTEL_BDW_GT1_ULT_IDS(&intel_broadwell_gt1_info),
> 	INTEL_BDW_GT1_ULX_IDS(&intel_broadwell_gt1_info),
> 	INTEL_BDW_GT1_IDS(&intel_broadwell_gt1_info),
> 	...

...so you don't need to make this change at all. But that's a minor
detail.

> And a separate table to map the id's to subplatform values.
>
> Hmm, but we would probably need to extrac the id's from the 
> INTEL_BDW1_GT_IDS like macros so they can be used in this second site 
> without the info parameter. Something like the trick for device info 
> flags, but can it be made to generate a macro? I think not..

Are we shy of macro magic? Pfft.

#undef INTEL_VGA_DEVICE
#define INTEL_VGA_DEVICE(id, info) (id)

static const u32 bdw_ult_ids[] = {
	INTEL_BDW_GT1_ULT_IDS(0),
};

static const u32 bdw_ulx_ids[] = {
	INTEL_BDW_GT1_ULX_IDS(0),
};

#undef INTEL_VGA_DEVICE

Now you can add another mapping on top with pointers to similar arrays
as above and corresponding subplatform bits. Just need to order the code
to not clobber the real INTEL_VGA_DEVICE needs.

We don't need to split the ult/ulx tables by platform either if we only
care about the subplatform ult/ulx here, just need to remember add all
ult/ulx in corresponding arrays.


BR,
Jani.

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-11-13 22:28 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12 17:12 [RFC 0/7] mkwrite_device_info removal Tvrtko Ursulin
2018-11-12 17:12 ` [RFC 1/7] drm/i915: Remove has_pooled_eu static initializer Tvrtko Ursulin
2018-11-12 17:29   ` Ville Syrjälä
2018-11-12 17:12 ` [RFC 2/7] drm/i915: Introduce runtime device info Tvrtko Ursulin
2018-11-12 17:36   ` Ville Syrjälä
2018-11-13  9:11     ` Tvrtko Ursulin
2018-11-12 17:12 ` [RFC 3/7] drm/i915: Move all runtime modified device info fields into runtime info Tvrtko Ursulin
2018-11-12 17:24   ` Chris Wilson
2018-11-13  9:13     ` Tvrtko Ursulin
2018-11-13  9:42       ` Chris Wilson
2018-11-12 21:22   ` Lucas De Marchi
2018-11-13  9:19     ` Tvrtko Ursulin
2018-11-12 17:12 ` [RFC 4/7] drm/i915: Remove mkwrite_device_info Tvrtko Ursulin
2018-11-12 17:25   ` Chris Wilson
2018-11-13  9:16     ` Tvrtko Ursulin
2018-11-13 11:28       ` Jani Nikula
2018-11-13 11:34         ` Chris Wilson
2018-11-13 11:45   ` Jani Nikula
2018-11-13 11:50     ` Jani Nikula
2018-11-13 11:51     ` Chris Wilson
2018-11-13 17:33       ` Tvrtko Ursulin
2018-11-13 17:40         ` Chris Wilson
2018-11-13 17:15     ` Tvrtko Ursulin
2018-11-12 17:12 ` [RFC 5/7] drm/i915: Move gen and platform mask to runtime device info Tvrtko Ursulin
2018-11-13 11:30   ` Jani Nikula
2018-11-13 11:48     ` Tvrtko Ursulin
2018-11-13 11:58       ` Tvrtko Ursulin
2018-11-12 17:12 ` [RFC 6/7] drm/i915: Introduce subplatform concept Tvrtko Ursulin
2018-11-12 17:29   ` Chris Wilson
2018-11-13  9:17     ` Tvrtko Ursulin
2018-11-13 11:40   ` Jani Nikula
2018-11-13 17:11     ` Tvrtko Ursulin
2018-11-13 22:28       ` Jani Nikula [this message]
2018-11-15 11:03         ` Tvrtko Ursulin
2019-03-25 18:00         ` Tvrtko Ursulin
2018-11-12 17:12 ` [RFC 7/7] drm/i915: Remove double underscore from static device info member names Tvrtko Ursulin
2018-11-12 17:34 ` ✗ Fi.CI.CHECKPATCH: warning for mkwrite_device_info removal Patchwork
2018-11-12 17:37 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-11-12 17:50 ` ✗ Fi.CI.BAT: 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=877ehgfw86.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@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).