Re: [Intel-gfx] [PATCH 03/10] drm/i915/bios: Enable parse of two integrated panels timing data

2021-07-26 Thread Matt Atwood
On Wed, Jul 21, 2021 at 10:43:31PM -0700, José Roberto de Souza wrote:
> Continuing the conversion from single integrated VBT data to two.
> 
> Cc: Ville Syrjälä 
> Cc: Jani Nikula 
> Signed-off-by: José Roberto de Souza 
Review-by: Matt Atwood 
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c| 53 +---
>  drivers/gpu/drm/i915/display/intel_bios.h|  1 +
>  drivers/gpu/drm/i915/display/intel_dsi_vbt.c |  7 ++-
>  drivers/gpu/drm/i915/display/intel_panel.c   |  7 +--
>  drivers/gpu/drm/i915/i915_drv.h  |  3 +-
>  5 files changed, 48 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c 
> b/drivers/gpu/drm/i915/display/intel_bios.c
> index 2b90efb41ecce..5906e9fa8f976 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -289,14 +289,15 @@ parse_panel_options(struct drm_i915_private *i915,
>  /* Try to find integrated panel timing data */
>  static void
>  parse_lfp_panel_dtd(struct drm_i915_private *i915,
> - const struct bdb_header *bdb)
> + const struct bdb_header *bdb,
> + struct ddi_vbt_port_info *info,
> + int panel_index)
>  {
>   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 lvds_fp_timing *fp_timing;
>   struct drm_display_mode *panel_fixed_mode;
> - int panel_type = i915->vbt.panel_type;
>  
>   lvds_lfp_data = find_section(bdb, BDB_LVDS_LFP_DATA);
>   if (!lvds_lfp_data)
> @@ -308,7 +309,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
>  
>   panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
>  lvds_lfp_data_ptrs,
> -panel_type);
> +panel_index);
>  
>   panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
>   if (!panel_fixed_mode)
> @@ -316,7 +317,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
>  
>   fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing);
>  
> - i915->vbt.lfp_lvds_vbt_mode = panel_fixed_mode;
> + info->lfp_lvds_vbt_mode = panel_fixed_mode;
>  
>   drm_dbg_kms(&i915->drm,
>   "Found panel mode in BIOS VBT legacy lfp table:\n");
> @@ -324,7 +325,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
>  
>   fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
>  lvds_lfp_data_ptrs,
> -panel_type);
> +panel_index);
>   if (fp_timing) {
>   /* check the resolution, just to be sure */
>   if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
> @@ -339,7 +340,9 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
>  
>  static void
>  parse_generic_dtd(struct drm_i915_private *i915,
> -   const struct bdb_header *bdb)
> +   const struct bdb_header *bdb,
> +   struct ddi_vbt_port_info *info,
> +   int panel_index)
>  {
>   const struct bdb_generic_dtd *generic_dtd;
>   const struct generic_dtd_entry *dtd;
> @@ -363,14 +366,14 @@ parse_generic_dtd(struct drm_i915_private *i915,
>  
>   num_dtd = (get_blocksize(generic_dtd) -
>  sizeof(struct bdb_generic_dtd)) / generic_dtd->gdtd_size;
> - if (i915->vbt.panel_type >= num_dtd) {
> + if (panel_index >= num_dtd) {
>   drm_err(&i915->drm,
> - "Panel type %d not found in table of %d DTD's\n",
> - i915->vbt.panel_type, num_dtd);
> + "Panel index %d not found in table of %d DTD's\n",
> + panel_index, num_dtd);
>   return;
>   }
>  
> - dtd = &generic_dtd->dtd[i915->vbt.panel_type];
> + dtd = &generic_dtd->dtd[panel_index];
>  
>   panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
>   if (!panel_fixed_mode)
> @@ -413,12 +416,14 @@ parse_generic_dtd(struct drm_i915_private *i915,
>   "Found panel mode in BIOS VBT generic dtd table:\n");
>   drm_mode_debug_printmodeline(panel_fixed_mode);
>  
> - i915->vbt.lfp_lvds_vbt_mode = panel_fixed_mode;
> + info->lfp_lvds_vbt_mode = panel_fixed_mode;
>  }
>  
>  static void
>  parse_panel_dtd(struct drm_i915_private *i915,
> - const struct bdb_header *bdb)
> + const struct bdb_header *bdb,
> + struct ddi_vbt_port_info *info,
> + int panel_index)
>  {
>   /*
>* Older VBTs provided provided DTD information for internal displays
> @@ -429,9 +434,9 @@ parse_panel_dtd(struct drm_i915_private *i915,
>* back to trying the old LFP block if that fails.
>*/
>   if (bdb->version >= 229)
>

[Intel-gfx] [PATCH 03/10] drm/i915/bios: Enable parse of two integrated panels timing data

2021-07-21 Thread José Roberto de Souza
Continuing the conversion from single integrated VBT data to two.

Cc: Ville Syrjälä 
Cc: Jani Nikula 
Signed-off-by: José Roberto de Souza 
---
 drivers/gpu/drm/i915/display/intel_bios.c| 53 +---
 drivers/gpu/drm/i915/display/intel_bios.h|  1 +
 drivers/gpu/drm/i915/display/intel_dsi_vbt.c |  7 ++-
 drivers/gpu/drm/i915/display/intel_panel.c   |  7 +--
 drivers/gpu/drm/i915/i915_drv.h  |  3 +-
 5 files changed, 48 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c 
b/drivers/gpu/drm/i915/display/intel_bios.c
index 2b90efb41ecce..5906e9fa8f976 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -289,14 +289,15 @@ parse_panel_options(struct drm_i915_private *i915,
 /* Try to find integrated panel timing data */
 static void
 parse_lfp_panel_dtd(struct drm_i915_private *i915,
-   const struct bdb_header *bdb)
+   const struct bdb_header *bdb,
+   struct ddi_vbt_port_info *info,
+   int panel_index)
 {
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 lvds_fp_timing *fp_timing;
struct drm_display_mode *panel_fixed_mode;
-   int panel_type = i915->vbt.panel_type;
 
lvds_lfp_data = find_section(bdb, BDB_LVDS_LFP_DATA);
if (!lvds_lfp_data)
@@ -308,7 +309,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
panel_dvo_timing = get_lvds_dvo_timing(lvds_lfp_data,
   lvds_lfp_data_ptrs,
-  panel_type);
+  panel_index);
 
panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
if (!panel_fixed_mode)
@@ -316,7 +317,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
fill_detail_timing_data(panel_fixed_mode, panel_dvo_timing);
 
-   i915->vbt.lfp_lvds_vbt_mode = panel_fixed_mode;
+   info->lfp_lvds_vbt_mode = panel_fixed_mode;
 
drm_dbg_kms(&i915->drm,
"Found panel mode in BIOS VBT legacy lfp table:\n");
@@ -324,7 +325,7 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
fp_timing = get_lvds_fp_timing(bdb, lvds_lfp_data,
   lvds_lfp_data_ptrs,
-  panel_type);
+  panel_index);
if (fp_timing) {
/* check the resolution, just to be sure */
if (fp_timing->x_res == panel_fixed_mode->hdisplay &&
@@ -339,7 +340,9 @@ parse_lfp_panel_dtd(struct drm_i915_private *i915,
 
 static void
 parse_generic_dtd(struct drm_i915_private *i915,
- const struct bdb_header *bdb)
+ const struct bdb_header *bdb,
+ struct ddi_vbt_port_info *info,
+ int panel_index)
 {
const struct bdb_generic_dtd *generic_dtd;
const struct generic_dtd_entry *dtd;
@@ -363,14 +366,14 @@ parse_generic_dtd(struct drm_i915_private *i915,
 
num_dtd = (get_blocksize(generic_dtd) -
   sizeof(struct bdb_generic_dtd)) / generic_dtd->gdtd_size;
-   if (i915->vbt.panel_type >= num_dtd) {
+   if (panel_index >= num_dtd) {
drm_err(&i915->drm,
-   "Panel type %d not found in table of %d DTD's\n",
-   i915->vbt.panel_type, num_dtd);
+   "Panel index %d not found in table of %d DTD's\n",
+   panel_index, num_dtd);
return;
}
 
-   dtd = &generic_dtd->dtd[i915->vbt.panel_type];
+   dtd = &generic_dtd->dtd[panel_index];
 
panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
if (!panel_fixed_mode)
@@ -413,12 +416,14 @@ parse_generic_dtd(struct drm_i915_private *i915,
"Found panel mode in BIOS VBT generic dtd table:\n");
drm_mode_debug_printmodeline(panel_fixed_mode);
 
-   i915->vbt.lfp_lvds_vbt_mode = panel_fixed_mode;
+   info->lfp_lvds_vbt_mode = panel_fixed_mode;
 }
 
 static void
 parse_panel_dtd(struct drm_i915_private *i915,
-   const struct bdb_header *bdb)
+   const struct bdb_header *bdb,
+   struct ddi_vbt_port_info *info,
+   int panel_index)
 {
/*
 * Older VBTs provided provided DTD information for internal displays
@@ -429,9 +434,9 @@ parse_panel_dtd(struct drm_i915_private *i915,
 * back to trying the old LFP block if that fails.
 */
if (bdb->version >= 229)
-   parse_generic_dtd(i915, bdb);
-   if (!i915->vbt.lfp_lvds_vbt_mode)
-   parse_lfp_panel_dtd(i915, bdb);
+   parse_generic_dtd(i915, bdb, info, panel_ind