Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Ville Syrjala <ville.syrjala@linux.intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 03/35] drm/i915/bios: Indicate which VBT structures are based on EDID
Date: Mon, 06 May 2024 12:14:19 +0300	[thread overview]
Message-ID: <87msp3nvys.fsf@intel.com> (raw)
In-Reply-To: <20240503122449.27266-4-ville.syrjala@linux.intel.com>

On Fri, 03 May 2024, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> VBT reuses a bunch of EDID data structures. Flag those as such
> for clarity.
>
> I chose "bdb_edid_" as the namespace for these.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Reviewed-by: Jani Nikula <jani.nikula@intel.com>

> ---
>  drivers/gpu/drm/i915/display/intel_bios.c     | 28 +++---
>  drivers/gpu/drm/i915/display/intel_vbt_defs.h | 95 ++++++++++---------
>  2 files changed, 62 insertions(+), 61 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index 661842a3c2e6..9f933508be1c 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -242,13 +242,13 @@ static bool validate_lfp_data_ptrs(const void *bdb,
>  
>  	/* fp_timing has variable size */
>  	if (fp_timing_size < 32 ||
> -	    dvo_timing_size != sizeof(struct lvds_dvo_timing) ||
> -	    panel_pnp_id_size != sizeof(struct lvds_pnp_id))
> +	    dvo_timing_size != sizeof(struct bdb_edid_dtd) ||
> +	    panel_pnp_id_size != sizeof(struct bdb_edid_pnp_id))
>  		return false;
>  
>  	/* panel_name is not present in old VBTs */
>  	if (panel_name_size != 0 &&
> -	    panel_name_size != sizeof(struct lvds_lfp_panel_name))
> +	    panel_name_size != sizeof(struct bdb_edid_product_name))
>  		return false;
>  
>  	lfp_data_size = ptrs->ptr[1].fp_timing.offset - ptrs->ptr[0].fp_timing.offset;
> @@ -385,8 +385,8 @@ static void *generate_lfp_data_ptrs(struct drm_i915_private *i915,
>  
>  	block_size = get_blocksize(block);
>  
> -	size = fp_timing_size + sizeof(struct lvds_dvo_timing) +
> -		sizeof(struct lvds_pnp_id);
> +	size = fp_timing_size + sizeof(struct bdb_edid_dtd) +
> +		sizeof(struct bdb_edid_pnp_id);
>  	if (size * 16 > block_size)
>  		return NULL;
>  
> @@ -398,10 +398,10 @@ static void *generate_lfp_data_ptrs(struct drm_i915_private *i915,
>  	*(u16 *)(ptrs_block + 1) = sizeof(*ptrs);
>  	ptrs = ptrs_block + 3;
>  
> -	table_size = sizeof(struct lvds_pnp_id);
> +	table_size = sizeof(struct bdb_edid_pnp_id);
>  	size = make_lfp_data_ptr(&ptrs->ptr[0].panel_pnp_id, table_size, size);
>  
> -	table_size = sizeof(struct lvds_dvo_timing);
> +	table_size = sizeof(struct bdb_edid_dtd);
>  	size = make_lfp_data_ptr(&ptrs->ptr[0].dvo_timing, table_size, size);
>  
>  	table_size = fp_timing_size;
> @@ -419,15 +419,15 @@ static void *generate_lfp_data_ptrs(struct drm_i915_private *i915,
>  		return NULL;
>  	}
>  
> -	size = fp_timing_size + sizeof(struct lvds_dvo_timing) +
> -		sizeof(struct lvds_pnp_id);
> +	size = fp_timing_size + sizeof(struct bdb_edid_dtd) +
> +		sizeof(struct bdb_edid_pnp_id);
>  	for (i = 1; i < 16; i++) {
>  		next_lfp_data_ptr(&ptrs->ptr[i].fp_timing, &ptrs->ptr[i-1].fp_timing, size);
>  		next_lfp_data_ptr(&ptrs->ptr[i].dvo_timing, &ptrs->ptr[i-1].dvo_timing, size);
>  		next_lfp_data_ptr(&ptrs->ptr[i].panel_pnp_id, &ptrs->ptr[i-1].panel_pnp_id, size);
>  	}
>  
> -	table_size = sizeof(struct lvds_lfp_panel_name);
> +	table_size = sizeof(struct bdb_edid_product_name);
>  
>  	if (16 * (size + table_size) <= block_size) {
>  		ptrs->panel_name.table_size = table_size;
> @@ -525,7 +525,7 @@ static void init_bdb_blocks(struct drm_i915_private *i915,
>  static void
>  fill_detail_timing_data(struct drm_i915_private *i915,
>  			struct drm_display_mode *panel_fixed_mode,
> -			const struct lvds_dvo_timing *dvo_timing)
> +			const struct bdb_edid_dtd *dvo_timing)
>  {
>  	panel_fixed_mode->hdisplay = (dvo_timing->hactive_hi << 8) |
>  		dvo_timing->hactive_lo;
> @@ -579,7 +579,7 @@ fill_detail_timing_data(struct drm_i915_private *i915,
>  	drm_mode_set_name(panel_fixed_mode);
>  }
>  
> -static const struct lvds_dvo_timing *
> +static const struct bdb_edid_dtd *
>  get_lvds_dvo_timing(const struct bdb_lvds_lfp_data *data,
>  		    const struct bdb_lvds_lfp_data_ptrs *ptrs,
>  		    int index)
> @@ -601,7 +601,7 @@ get_lvds_pnp_id(const struct bdb_lvds_lfp_data *data,
>  		int index)
>  {
>  	/* These two are supposed to have the same layout in memory. */
> -	BUILD_BUG_ON(sizeof(struct lvds_pnp_id) != sizeof(struct drm_edid_product_id));
> +	BUILD_BUG_ON(sizeof(struct bdb_edid_pnp_id) != sizeof(struct drm_edid_product_id));
>  
>  	return (const void *)data + ptrs->ptr[index].panel_pnp_id.offset;
>  }
> @@ -835,7 +835,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
>  		    const struct bdb_lvds_lfp_data *lvds_lfp_data,
>  		    const struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs)
>  {
> -	const struct lvds_dvo_timing *panel_dvo_timing;
> +	const struct bdb_edid_dtd *panel_dvo_timing;
>  	const struct lvds_fp_timing *fp_timing;
>  	struct drm_display_mode *panel_fixed_mode;
>  	int panel_type = panel->vbt.panel_type;
> diff --git a/drivers/gpu/drm/i915/display/intel_vbt_defs.h b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
> index eebb91f4d88b..7ad4d31f6437 100644
> --- a/drivers/gpu/drm/i915/display/intel_vbt_defs.h
> +++ b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
> @@ -39,6 +39,50 @@
>  
>  #include "intel_bios.h"
>  
> +/* EDID derived structures */
> +struct bdb_edid_pnp_id {
> +	u16 mfg_name;
> +	u16 product_code;
> +	u32 serial;
> +	u8 mfg_week;
> +	u8 mfg_year;
> +} __packed;
> +
> +struct bdb_edid_product_name {
> +	char name[13];
> +} __packed;
> +
> +struct bdb_edid_dtd {
> +	u16 clock;		/**< In 10khz */
> +	u8 hactive_lo;
> +	u8 hblank_lo;
> +	u8 hblank_hi:4;
> +	u8 hactive_hi:4;
> +	u8 vactive_lo;
> +	u8 vblank_lo;
> +	u8 vblank_hi:4;
> +	u8 vactive_hi:4;
> +	u8 hsync_off_lo;
> +	u8 hsync_pulse_width_lo;
> +	u8 vsync_pulse_width_lo:4;
> +	u8 vsync_off_lo:4;
> +	u8 vsync_pulse_width_hi:2;
> +	u8 vsync_off_hi:2;
> +	u8 hsync_pulse_width_hi:2;
> +	u8 hsync_off_hi:2;
> +	u8 himage_lo;
> +	u8 vimage_lo;
> +	u8 vimage_hi:4;
> +	u8 himage_hi:4;
> +	u8 h_border;
> +	u8 v_border;
> +	u8 rsvd1:3;
> +	u8 digital:2;
> +	u8 vsync_positive:1;
> +	u8 hsync_positive:1;
> +	u8 non_interlaced:1;
> +} __packed;
> +
>  /**
>   * struct vbt_header - VBT Header structure
>   * @signature:		VBT signature, always starts with "$VBT"
> @@ -645,39 +689,8 @@ struct bdb_sdvo_lvds_options {
>   * Block 23 - SDVO LVDS Panel DTDs
>   */
>  
> -struct lvds_dvo_timing {
> -	u16 clock;		/**< In 10khz */
> -	u8 hactive_lo;
> -	u8 hblank_lo;
> -	u8 hblank_hi:4;
> -	u8 hactive_hi:4;
> -	u8 vactive_lo;
> -	u8 vblank_lo;
> -	u8 vblank_hi:4;
> -	u8 vactive_hi:4;
> -	u8 hsync_off_lo;
> -	u8 hsync_pulse_width_lo;
> -	u8 vsync_pulse_width_lo:4;
> -	u8 vsync_off_lo:4;
> -	u8 vsync_pulse_width_hi:2;
> -	u8 vsync_off_hi:2;
> -	u8 hsync_pulse_width_hi:2;
> -	u8 hsync_off_hi:2;
> -	u8 himage_lo;
> -	u8 vimage_lo;
> -	u8 vimage_hi:4;
> -	u8 himage_hi:4;
> -	u8 h_border;
> -	u8 v_border;
> -	u8 rsvd1:3;
> -	u8 digital:2;
> -	u8 vsync_positive:1;
> -	u8 hsync_positive:1;
> -	u8 non_interlaced:1;
> -} __packed;
> -
>  struct bdb_sdvo_panel_dtds {
> -	struct lvds_dvo_timing dtds[4];
> +	struct bdb_edid_dtd dtds[4];
>  } __packed;
>  
>  /*
> @@ -828,14 +841,6 @@ struct lvds_fp_timing {
>  	u16 terminator;
>  } __packed;
>  
> -struct lvds_pnp_id {
> -	u16 mfg_name;
> -	u16 product_code;
> -	u32 serial;
> -	u8 mfg_week;
> -	u8 mfg_year;
> -} __packed;
> -
>  /*
>   * For reference only. fp_timing has variable size so
>   * the data must be accessed using the data table pointers.
> @@ -843,18 +848,14 @@ struct lvds_pnp_id {
>   */
>  struct lvds_lfp_data_entry {
>  	struct lvds_fp_timing fp_timing;
> -	struct lvds_dvo_timing dvo_timing;
> -	struct lvds_pnp_id pnp_id;
> +	struct bdb_edid_dtd dvo_timing;
> +	struct bdb_edid_pnp_id pnp_id;
>  } __packed;
>  
>  struct bdb_lvds_lfp_data {
>  	struct lvds_lfp_data_entry data[16];
>  } __packed;
>  
> -struct lvds_lfp_panel_name {
> -	u8 name[13];
> -} __packed;
> -
>  struct lvds_lfp_black_border {
>  	u8 top;		/* 227+ */
>  	u8 bottom;	/* 227+ */
> @@ -863,7 +864,7 @@ struct lvds_lfp_black_border {
>  } __packed;
>  
>  struct bdb_lvds_lfp_data_tail {
> -	struct lvds_lfp_panel_name panel_name[16];		/* (156-163?)+ */
> +	struct bdb_edid_product_name panel_name[16];		/* (156-163?)+ */
>  	u16 scaling_enable;					/* 187+ */
>  	u8 seamless_drrs_min_refresh_rate[16];			/* 188+ */
>  	u8 pixel_overlap_count[16];				/* 208+ */

-- 
Jani Nikula, Intel

  reply	other threads:[~2024-05-06  9:14 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-03 12:24 [PATCH 00/35] drm/i915/bios: Define (almost) all BDB blocks Ville Syrjala
2024-05-03 12:24 ` [PATCH 01/35] drm/i915/bios: Define eDP DSC disable bit Ville Syrjala
2024-05-06  9:10   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 02/35] drm/i915/bios: Remove version number comment from DEVICE_HANDLE_EFP4 Ville Syrjala
2024-05-03 12:24 ` [PATCH 03/35] drm/i915/bios: Indicate which VBT structures are based on EDID Ville Syrjala
2024-05-06  9:14   ` Jani Nikula [this message]
2024-05-03 12:24 ` [PATCH 04/35] drm/i915/bios: Get rid of "LVDS" from all LFP data stuff Ville Syrjala
2024-05-06  9:19   ` Jani Nikula
2024-05-06 11:32     ` Ville Syrjälä
2024-05-03 12:24 ` [PATCH 05/35] drm/i915/bios: Rename SDVO DTD blocks a bit Ville Syrjala
2024-05-03 12:24 ` [PATCH 06/35] drm/i915/bios: Define "TV" child device handle Ville Syrjala
2024-05-03 12:24 ` [PATCH 07/35] drm/i915/bios: Flag "VBIOS only" VBT data blocks Ville Syrjala
2024-05-03 12:24 ` [PATCH 08/35] drm/i915/bios: Add version notes for some blocks Ville Syrjala
2024-05-06  9:23   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 09/35] drm/i915/bios: Define VBT block 3 (Display Toggle Option) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 10/35] drm/i915/bios: Define VBT block 4 (Mode Support List) contents Ville Syrjala
2024-05-06  9:24   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 11/35] drm/i915/bios: Define VBT block 5 (Generic Mode Table) Ville Syrjala
2024-05-03 12:24 ` [PATCH 12/35] drm/i915/bios: Define VBT blocks 6, 7, 8 (register tables) contents Ville Syrjala
2024-05-06  9:27   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 13/35] drm/i915/bios: Define VBT block 10 (Mode Removal Table) contents Ville Syrjala
2024-05-06  9:28   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 14/35] drm/i915/bios: Define VBT block 12 (Driver Persistent Algorithm) contents Ville Syrjala
2024-05-06  9:29   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 15/35] drm/i915/bios: Define VBT block 15 (Dot Clock Override Table) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 16/35] drm/i915/bios: Define ALM only VBT block 9 contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 17/35] drm/i915/bios: Define VBT block 17 (SV Test Functions) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 18/35] drm/i915/bios: Define VBT block 18 (Driver Rotation) contents Ville Syrjala
2024-05-06  9:31   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 19/35] drm/i915/bios: Define VBT blocks 16, 29, 31 (Toggle List) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 20/35] drm/i915/bios: Define VBT blocks 19, 30, 32 (Display Configuration Removal Table) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 21/35] drm/i915/bios: Define VBT block 20 (OEM Customizable Modes) contents Ville Syrjala
2024-05-06  9:35   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 22/35] drm/i915/bios: Define VBT block 21 (EFP List) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 23/35] drm/i915/bios: Define VBT block 24 (SDVO LVDS PnP ID) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 24/35] drm/i915/bios: Define VBT block 25 (SDVO LVDS PPS) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 25/35] drm/i915/bios: Define VBT block 26 (TV Options) contents Ville Syrjala
2024-05-06  9:36   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 26/35] drm/i915/bios: Define VBT block 28 (EFP DTD) contents Ville Syrjala
2024-05-06  9:37   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 27/35] drm/i915/bios: Define VBT block 45 (eDP BFI) contents Ville Syrjala
2024-05-03 12:24 ` [PATCH 28/35] drm/i915/bios: Define VBT block 46 (Chromaticity For Narrow Gamut Panel) contents Ville Syrjala
2024-05-06  9:39   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 29/35] drm/i915/bios: Define VBT block 51 (Fixed Set Mode Table) contents Ville Syrjala
2024-05-06  9:40   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 30/35] drm/i915/bios: Define VBT block 55 (RGB Palette " Ville Syrjala
2024-05-06  9:40   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 31/35] drm/i915/bios: Define VBT block 57 (Vswing PreEmphasis " Ville Syrjala
2024-05-06  9:42   ` Jani Nikula
2024-05-06 11:47     ` Ville Syrjälä
2024-05-03 12:24 ` [PATCH 32/35] drm/i915/bios: Define VBT block 50 (MIPI) contents Ville Syrjala
2024-05-06  9:44   ` Jani Nikula
2024-05-03 12:24 ` [PATCH 33/35] drm/i915/bios: Define VBT block 55 (Compression Parameters) Ville Syrjala
2024-05-03 12:24 ` [PATCH 34/35] drm/i915/bios: Define VBT block 252 (int15 Hook) Ville Syrjala
2024-05-03 12:24 ` [PATCH 35/35] drm/i915/bios: Define VBT block 253 (PRD Table) contents Ville Syrjala
2024-05-06  9:45   ` Jani Nikula
2024-05-03 13:05 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915/bios: Define (almost) all BDB blocks Patchwork
2024-05-03 13:05 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-05-03 13:13 ` ✓ Fi.CI.BAT: success " Patchwork
2024-05-04  2:02 ` ✗ Fi.CI.IGT: failure " Patchwork
2024-05-06  9:47 ` [PATCH 00/35] " Jani Nikula

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=87msp3nvys.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --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