diff mbox

[2/2] drm/i915: LVDS fallback to fixed-mode if EDID not present

Message ID 1353514444-5771-2-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Nov. 21, 2012, 4:14 p.m. UTC
Use the recorded panel fixed-mode to populate the get_modes() request in
the absence of an EDID.

Fixes regression from
commit 9cd300e038d492af4990b04e127e0bd2df64b1ca
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Fri Oct 19 14:51:52 2012 +0300

    drm/i915: Move cached EDID to intel_connector

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
---
 drivers/gpu/drm/i915/intel_lvds.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

Comments

Jani Nikula Nov. 22, 2012, 4:20 p.m. UTC | #1
On Wed, 21 Nov 2012, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Use the recorded panel fixed-mode to populate the get_modes() request in
> the absence of an EDID.
>
> Fixes regression from
> commit 9cd300e038d492af4990b04e127e0bd2df64b1ca
> Author: Jani Nikula <jani.nikula@intel.com>
> Date:   Fri Oct 19 14:51:52 2012 +0300
>
>     drm/i915: Move cached EDID to intel_connector
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/gpu/drm/i915/intel_lvds.c |    9 +--------
>  1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 5b38c17..189390e 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -480,13 +480,8 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
>  	struct drm_display_mode *mode;
>  
>  	/* use cached edid if we have one */
> -	if (lvds_connector->base.edid) {
> -		/* invalid edid */
> -		if (IS_ERR(lvds_connector->base.edid))
> -			return 0;
> -
> +	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
>  		return drm_add_edid_modes(connector, lvds_connector->base.edid);
> -	}

Yeah, good catch, my bad. I guess I was pressing too hard to have
similar code in DP and LVDS...

>  
>  	mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
>  	if (mode == NULL)
> @@ -1065,8 +1060,6 @@ bool intel_lvds_init(struct drm_device *dev)
>  			kfree(edid);
>  			edid = ERR_PTR(-EINVAL);
>  		}
> -	} else {
> -		edid = ERR_PTR(-ENOENT);

I'd like to keep this though. I was thinking a more generic, future EDID
caching feature might use the difference between -EINVAL and -ENOENT,
NULL being the "we just haven't read it yet" flag, to prevent trying to
re-read the EDID when it isn't there. *shrug*. Either way,

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


>  	}
>  	lvds_connector->base.edid = edid;
>  
> -- 
> 1.7.10.4
Chris Wilson Nov. 22, 2012, 4:36 p.m. UTC | #2
On Thu, 22 Nov 2012 18:20:27 +0200, Jani Nikula <jani.nikula@intel.com> wrote:
> On Wed, 21 Nov 2012, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> >  
> >  	mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
> >  	if (mode == NULL)
> > @@ -1065,8 +1060,6 @@ bool intel_lvds_init(struct drm_device *dev)
> >  			kfree(edid);
> >  			edid = ERR_PTR(-EINVAL);
> >  		}
> > -	} else {
> > -		edid = ERR_PTR(-ENOENT);
> 
> I'd like to keep this though. I was thinking a more generic, future EDID
> caching feature might use the difference between -EINVAL and -ENOENT,
> NULL being the "we just haven't read it yet" flag, to prevent trying to
> re-read the EDID when it isn't there. *shrug*.

Okay, that's a reasonable argument. Daniel feel free to drop this hunk.
-Chris
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 5b38c17..189390e 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -480,13 +480,8 @@  static int intel_lvds_get_modes(struct drm_connector *connector)
 	struct drm_display_mode *mode;
 
 	/* use cached edid if we have one */
-	if (lvds_connector->base.edid) {
-		/* invalid edid */
-		if (IS_ERR(lvds_connector->base.edid))
-			return 0;
-
+	if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
 		return drm_add_edid_modes(connector, lvds_connector->base.edid);
-	}
 
 	mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
 	if (mode == NULL)
@@ -1065,8 +1060,6 @@  bool intel_lvds_init(struct drm_device *dev)
 			kfree(edid);
 			edid = ERR_PTR(-EINVAL);
 		}
-	} else {
-		edid = ERR_PTR(-ENOENT);
 	}
 	lvds_connector->base.edid = edid;