diff mbox series

[09/11] drm/edid: Unconfuse preferred timing stuff a bit

Message ID 20220826213501.31490-10-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series drm/edid: Range descriptor stuff | expand

Commit Message

Ville Syrjälä Aug. 26, 2022, 9:34 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

For EDID 1.4 the first detailed timing is always preferred,
for older EDIDs there was a feature flag to indicate the same.
While correct, the code setting that up is rather confusing.
Restate it in a slightly more straightforward manner.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_edid.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Jani Nikula Sept. 2, 2022, 12:27 p.m. UTC | #1
On Sat, 27 Aug 2022, Ville Syrjala <ville.syrjala@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> For EDID 1.4 the first detailed timing is always preferred,
> for older EDIDs there was a feature flag to indicate the same.
> While correct, the code setting that up is rather confusing.
> Restate it in a slightly more straightforward manner.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> ---
>  drivers/gpu/drm/drm_edid.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index c1c85b9e1208..0fe06e5fd6e0 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -3952,13 +3952,14 @@ static int add_detailed_modes(struct drm_connector *connector,
>  	struct detailed_mode_closure closure = {
>  		.connector = connector,
>  		.drm_edid = drm_edid,
> -		.preferred = true,
>  		.quirks = quirks,
>  	};
>  
> -	if (closure.preferred && !version_greater(drm_edid, 1, 3))
> +	if (version_greater(drm_edid, 1, 3))
> +		closure.preferred = true; /* first detailed timing is always preferred */
> +	else
>  		closure.preferred =
> -		    (drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING);
> +			drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING;
>  
>  	drm_for_each_detailed_block(drm_edid, do_detailed_mode, &closure);
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index c1c85b9e1208..0fe06e5fd6e0 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -3952,13 +3952,14 @@  static int add_detailed_modes(struct drm_connector *connector,
 	struct detailed_mode_closure closure = {
 		.connector = connector,
 		.drm_edid = drm_edid,
-		.preferred = true,
 		.quirks = quirks,
 	};
 
-	if (closure.preferred && !version_greater(drm_edid, 1, 3))
+	if (version_greater(drm_edid, 1, 3))
+		closure.preferred = true; /* first detailed timing is always preferred */
+	else
 		closure.preferred =
-		    (drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING);
+			drm_edid->edid->features & DRM_EDID_FEATURE_PREFERRED_TIMING;
 
 	drm_for_each_detailed_block(drm_edid, do_detailed_mode, &closure);