diff mbox series

[v3,08/18] drm/i915/bios: Don't parse some panel specific data multiple times

Message ID 20220426193222.3422-9-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/bios: Rework BDB block handling and PNPID->panel_type matching | expand

Commit Message

Ville Syrjälä April 26, 2022, 7:32 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Make sure we don't cause memory leaks/etc. by parsing panel_type
specific parts multiple times. The real solution would be to stop
stuffing panel specific stuff into i915->vbt, but in the meantime
let's just make sure we don't leak too badly.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_bios.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Jani Nikula May 3, 2022, 11:08 a.m. UTC | #1
On Tue, 26 Apr 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Make sure we don't cause memory leaks/etc. by parsing panel_type
> specific parts multiple times. The real solution would be to stop
> stuffing panel specific stuff into i915->vbt, but in the meantime
> let's just make sure we don't leak too badly.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

A bit meh intermediate step, but I guess this keeps the series
manageable.

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


> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
> index b246a3a649a0..24e3b2f2485e 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -729,6 +729,10 @@ parse_generic_dtd(struct drm_i915_private *i915)
>  	struct drm_display_mode *panel_fixed_mode;
>  	int num_dtd;
>  
> +	/* FIXME stop using i915->vbt for panel specific data */
> +	if (i915->vbt.lfp_lvds_vbt_mode)
> +		return;
> +
>  	/*
>  	 * Older VBTs provided DTD information for internal displays through
>  	 * the "LFP panel tables" block (42).  As of VBT revision 229 the
> @@ -908,6 +912,10 @@ parse_sdvo_panel_data(struct drm_i915_private *i915)
>  	struct drm_display_mode *panel_fixed_mode;
>  	int index;
>  
> +	/* FIXME stop using i915->vbt for panel specific data */
> +	if (i915->vbt.sdvo_lvds_vbt_mode)
> +		return;
> +
>  	index = i915->params.vbt_sdvo_panel_type;
>  	if (index == -2) {
>  		drm_dbg_kms(&i915->drm,
> @@ -1436,6 +1444,10 @@ parse_mipi_config(struct drm_i915_private *i915)
>  	int panel_type = i915->vbt.panel_type;
>  	enum port port;
>  
> +	/* FIXME stop using i915->vbt for panel specific data */
> +	if (i915->vbt.dsi.config)
> +		return;
> +
>  	/* parse MIPI blocks only if LFP type is MIPI */
>  	if (!intel_bios_is_dsi_present(i915, &port))
>  		return;
> @@ -1756,6 +1768,10 @@ parse_mipi_sequence(struct drm_i915_private *i915)
>  	u8 *data;
>  	int index = 0;
>  
> +	/* FIXME stop using i915->vbt for panel specific data */
> +	if (i915->vbt.dsi.data)
> +		return;
> +
>  	/* Only our generic panel driver uses the sequence block. */
>  	if (i915->vbt.dsi.panel_id != MIPI_DSI_GENERIC_PANEL_ID)
>  		return;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
index b246a3a649a0..24e3b2f2485e 100644
--- a/drivers/gpu/drm/i915/display/intel_bios.c
+++ b/drivers/gpu/drm/i915/display/intel_bios.c
@@ -729,6 +729,10 @@  parse_generic_dtd(struct drm_i915_private *i915)
 	struct drm_display_mode *panel_fixed_mode;
 	int num_dtd;
 
+	/* FIXME stop using i915->vbt for panel specific data */
+	if (i915->vbt.lfp_lvds_vbt_mode)
+		return;
+
 	/*
 	 * Older VBTs provided DTD information for internal displays through
 	 * the "LFP panel tables" block (42).  As of VBT revision 229 the
@@ -908,6 +912,10 @@  parse_sdvo_panel_data(struct drm_i915_private *i915)
 	struct drm_display_mode *panel_fixed_mode;
 	int index;
 
+	/* FIXME stop using i915->vbt for panel specific data */
+	if (i915->vbt.sdvo_lvds_vbt_mode)
+		return;
+
 	index = i915->params.vbt_sdvo_panel_type;
 	if (index == -2) {
 		drm_dbg_kms(&i915->drm,
@@ -1436,6 +1444,10 @@  parse_mipi_config(struct drm_i915_private *i915)
 	int panel_type = i915->vbt.panel_type;
 	enum port port;
 
+	/* FIXME stop using i915->vbt for panel specific data */
+	if (i915->vbt.dsi.config)
+		return;
+
 	/* parse MIPI blocks only if LFP type is MIPI */
 	if (!intel_bios_is_dsi_present(i915, &port))
 		return;
@@ -1756,6 +1768,10 @@  parse_mipi_sequence(struct drm_i915_private *i915)
 	u8 *data;
 	int index = 0;
 
+	/* FIXME stop using i915->vbt for panel specific data */
+	if (i915->vbt.dsi.data)
+		return;
+
 	/* Only our generic panel driver uses the sequence block. */
 	if (i915->vbt.dsi.panel_id != MIPI_DSI_GENERIC_PANEL_ID)
 		return;