public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 16/16] drm/i915: make device info a pointer to static const data
Date: Thu, 18 Aug 2022 13:05:35 +0200	[thread overview]
Message-ID: <ae9e9932-bb68-37f2-f9e6-95dae331d8c2@linux.intel.com> (raw)
In-Reply-To: <87zgg1omic.fsf@intel.com>

Op 18-08-2022 om 12:48 schreef Jani Nikula:
> On Thu, 18 Aug 2022, Maarten Lankhorst <maarten.lankhorst@linux.intel.com> wrote:
>> Op 20-06-2022 om 10:49 schreef Jani Nikula:
>>> Now that the device info is no longer modified runtime, we don't need to
>>> make a copy of it, and we can convert i915->__info into a pointer to
>>> static const data. Also remove mkwrite_device_info().
>>>
>>> This does increase the text size slightly.
>>>
>>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>>>
>>> ---
>>>
>>> An alternative is to keep copying device info, but casting away the
>>> const only once at the copy time, removing mkwrite_device_info().
>>> ---
>>>  drivers/gpu/drm/i915/i915_driver.c |  8 ++------
>>>  drivers/gpu/drm/i915/i915_drv.h    | 11 ++---------
>>>  2 files changed, 4 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
>>> index 5969cc7805d3..9c9c492e97a8 100644
>>> --- a/drivers/gpu/drm/i915/i915_driver.c
>>> +++ b/drivers/gpu/drm/i915/i915_driver.c
>>> @@ -793,9 +793,6 @@ static void i915_welcome_messages(struct drm_i915_private *dev_priv)
>>>  static struct drm_i915_private *
>>>  i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent)
>>>  {
>>> -	const struct intel_device_info *match_info =
>>> -		(struct intel_device_info *)ent->driver_data;
>>> -	struct intel_device_info *device_info;
>>>  	struct intel_runtime_info *runtime;
>>>  	struct drm_i915_private *i915;
>>>  
>>> @@ -809,9 +806,8 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent)
>>>  	/* Device parameters start as a copy of module parameters. */
>>>  	i915_params_copy(&i915->params, &i915_modparams);
>>>  
>>> -	/* Setup the write-once "constant" device info */
>>> -	device_info = mkwrite_device_info(i915);
>>> -	memcpy(device_info, match_info, sizeof(*device_info));
>>> +	/* Static const device info. */
>>> +	i915->__info = (const struct intel_device_info *)ent->driver_data;
>>>  
>>>  	/* Initialize initial runtime info from static const data and pdev. */
>>>  	runtime = RUNTIME_INFO(i915);
>>> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
>>> index 89472440947c..a2a57f07c5be 100644
>>> --- a/drivers/gpu/drm/i915/i915_drv.h
>>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>>> @@ -380,7 +380,7 @@ struct drm_i915_private {
>>>  	/* i915 device parameters */
>>>  	struct i915_params params;
>>>  
>>> -	const struct intel_device_info __info; /* Use INTEL_INFO() to access. */
>>> +	const struct intel_device_info *__info; /* Use INTEL_INFO() to access. */
>>>  	struct intel_runtime_info __runtime; /* Use RUNTIME_INFO() to access. */
>>>  	struct intel_driver_caps caps;
>>>  
>>> @@ -848,7 +848,7 @@ static inline struct intel_gt *to_gt(struct drm_i915_private *i915)
>>>  	GENMASK(INTEL_FRONTBUFFER_BITS_PER_PIPE * ((pipe) + 1) - 1, \
>>>  		INTEL_FRONTBUFFER_BITS_PER_PIPE * (pipe))
>>>  
>>> -#define INTEL_INFO(dev_priv)	(&(dev_priv)->__info)
>>> +#define INTEL_INFO(__i915)	(__i915->__info)
>>>  #define RUNTIME_INFO(dev_priv)	(&(dev_priv)->__runtime)
>>>  #define DRIVER_CAPS(dev_priv)	(&(dev_priv)->caps)
>>>  
>>> @@ -1432,13 +1432,6 @@ void i915_gem_driver_release(struct drm_i915_private *dev_priv);
>>>  
>>>  int i915_gem_open(struct drm_i915_private *i915, struct drm_file *file);
>>>  
>>> -/* intel_device_info.c */
>>> -static inline struct intel_device_info *
>>> -mkwrite_device_info(struct drm_i915_private *dev_priv)
>>> -{
>>> -	return (struct intel_device_info *)INTEL_INFO(dev_priv);
>>> -}
>>> -
>>>  static inline enum i915_map_type
>>>  i915_coherent_map_type(struct drm_i915_private *i915,
>>>  		       struct drm_i915_gem_object *obj, bool always_coherent)
>> I think just moving around things is safest in this case. I believe
>> all should be moved to the new display sub-struct, but this is a start
>> of making that easier.
>>
>> For the series, except patch 5:
>>
>> Reviewed-by: Maarten Lankhort <maarten.lankhorst@linux.intel.com>
> Thanks... but there's v2 starting at [1]. I don't recall any changes
> other than rebase and slight reordering of patches.
>
> What's wrong with patch 5? I mean it does get modified runtime.
>
> BR,
> Jani.
>
>
>
> [1] https://lore.kernel.org/r/cover.1660137416.git.jani.nikula@intel.com
>
>
Sorry, except 5 was for the display split series. Patch 5 from this series is fine. :)


  reply	other threads:[~2022-08-18 11:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-20  8:37 [Intel-gfx] [PATCH 00/16] drm/i915: stop modifying "const" device info Jani Nikula
2022-06-20  8:37 ` [Intel-gfx] [PATCH 01/16] drm/i915: use GRAPHICS_VER() instead of accessing match_info directly Jani Nikula
2022-06-20  8:38   ` Jani Nikula
2022-06-23 20:00   ` Ville Syrjälä
2022-06-28 14:10     ` Jani Nikula
2022-06-20  8:37 ` [Intel-gfx] [PATCH 00/16] drm/i915: stop modifying "const" device info Jani Nikula
2022-06-20  8:38 ` [Intel-gfx] [PATCH 02/16] drm/i915: combine device info printing into one Jani Nikula
2022-06-20  8:38 ` [Intel-gfx] [PATCH 03/16] drm/i915: add initial runtime info into device info Jani Nikula
2022-06-23 20:05   ` Ville Syrjälä
2022-06-20  8:38 ` [Intel-gfx] [PATCH 04/16] drm/i915: move fbc_mask to runtime info Jani Nikula
2022-06-20  8:38 ` [Intel-gfx] [PATCH 05/16] drm/i915: move page_sizes " Jani Nikula
2022-06-20  8:38 ` [Intel-gfx] [PATCH 06/16] drm/i915: move ppgtt_type and ppgtt_size " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 07/16] drm/i915: move has_pooled_eu " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 08/16] drm/i915: move memory_regions " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 09/16] drm/i915: move platform_engine_mask " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 10/16] drm/i915: move graphics.ver and graphics.rel " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 11/16] drm/i915: move pipe_mask and cpu_transcoder_mask " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 12/16] drm/i915: move has_hdcp " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 13/16] drm/i915: move has_dmc " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 14/16] drm/i915: move has_dsc " Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 15/16] drm/i915: stop resetting display info to zero for no display Jani Nikula
2022-06-20  8:49 ` [Intel-gfx] [PATCH 16/16] drm/i915: make device info a pointer to static const data Jani Nikula
2022-08-18  9:57   ` Maarten Lankhorst
2022-08-18 10:48     ` Jani Nikula
2022-08-18 11:05       ` Maarten Lankhorst [this message]
2022-06-20  8:54 ` [Intel-gfx] [PATCH 00/16] drm/i915: stop modifying "const" device info Jani Nikula
2022-06-20 14:16 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2022-06-20 14:43 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-06-20 19:45 ` [Intel-gfx] ✗ 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=ae9e9932-bb68-37f2-f9e6-95dae331d8c2@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@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