public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH 03/16] drm/i915: add initial runtime info into device info
Date: Thu, 23 Jun 2022 23:05:18 +0300	[thread overview]
Message-ID: <YrTHfkVrzx2v8wSW@intel.com> (raw)
In-Reply-To: <1037cd2faeb2ad28be07dcb07afd4ec80a80e7a4.1655712106.git.jani.nikula@intel.com>

On Mon, Jun 20, 2022 at 11:38:02AM +0300, Jani Nikula wrote:
> Add initial runtime info that we can copy to runtime info at i915
> creation time. This lets us define the initial values for runtime info
> statically while making it possible to change them runtime. This will be
> the new home for the current "const" device info members that are
> modified runtime anyway.
> 
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_driver.c       |  7 +++-
>  drivers/gpu/drm/i915/intel_device_info.h | 41 +++++++++++++-----------
>  2 files changed, 29 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c
> index 0b00a05f1a74..5969cc7805d3 100644
> --- a/drivers/gpu/drm/i915/i915_driver.c
> +++ b/drivers/gpu/drm/i915/i915_driver.c
> @@ -796,6 +796,7 @@ 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;
>  
>  	i915 = devm_drm_dev_alloc(&pdev->dev, &i915_drm_driver,
> @@ -811,7 +812,11 @@ i915_driver_create(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	/* Setup the write-once "constant" device info */
>  	device_info = mkwrite_device_info(i915);
>  	memcpy(device_info, match_info, sizeof(*device_info));
> -	RUNTIME_INFO(i915)->device_id = pdev->device;
> +
> +	/* Initialize initial runtime info from static const data and pdev. */
> +	runtime = RUNTIME_INFO(i915);
> +	memcpy(runtime, &INTEL_INFO(i915)->__runtime, sizeof(*runtime));
> +	runtime->device_id = pdev->device;
>  
>  	return i915;
>  }
> diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
> index b86f68866e35..85385c98b9f4 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.h
> +++ b/drivers/gpu/drm/i915/intel_device_info.h
> @@ -197,6 +197,27 @@ struct ip_version {
>  	u8 rel;
>  };
>  
> +struct intel_runtime_info {
> +	/*
> +	 * Platform mask is used for optimizing or-ed IS_PLATFORM calls into
> +	 * into single runtime conditionals, and also to provide groundwork
> +	 * for future per platform, or per SKU build optimizations.
> +	 *
> +	 * Array can be extended when necessary if the corresponding
> +	 * BUILD_BUG_ON is hit.
> +	 */
> +	u32 platform_mask[2];
> +
> +	u16 device_id;
> +
> +	u8 num_sprites[I915_MAX_PIPES];
> +	u8 num_scalers[I915_MAX_PIPES];

I was just thinking about moving these out from runtime init,
and perhaps converting to something a bit less funky (eg. plane
bitmask or somesuch thing). But then I got lost trying to parse
my way through the macro hell in i915_pci.c...

> +
> +	u32 rawclk_freq;
> +
> +	struct intel_step_info step;
> +};
> +
>  struct intel_device_info {
>  	struct ip_version graphics;
>  	struct ip_version media;
> @@ -252,27 +273,11 @@ struct intel_device_info {
>  		u32 degamma_lut_tests;
>  		u32 gamma_lut_tests;
>  	} color;
> -};
>  
> -struct intel_runtime_info {
>  	/*
> -	 * Platform mask is used for optimizing or-ed IS_PLATFORM calls into
> -	 * into single runtime conditionals, and also to provide groundwork
> -	 * for future per platform, or per SKU build optimizations.
> -	 *
> -	 * Array can be extended when necessary if the corresponding
> -	 * BUILD_BUG_ON is hit.
> +	 * Initial runtime info. Do not access outside of i915_driver_create().
>  	 */
> -	u32 platform_mask[2];
> -
> -	u16 device_id;
> -
> -	u8 num_sprites[I915_MAX_PIPES];
> -	u8 num_scalers[I915_MAX_PIPES];
> -
> -	u32 rawclk_freq;
> -
> -	struct intel_step_info step;
> +	const struct intel_runtime_info __runtime;
>  };
>  
>  struct intel_driver_caps {
> -- 
> 2.30.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2022-06-23 20:05 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ä [this message]
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
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=YrTHfkVrzx2v8wSW@intel.com \
    --to=ville.syrjala@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