drm/edid: Check the number of detailed timing descriptors in the CEA ext block
Subsystems (2)
PATCH 1/8 drm/edid: Check the number of detailed timing descriptors in the CEA ext block
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."
So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
--- drivers/gpu/drm/drm_edid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_edid.c +4 -1
@@ -2201,10 +2201,13 @@ typedef void detailed_cb(struct detailed_timing *timing, void *closure);static void cea_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) { -int i, n =0 ; +int i, n;u8 d = ext[0x02 ];u8 *det_base = ext + d; +if (d <4 || d >127 ) +return ; + n = (127 - d) /18 ;for (i =0 ; i < n; i++)cb ((struct detailed_timing *)(det_base +18 * i), closure);
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/8 drm/edid: Don't accept any old garbage as a display descriptor
From: Ville Syrjälä <[email protected]>
Currently we assume any 18 byte descriptor to be a display descritor if only the tag byte matches the expected value. But for detailed timing descriptors that same byte is just the lower 8 bits of hblank, and as such can match any display descriptor tag. To properly validate that the 18 byte descriptor is in fact a display descriptor we must also examine bytes 0-2 (just byte 1 should actually suffice but the spec does say that bytes 0 and 2 must also always be zero for display descriptors so we check those too).
Unlike Allen's original proposed patch to just fix is_rb() we roll this out across the board to fix everything.
--- drivers/gpu/drm/drm_edid.c | 65 ++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 24 deletions(-)
drivers/gpu/drm/drm_edid.c +41 -24
@@ -2196,6 +2196,12 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, }EXPORT_SYMBOL (drm_mode_find_dmt); +static bool is_display_descriptor (const u8 d[18 ],u8 tag) +{ +return d[0 ] ==0x00 && d[1 ] ==0x00 && + d[2 ] ==0x00 && d[3 ] == tag; +} +typedef void detailed_cb (struct detailed_timing *timing,void *closure); static void
@@ -2257,9 +2263,12 @@ static void is_rb(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; -if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE ) -if (r[15 ] &0x10 ) - *(bool *)data = true; + +if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE )) +return ; + +if (r[15 ] &0x10 ) + *(bool *)data = true; }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
@@ -2279,7 +2288,11 @@ static void find_gtf2(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; -if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE && r[10 ] ==0x02 ) + +if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE )) +return ; + +if (r[10 ] ==0x02 ) *(u8 **)data = r; }
@@ -2818,7 +2831,7 @@ do_inferred_modes(struct detailed_timing *timing, void *c)struct detailed_non_pixel *data = &timing->data.other_data;struct detailed_data_monitor_range *range = &data->data.range; -if (data->type !=EDID_DETAIL_MONITOR_RANGE ) +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_MONITOR_RANGE ))return ; closure->modes += drm_dmt_modes_for_range(closure->connector,
@@ -2897,10 +2910,11 @@ static void do_established_modes(struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -if (data->type ==EDID_DETAIL_EST_TIMINGS ) - closure->modes +=drm_est3_modes (closure->connector, timing); +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_EST_TIMINGS )) +return ; + + closure->modes +=drm_est3_modes (closure->connector, timing); }/**
@@ -2949,19 +2963,19 @@ do_standard_modes(struct detailed_timing *timing, void *c)struct detailed_non_pixel *data = &timing->data.other_data;struct drm_connector *connector = closure->connector;struct edid *edid = closure->edid; +int i; -if (data->type ==EDID_DETAIL_STD_MODES ) { -int i; -for (i =0 ; i <6 ; i++) { -struct std_timing *std; -struct drm_display_mode *newmode; +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_STD_MODES )) +return ; - std = &data->data.timings[i]; - newmode =drm_mode_std (connector, edid, std); -if (newmode) { -drm_mode_probed_add (connector, newmode); - closure->modes++; - } +for (i =0 ; i <6 ; i++) { +struct std_timing *std = &data->data.timings[i]; +struct drm_display_mode *newmode; + + newmode =drm_mode_std (connector, edid, std); +if (newmode) { +drm_mode_probed_add (connector, newmode); + closure->modes++; } } }
@@ -3056,10 +3070,11 @@ static void do_cvt_mode(struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -if (data->type ==EDID_DETAIL_CVT_3BYTE ) - closure->modes +=drm_cvt_modes (closure->connector, timing); +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_CVT_3BYTE )) +return ; + + closure->modes +=drm_cvt_modes (closure->connector, timing); } static int
@@ -4285,8 +4300,10 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)static void monitor_name (struct detailed_timing *t,void *data) { -if (t->data.other_data.type ==EDID_DETAIL_MONITOR_NAME ) - *(u8 **)data = t->data.other_data.data.str.str; +if (!is_display_descriptor ((const u8 *)t,EDID_DETAIL_MONITOR_NAME )) +return ; + + *(u8 **)data = t->data.other_data.data.str.str; }static int get_monitor_name (struct edid *edid,char name[13 ])
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/8] drm/edid: Don't accept any old garbage as a display descriptor
Quoted 13 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Currently we assume any 18 byte descriptor to be a display descritor if only the tag byte matches the expected value. But for detailed timing descriptors that same byte is just the lower 8 bits of hblank, and as such can match any display descriptor tag. To properly validate that the 18 byte descriptor is in fact a display descriptor we must also examine bytes 0-2 (just byte 1 should actually suffice but the spec does say that bytes 0 and 2 must also always be zero for display descriptors so we check those too).
Quoted 5 lines
Unlike Allen's original proposed patch to just fix
is_rb()we roll this out across the board to fix everything.Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 136 lines
--- drivers/gpu/drm/drm_edid.c | 65 ++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 24 deletions(-)drivers/gpu/drm/drm_edid.c +41
-25@@ -2196,6 +2196,12 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, }EXPORT_SYMBOL (drm_mode_find_dmt); +static bool is_display_descriptor (const u8 d[18 ],u8 tag) +{ +return d[0 ] ==0x00 && d[1 ] ==0x00 && + d[2 ] ==0x00 && d[3 ] == tag; +} +typedef void detailed_cb (struct detailed_timing *timing,void *closure); static void@@ -2257,9 +2263,12 @@ static void is_rb(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; -if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE ) -if (r[15 ] &0x10 ) - *(bool *)data = true; + +if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE )) +return ; + +if (r[15 ] &0x10 ) + *(bool *)data = true; }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ @@ -2279,7 +2288,11 @@ static void find_gtf2(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; -if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE && r[10 ] ==0x02 ) + +if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE )) +return ; + +if (r[10 ] ==0x02 ) *(u8 **)data = r; }@@ -2818,7 +2831,7 @@ do_inferred_modes(struct detailed_timing *timing, void *c)struct detailed_non_pixel *data = &timing->data.other_data;struct detailed_data_monitor_range *range = &data->data.range; -if (data->type !=EDID_DETAIL_MONITOR_RANGE ) +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_MONITOR_RANGE ))return ; closure->modes += drm_dmt_modes_for_range(closure->connector,@@ -2897,10 +2910,11 @@ static void do_established_modes(struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -if (data->type ==EDID_DETAIL_EST_TIMINGS ) - closure->modes +=drm_est3_modes (closure->connector, timing); +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_EST_TIMINGS )) +return ; + + closure->modes +=drm_est3_modes (closure->connector, timing); }/** @@ -2949,19 +2963,19 @@ do_standard_modes(struct detailed_timing *timing, void *c)struct detailed_non_pixel *data = &timing->data.other_data;struct drm_connector *connector = closure->connector;struct edid *edid = closure->edid; +int i; -if (data->type ==EDID_DETAIL_STD_MODES ) { -int i; -for (i =0 ; i <6 ; i++) { -struct std_timing *std; -struct drm_display_mode *newmode; +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_STD_MODES )) +return ; - std = &data->data.timings[i]; - newmode =drm_mode_std (connector, edid, std); -if (newmode) { -drm_mode_probed_add (connector, newmode); - closure->modes++; - } +for (i =0 ; i <6 ; i++) { +struct std_timing *std = &data->data.timings[i]; +struct drm_display_mode *newmode; + + newmode =drm_mode_std (connector, edid, std); +if (newmode) { +drm_mode_probed_add (connector, newmode); + closure->modes++; } } }@@ -3056,10 +3070,11 @@ static void do_cvt_mode(struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -if (data->type ==EDID_DETAIL_CVT_3BYTE ) - closure->modes +=drm_cvt_modes (closure->connector, timing); +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_CVT_3BYTE )) +return ; + + closure->modes +=drm_cvt_modes (closure->connector, timing); } static int@@ -4285,8 +4300,10 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)static void monitor_name (struct detailed_timing *t,void *data) { -if (t->data.other_data.type ==EDID_DETAIL_MONITOR_NAME ) - *(u8 **)data = t->data.other_data.data.str.str; +if (!is_display_descriptor ((const u8 *)t,EDID_DETAIL_MONITOR_NAME )) +return ; + + *(u8 **)data = t->data.other_data.data.str.str; }static int get_monitor_name (struct edid *edid,char name[13 ]) --2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma
Reviewed-byRE: [Intel-gfx] [PATCH 2/8] drm/edid: Don't accept any old garbage as a display descriptor
Quoted 27 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, January 28, 2020 4:06 AM
To: Ville Syrjala <[email protected]>
Cc: Allen Chen <[email protected]>; Intel Graphics Development <intel- [email protected]>; Maling list - DRI developers <dri- [email protected]>
Subject: Re: [Intel-gfx] [PATCH 2/8] drm/edid: Don't accept any old garbage as a display descriptorQuoted 13 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Currently we assume any 18 byte descriptor to be a display descritor if only the tag byte matches the expected value. But for detailed timing descriptors that same byte is just the lower 8 bits of hblank, and as such can match any display descriptor tag. To properly validate that the 18 byte descriptor is in fact a display descriptor we must also examine bytes 0-2 (just byte 1 should actually suffice but the spec does say that bytes 0 and
2 must also always be zero for display descriptors so we check those too).
Quoted 7 lines
Quoted 5 lines
Unlike Allen's original proposed patch to just fix
is_rb()we roll this out across the board to fix everything.Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Acked-by Alex Deucher <[email protected]>
Looks Good to me.
Quoted 134 lines
drivers/gpu/drm/drm_edid.c do_inferred_modes(struct detailed_timing *timing, void
Quoted 49 lines
--- drivers/gpu/drm/drm_edid.c | 65 ++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 24 deletions(-)drivers/gpu/drm/drm_edid.c +10
-3@@ -2196,6 +2196,12 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, } EXPORT_SYMBOL(drm_mode_find_dmt); +static bool is_display_descriptor (const u8 d[18 ],u8 tag) { +return d[0 ] ==0x00 && d[1 ] ==0x00 && + d[2 ] ==0x00 && d[3 ] == tag; } +typedef void detailed_cb (struct detailed_timing *timing,void *closure); static void@@ -2257,9 +2263,12 @@ static void is_rb(struct detailed_timing *t, void *data) { u8 *r = (u8 *)t; -if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE ) -if (r[15 ] &0x10 ) - *(bool *)data = true; + +if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE )) +return ; + +if (r[15 ] &0x10 ) + *(bool *)data = true; }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ @@ -2279,7 +2288,11 @@ static void find_gtf2(structdetailed_timing *t, void *data) { u8 *r = (u8 *)t;drivers/gpu/drm/drm_edid.c +5
-1-if (r[3 ] ==EDID_DETAIL_MONITOR_RANGE && r[10 ] ==0x02 ) + +if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE )) +return ; + +if (r[10 ] ==0x02 ) *(u8 **)data = r; }@@ -2818,7 +2831,7 @@ do_inferred_modes(struct detailed_timing *timing, void*c)
drivers/gpu/drm/drm_edid.c do_standard_modes(struct detailed_timing *timing,
Quoted 24 lines
drivers/gpu/drm/drm_edid.c +6
-4struct detailed_non_pixel *data = &timing->data.other_data;struct detailed_data_monitor_range *range = &data->data.range; -if (data->type !=EDID_DETAIL_MONITOR_RANGE ) +if (!is_display_descriptor ((const u8 *)timing, +EDID_DETAIL_MONITOR_RANGE ))return ; closure->modes += drm_dmt_modes_for_range(closure->connector,@@ -2897,10 +2910,11 @@ static void do_established_modes(struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -if (data->type ==EDID_DETAIL_EST_TIMINGS ) - closure->modes +=drm_est3_modes (closure->connector, timing); +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_EST_TIMINGS )) +return ; + + closure->modes +=drm_est3_modes (closure->connector, timing); }/** @@ -2949,19 +2963,19 @@ do_standard_modes(struct detailed_timing *timing,void *c)
Quoted 59 lines
drivers/gpu/drm/drm_edid.c +19
-17struct detailed_non_pixel *data = &timing->data.other_data;struct drm_connector *connector = closure->connector;struct edid *edid = closure->edid; +int i; -if (data->type ==EDID_DETAIL_STD_MODES ) { -int i; -for (i =0 ; i <6 ; i++) { -struct std_timing *std; -struct drm_display_mode *newmode; +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_STD_MODES )) +return ; - std = &data->data.timings[i]; - newmode =drm_mode_std (connector, edid, std); -if (newmode) { -drm_mode_probed_add (connector, newmode); - closure->modes++; - } +for (i =0 ; i <6 ; i++) { +struct std_timing *std = &data->data.timings[i]; +struct drm_display_mode *newmode; + + newmode =drm_mode_std (connector, edid, std); +if (newmode) { +drm_mode_probed_add (connector, newmode); + closure->modes++; } } }@@ -3056,10 +3070,11 @@ static void do_cvt_mode(struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -if (data->type ==EDID_DETAIL_CVT_3BYTE ) - closure->modes +=drm_cvt_modes (closure->connector, timing); +if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_CVT_3BYTE )) +return ; + + closure->modes +=drm_cvt_modes (closure->connector, timing); } static int@@ -4285,8 +4300,10 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db) static void monitor_name(structdetailed_timing *t,void *data) { -if (t->data.other_data.type ==EDID_DETAIL_MONITOR_NAME ) - *(u8 **)data = t->data.other_data.data.str.str; +if (!is_display_descriptor ((const u8 *)t,EDID_DETAIL_MONITOR_NAME )) +return ; + + *(u8 **)data = t->data.other_data.data.str.str; }static int get_monitor_name (struct edid *edid,char name[13 ]) --2.24.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/8 drm/edid: Introduce is_detailed_timing_descritor()
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Let's introduce is_detailed_timing_descritor() as the opposite counterpart of is_display_descriptor().
--- drivers/gpu/drm/drm_edid.c | 42 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-)
drivers/gpu/drm/drm_edid.c +24 -18
@@ -2202,6 +2202,11 @@ static bool is_display_descriptor(const u8 d[18], u8 tag) d[2 ] ==0x00 && d[3 ] == tag; } +static bool is_detailed_timing_descriptor (const u8 d[18 ]) +{ +return d[0 ] !=0x00 || d[1 ] !=0x00 ; +} +typedef void detailed_cb (struct detailed_timing *timing,void *closure); static void
@@ -3101,27 +3106,28 @@ do_detailed_mode(struct detailed_timing *timing, void *c)struct detailed_mode_closure *closure = c;struct drm_display_mode *newmode; -if (timing->pixel_clock) { - newmode =drm_mode_detailed (closure->connector->dev, - closure->edid, timing, - closure->quirks); -if (!newmode) -return ; +if (!is_detailed_timing_descriptor ((const u8 *)timing)) +return ; + + newmode =drm_mode_detailed (closure->connector->dev, + closure->edid, timing, + closure->quirks); +if (!newmode) +return ; -if (closure->preferred) - newmode->type |=DRM_MODE_TYPE_PREFERRED ; +if (closure->preferred) + newmode->type |=DRM_MODE_TYPE_PREFERRED ; -/* -* Detailed modes are limited to 10kHz pixel clock resolution, -* so fix up anything that looks like CEA/HDMI mode, but the clock -* is just slightly off. -*/ -fixup_detailed_cea_mode_clock (newmode); +/* +* Detailed modes are limited to 10kHz pixel clock resolution, +* so fix up anything that looks like CEA/HDMI mode, but the clock +* is just slightly off. +*/ +fixup_detailed_cea_mode_clock (newmode); -drm_mode_probed_add (closure->connector, newmode); - closure->modes++; - closure->preferred = false; - } +drm_mode_probed_add (closure->connector, newmode); + closure->modes++; + closure->preferred = false; }/*
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 3/8] drm/edid: Introduce is_detailed_timing_descritor()
Quoted 8 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's introduce
is_detailed_timing_descritor()as the opposite counterpart ofis_display_descriptor().Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 70 lines
--- drivers/gpu/drm/drm_edid.c | 42 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_edid.c +24
-19@@ -2202,6 +2202,11 @@ static bool is_display_descriptor(const u8 d[18], u8 tag) d[2 ] ==0x00 && d[3 ] == tag; } +static bool is_detailed_timing_descriptor (const u8 d[18 ]) +{ +return d[0 ] !=0x00 || d[1 ] !=0x00 ; +} +typedef void detailed_cb (struct detailed_timing *timing,void *closure); static void@@ -3101,27 +3106,28 @@ do_detailed_mode(struct detailed_timing *timing, void *c)struct detailed_mode_closure *closure = c;struct drm_display_mode *newmode; -if (timing->pixel_clock) { - newmode =drm_mode_detailed (closure->connector->dev, - closure->edid, timing, - closure->quirks); -if (!newmode) -return ; +if (!is_detailed_timing_descriptor ((const u8 *)timing)) +return ; + + newmode =drm_mode_detailed (closure->connector->dev, + closure->edid, timing, + closure->quirks); +if (!newmode) +return ; -if (closure->preferred) - newmode->type |=DRM_MODE_TYPE_PREFERRED ; +if (closure->preferred) + newmode->type |=DRM_MODE_TYPE_PREFERRED ; -/* -* Detailed modes are limited to 10kHz pixel clock resolution, -* so fix up anything that looks like CEA/HDMI mode, but the clock -* is just slightly off. -*/ -fixup_detailed_cea_mode_clock (newmode); +/* +* Detailed modes are limited to 10kHz pixel clock resolution, +* so fix up anything that looks like CEA/HDMI mode, but the clock +* is just slightly off. +*/ +fixup_detailed_cea_mode_clock (newmode); -drm_mode_probed_add (closure->connector, newmode); - closure->modes++; - closure->preferred = false; - } +drm_mode_probed_add (closure->connector, newmode); + closure->modes++; + closure->preferred = false; }/* -- 2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Shankar, Uma
Reviewed-byRE: [Intel-gfx] [PATCH 3/8] drm/edid: Introduce is_detailed_timing_descritor()
Quoted 17 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, January 28, 2020 4:06 AM
To: Ville Syrjala <[email protected]>
Cc: Allen Chen <[email protected]>; Intel Graphics Development <intel- [email protected]>; Maling list - DRI developers <dri- [email protected]>
Subject: Re: [Intel-gfx] [PATCH 3/8] drm/edid: Introduceis_detailed_timing_descritor()Quoted 3 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Quoted 7 lines
Quoted 5 lines
Let's introduce
is_detailed_timing_descritor()as the opposite counterpart ofis_display_descriptor().Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Acked-by Alex Deucher <[email protected]>
Looks good.
Quoted 71 lines
drivers/gpu/drm/drm_edid.c static bool is_display_descriptor(const u8 d[18], u8
Quoted 10 lines
--- drivers/gpu/drm/drm_edid.c | 42 ++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-)drivers/gpu/drm/drm_edid.c +0
-0@@ -2202,6 +2202,11 @@ static bool is_display_descriptor(const u8 d[18], u8tag)
drivers/gpu/drm/drm_edid.c do_detailed_mode(struct detailed_timing *timing,
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +3
-0d[2 ] ==0x00 && d[3 ] == tag; } +static bool is_detailed_timing_descriptor (const u8 d[18 ]) { +return d[0 ] !=0x00 || d[1 ] !=0x00 ; } +typedef void detailed_cb (struct detailed_timing *timing,void *closure); static void@@ -3101,27 +3106,28 @@ do_detailed_mode(struct detailed_timing *timing,void *c)
Quoted 49 lines
drivers/gpu/drm/drm_edid.c +19
-19struct detailed_mode_closure *closure = c;struct drm_display_mode *newmode; -if (timing->pixel_clock) { - newmode =drm_mode_detailed (closure->connector->dev, - closure->edid, timing, - closure->quirks); -if (!newmode) -return ; +if (!is_detailed_timing_descriptor ((const u8 *)timing)) +return ; + + newmode =drm_mode_detailed (closure->connector->dev, + closure->edid, timing, + closure->quirks); +if (!newmode) +return ; -if (closure->preferred) - newmode->type |=DRM_MODE_TYPE_PREFERRED ; +if (closure->preferred) + newmode->type |=DRM_MODE_TYPE_PREFERRED ; -/* -* Detailed modes are limited to 10kHz pixel clock resolution, -* so fix up anything that looks like CEA/HDMI mode, but the clock -* is just slightly off. -*/ -fixup_detailed_cea_mode_clock (newmode); +/* +* Detailed modes are limited to 10kHz pixel clock resolution, +* so fix up anything that looks like CEA/HDMI mode, but the clock +* is just slightly off. +*/ +fixup_detailed_cea_mode_clock (newmode); -drm_mode_probed_add (closure->connector, newmode); - closure->modes++; - closure->preferred = false; - } +drm_mode_probed_add (closure->connector, newmode); + closure->modes++; + closure->preferred = false; }/* -- 2.24.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/8 drm/i915: Clear out spurious whitespace
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Nuke some whitespace that shouldn't be there.
--- drivers/gpu/drm/drm_edid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -3
@@ -2842,7 +2842,7 @@ do_inferred_modes(struct detailed_timing *timing, void *c) closure->modes +=drm_dmt_modes_for_range (closure->connector, closure->edid, timing); - +if (!version_greater (closure->edid,1 ,1 ))return ;/* GTF not defined yet */
@@ -3084,7 +3084,7 @@ do_cvt_mode(struct detailed_timing *timing, void *c)static int add_cvt_modes (struct drm_connector *connector,struct edid *edid) -{ +{struct detailed_mode_closure closure = { .connector = connector, .edid = edid,
@@ -4342,7 +4342,7 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize) {int name_length;char buf[13 ]; - +if (bufsize <=0 )return ;
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 4/8] drm/i915: Clear out spurious whitespace
Title should be s/i915/edid/ , with that fixed:
Quoted 44 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Nuke some whitespace that shouldn't be there.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_edid.c +3
-4@@ -2842,7 +2842,7 @@ do_inferred_modes(struct detailed_timing *timing, void *c) closure->modes +=drm_dmt_modes_for_range (closure->connector, closure->edid, timing); - +if (!version_greater (closure->edid,1 ,1 ))return ;/* GTF not defined yet */ @@ -3084,7 +3084,7 @@ do_cvt_mode(struct detailed_timing *timing, void *c)static int add_cvt_modes (struct drm_connector *connector,struct edid *edid) -{ +{struct detailed_mode_closure closure = { .connector = connector, .edid = edid,@@ -4342,7 +4342,7 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize) {int name_length;char buf[13 ]; - +if (bufsize <=0 )return ; --2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma
Reviewed-byRE: [Intel-gfx] [PATCH 4/8] drm/i915: Clear out spurious whitespace
Quoted 11 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, January 28, 2020 3:58 AM
To: Ville Syrjala <[email protected]>
Cc: Intel Graphics Development <[email protected]>; Maling list - DRI developers <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 4/8] drm/i915: Clear out spurious whitespace
Quoted 2 lines
Title should be s/i915/edid/ , with that fixed:
Reviewed-by Alex Deucher <[email protected]>
Yeah with the title fixed, this is
Quoted 47 lines · Ville Syrjala
drivers/gpu/drm/drm_edid.c do_inferred_modes(struct detailed_timing *timing, void
Quoted 15 lines
From: Ville Syrjälä <[email protected]>
Nuke some whitespace that shouldn't be there.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_edid.c +0
-0@@ -2842,7 +2842,7 @@ do_inferred_modes(struct detailed_timing *timing, void*c)
Quoted 29 lines
drivers/gpu/drm/drm_edid.c +3
-3closure->modes +=drm_dmt_modes_for_range (closure->connector, closure->edid, timing); - +if (!version_greater (closure->edid,1 ,1 ))return ;/* GTF not defined yet */ @@ -3084,7 +3084,7 @@ do_cvt_mode(struct detailed_timing *timing, void *c)static int add_cvt_modes(struct drm_connector *connector, struct edid *edid) -{ +{struct detailed_mode_closure closure = { .connector = connector, .edid = edid,@@ -4342,7 +4342,7 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize) {int name_length;char buf[13 ]; - +if (bufsize <=0 )return ; --2.24.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/8 drm/edid: Document why we don't bounds check the DispID CEA block start/end
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
After much head scratching I managed to convince myself that for_each_displayid_db() has already done the bounds checks for the DispID CEA data block. Which is why we don't need to repeat them in cea_db_offsets(). To avoid having to go through that pain again in the future add a comment which explains this fact.
--- drivers/gpu/drm/drm_edid.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/drm_edid.c +4 -0
@@ -4001,6 +4001,10 @@ cea_db_offsets(const u8 *cea, int *start, int *end)* no non-DTD data. */ if (cea[0 ] ==DATA_BLOCK_CTA ) { +/* +* for_each_displayid_db() has already verified +* that these stay within expected bounds. +*/ *start =3 ; *end = *start + cea[2 ]; }else if (cea[0 ] ==CEA_EXT ) {
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/8] drm/edid: Document why we don't bounds check the DispID CEA block start/end
Quoted 20 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
After much head scratching I managed to convince myself that
for_each_displayid_db()has already done the bounds checks for the DispID CEA data block. Which is why we don't need to repeat them incea_db_offsets(). To avoid having to go through that pain again in the future add a comment which explains this fact.Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 4 ++++ 1 file changed, 4 insertions(+)drivers/gpu/drm/drm_edid.c +0
-0
drivers/gpu/drm/drm_edid.c cea_db_offsets(const u8 *cea, int *start, int *end) · line 4007
Quoted 7 lines
drivers/gpu/drm/drm_edid.c +4
-0@@ -4001,6 +4001,10 @@ cea_db_offsets(const u8 *cea, int *start, int *end)* no non-DTD data. */ if (cea[0 ] ==DATA_BLOCK_CTA ) { +/* +* for_each_displayid_db() has already verified +* that these stay within expected bounds. +*/
I think the preferred format is to have the start of the comment be on the first line after the /* with that fixed:
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +0
-1*start =3 ; *end = *start + cea[2 ]; }else if (cea[0 ] ==CEA_EXT ) { --2.24.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 5/8] drm/edid: Document why we don't bounds check the DispID CEA block start/end
Quoted 17 lines · Alex Deucher
Quoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
After much head scratching I managed to convince myself that
for_each_displayid_db()has already done the bounds checks for the DispID CEA data block. Which is why we don't need to repeat them incea_db_offsets(). To avoid having to go through that pain again in the future add a comment which explains this fact.Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 15 lines
drivers/gpu/drm/drm_edid.c cea_db_offsets(const u8 *cea, int *start, int *end) · line 4007
Quoted 12 lines
drivers/gpu/drm/drm_edid.c +4
-0@@ -4001,6 +4001,10 @@ cea_db_offsets(const u8 *cea, int *start, int *end)* no non-DTD data. */ if (cea[0 ] ==DATA_BLOCK_CTA ) { +/* +* for_each_displayid_db() has already verified +* that these stay within expected bounds. +*/ I think the preferred format is to have the start of the comment be on the first line after the /* with that fixed:
Nope.
Quoted 12 lines
Acked-by Alex Deucher <[email protected]>Quoted 10 lines
drivers/gpu/drm/drm_edid.c +0
-1*start =3 ; *end = *start + cea[2 ]; }else if (cea[0 ] ==CEA_EXT ) { --2.24.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma
Reviewed-byRE: [PATCH 5/8] drm/edid: Document why we don't bounds check the DispID CEA block start/end
Quoted 46 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Ville Syrjälä
Sent: Tuesday, January 28, 2020 5:14 PM
To: Alex Deucher <[email protected]>
Cc: Intel Graphics Development <[email protected]>; Andres Rodriguez <[email protected]>; Maling list - DRI developers <dri- [email protected]>
Subject: Re: [PATCH 5/8] drm/edid: Document why we don't bounds check the DispID CEA block start/endQuoted 17 lines · Alex Deucher
Quoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
After much head scratching I managed to convince myself that
for_each_displayid_db()has already done the bounds checks for the DispID CEA data block. Which is why we don't need to repeat them incea_db_offsets(). To avoid having to go through that pain again in the future add a comment which explains this fact.Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 4 ++++ 1 file changed, 4 insertions(+)Quoted 15 lines
drivers/gpu/drm/drm_edid.c cea_db_offsets(const u8 *cea, int *start, int *end) · line 4007
Quoted 12 lines
drivers/gpu/drm/drm_edid.c +4
-0@@ -4001,6 +4001,10 @@ cea_db_offsets(const u8 *cea, int *start, int *end)* no non-DTD data. */ if (cea[0 ] ==DATA_BLOCK_CTA ) { +/* +* for_each_displayid_db() has already verified +* that these stay within expected bounds. +*/ I think the preferred format is to have the start of the comment be on the first line after the /* with that fixed:
Quoted 1 line
Nope.
Yes the style is correct here, comment is apt as well.
Quoted 13 lines
Quoted 12 lines
Acked-by Alex Deucher <[email protected]>Quoted 10 lines
drivers/gpu/drm/drm_edid.c +0
-1*start =3 ; *end = *start + cea[2 ]; }else if (cea[0 ] ==CEA_EXT ) { --2.24.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 7 lines
--
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/8 drm/edid: Add a FIXME about DispID CEA data block revision
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
I don't understand what the DispID CEA data block revision means. The spec doesn't say. I guess some DispID must have a value of >= 3 in there or else we generally wouldn't even parse the CEA data blocks. Or does all this code actually not do anything?
--- drivers/gpu/drm/drm_edid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_edid.c +7 -0
@@ -3977,6 +3977,13 @@ cea_db_tag(const u8 *db)static int cea_revision (const u8 *cea) { +/* +* FIXME is this correct for the DispID variant? +* The DispID spec doesn't really specify whether +* this is the revision of the CEA extension or +* the DispID CEA data block. And the only value +* given as an example is 0. +*/ return cea[1 ]; }
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revision
Quoted 20 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
I don't understand what the DispID CEA data block revision means. The spec doesn't say. I guess some DispID must have a value of >= 3 in there or else we generally wouldn't even parse the CEA data blocks. Or does all this code actually not do anything?
Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/drm_edid.c +0
-0
drivers/gpu/drm/drm_edid.c cea_db_tag(const u8 *db) · line 3986
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +7
-0@@ -3977,6 +3977,13 @@ cea_db_tag(const u8 *db)static int cea_revision (const u8 *cea) { +/* +* FIXME is this correct for the DispID variant? +* The DispID spec doesn't really specify whether +* this is the revision of the CEA extension or +* the DispID CEA data block. And the only value +* given as an example is 0. +*/
Same comment as the previous patch regarding the comment formatting.
Alex
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +0
-1return cea[1 ]; } --2.24.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revision
In reply to Ville SyrjalaQuoted 10 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjala
Sent: Saturday, January 25, 2020 1:32 AM
To: [email protected]
Cc: [email protected]; Andres Rodriguez <[email protected]>
Subject: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revision
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
I don't understand what the DispID CEA data block revision means. The spec doesn't say. I guess some DispID must have a value of >= 3 in there or else we generally wouldn't even parse the CEA data blocks. Or does all this code actually not do anything?
This signifies the CTA extension revision (byte 1 of the block). As per the spec, seems like Version 1 is legacy and 2 is deprecated. So version >=3 is checked here. Refer section 7.3 of CTA-861-G
Quoted 25 lines
Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/drm_edid.c index renamed from drivers/gpu/drm/drm_edid.c +0
-0
0369a54e3d32..fd9b724067a7100644drivers/gpu/drm/drm_edid.c +7
-1@@ -3977,6 +3977,13 @@ cea_db_tag(const u8 *db) static int cea_revision(const u8 *cea) { +/* +* FIXME is this correct for the DispID variant? +* The DispID spec doesn't really specify whether +* this is the revision of the CEA extension or +* the DispID CEA data block. And the only value +* given as an example is 0. +*/ return cea[1 ]; } --2.24.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revision
Quoted 12 lines · Uma
Quoted 12 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjala
Sent: Saturday, January 25, 2020 1:32 AM
To: [email protected]
Cc: [email protected]; Andres Rodriguez <[email protected]>
Subject: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revisionFrom: Ville Syrjälä <[email protected]>
Quoted 8 lines
Quoted 4 lines
I don't understand what the DispID CEA data block revision means. The spec doesn't say. I guess some DispID must have a value of >= 3 in there or else we generally wouldn't even parse the CEA data blocks. Or does all this code actually not do anything?
This signifies the CTA extension revision (byte 1 of the block). As per the spec, seems like Version 1 is legacy and 2 is deprecated. So version >=3 is checked here. Refer section 7.3 of CTA-861-G
The confusion is about the revision field in the DispID CTA block, not in the CTA extension block.
Quoted 30 lines
Quoted 30 lines
Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/drm_edid.c index renamed from drivers/gpu/drm/drm_edid.c +0
-0
0369a54e3d32..fd9b724067a7100644drivers/gpu/drm/drm_edid.c +7
-1@@ -3977,6 +3977,13 @@ cea_db_tag(const u8 *db) static int cea_revision(const u8 *cea) { +/* +* FIXME is this correct for the DispID variant? +* The DispID spec doesn't really specify whether +* this is the revision of the CEA extension or +* the DispID CEA data block. And the only value +* given as an example is 0. +*/ return cea[1 ]; } --2.24.1
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Shankar, Uma
Reviewed-byRE: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revision
Quoted 31 lines
-----Original Message-----
From: Ville Syrjälä <[email protected]>
Sent: Tuesday, February 4, 2020 7:02 PM
To: Shankar, Uma <[email protected]>
Cc: [email protected]; [email protected]; Andres Rodriguez <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revisionQuoted 19 lines · Uma
Quoted 18 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjala
Sent: Saturday, January 25, 2020 1:32 AM
To: [email protected]
Cc: [email protected]; Andres Rodriguez <[email protected]>
Subject: [Intel-gfx] [PATCH 6/8] drm/edid: Add a FIXME about DispID CEA data block revisionFrom: Ville Syrjälä <[email protected]>
I don't understand what the DispID CEA data block revision means. The spec doesn't say. I guess some DispID must have a value of >= 3 in there or else we generally wouldn't even parse the CEA data blocks. Or does all this code actually not do anything?
Quoted 7 lines
Quoted 2 lines
This signifies the CTA extension revision (byte 1 of the block). As per the spec, seems like Version 1 is legacy and 2 is deprecated. So version >=3 is
checked here.
Quoted 1 line
Refer section 7.3 of CTA-861-G
The confusion is about the revision field in the DispID CTA block, not in the CTA extension block.
Oh ok, got the ambiguity here. Not sure if we actually get >3 here as value for the block revision, totally unclear from spec, default being 0. Good to have this comment till we get some clarity on its significance. Thanks for the clarification.
Quoted 28 lines
Quoted 28 lines
Quoted 28 lines
Cc Andres Rodriguez <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/drm_edid.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/gpu/drm/drm_edid.c +0
-0index
0369a54e3d32..fd9b724067a7100644drivers/gpu/drm/drm_edid.c +0
-0@@ -3977,6 +3977,13 @@ cea_db_tag(const u8 *db) static intcea_revision(const
u8 *cea) {drivers/gpu/drm/drm_edid.c +7
-1+/* +* FIXME is this correct for the DispID variant? +* The DispID spec doesn't really specify whether +* this is the revision of the CEA extension or +* the DispID CEA data block. And the only value +* given as an example is 0. +*/ return cea[1 ]; } --2.24.1
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/8 drm/edid: Constify lots of things
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
Let's try to make a lot more stuff const in the edid parser.
The "downside" is that we can no longer mangle the EDID in the middle of the parsing to apply quirks (drm_mode_detailed()). I don't really think mangling the blob itself is such a great idea anyway so I won't miss that part. But if we do want it back I guess we should do the mangling in one explicit place before we otherwise parse the EDID.
--- drivers/gpu/drm/drm_connector.c | 4 +- drivers/gpu/drm/drm_edid.c | 303 ++++++++++++++++++-------------- include/drm/drm_connector.h | 4 +- 3 files changed, 176 insertions(+), 135 deletions(-)
drivers/gpu/drm/drm_connector.c +2 -2
@@ -2377,7 +2377,7 @@ EXPORT_SYMBOL(drm_mode_put_tile_group);* tile group or NULL if not found. */ struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int id;
@@ -2407,7 +2407,7 @@ EXPORT_SYMBOL(drm_mode_get_tile_group);* new tile group or NULL. */ struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int ret;
drivers/gpu/drm/drm_edid.c +172 -131
756 lines not on this page · raw message
include/drm/drm_connector.h +2 -2
@@ -1580,9 +1580,9 @@ struct drm_tile_group { };struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 topology[8 ]);struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 topology[8 ]);void drm_mode_put_tile_group (struct drm_device *dev,struct drm_tile_group *tg);
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/8] drm/edid: Constify lots of things
Quoted 5 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's try to make a lot more stuff const in the edid parser.
Quoted 8 lines
The "downside" is that we can no longer mangle the EDID in the middle of the parsing to apply quirks (
drm_mode_detailed()). I don't really think mangling the blob itself is such a great idea anyway so I won't miss that part. But if we do want it back I guess we should do the mangling in one explicit place before we otherwise parse the EDID.Signed-off-by Ville Syrjälä <[email protected]>
I generally agree, but are there any userspace expectations that they will be getting a corrected EDID in some cases?
Alex
Quoted 857 lines
--- drivers/gpu/drm/drm_connector.c | 4 +- drivers/gpu/drm/drm_edid.c | 303 ++++++++++++++++++-------------- include/drm/drm_connector.h | 4 +- 3 files changed, 176 insertions(+), 135 deletions(-)drivers/gpu/drm/drm_connector.c +2
-2@@ -2377,7 +2377,7 @@ EXPORT_SYMBOL(drm_mode_put_tile_group);* tile group or NULL if not found. */ struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int id;@@ -2407,7 +2407,7 @@ EXPORT_SYMBOL(drm_mode_get_tile_group);* new tile group or NULL. */ struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int ret;drivers/gpu/drm/drm_edid.c +172
-131@@ -88,7 +88,7 @@struct detailed_mode_closure {struct drm_connector *connector; -struct edid *edid; +const struct edid *edid;bool preferred;u32 quirks;int modes;@@ -1584,8 +1584,8 @@ MODULE_PARM_DESC(edid_fixup, "Minimum number of valid EDID header bytes (0-8, default 6)");static void drm_get_displayid (struct drm_connector *connector, -struct edid *edid); -static int validate_displayid (u8 *displayid,int length,int idx); +const struct edid *edid); +static int validate_displayid (const u8 *displayid,int length,int idx);static int drm_edid_block_checksum (const u8 *raw_edid) {@@ -2207,41 +2207,41 @@ static bool is_detailed_timing_descriptor(const u8 d[18])return d[0 ] !=0x00 || d[1 ] !=0x00 ; } -typedef void detailed_cb (struct detailed_timing *timing,void *closure); +typedef void detailed_cb (const struct detailed_timing *timing,void *closure);static void -cea_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) +cea_for_each_detailed_block (const u8 *ext,detailed_cb *cb,void *closure) {int i, n;u8 d = ext[0x02 ]; -u8 *det_base = ext + d; +const u8 *det_base = ext + d;if (d <4 || d >127 )return ; n = (127 - d) /18 ;for (i =0 ; i < n; i++) -cb ((struct detailed_timing *)(det_base +18 * i), closure); +cb ((const struct detailed_timing *)(det_base +18 * i), closure); }static void -vtb_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) +vtb_for_each_detailed_block (const u8 *ext,detailed_cb *cb,void *closure) {unsigned int i, n =min ((int )ext[0x02 ],6 ); -u8 *det_base = ext +5 ; +const u8 *det_base = ext +5 ;if (ext[0x01 ] !=1 )return ;/* unknown version */ for (i =0 ; i < n; i++) -cb ((struct detailed_timing *)(det_base +18 * i), closure); +cb ((const struct detailed_timing *)(det_base +18 * i), closure); }static void -drm_for_each_detailed_block (u8 *raw_edid,detailed_cb *cb,void *closure) +drm_for_each_detailed_block (const u8 *raw_edid,detailed_cb *cb,void *closure) { +const struct edid *edid = (struct edid *)raw_edid;int i; -struct edid *edid = (struct edid *)raw_edid;if (edid ==NULL )return ;@@ -2250,7 +2250,7 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)cb (&(edid->detailed_timings[i]), closure);for (i =1 ; i <= raw_edid[0x7e ]; i++) { -u8 *ext = raw_edid + (i *EDID_LENGTH ); +const u8 *ext = raw_edid + (i *EDID_LENGTH );switch (*ext) {case CEA_EXT :cea_for_each_detailed_block (ext, cb, closure);@@ -2264,81 +2264,105 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure) } } +struct bool_closure { +bool ret; +}; +static void -is_rb (struct detailed_timing *t,void *data) +is_rb (const struct detailed_timing *t,void *c) { -u8 *r = (u8 *)t; +struct bool_closure *closure = c; +const u8 *r = (const u8 *)t;if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE ))return ;if (r[15 ] &0x10 ) - *(bool *)data = true; + closure->ret = true; }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ static bool -drm_monitor_supports_rb (struct edid *edid) +drm_monitor_supports_rb (const struct edid *edid) {if (edid->revision >=4 ) { -bool ret = false; -drm_for_each_detailed_block ((u8 *)edid, is_rb, &ret); -return ret; +struct bool_closure closure = { + .ret = false, + }; + +drm_for_each_detailed_block ((u8 *)edid, is_rb, &closure); + +return closure.ret; }return ((edid->input &DRM_EDID_INPUT_DIGITAL ) !=0 ); } +struct data_closure { +const u8 *data; +}; +static void -find_gtf2 (struct detailed_timing *t,void *data) +do_find_gtf2 (const struct detailed_timing *t,void *c) { -u8 *r = (u8 *)t; +struct data_closure *closure = c; +const u8 *r = (const u8 *)t;if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE ))return ;if (r[10 ] ==0x02 ) - *(u8 **)data = r; + closure->data = r; +} + +static const u8 * +find_gtf2_descriptor (const struct edid *edid) +{ +struct data_closure closure = {}; + +drm_for_each_detailed_block ((u8 *)edid, do_find_gtf2, &closure); + +return closure.data; }/* Secondary GTF curve kicks in above some break frequency */ static int -drm_gtf2_hbreak (struct edid *edid) +drm_gtf2_hbreak (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); -return r ? (r[12 ] *2 ) :0 ; +const u8 *r =find_gtf2_descriptor (edid); + +return r ? r[12 ] *2 :0 ; }static int -drm_gtf2_2c (struct edid *edid) +drm_gtf2_2c (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[13 ] :0 ; }static int -drm_gtf2_m (struct edid *edid) +drm_gtf2_m (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); -return r ? (r[15 ] <<8 ) + r[14 ] :0 ; +const u8 *r =find_gtf2_descriptor (edid); + +return r ? (r[15 ] <<8 ) | r[14 ] :0 ; }static int -drm_gtf2_k (struct edid *edid) +drm_gtf2_k (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[16 ] :0 ; }static int -drm_gtf2_2j (struct edid *edid) +drm_gtf2_2j (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[17 ] :0 ; }@@ -2346,7 +2370,7 @@ drm_gtf2_2j(struct edid *edid)* standard_timing_level - get std. timing level(CVT/GTF/DMT) * @edid: EDID block to scan */ -static int standard_timing_level (struct edid *edid) +static int standard_timing_level (const struct edid *edid) {if (edid->revision >=2 ) {if (edid->revision >=4 && (edid->features &DRM_EDID_FEATURE_DEFAULT_GTF ))@@ -2381,8 +2405,9 @@ bad_std_timing(u8 a, u8 b)* and convert them into a real mode using CVT/GTF/DMT. */ static struct drm_display_mode * -drm_mode_std (struct drm_connector *connector,struct edid *edid, -struct std_timing *t) +drm_mode_std (struct drm_connector *connector, +const struct edid *edid, +const struct std_timing *t) {struct drm_device *dev = connector->dev;struct drm_display_mode *m, *mode =NULL ;@@ -2500,7 +2525,7 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid,*/ static void drm_mode_do_interlace_quirk (struct drm_display_mode *mode, -struct detailed_pixel_timing *pt) +const struct detailed_pixel_timing *pt) {int i; static const struct {@@ -2543,12 +2568,12 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode,* return a new struct drm_display_mode. */ static struct drm_display_mode *drm_mode_detailed (struct drm_device *dev, -struct edid *edid, -struct detailed_timing *timing, +const struct edid *edid, +const struct detailed_timing *timing,u32 quirks) {struct drm_display_mode *mode; -struct detailed_pixel_timing *pt = &timing->data.pixel_data; +const struct detailed_pixel_timing *pt = &timing->data.pixel_data;unsigned hactive = (pt->hactive_hblank_hi &0xf0 ) <<4 | pt->hactive_lo;unsigned vactive = (pt->vactive_vblank_hi &0xf0 ) <<4 | pt->vactive_lo;unsigned hblank = (pt->hactive_hblank_hi &0xf ) <<8 | pt->hblank_lo;@@ -2590,9 +2615,9 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,return NULL ;if (quirks &EDID_QUIRK_135_CLOCK_TOO_HIGH ) - timing->pixel_clock =cpu_to_le16 (1088 ); - - mode->clock =le16_to_cpu (timing->pixel_clock) *10 ; + mode->clock =1088 *10 ; +else + mode->clock =le16_to_cpu (timing->pixel_clock) *10 ; mode->hdisplay = hactive; mode->hsync_start = mode->hdisplay + hsync_offset;@@ -2613,14 +2638,14 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,drm_mode_do_interlace_quirk (mode, pt);if (quirks &EDID_QUIRK_DETAILED_SYNC_PP ) { - pt->misc |=DRM_EDID_PT_HSYNC_POSITIVE |DRM_EDID_PT_VSYNC_POSITIVE ; + mode->flags |=DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ; + }else { + mode->flags |= (pt->misc &DRM_EDID_PT_HSYNC_POSITIVE ) ? +DRM_MODE_FLAG_PHSYNC :DRM_MODE_FLAG_NHSYNC ; + mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ? +DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; } - mode->flags |= (pt->misc &DRM_EDID_PT_HSYNC_POSITIVE ) ? -DRM_MODE_FLAG_PHSYNC :DRM_MODE_FLAG_NHSYNC ; - mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ? -DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; - set_size: mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi &0xf0 ) <<4 ; mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi &0xf ) <<8 ;@@ -2644,7 +2669,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,static bool mode_in_hsync_range (const struct drm_display_mode *mode, -struct edid *edid,u8 *t) +const struct edid *edid,const u8 *t) {int hsync, hmin, hmax;@@ -2661,7 +2686,7 @@ mode_in_hsync_range(const struct drm_display_mode *mode,static bool mode_in_vsync_range (const struct drm_display_mode *mode, -struct edid *edid,u8 *t) +const struct edid *edid,const u8 *t) {int vsync, vmin, vmax;@@ -2677,7 +2702,7 @@ mode_in_vsync_range(const struct drm_display_mode *mode, }static u32 -range_pixel_clock (struct edid *edid,u8 *t) +range_pixel_clock (const struct edid *edid,const u8 *t) {/* unspecified */ if (t[9 ] ==0 || t[9 ] ==255 )@@ -2692,11 +2717,12 @@ range_pixel_clock(struct edid *edid, u8 *t) }static bool -mode_in_range (const struct drm_display_mode *mode,struct edid *edid, -struct detailed_timing *timing) +mode_in_range (const struct drm_display_mode *mode, +const struct edid *edid, +const struct detailed_timing *timing) {u32 max_clock; -u8 *t = (u8 *)timing; +const u8 *t = (const u8 *)timing;if (!mode_in_hsync_range (mode, edid, t))return false;@@ -2738,8 +2764,9 @@ static bool valid_inferred_mode(const struct drm_connector *connector, }static int -drm_dmt_modes_for_range (struct drm_connector *connector,struct edid *edid, -struct detailed_timing *timing) +drm_dmt_modes_for_range (struct drm_connector *connector, +const struct edid *edid, +const struct detailed_timing *timing) {int i, modes =0 ;struct drm_display_mode *newmode;@@ -2773,8 +2800,9 @@ void drm_mode_fixup_1366x768(struct drm_display_mode *mode) }static int -drm_gtf_modes_for_range (struct drm_connector *connector,struct edid *edid, -struct detailed_timing *timing) +drm_gtf_modes_for_range (struct drm_connector *connector, +const struct edid *edid, +const struct detailed_timing *timing) {int i, modes =0 ;struct drm_display_mode *newmode;@@ -2801,8 +2829,9 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, }static int -drm_cvt_modes_for_range (struct drm_connector *connector,struct edid *edid, -struct detailed_timing *timing) +drm_cvt_modes_for_range (struct drm_connector *connector, +const struct edid *edid, +const struct detailed_timing *timing) {int i, modes =0 ;struct drm_display_mode *newmode;@@ -2830,11 +2859,11 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, }static void -do_inferred_modes (struct detailed_timing *timing,void *c) +do_inferred_modes (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -struct detailed_data_monitor_range *range = &data->data.range; +const struct detailed_non_pixel *data = &timing->data.other_data; +const struct detailed_data_monitor_range *range = &data->data.range;if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_MONITOR_RANGE ))return ;@@ -2868,7 +2897,8 @@ do_inferred_modes(struct detailed_timing *timing, void *c) }static int -add_inferred_modes (struct drm_connector *connector,struct edid *edid) +add_inferred_modes (struct drm_connector *connector, +const struct edid *edid) {struct detailed_mode_closure closure = { .connector = connector,@@ -2876,18 +2906,20 @@ add_inferred_modes(struct drm_connector *connector, struct edid *edid) };if (version_greater (edid,1 ,0 )) -drm_for_each_detailed_block ((u8 *)edid, do_inferred_modes, +drm_for_each_detailed_block ((const u8 *)edid, + do_inferred_modes, &closure);return closure.modes; }static int -drm_est3_modes (struct drm_connector *connector,struct detailed_timing *timing) +drm_est3_modes (struct drm_connector *connector, +const struct detailed_timing *timing) {int i, j, m, modes =0 ;struct drm_display_mode *mode; -u8 *est = ((u8 *)timing) +6 ; +const u8 *est = ((const u8 *)timing) +6 ;for (i =0 ; i <6 ; i++) {for (j =7 ; j >=0 ; j--) {@@ -2912,7 +2944,7 @@ drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) }static void -do_established_modes (struct detailed_timing *timing,void *c) +do_established_modes (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;@@ -2931,7 +2963,8 @@ do_established_modes(struct detailed_timing *timing, void *c)* (defined above). Tease them out and add them to the global modes list. */ static int -add_established_modes (struct drm_connector *connector,struct edid *edid) +add_established_modes (struct drm_connector *connector, +const struct edid *edid) {struct drm_device *dev = connector->dev; unsigned long est_bits = edid->established_timings.t1 |@@ -2962,19 +2995,19 @@ add_established_modes(struct drm_connector *connector, struct edid *edid) }static void -do_standard_modes (struct detailed_timing *timing,void *c) +do_standard_modes (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; +const struct detailed_non_pixel *data = &timing->data.other_data;struct drm_connector *connector = closure->connector; -struct edid *edid = closure->edid; +const struct edid *edid = closure->edid;int i;if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_STD_MODES ))return ;for (i =0 ; i <6 ; i++) { -struct std_timing *std = &data->data.timings[i]; +const struct std_timing *std = &data->data.timings[i];struct drm_display_mode *newmode; newmode =drm_mode_std (connector, edid, std);@@ -2994,7 +3027,8 @@ do_standard_modes(struct detailed_timing *timing, void *c)* GTF or CVT. Grab them from @edid and add them to the list. */ static int -add_standard_modes (struct drm_connector *connector,struct edid *edid) +add_standard_modes (struct drm_connector *connector, +const struct edid *edid) {int i, modes =0 ;struct detailed_mode_closure closure = {@@ -3023,18 +3057,18 @@ add_standard_modes(struct drm_connector *connector, struct edid *edid) }static int drm_cvt_modes (struct drm_connector *connector, -struct detailed_timing *timing) +const struct detailed_timing *timing) {int i, j, modes =0 ;struct drm_display_mode *newmode;struct drm_device *dev = connector->dev; -struct cvt_timing *cvt;const int rates[] = {60 ,85 ,75 ,60 ,50 };const u8 empty[3 ] = {0 ,0 ,0 };for (i =0 ; i <4 ; i++) {int uninitialized_var (width ), height; - cvt = &(timing->data.other_data.data.cvt[i]); +const struct cvt_timing *cvt = + &timing->data.other_data.data.cvt[i];if (!memcmp (cvt->code, empty,3 ))continue ;@@ -3072,7 +3106,7 @@ static int drm_cvt_modes(struct drm_connector *connector, }static void -do_cvt_mode (struct detailed_timing *timing,void *c) +do_cvt_mode (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;@@ -3083,7 +3117,8 @@ do_cvt_mode(struct detailed_timing *timing, void *c) }static int -add_cvt_modes (struct drm_connector *connector,struct edid *edid) +add_cvt_modes (struct drm_connector *connector, +const struct edid *edid) {struct detailed_mode_closure closure = { .connector = connector,@@ -3101,7 +3136,7 @@ add_cvt_modes(struct drm_connector *connector, struct edid *edid)static void fixup_detailed_cea_mode_clock (struct drm_display_mode *mode);static void -do_detailed_mode (struct detailed_timing *timing,void *c) +do_detailed_mode (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;struct drm_display_mode *newmode;@@ -3137,8 +3172,8 @@ do_detailed_mode(struct detailed_timing *timing, void *c)* @quirks: quirks to apply */ static int -add_detailed_modes (struct drm_connector *connector,struct edid *edid, -u32 quirks) +add_detailed_modes (struct drm_connector *connector, +struct edid *edid,u32 quirks) {struct detailed_mode_closure closure = { .connector = connector,@@ -3173,9 +3208,10 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,/* * Search EDID for CEA extension block. */ -static u8 *drm_find_edid_extension (const struct edid *edid,int ext_id) +static const u8 *drm_find_edid_extension (const struct edid *edid, +int ext_id) { -u8 *edid_ext =NULL ; +const u8 *edid_ext =NULL ;int i;/* No EDID or EDID extensions */ @@ -3184,7 +3220,7 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id)/* Find CEA extension */ for (i =0 ; i < edid->extensions; i++) { - edid_ext = (u8 *)edid +EDID_LENGTH * (i +1 ); + edid_ext = (const u8 *)edid +EDID_LENGTH * (i +1 );if (edid_ext[0 ] == ext_id)break ; }@@ -3196,19 +3232,19 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id) } -static u8 *drm_find_displayid_extension (const struct edid *edid) +static const u8 *drm_find_displayid_extension (const struct edid *edid) {return drm_find_edid_extension (edid,DISPLAYID_EXT ); } -static u8 *drm_find_cea_extension (const struct edid *edid) +static const u8 *drm_find_cea_extension (const struct edid *edid) {int ret;int idx =1 ;int length =EDID_LENGTH ; -struct displayid_block *block; -u8 *cea; -u8 *displayid; +const struct displayid_block *block; +const u8 *cea; +const u8 *displayid;/* Look for a top level CEA extension block */ cea =drm_find_edid_extension (edid,CEA_EXT );@@ -4315,28 +4351,30 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db) }static void -monitor_name (struct detailed_timing *t,void *data) +monitor_name (const struct detailed_timing *t,void *c) { +struct data_closure *closure = c; +if (!is_display_descriptor ((const u8 *)t,EDID_DETAIL_MONITOR_NAME ))return ; - *(u8 **)data = t->data.other_data.data.str.str; + closure->data = t->data.other_data.data.str.str; }static int get_monitor_name (struct edid *edid,char name[13 ]) { -char *edid_name =NULL ; +struct data_closure closure = {};int mnl;if (!edid || !name)return 0 ; -drm_for_each_detailed_block ((u8 *)edid, monitor_name, &edid_name); -for (mnl =0 ; edid_name && mnl <13 ; mnl++) { -if (edid_name[mnl] ==0x0a ) +drm_for_each_detailed_block ((const u8 *)edid, monitor_name, &closure); +for (mnl =0 ; closure.data && mnl <13 ; mnl++) { +if (closure.data[mnl] ==0x0a )break ; - name[mnl] = edid_name[mnl]; + name[mnl] = closure.data[mnl]; }return mnl;@@ -4386,11 +4424,9 @@ static void clear_eld(struct drm_connector *connector)static void drm_edid_to_eld (struct drm_connector *connector,struct edid *edid) {uint8_t *eld = connector->eld; -u8 *cea; -u8 *db; +const u8 *cea;int total_sad_count =0 ;int mnl; -int dbl;clear_eld (connector);@@ -4425,8 +4461,8 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) }for_each_cea_db (cea, i, start, end) { - db = &cea[i]; - dbl =cea_db_payload_len (db); +const u8 *db = &cea[i]; +int dbl =cea_db_payload_len (db);switch (cea_db_tag (db)) {int sad_count;@@ -4484,7 +4520,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) {int count =0 ;int i, start, end, dbl; -u8 *cea; +const u8 *cea; cea =drm_find_cea_extension (edid);if (!cea) {@@ -4503,7 +4539,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) }for_each_cea_db (cea, i, start, end) { -u8 *db = &cea[i]; +const u8 *db = &cea[i];if (cea_db_tag (db) ==AUDIO_BLOCK ) {int j;@@ -4514,7 +4550,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)if (!*sads)return -ENOMEM ;for (j =0 ; j < count; j++) { -u8 *sad = &db[1 + j *3 ]; +const u8 *sad = &db[1 + j *3 ]; (*sads)[j].format = (sad[0 ] &0x78 ) >>3 ; (*sads)[j].channels = sad[0 ] &0x7 ;@@ -4635,7 +4671,7 @@ EXPORT_SYMBOL(drm_av_sync_delay);*/ bool drm_detect_hdmi_monitor (struct edid *edid) { -u8 *edid_ext; +const u8 *edid_ext;int i;int start_offset, end_offset;@@ -4673,7 +4709,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor);*/ bool drm_detect_monitor_audio (struct edid *edid) { -u8 *edid_ext; +const u8 *edid_ext;int i, j;bool has_audio = false;int start_offset, end_offset;@@ -5017,13 +5053,13 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edireturn quirks; } -static int validate_displayid (u8 *displayid,int length,int idx) +static int validate_displayid (const u8 *displayid,int length,int idx) {int i;u8 csum =0 ; -struct displayid_hdr *base; +const struct displayid_hdr *base; - base = (struct displayid_hdr *)&displayid[idx]; + base = (const struct displayid_hdr *)&displayid[idx];DRM_DEBUG_KMS ("base revision 0x%x, length %d, %d %d\n" , base->rev, base->bytes, base->prod_id, base->ext_count);@@ -5041,7 +5077,7 @@ static int validate_displayid(u8 *displayid, int length, int idx) }static struct drm_display_mode *drm_mode_displayid_detailed (struct drm_device *dev, -struct displayid_detailed_timings_1 *timings) +const struct displayid_detailed_timings_1 *timings) {struct drm_display_mode *mode; unsigned pixel_clock = (timings->pixel_clock[0] |@@ -5057,6 +5093,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dunsigned vsync_width = (timings->vsw[0 ] | timings->vsw[1 ] <<8 ) +1 ;bool hsync_positive = (timings->hsync[1 ] >>7 ) &0x1 ;bool vsync_positive = (timings->vsync[1 ] >>7 ) &0x1 ; + mode =drm_mode_create (dev);if (!mode)return NULL ;@@ -5086,9 +5123,10 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d }static int add_displayid_detailed_1_modes (struct drm_connector *connector, -struct displayid_block *block) +const struct displayid_block *block) { -struct displayid_detailed_timing_block *det = (struct displayid_detailed_timing_block *)block; +const struct displayid_detailed_timing_block *det = + (const struct displayid_detailed_timing_block *)block;int i;int num_timings;struct drm_display_mode *newmode;@@ -5099,7 +5137,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, num_timings = block->num_bytes /20 ;for (i =0 ; i < num_timings; i++) { -struct displayid_detailed_timings_1 *timings = &det->timings[i]; +const struct displayid_detailed_timings_1 *timings = &det->timings[i]; newmode =drm_mode_displayid_detailed (connector->dev, timings);if (!newmode)@@ -5112,13 +5150,13 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, }static int add_displayid_detailed_modes (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) { -u8 *displayid; +const u8 *displayid;int ret;int idx =1 ;int length =EDID_LENGTH ; -struct displayid_block *block; +const struct displayid_block *block;int num_modes =0 ; displayid =drm_find_displayid_extension (edid);@@ -5720,9 +5758,10 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,EXPORT_SYMBOL (drm_hdmi_vendor_infoframe_from_display_mode);static int drm_parse_tiled_block (struct drm_connector *connector, -struct displayid_block *block) +const struct displayid_block *block) { -struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; +const struct displayid_tiled_block *tile = + (const struct displayid_tiled_block *)block;u16 w, h;u8 tile_v_loc, tile_h_loc;u8 num_v_tile, num_h_tile;@@ -5774,12 +5813,12 @@ static int drm_parse_tiled_block(struct drm_connector *connector, }static int drm_parse_display_id (struct drm_connector *connector, -u8 *displayid,int length, +const u8 *displayid,int length,bool is_edid_extension) {/* if this is an EDID extension the first byte will be 0x70 */ int idx =0 ; -struct displayid_block *block; +const struct displayid_block *block;int ret;if (is_edid_extension)@@ -5815,11 +5854,13 @@ static int drm_parse_display_id(struct drm_connector *connector, }static void drm_get_displayid (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) { -void *displayid =NULL ; +const void *displayid;int ret; + connector->has_tile = false; + displayid =drm_find_displayid_extension (edid);if (!displayid) {/* drop reference to any tile group we had */ include/drm/drm_connector.h +2
-3@@ -1580,9 +1580,9 @@ struct drm_tile_group { };struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 topology[8 ]);struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 topology[8 ]);void drm_mode_put_tile_group (struct drm_device *dev,struct drm_tile_group *tg); --2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 7/8] drm/edid: Constify lots of things
Quoted 14 lines · Alex Deucher
Quoted 12 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's try to make a lot more stuff const in the edid parser.
The "downside" is that we can no longer mangle the EDID in the middle of the parsing to apply quirks (
drm_mode_detailed()). I don't really think mangling the blob itself is such a great idea anyway so I won't miss that part. But if we do want it back I guess we should do the mangling in one explicit place before we otherwise parse the EDID.
Quoted 4 lines
Quoted 1 line
Signed-off-by Ville Syrjälä <[email protected]>I generally agree, but are there any userspace expectations that they will be getting a corrected EDID in some cases?
Not sure. I think the the only thing we're fixing up is some DTDs so at least there's a better way for userspace to get the fixed information (getconnector ioctl). I guess Xorg is still parsing the EDID though, but it should have more or less the same quirks in its parser.
Quoted 864 lines
Alex
Quoted 861 lines
--- drivers/gpu/drm/drm_connector.c | 4 +- drivers/gpu/drm/drm_edid.c | 303 ++++++++++++++++++-------------- include/drm/drm_connector.h | 4 +- 3 files changed, 176 insertions(+), 135 deletions(-)drivers/gpu/drm/drm_connector.c +2
-2@@ -2377,7 +2377,7 @@ EXPORT_SYMBOL(drm_mode_put_tile_group);* tile group or NULL if not found. */ struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int id;@@ -2407,7 +2407,7 @@ EXPORT_SYMBOL(drm_mode_get_tile_group);* new tile group or NULL. */ struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int ret;drivers/gpu/drm/drm_edid.c +172
-131@@ -88,7 +88,7 @@struct detailed_mode_closure {struct drm_connector *connector; -struct edid *edid; +const struct edid *edid;bool preferred;u32 quirks;int modes;@@ -1584,8 +1584,8 @@ MODULE_PARM_DESC(edid_fixup, "Minimum number of valid EDID header bytes (0-8, default 6)");static void drm_get_displayid (struct drm_connector *connector, -struct edid *edid); -static int validate_displayid (u8 *displayid,int length,int idx); +const struct edid *edid); +static int validate_displayid (const u8 *displayid,int length,int idx);static int drm_edid_block_checksum (const u8 *raw_edid) {@@ -2207,41 +2207,41 @@ static bool is_detailed_timing_descriptor(const u8 d[18])return d[0 ] !=0x00 || d[1 ] !=0x00 ; } -typedef void detailed_cb (struct detailed_timing *timing,void *closure); +typedef void detailed_cb (const struct detailed_timing *timing,void *closure);static void -cea_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) +cea_for_each_detailed_block (const u8 *ext,detailed_cb *cb,void *closure) {int i, n;u8 d = ext[0x02 ]; -u8 *det_base = ext + d; +const u8 *det_base = ext + d;if (d <4 || d >127 )return ; n = (127 - d) /18 ;for (i =0 ; i < n; i++) -cb ((struct detailed_timing *)(det_base +18 * i), closure); +cb ((const struct detailed_timing *)(det_base +18 * i), closure); }static void -vtb_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) +vtb_for_each_detailed_block (const u8 *ext,detailed_cb *cb,void *closure) {unsigned int i, n =min ((int )ext[0x02 ],6 ); -u8 *det_base = ext +5 ; +const u8 *det_base = ext +5 ;if (ext[0x01 ] !=1 )return ;/* unknown version */ for (i =0 ; i < n; i++) -cb ((struct detailed_timing *)(det_base +18 * i), closure); +cb ((const struct detailed_timing *)(det_base +18 * i), closure); }static void -drm_for_each_detailed_block (u8 *raw_edid,detailed_cb *cb,void *closure) +drm_for_each_detailed_block (const u8 *raw_edid,detailed_cb *cb,void *closure) { +const struct edid *edid = (struct edid *)raw_edid;int i; -struct edid *edid = (struct edid *)raw_edid;if (edid ==NULL )return ;@@ -2250,7 +2250,7 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)cb (&(edid->detailed_timings[i]), closure);for (i =1 ; i <= raw_edid[0x7e ]; i++) { -u8 *ext = raw_edid + (i *EDID_LENGTH ); +const u8 *ext = raw_edid + (i *EDID_LENGTH );switch (*ext) {case CEA_EXT :cea_for_each_detailed_block (ext, cb, closure);@@ -2264,81 +2264,105 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure) } } +struct bool_closure { +bool ret; +}; +static void -is_rb (struct detailed_timing *t,void *data) +is_rb (const struct detailed_timing *t,void *c) { -u8 *r = (u8 *)t; +struct bool_closure *closure = c; +const u8 *r = (const u8 *)t;if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE ))return ;if (r[15 ] &0x10 ) - *(bool *)data = true; + closure->ret = true; }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ static bool -drm_monitor_supports_rb (struct edid *edid) +drm_monitor_supports_rb (const struct edid *edid) {if (edid->revision >=4 ) { -bool ret = false; -drm_for_each_detailed_block ((u8 *)edid, is_rb, &ret); -return ret; +struct bool_closure closure = { + .ret = false, + }; + +drm_for_each_detailed_block ((u8 *)edid, is_rb, &closure); + +return closure.ret; }return ((edid->input &DRM_EDID_INPUT_DIGITAL ) !=0 ); } +struct data_closure { +const u8 *data; +}; +static void -find_gtf2 (struct detailed_timing *t,void *data) +do_find_gtf2 (const struct detailed_timing *t,void *c) { -u8 *r = (u8 *)t; +struct data_closure *closure = c; +const u8 *r = (const u8 *)t;if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE ))return ;if (r[10 ] ==0x02 ) - *(u8 **)data = r; + closure->data = r; +} + +static const u8 * +find_gtf2_descriptor (const struct edid *edid) +{ +struct data_closure closure = {}; + +drm_for_each_detailed_block ((u8 *)edid, do_find_gtf2, &closure); + +return closure.data; }/* Secondary GTF curve kicks in above some break frequency */ static int -drm_gtf2_hbreak (struct edid *edid) +drm_gtf2_hbreak (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); -return r ? (r[12 ] *2 ) :0 ; +const u8 *r =find_gtf2_descriptor (edid); + +return r ? r[12 ] *2 :0 ; }static int -drm_gtf2_2c (struct edid *edid) +drm_gtf2_2c (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[13 ] :0 ; }static int -drm_gtf2_m (struct edid *edid) +drm_gtf2_m (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); -return r ? (r[15 ] <<8 ) + r[14 ] :0 ; +const u8 *r =find_gtf2_descriptor (edid); + +return r ? (r[15 ] <<8 ) | r[14 ] :0 ; }static int -drm_gtf2_k (struct edid *edid) +drm_gtf2_k (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[16 ] :0 ; }static int -drm_gtf2_2j (struct edid *edid) +drm_gtf2_2j (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[17 ] :0 ; }@@ -2346,7 +2370,7 @@ drm_gtf2_2j(struct edid *edid)* standard_timing_level - get std. timing level(CVT/GTF/DMT) * @edid: EDID block to scan */ -static int standard_timing_level (struct edid *edid) +static int standard_timing_level (const struct edid *edid) {if (edid->revision >=2 ) {if (edid->revision >=4 && (edid->features &DRM_EDID_FEATURE_DEFAULT_GTF ))@@ -2381,8 +2405,9 @@ bad_std_timing(u8 a, u8 b)* and convert them into a real mode using CVT/GTF/DMT. */ static struct drm_display_mode * -drm_mode_std (struct drm_connector *connector,struct edid *edid, -struct std_timing *t) +drm_mode_std (struct drm_connector *connector, +const struct edid *edid, +const struct std_timing *t) {struct drm_device *dev = connector->dev;struct drm_display_mode *m, *mode =NULL ;@@ -2500,7 +2525,7 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid,*/ static void drm_mode_do_interlace_quirk (struct drm_display_mode *mode, -struct detailed_pixel_timing *pt) +const struct detailed_pixel_timing *pt) {int i; static const struct {@@ -2543,12 +2568,12 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode,* return a new struct drm_display_mode. */ static struct drm_display_mode *drm_mode_detailed (struct drm_device *dev, -struct edid *edid, -struct detailed_timing *timing, +const struct edid *edid, +const struct detailed_timing *timing,u32 quirks) {struct drm_display_mode *mode; -struct detailed_pixel_timing *pt = &timing->data.pixel_data; +const struct detailed_pixel_timing *pt = &timing->data.pixel_data;unsigned hactive = (pt->hactive_hblank_hi &0xf0 ) <<4 | pt->hactive_lo;unsigned vactive = (pt->vactive_vblank_hi &0xf0 ) <<4 | pt->vactive_lo;unsigned hblank = (pt->hactive_hblank_hi &0xf ) <<8 | pt->hblank_lo;@@ -2590,9 +2615,9 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,return NULL ;if (quirks &EDID_QUIRK_135_CLOCK_TOO_HIGH ) - timing->pixel_clock =cpu_to_le16 (1088 ); - - mode->clock =le16_to_cpu (timing->pixel_clock) *10 ; + mode->clock =1088 *10 ; +else + mode->clock =le16_to_cpu (timing->pixel_clock) *10 ; mode->hdisplay = hactive; mode->hsync_start = mode->hdisplay + hsync_offset;@@ -2613,14 +2638,14 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,drm_mode_do_interlace_quirk (mode, pt);if (quirks &EDID_QUIRK_DETAILED_SYNC_PP ) { - pt->misc |=DRM_EDID_PT_HSYNC_POSITIVE |DRM_EDID_PT_VSYNC_POSITIVE ; + mode->flags |=DRM_MODE_FLAG_PHSYNC |DRM_MODE_FLAG_NVSYNC ; + }else { + mode->flags |= (pt->misc &DRM_EDID_PT_HSYNC_POSITIVE ) ? +DRM_MODE_FLAG_PHSYNC :DRM_MODE_FLAG_NHSYNC ; + mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ? +DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; } - mode->flags |= (pt->misc &DRM_EDID_PT_HSYNC_POSITIVE ) ? -DRM_MODE_FLAG_PHSYNC :DRM_MODE_FLAG_NHSYNC ; - mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ? -DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; - set_size: mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi &0xf0 ) <<4 ; mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi &0xf ) <<8 ;@@ -2644,7 +2669,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,static bool mode_in_hsync_range (const struct drm_display_mode *mode, -struct edid *edid,u8 *t) +const struct edid *edid,const u8 *t) {int hsync, hmin, hmax;@@ -2661,7 +2686,7 @@ mode_in_hsync_range(const struct drm_display_mode *mode,static bool mode_in_vsync_range (const struct drm_display_mode *mode, -struct edid *edid,u8 *t) +const struct edid *edid,const u8 *t) {int vsync, vmin, vmax;@@ -2677,7 +2702,7 @@ mode_in_vsync_range(const struct drm_display_mode *mode, }static u32 -range_pixel_clock (struct edid *edid,u8 *t) +range_pixel_clock (const struct edid *edid,const u8 *t) {/* unspecified */ if (t[9 ] ==0 || t[9 ] ==255 )@@ -2692,11 +2717,12 @@ range_pixel_clock(struct edid *edid, u8 *t) }static bool -mode_in_range (const struct drm_display_mode *mode,struct edid *edid, -struct detailed_timing *timing) +mode_in_range (const struct drm_display_mode *mode, +const struct edid *edid, +const struct detailed_timing *timing) {u32 max_clock; -u8 *t = (u8 *)timing; +const u8 *t = (const u8 *)timing;if (!mode_in_hsync_range (mode, edid, t))return false;@@ -2738,8 +2764,9 @@ static bool valid_inferred_mode(const struct drm_connector *connector, }static int -drm_dmt_modes_for_range (struct drm_connector *connector,struct edid *edid, -struct detailed_timing *timing) +drm_dmt_modes_for_range (struct drm_connector *connector, +const struct edid *edid, +const struct detailed_timing *timing) {int i, modes =0 ;struct drm_display_mode *newmode;@@ -2773,8 +2800,9 @@ void drm_mode_fixup_1366x768(struct drm_display_mode *mode) }static int -drm_gtf_modes_for_range (struct drm_connector *connector,struct edid *edid, -struct detailed_timing *timing) +drm_gtf_modes_for_range (struct drm_connector *connector, +const struct edid *edid, +const struct detailed_timing *timing) {int i, modes =0 ;struct drm_display_mode *newmode;@@ -2801,8 +2829,9 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, }static int -drm_cvt_modes_for_range (struct drm_connector *connector,struct edid *edid, -struct detailed_timing *timing) +drm_cvt_modes_for_range (struct drm_connector *connector, +const struct edid *edid, +const struct detailed_timing *timing) {int i, modes =0 ;struct drm_display_mode *newmode;@@ -2830,11 +2859,11 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, }static void -do_inferred_modes (struct detailed_timing *timing,void *c) +do_inferred_modes (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -struct detailed_data_monitor_range *range = &data->data.range; +const struct detailed_non_pixel *data = &timing->data.other_data; +const struct detailed_data_monitor_range *range = &data->data.range;if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_MONITOR_RANGE ))return ;@@ -2868,7 +2897,8 @@ do_inferred_modes(struct detailed_timing *timing, void *c) }static int -add_inferred_modes (struct drm_connector *connector,struct edid *edid) +add_inferred_modes (struct drm_connector *connector, +const struct edid *edid) {struct detailed_mode_closure closure = { .connector = connector,@@ -2876,18 +2906,20 @@ add_inferred_modes(struct drm_connector *connector, struct edid *edid) };if (version_greater (edid,1 ,0 )) -drm_for_each_detailed_block ((u8 *)edid, do_inferred_modes, +drm_for_each_detailed_block ((const u8 *)edid, + do_inferred_modes, &closure);return closure.modes; }static int -drm_est3_modes (struct drm_connector *connector,struct detailed_timing *timing) +drm_est3_modes (struct drm_connector *connector, +const struct detailed_timing *timing) {int i, j, m, modes =0 ;struct drm_display_mode *mode; -u8 *est = ((u8 *)timing) +6 ; +const u8 *est = ((const u8 *)timing) +6 ;for (i =0 ; i <6 ; i++) {for (j =7 ; j >=0 ; j--) {@@ -2912,7 +2944,7 @@ drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing) }static void -do_established_modes (struct detailed_timing *timing,void *c) +do_established_modes (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;@@ -2931,7 +2963,8 @@ do_established_modes(struct detailed_timing *timing, void *c)* (defined above). Tease them out and add them to the global modes list. */ static int -add_established_modes (struct drm_connector *connector,struct edid *edid) +add_established_modes (struct drm_connector *connector, +const struct edid *edid) {struct drm_device *dev = connector->dev; unsigned long est_bits = edid->established_timings.t1 |@@ -2962,19 +2995,19 @@ add_established_modes(struct drm_connector *connector, struct edid *edid) }static void -do_standard_modes (struct detailed_timing *timing,void *c) +do_standard_modes (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; +const struct detailed_non_pixel *data = &timing->data.other_data;struct drm_connector *connector = closure->connector; -struct edid *edid = closure->edid; +const struct edid *edid = closure->edid;int i;if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_STD_MODES ))return ;for (i =0 ; i <6 ; i++) { -struct std_timing *std = &data->data.timings[i]; +const struct std_timing *std = &data->data.timings[i];struct drm_display_mode *newmode; newmode =drm_mode_std (connector, edid, std);@@ -2994,7 +3027,8 @@ do_standard_modes(struct detailed_timing *timing, void *c)* GTF or CVT. Grab them from @edid and add them to the list. */ static int -add_standard_modes (struct drm_connector *connector,struct edid *edid) +add_standard_modes (struct drm_connector *connector, +const struct edid *edid) {int i, modes =0 ;struct detailed_mode_closure closure = {@@ -3023,18 +3057,18 @@ add_standard_modes(struct drm_connector *connector, struct edid *edid) }static int drm_cvt_modes (struct drm_connector *connector, -struct detailed_timing *timing) +const struct detailed_timing *timing) {int i, j, modes =0 ;struct drm_display_mode *newmode;struct drm_device *dev = connector->dev; -struct cvt_timing *cvt;const int rates[] = {60 ,85 ,75 ,60 ,50 };const u8 empty[3 ] = {0 ,0 ,0 };for (i =0 ; i <4 ; i++) {int uninitialized_var (width ), height; - cvt = &(timing->data.other_data.data.cvt[i]); +const struct cvt_timing *cvt = + &timing->data.other_data.data.cvt[i];if (!memcmp (cvt->code, empty,3 ))continue ;@@ -3072,7 +3106,7 @@ static int drm_cvt_modes(struct drm_connector *connector, }static void -do_cvt_mode (struct detailed_timing *timing,void *c) +do_cvt_mode (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;@@ -3083,7 +3117,8 @@ do_cvt_mode(struct detailed_timing *timing, void *c) }static int -add_cvt_modes (struct drm_connector *connector,struct edid *edid) +add_cvt_modes (struct drm_connector *connector, +const struct edid *edid) {struct detailed_mode_closure closure = { .connector = connector,@@ -3101,7 +3136,7 @@ add_cvt_modes(struct drm_connector *connector, struct edid *edid)static void fixup_detailed_cea_mode_clock (struct drm_display_mode *mode);static void -do_detailed_mode (struct detailed_timing *timing,void *c) +do_detailed_mode (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;struct drm_display_mode *newmode;@@ -3137,8 +3172,8 @@ do_detailed_mode(struct detailed_timing *timing, void *c)* @quirks: quirks to apply */ static int -add_detailed_modes (struct drm_connector *connector,struct edid *edid, -u32 quirks) +add_detailed_modes (struct drm_connector *connector, +struct edid *edid,u32 quirks) {struct detailed_mode_closure closure = { .connector = connector,@@ -3173,9 +3208,10 @@ add_detailed_modes(struct drm_connector *connector, struct edid *edid,/* * Search EDID for CEA extension block. */ -static u8 *drm_find_edid_extension (const struct edid *edid,int ext_id) +static const u8 *drm_find_edid_extension (const struct edid *edid, +int ext_id) { -u8 *edid_ext =NULL ; +const u8 *edid_ext =NULL ;int i;/* No EDID or EDID extensions */ @@ -3184,7 +3220,7 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id)/* Find CEA extension */ for (i =0 ; i < edid->extensions; i++) { - edid_ext = (u8 *)edid +EDID_LENGTH * (i +1 ); + edid_ext = (const u8 *)edid +EDID_LENGTH * (i +1 );if (edid_ext[0 ] == ext_id)break ; }@@ -3196,19 +3232,19 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id) } -static u8 *drm_find_displayid_extension (const struct edid *edid) +static const u8 *drm_find_displayid_extension (const struct edid *edid) {return drm_find_edid_extension (edid,DISPLAYID_EXT ); } -static u8 *drm_find_cea_extension (const struct edid *edid) +static const u8 *drm_find_cea_extension (const struct edid *edid) {int ret;int idx =1 ;int length =EDID_LENGTH ; -struct displayid_block *block; -u8 *cea; -u8 *displayid; +const struct displayid_block *block; +const u8 *cea; +const u8 *displayid;/* Look for a top level CEA extension block */ cea =drm_find_edid_extension (edid,CEA_EXT );@@ -4315,28 +4351,30 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db) }static void -monitor_name (struct detailed_timing *t,void *data) +monitor_name (const struct detailed_timing *t,void *c) { +struct data_closure *closure = c; +if (!is_display_descriptor ((const u8 *)t,EDID_DETAIL_MONITOR_NAME ))return ; - *(u8 **)data = t->data.other_data.data.str.str; + closure->data = t->data.other_data.data.str.str; }static int get_monitor_name (struct edid *edid,char name[13 ]) { -char *edid_name =NULL ; +struct data_closure closure = {};int mnl;if (!edid || !name)return 0 ; -drm_for_each_detailed_block ((u8 *)edid, monitor_name, &edid_name); -for (mnl =0 ; edid_name && mnl <13 ; mnl++) { -if (edid_name[mnl] ==0x0a ) +drm_for_each_detailed_block ((const u8 *)edid, monitor_name, &closure); +for (mnl =0 ; closure.data && mnl <13 ; mnl++) { +if (closure.data[mnl] ==0x0a )break ; - name[mnl] = edid_name[mnl]; + name[mnl] = closure.data[mnl]; }return mnl;@@ -4386,11 +4424,9 @@ static void clear_eld(struct drm_connector *connector)static void drm_edid_to_eld (struct drm_connector *connector,struct edid *edid) {uint8_t *eld = connector->eld; -u8 *cea; -u8 *db; +const u8 *cea;int total_sad_count =0 ;int mnl; -int dbl;clear_eld (connector);@@ -4425,8 +4461,8 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) }for_each_cea_db (cea, i, start, end) { - db = &cea[i]; - dbl =cea_db_payload_len (db); +const u8 *db = &cea[i]; +int dbl =cea_db_payload_len (db);switch (cea_db_tag (db)) {int sad_count;@@ -4484,7 +4520,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) {int count =0 ;int i, start, end, dbl; -u8 *cea; +const u8 *cea; cea =drm_find_cea_extension (edid);if (!cea) {@@ -4503,7 +4539,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) }for_each_cea_db (cea, i, start, end) { -u8 *db = &cea[i]; +const u8 *db = &cea[i];if (cea_db_tag (db) ==AUDIO_BLOCK ) {int j;@@ -4514,7 +4550,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)if (!*sads)return -ENOMEM ;for (j =0 ; j < count; j++) { -u8 *sad = &db[1 + j *3 ]; +const u8 *sad = &db[1 + j *3 ]; (*sads)[j].format = (sad[0 ] &0x78 ) >>3 ; (*sads)[j].channels = sad[0 ] &0x7 ;@@ -4635,7 +4671,7 @@ EXPORT_SYMBOL(drm_av_sync_delay);*/ bool drm_detect_hdmi_monitor (struct edid *edid) { -u8 *edid_ext; +const u8 *edid_ext;int i;int start_offset, end_offset;@@ -4673,7 +4709,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor);*/ bool drm_detect_monitor_audio (struct edid *edid) { -u8 *edid_ext; +const u8 *edid_ext;int i, j;bool has_audio = false;int start_offset, end_offset;@@ -5017,13 +5053,13 @@ u32 drm_add_display_info(struct drm_connector *connector, const struct edid *edireturn quirks; } -static int validate_displayid (u8 *displayid,int length,int idx) +static int validate_displayid (const u8 *displayid,int length,int idx) {int i;u8 csum =0 ; -struct displayid_hdr *base; +const struct displayid_hdr *base; - base = (struct displayid_hdr *)&displayid[idx]; + base = (const struct displayid_hdr *)&displayid[idx];DRM_DEBUG_KMS ("base revision 0x%x, length %d, %d %d\n" , base->rev, base->bytes, base->prod_id, base->ext_count);@@ -5041,7 +5077,7 @@ static int validate_displayid(u8 *displayid, int length, int idx) }static struct drm_display_mode *drm_mode_displayid_detailed (struct drm_device *dev, -struct displayid_detailed_timings_1 *timings) +const struct displayid_detailed_timings_1 *timings) {struct drm_display_mode *mode; unsigned pixel_clock = (timings->pixel_clock[0] |@@ -5057,6 +5093,7 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *dunsigned vsync_width = (timings->vsw[0 ] | timings->vsw[1 ] <<8 ) +1 ;bool hsync_positive = (timings->hsync[1 ] >>7 ) &0x1 ;bool vsync_positive = (timings->vsync[1 ] >>7 ) &0x1 ; + mode =drm_mode_create (dev);if (!mode)return NULL ;@@ -5086,9 +5123,10 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d }static int add_displayid_detailed_1_modes (struct drm_connector *connector, -struct displayid_block *block) +const struct displayid_block *block) { -struct displayid_detailed_timing_block *det = (struct displayid_detailed_timing_block *)block; +const struct displayid_detailed_timing_block *det = + (const struct displayid_detailed_timing_block *)block;int i;int num_timings;struct drm_display_mode *newmode;@@ -5099,7 +5137,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, num_timings = block->num_bytes /20 ;for (i =0 ; i < num_timings; i++) { -struct displayid_detailed_timings_1 *timings = &det->timings[i]; +const struct displayid_detailed_timings_1 *timings = &det->timings[i]; newmode =drm_mode_displayid_detailed (connector->dev, timings);if (!newmode)@@ -5112,13 +5150,13 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, }static int add_displayid_detailed_modes (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) { -u8 *displayid; +const u8 *displayid;int ret;int idx =1 ;int length =EDID_LENGTH ; -struct displayid_block *block; +const struct displayid_block *block;int num_modes =0 ; displayid =drm_find_displayid_extension (edid);@@ -5720,9 +5758,10 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,EXPORT_SYMBOL (drm_hdmi_vendor_infoframe_from_display_mode);static int drm_parse_tiled_block (struct drm_connector *connector, -struct displayid_block *block) +const struct displayid_block *block) { -struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; +const struct displayid_tiled_block *tile = + (const struct displayid_tiled_block *)block;u16 w, h;u8 tile_v_loc, tile_h_loc;u8 num_v_tile, num_h_tile;@@ -5774,12 +5813,12 @@ static int drm_parse_tiled_block(struct drm_connector *connector, }static int drm_parse_display_id (struct drm_connector *connector, -u8 *displayid,int length, +const u8 *displayid,int length,bool is_edid_extension) {/* if this is an EDID extension the first byte will be 0x70 */ int idx =0 ; -struct displayid_block *block; +const struct displayid_block *block;int ret;if (is_edid_extension)@@ -5815,11 +5854,13 @@ static int drm_parse_display_id(struct drm_connector *connector, }static void drm_get_displayid (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) { -void *displayid =NULL ; +const void *displayid;int ret; + connector->has_tile = false; + displayid =drm_find_displayid_extension (edid);if (!displayid) {/* drop reference to any tile group we had */ include/drm/drm_connector.h +2
-3@@ -1580,9 +1580,9 @@ struct drm_tile_group { };struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 topology[8 ]);struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 topology[8 ]);void drm_mode_put_tile_group (struct drm_device *dev,struct drm_tile_group *tg); --2.24.1
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
RE: [Intel-gfx] [PATCH 7/8] drm/edid: Constify lots of things
Quoted 27 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Ville Syrjälä
Sent: Tuesday, January 28, 2020 5:19 PM
To: Alex Deucher <[email protected]>
Cc: Intel Graphics Development <[email protected]>; Maling list - DRI developers <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 7/8] drm/edid: Constify lots of thingsQuoted 16 lines · Alex Deucher
Quoted 13 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Let's try to make a lot more stuff const in the edid parser.
The "downside" is that we can no longer mangle the EDID in the middle of the parsing to apply quirks (
drm_mode_detailed()). I don't really think mangling the blob itself is such a great idea anyway so I won't miss that part. But if we do want it back I guess we should do the mangling in one explicit place before we otherwise parse the EDID.Signed-off-by Ville Syrjälä <[email protected]>
Quoted 7 lines
Quoted 2 lines
I generally agree, but are there any userspace expectations that they will be getting a corrected EDID in some cases?
Not sure. I think the the only thing we're fixing up is some DTDs so at least there's a better way for userspace to get the fixed information (getconnector ioctl). I guess Xorg is still parsing the EDID though, but it should have more or less the same quirks in its parser.
Theoretically, there may be a possibility of userspace getting out of sync in case EDID exposed to user is different to the quirked version getting used in kernel. I feel what you said in commit message looks good, where we can do the quirks at one place and share the same to userspace. Later just use that to proceed with parsing with constantifed edid in kernel.
Regards,
Uma Shankar
Quoted 905 lines
Quoted 115 lines
Alex
Quoted 112 lines
--- drivers/gpu/drm/drm_connector.c | 4 +- drivers/gpu/drm/drm_edid.c | 303 ++++++++++++++++++-------------- include/drm/drm_connector.h | 4 +- 3 files changed, 176 insertions(+), 135 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/drm_connector.cindexf632ca05960e..92a5cd6ff6b1100644drivers/gpu/drm/drm_connector.c +3
-2@@ -2377,7 +2377,7 @@ EXPORT_SYMBOL(drm_mode_put_tile_group);* tile group or NULL if not found. */ struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 topology[8 ]) {struct drm_tile_group *tg;int id;@@ -2407,7 +2407,7 @@ EXPORT_SYMBOL(drm_mode_get_tile_group);* new tile group or NULL. */ struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]) +const u8 + topology[8 ]) {struct drm_tile_group *tg;int ret;drivers/gpu/drm/drm_edid.c +3
-5@@ -88,7 +88,7 @@struct detailed_mode_closure {struct drm_connector *connector; -struct edid *edid; +const struct edid *edid;bool preferred;u32 quirks;int modes;@@ -1584,8 +1584,8 @@ MODULE_PARM_DESC(edid_fixup,"Minimum number of valid EDID header bytes (0-8, default 6)");static void drm_get_displayid (struct drm_connector *connector, -struct edid *edid); -static int validate_displayid (u8 *displayid,int length,int idx); +const struct edid *edid);static int +validate_displayid (const u8 *displayid,int length,int idx); static int drm_edid_block_checksum(const u8 *raw_edid) { @@ -2207,41 +2207,41 @@ static bool is_detailed_timing_descriptor(const u8 d[18])return d[0 ] !=0x00 || d[1 ] !=0x00 ; } -typedef void detailed_cb(struct detailed_timing *timing, void*closure);
drivers/gpu/drm/drm_edid.c +2
-1+typedef void detailed_cb (const struct detailed_timing *timing,void +*closure); static void -cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void*closure)
drivers/gpu/drm/drm_edid.c +5
-3+cea_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void +*closure) { int i, n;u8 d = ext[0x02 ]; -u8 *det_base = ext + d; +const u8 *det_base = ext + d;if (d <4 || d >127 )return ; n = (127 - d) /18 ;for (i =0 ; i < n; i++) -cb ((struct detailed_timing *)(det_base +18 * i), closure); +cb ((const struct detailed_timing *)(det_base +18 * + i), closure); } static void -vtb_for_each_detailed_block(u8 *ext, detailed_cb *cb, void*closure)
drivers/gpu/drm/drm_edid.c +5
-3+vtb_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void +*closure) { unsigned int i, n = min((int)ext[0x02], 6); -u8 *det_base = ext +5 ; +const u8 *det_base = ext +5 ;if (ext[0x01 ] !=1 )return ;/* unknown version */ for (i =0 ; i < n; i++) -cb ((struct detailed_timing *)(det_base +18 * i), closure); +cb ((const struct detailed_timing *)(det_base +18 * + i), closure); } static void -drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void*closure)
drivers/gpu/drm/drm_edid.c +3
-1+drm_for_each_detailed_block(const u8 *raw_edid, detailed_cb *cb, +void *closure) { + const struct edid *edid = (struct edid *)raw_edid;int i; -struct edid *edid = (struct edid *)raw_edid;Quoted 3 lines
drivers/gpu/drm/drm_edid.c drm_for_each_detailed_block(u8 *raw_edid,
Quoted 3 lines
if (edid == NULL) return;drivers/gpu/drm/drm_edid.c +0
-0@@ -2250,7 +2250,7 @@ drm_for_each_detailed_block(u8 *raw_edid,
detailed_cb*cb, void *closure)Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_edid.c +1
-1cb (&(edid->detailed_timings[i]), closure);for (i =1 ; i <= raw_edid[0x7e ]; i++) { -u8 *ext = raw_edid + (i *EDID_LENGTH ); +const u8 *ext = raw_edid + (i *EDID_LENGTH );switch (*ext) {case CEA_EXT : cea_for_each_detailed_block(ext, cb,closure); @@ -2264,81 +2264,105 @@ drm_for_each_detailed_block(u8
*raw_edid,detailed_cb*cb, void *closure)Quoted 130 lines
Quoted 130 lines
}}
drivers/gpu/drm/drm_edid.c +8
-3+struct bool_closure { +bool ret; +}; +static void -is_rb (struct detailed_timing *t,void *data) +is_rb (const struct detailed_timing *t,void *c) { -u8 *r = (u8 *)t; +struct bool_closure *closure = c; +const u8 *r = (const u8 *)t;if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE ))return ;if (r[15 ] &0x10 ) - *(bool *)data = true; + closure->ret = true; }/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */ static bool -drm_monitor_supports_rb(struct edid *edid)
drivers/gpu/drm/drm_edid.c +27
-6+drm_monitor_supports_rb(const struct edid *edid) {if (edid->revision >=4 ) { -bool ret = false; -drm_for_each_detailed_block ((u8 *)edid, is_rb, &ret); -return ret; +struct bool_closure closure = { + .ret = false, + }; + +drm_for_each_detailed_block ((u8 *)edid, is_rb, + &closure); + +return closure.ret; }return ((edid->input &DRM_EDID_INPUT_DIGITAL ) !=0 ); } +struct data_closure { +const u8 *data; +}; +static void -find_gtf2 (struct detailed_timing *t,void *data) +do_find_gtf2 (const struct detailed_timing *t,void *c) { -u8 *r = (u8 *)t; +struct data_closure *closure = c; +const u8 *r = (const u8 *)t;if (!is_display_descriptor (r,EDID_DETAIL_MONITOR_RANGE ))return ;if (r[10 ] ==0x02 ) - *(u8 **)data = r; + closure->data = r; +} + +static const u8 * +find_gtf2_descriptor (const struct edid *edid) { +struct data_closure closure = {}; + +drm_for_each_detailed_block ((u8 *)edid, do_find_gtf2, + &closure); + +return closure.data; }/* Secondary GTF curve kicks in above some break frequency */ static int -drm_gtf2_hbreak(struct edid *edid)
drivers/gpu/drm/drm_edid.c +17
-16+drm_gtf2_hbreak(const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); -return r ? (r[12 ] *2 ) :0 ; +const u8 *r =find_gtf2_descriptor (edid); + +return r ? r[12 ] *2 :0 ; }static int -drm_gtf2_2c (struct edid *edid) +drm_gtf2_2c (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[13 ] :0 ; }static int -drm_gtf2_m (struct edid *edid) +drm_gtf2_m (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); -return r ? (r[15 ] <<8 ) + r[14 ] :0 ; +const u8 *r =find_gtf2_descriptor (edid); + +return r ? (r[15 ] <<8 ) | r[14 ] :0 ; }static int -drm_gtf2_k (struct edid *edid) +drm_gtf2_k (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[16 ] :0 ; }static int -drm_gtf2_2j (struct edid *edid) +drm_gtf2_2j (const struct edid *edid) { -u8 *r =NULL ; -drm_for_each_detailed_block ((u8 *)edid, find_gtf2, &r); +const u8 *r =find_gtf2_descriptor (edid); +return r ? r[17 ] :0 ; }Quoted 10 lines
Quoted 10 lines
drivers/gpu/drm/drm_edid.c +1
-1@@ -2346,7 +2370,7 @@ drm_gtf2_2j(struct edid *edid)* standard_timing_level - get std. timing level(CVT/GTF/DMT) * @edid: EDID block to scan */ -static int standard_timing_level (struct edid *edid) +static int standard_timing_level (const struct edid *edid) {if (edid->revision >=2 ) { if (edid->revision >= 4 && (edid->features &
DRM_EDID_FEATURE_DEFAULT_GTF)) @@ -2381,8 +2405,9 @@
bad_std_timing(u8 a, u8 b)Quoted 13 lines
Quoted 13 lines
* and convert them into a real mode using CVT/GTF/DMT. */
static structdrm_display_mode*drivers/gpu/drm/drm_edid.c +3
-2-drm_mode_std(struct drm_connector *connector, struct edid *edid, - struct std_timing *t) +drm_mode_std(struct drm_connector *connector, + const struct edid *edid, + const struct std_timing *t) { struct drm_device *dev = connector->dev; struct drm_display_mode *m, *mode = NULL; @@ -2500,7 +2525,7@@ drm_mode_std(struct
drm_connector*connector, struct edid *edid,
*/Quoted 8 lines
drivers/gpu/drm/drm_edid.c drm_mode_do_interlace_quirk(struct
Quoted 8 lines
static void
drm_mode_do_interlace_quirk(structdrm_display_mode*mode,drivers/gpu/drm/drm_edid.c +1
-1- struct detailed_pixel_timing *pt) + const struct detailed_pixel_timing *pt) {int i; static const struct {@@ -2543,12 +2568,12 @@ drm_mode_do_interlace_quirk(struct
drm_display_mode*mode,Quoted 9 lines
Quoted 9 lines
drivers/gpu/drm/drm_edid.c +3
-2* return a new struct drm_display_mode. */ static struct drm_display_mode *drm_mode_detailed (struct drm_device *dev, -struct edid *edid, -struct detailed_timing *timing, +const struct edid *edid, +const struct +detailed_timing *timing,u32 quirks) {Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/drm_edid.c +2
-1struct drm_display_mode *mode; -struct detailed_pixel_timing *pt = &timing->data.pixel_data; +const struct detailed_pixel_timing *pt = + &timing->data.pixel_data;unsigned hactive = (pt->hactive_hblank_hi &0xf0 ) <<4 | pt->hactive_lo;unsigned vactive = (pt->vactive_vblank_hi &0xf0 ) <<4 | pt->vactive_lo; unsigned hblank = (pt->hactive_hblank_hi & 0xf) << 8 |
pt->hblank_lo; @@ -2590,9 +2615,9 @@ static structdrm_display_mode*drm_mode_detailed(struct
drm_device*dev,Quoted 10 lines
Quoted 10 lines
return NULL; if (quirks & EDID_QUIRK_135_CLOCK_TOO_HIGH)drivers/gpu/drm/drm_edid.c +3
-3- timing->pixel_clock =cpu_to_le16 (1088 ); - - mode->clock =le16_to_cpu (timing->pixel_clock) *10 ; + mode->clock =1088 *10 ; + else + mode->clock = le16_to_cpu(timing->pixel_clock) * 10;Quoted 3 lines
Quoted 3 lines
mode->hdisplay = hactive; mode->hsync_start = mode->hdisplay + hsync_offset; @@-2613,14 +2638,14 @@ static struct
drm_display_mode*drm_mode_detailed(struct
drm_device*dev,Quoted 4 lines
Quoted 4 lines
drm_mode_do_interlace_quirk(mode, pt); if (quirks & EDID_QUIRK_DETAILED_SYNC_PP) {-
pt->misc|=DRM_EDID_PT_HSYNC_POSITIVE|
DRM_EDID_PT_VSYNC_POSITIVE;Quoted 1 line
Quoted 1 line
+
mode->flags|=DRM_MODE_FLAG_PHSYNC|
DRM_MODE_FLAG_NVSYNC;Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/drm_edid.c +5
-0+ }else { + mode->flags |= (pt->misc &DRM_EDID_PT_HSYNC_POSITIVE ) ? +DRM_MODE_FLAG_PHSYNC :DRM_MODE_FLAG_NHSYNC ; + mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ? +DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; }Quoted 7 lines
drivers/gpu/drm/drm_edid.c static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
Quoted 7 lines
drivers/gpu/drm/drm_edid.c +0
-5- mode->flags |= (pt->misc &DRM_EDID_PT_HSYNC_POSITIVE ) ? -DRM_MODE_FLAG_PHSYNC :DRM_MODE_FLAG_NHSYNC ; - mode->flags |= (pt->misc &DRM_EDID_PT_VSYNC_POSITIVE ) ? -DRM_MODE_FLAG_PVSYNC :DRM_MODE_FLAG_NVSYNC ; - set_size: mode->width_mm = pt->width_mm_lo | (pt->width_height_mm_hi &0xf0 )<< 4;
Quoted 43 lines
Quoted 43 lines
mode->height_mm = pt->height_mm_lo | (pt->width_height_mm_hi&
0xf) << 8; @@ -2644,7 +2669,7 @@ static structdrm_display_mode*drm_mode_detailed(structdrm_device*dev,static bool
mode_in_hsync_range(const structdrm_display_mode*mode,drivers/gpu/drm/drm_edid.c +3
-3- struct edid *edid, u8 *t) + const struct edid *edid, const u8 *t) { int hsync, hmin, hmax;@@ -2661,7 +2686,7 @@ mode_in_hsync_range(const structdrm_display_mode *mode, static bool mode_in_vsync_range(const struct drm_display_mode *mode, - struct edid *edid, u8 *t) + const struct edid *edid, const u8 *t) { int vsync, vmin, vmax;@@ -2677,7 +2702,7 @@ mode_in_vsync_range(const struct drm_display_mode *mode, }static u32 -range_pixel_clock (struct edid *edid,u8 *t) +range_pixel_clock (const struct edid *edid,const u8 *t) {/* unspecified */ if (t[9] == 0 || t[9] == 255) @@ -2692,11 +2717,12 @@
range_pixel_clock(struct edid *edid, u8 *t)}static bool
drivers/gpu/drm/drm_edid.c +4
-3-mode_in_range(const struct drm_display_mode *mode, struct edid *edid, - struct detailed_timing *timing) +mode_in_range(const struct drm_display_mode *mode, + const struct edid *edid, + const struct detailed_timing *timing) { u32 max_clock; -u8 *t = (u8 *)timing; +const u8 *t = (const u8 *)timing;Quoted 7 lines
drivers/gpu/drm/drm_edid.c static bool valid_inferred_mode(const struct · line 2741
Quoted 7 lines
if (!mode_in_hsync_range(mode, edid, t))
return false;drivers/gpu/drm/drm_edid.c +0
-1@@ -2738,8 +2764,9 @@ static bool valid_inferred_mode(const struct drm_connector *connector, } static int -drm_dmt_modes_for_range(struct drm_connector *connector, struct edid*edid,
Quoted 44 lines
Quoted 44 lines
drivers/gpu/drm/drm_edid.c +3
-1- struct detailed_timing *timing) +drm_dmt_modes_for_range(struct drm_connector *connector, + const struct edid *edid, + const struct detailed_timing *timing) { int i, modes = 0; struct drm_display_mode *newmode; @@ -2773,8 +2800,9 @@ void
drm_mode_fixup_1366x768(struct drm_display_mode *mode)}static int
drivers/gpu/drm/drm_edid.c +3
-2-drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid, - struct detailed_timing *timing) +drm_gtf_modes_for_range(struct drm_connector *connector, + const struct edid *edid, + const struct detailed_timing *timing) { int i, modes = 0; struct drm_display_mode *newmode; @@ -2801,8 +2829,9 @@drm_gtf_modes_for_range(struct
drm_connector*connector, struct edid *edid, }static int
drivers/gpu/drm/drm_edid.c +3
-2-drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid, - struct detailed_timing *timing) +drm_cvt_modes_for_range(struct drm_connector *connector, + const struct edid *edid, + const struct detailed_timing *timing) { int i, modes = 0; struct drm_display_mode *newmode; @@ -2830,11 +2859,11 @@drm_cvt_modes_for_range(struct
drm_connector*connector, struct edid *edid, }static void
drivers/gpu/drm/drm_edid.c +4
-3-do_inferred_modes(struct detailed_timing *timing, void *c) +do_inferred_modes(const struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; -struct detailed_data_monitor_range *range = &data->data.range; +const struct detailed_non_pixel *data = &timing->data.other_data; +const struct detailed_data_monitor_range *range = + &data->data.range;Quoted 1 line
Quoted 1 line
if (!is_display_descriptor((const u8 *)timing,
EDID_DETAIL_MONITOR_RANGE))Quoted 40 lines
Quoted 40 lines
return;drivers/gpu/drm/drm_edid.c +2
-1@@ -2868,7 +2897,8 @@ do_inferred_modes(struct detailed_timing *timing, void *c) }static int -add_inferred_modes (struct drm_connector *connector,struct edid *edid) +add_inferred_modes (struct drm_connector *connector, +const struct edid *edid) {struct detailed_mode_closure closure = {.connector = connector, @@ -2876,18 +2906,20 @@ add_inferred_modes(struct drm_connector *connector, struct edid *edid) }; if (version_greater(edid, 1, 0))drivers/gpu/drm/drm_edid.c +2
-2-drm_for_each_detailed_block ((u8 *)edid, do_inferred_modes, +drm_for_each_detailed_block ((const u8 *)edid, + do_inferred_modes, &closure);return closure.modes; } static int -drm_est3_modes(struct drm_connector *connector, struct
detailed_timing*timing)drivers/gpu/drm/drm_edid.c +3
-1+drm_est3_modes(struct drm_connector *connector, + const struct detailed_timing *timing) { int i, j, m, modes = 0;struct drm_display_mode *mode; -u8 *est = ((u8 *)timing) +6 ; +const u8 *est = ((const u8 *)timing) +6 ;for (i =0 ; i <6 ; i++) { for (j = 7; j >= 0; j--) { @@ -2912,7 +2944,7 @@
drm_est3_modes(struct drm_connector *connector, struct detailed_timing *timing)}Quoted 7 lines
drivers/gpu/drm/drm_edid.c do_established_modes(struct detailed_timing *timing,
Quoted 7 lines
static void
drivers/gpu/drm/drm_edid.c +1
-1-do_established_modes(struct detailed_timing *timing, void *c) +do_established_modes(const struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c;@@ -2931,7 +2963,8 @@ do_established_modes(struct detailed_timing *timing,void *c)
Quoted 29 lines
Quoted 29 lines
drivers/gpu/drm/drm_edid.c +2
-1* (defined above). Tease them out and add them to the global modes list. */ static int -add_established_modes (struct drm_connector *connector,struct edid *edid) +add_established_modes (struct drm_connector *connector, +const struct edid *edid) {struct drm_device *dev = connector->dev;unsigned long est_bits = edid->established_timings.t1 | @@-2962,19 +2995,19 @@
add_established_modes(struct drm_connector *connector, struct edid *edid)}static void
drivers/gpu/drm/drm_edid.c +4
-3-do_standard_modes(struct detailed_timing *timing, void *c) +do_standard_modes(const struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; -struct detailed_non_pixel *data = &timing->data.other_data; +const struct detailed_non_pixel *data = + &timing->data.other_data;struct drm_connector *connector = closure->connector; -struct edid *edid = closure->edid; +const struct edid *edid = closure->edid;int i;if (!is_display_descriptor ((const u8 *)timing,EDID_DETAIL_STD_MODES ))return ;Quoted 8 lines
drivers/gpu/drm/drm_edid.c
Quoted 8 lines
for (i = 0; i < 6; i++) {drivers/gpu/drm/drm_edid.c +2
-2-struct std_timing *std = &data->data.timings[i]; +const struct std_timing *std = + &data->data.timings[i];struct drm_display_mode *newmode; newmode = drm_mode_std(connector, edid, std); @@ -2994,7 +3027,8 @@ do_standard_modes(struct detailed_timing *timing, void*c)
Quoted 170 lines
Quoted 170 lines
* GTF or CVT. Grab them from @edid and add them to the list. */
static int
-add_standard_modes(structdrm_connector*connector, struct edid *edid)drivers/gpu/drm/drm_edid.c +3
-0+add_standard_modes(struct drm_connector *connector, + const struct edid *edid) { int i, modes = 0; struct detailed_mode_closure closure = { @@ -3023,18 +3057,18 @@ add_standard_modes(struct drm_connector *connector,struct edid *edid) }
static int drm_cvt_modes(struct
drm_connector*connector,drivers/gpu/drm/drm_edid.c +6
-5- struct detailed_timing *timing) + const struct detailed_timing *timing) {int i, j, modes =0 ;struct drm_display_mode *newmode;struct drm_device *dev = connector->dev; -struct cvt_timing *cvt;const int rates[] = {60 ,85 ,75 ,60 ,50 };const u8 empty[3 ] = {0 ,0 ,0 };for (i =0 ; i <4 ; i++) {int uninitialized_var (width ), height; - cvt = &(timing->data.other_data.data.cvt[i]); +const struct cvt_timing *cvt = + &timing->data.other_data.data.cvt[i];if (!memcmp (cvt->code, empty,3 ))continue ;@@ -3072,7 +3106,7 @@ static int drm_cvt_modes(struct drm_connector *connector, }static void -do_cvt_mode (struct detailed_timing *timing,void *c) +do_cvt_mode (const struct detailed_timing *timing,void *c) {struct detailed_mode_closure *closure = c;@@ -3083,7 +3117,8 @@ do_cvt_mode(struct detailed_timing *timing, void *c) }static int -add_cvt_modes (struct drm_connector *connector,struct edid *edid) +add_cvt_modes (struct drm_connector *connector, +const struct edid *edid) {struct detailed_mode_closure closure = { .connector = connector, @@ -3101,7 +3136,7 @@
add_cvt_modes(struct drm_connector *connector, struct edid *edid)static voidfixup_detailed_cea_mode_clock(struct drm_display_mode *mode);static void
drivers/gpu/drm/drm_edid.c +1
-1-do_detailed_mode(struct detailed_timing *timing, void *c) +do_detailed_mode(const struct detailed_timing *timing, void *c) { struct detailed_mode_closure *closure = c; struct drm_display_mode *newmode; @@ -3137,8 +3172,8 @@
do_detailed_mode(struct detailed_timing *timing, void *c)
* @quirks: quirks to apply
*/
static intdrivers/gpu/drm/drm_edid.c +2
-2-add_detailed_modes(struct drm_connector *connector, struct edid *edid, - u32 quirks) +add_detailed_modes(struct drm_connector *connector, + struct edid *edid, u32 quirks) { struct detailed_mode_closure closure = { .connector = connector, @@ -3173,9 +3208,10 @@add_detailed_modes(struct
drm_connector*connector, struct edid *edid,
/*
* Search EDID for CEA extension block.
*/
-static u8 *drm_find_edid_extension(const struct edid *edid, intext_id)drivers/gpu/drm/drm_edid.c +3
-1+static const u8 *drm_find_edid_extension (const struct edid *edid, +int ext_id) { -u8 *edid_ext =NULL ; +const u8 *edid_ext =NULL ;int i; /* No EDID or EDID extensions */ @@ -3184,7 +3220,7 @@static u8 *drm_find_edid_extension(const struct edid *edid, int
ext_id)/* Find CEA extension */ for (i = 0; i < edid->extensions; i++) {drivers/gpu/drm/drm_edid.c +8
-6- edid_ext = (u8 *)edid +EDID_LENGTH * (i +1 ); + edid_ext = (const u8 *)edid +EDID_LENGTH * (i +1 );if (edid_ext[0 ] == ext_id)break ; }@@ -3196,19 +3232,19 @@ static u8 *drm_find_edid_extension(const struct edid *edid, int ext_id) } -static u8 *drm_find_displayid_extension (const struct edid *edid) +static const u8 *drm_find_displayid_extension (const struct edid +*edid) {return drm_find_edid_extension (edid,DISPLAYID_EXT ); } -static u8 *drm_find_cea_extension (const struct edid *edid) +static const u8 *drm_find_cea_extension(const struct edid *edid) { int ret; int idx = 1; int length = EDID_LENGTH; -struct displayid_block *block; -u8 *cea; -u8 *displayid; + const struct displayid_block *block; + const u8 *cea; + const u8 *displayid; /* Look for a top level CEA extension block */ cea = drm_find_edid_extension(edid, CEA_EXT); @@ -4315,28 +4351,30 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector*connector, const u8 *db) }
static void
drivers/gpu/drm/drm_edid.c +10
-10-monitor_name(struct detailed_timing *t, void *data) +monitor_name(const struct detailed_timing *t, void *c) { + struct data_closure *closure = c; +if (!is_display_descriptor ((const u8 *)t,EDID_DETAIL_MONITOR_NAME ))return ; - *(u8 **)data = t->data.other_data.data.str.str; + closure->data = t->data.other_data.data.str.str; }static int get_monitor_name (struct edid *edid,char name[13 ]) { -char *edid_name =NULL ; +struct data_closure closure = {};int mnl;if (!edid || !name)return 0 ; -drm_for_each_detailed_block ((u8 *)edid, monitor_name, &edid_name); -for (mnl =0 ; edid_name && mnl <13 ; mnl++) { -if (edid_name[mnl] ==0x0a ) +drm_for_each_detailed_block ((const u8 *)edid, monitor_name, &closure); +for (mnl =0 ; closure.data && mnl <13 ; mnl++) { +if (closure.data[mnl] ==0x0a )break ; - name[mnl] = edid_name[mnl]; + name[mnl] = closure.data[mnl]; }return mnl;@@ -4386,11 +4424,9 @@ static void clear_eld(struct drm_connector *connector) static void drm_edid_to_eld(struct drm_connector *connector,struct edid *edid) {uint8_t *eld = connector->eld; -u8 *cea; -u8 *db; +const u8 *cea;int total_sad_count =0 ;int mnl; -int dbl;Quoted 3 lines
drivers/gpu/drm/drm_edid.c static void drm_edid_to_eld(struct drm_connector
Quoted 3 lines
drivers/gpu/drm/drm_edid.c +0
-0clear_eld (connector);@@ -4425,8 +4461,8 @@ static void drm_edid_to_eld(struct drm_connector*connector, struct edid *edid)
Quoted 16 lines
Quoted 16 lines
drivers/gpu/drm/drm_edid.c +2
-2}for_each_cea_db (cea, i, start, end) { - db = &cea[i]; - dbl =cea_db_payload_len (db); +const u8 *db = &cea[i]; +int dbl =cea_db_payload_len (db);switch (cea_db_tag (db)) { int sad_count; @@ -4484,7 +4520,7 @@int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) { int count = 0; int i, start, end, dbl;drivers/gpu/drm/drm_edid.c +1
-1-u8 *cea; +const u8 *cea;Quoted 3 lines
drivers/gpu/drm/drm_edid.c int drm_edid_to_sad(struct edid *edid, struct cea_sad
Quoted 3 lines
cea = drm_find_cea_extension(edid); if (!cea) {drivers/gpu/drm/drm_edid.c +0
-0@@ -4503,7 +4539,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad**sads)
Quoted 9 lines
drivers/gpu/drm/drm_edid.c int drm_edid_to_sad(struct edid *edid, struct cea_sad
Quoted 9 lines
drivers/gpu/drm/drm_edid.c +1
-1}for_each_cea_db (cea, i, start, end) { -u8 *db = &cea[i]; +const u8 *db = &cea[i];if (cea_db_tag (db) ==AUDIO_BLOCK ) {int j;@@ -4514,7 +4550,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad**sads)
Quoted 40 lines
Quoted 40 lines
drivers/gpu/drm/drm_edid.c +3
-3if (!*sads)return -ENOMEM ;for (j =0 ; j < count; j++) { -u8 *sad = &db[1 + j *3 ]; +const u8 *sad = &db[1 + j *3 ]; (*sads)[j].format = (sad[0 ] &0x78 ) >>3 ; (*sads)[j].channels = sad[0 ] &0x7 ;@@ -4635,7 +4671,7 @@ EXPORT_SYMBOL(drm_av_sync_delay);*/ bool drm_detect_hdmi_monitor (struct edid *edid) { -u8 *edid_ext; +const u8 *edid_ext;int i;int start_offset, end_offset;@@ -4673,7 +4709,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor);*/ bool drm_detect_monitor_audio (struct edid *edid) { -u8 *edid_ext; +const u8 *edid_ext;int i, j;bool has_audio = false; int start_offset, end_offset; @@ -5017,13 +5053,13 @@ u32drm_add_display_info(struct
drm_connector*connector, const struct edid *edireturn quirks;}
drivers/gpu/drm/drm_edid.c +4
-3-static int validate_displayid (u8 *displayid,int length,int idx) +static int validate_displayid (const u8 *displayid,int length,int +idx) {int i;u8 csum =0 ; -struct displayid_hdr *base; +const struct displayid_hdr *base; - base = (struct displayid_hdr *)&displayid[idx]; + base = (const struct displayid_hdr *)&displayid[idx];Quoted 6 lines
Quoted 6 lines
DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n", base->rev, base->bytes, base->prod_id,
base->ext_count); @@ -5041,7 +5077,7 @@ static intvalidate_displayid(u8 *displayid, int length, int idx)}static struct
drm_display_mode*drm_mode_displayid_detailed(struct
drm_device*dev,Quoted 7 lines
drivers/gpu/drm/drm_edid.c
Quoted 7 lines
drivers/gpu/drm/drm_edid.c +3
-1- struct displayid_detailed_timings_1 *timings) +const + struct displayid_detailed_timings_1 *timings) {struct drm_display_mode *mode; unsigned pixel_clock = (timings->pixel_clock[0] | @@ -5057,6 +5093,7 @@ static struct drm_display_mode*drm_mode_displayid_detailed(struct
drm_device*dQuoted 10 lines
Quoted 10 lines
unsigned vsync_width = (timings->vsw[0] | timings->vsw[1] << 8) + 1; bool hsync_positive = (timings->hsync[1] >> 7) & 0x1; bool vsync_positive = (timings->vsync[1] >> 7) & 0x1;drivers/gpu/drm/drm_edid.c +1
-0+ mode =drm_mode_create (dev);if (!mode)return NULL ;@@ -5086,9 +5123,10 @@ static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d }Quoted 6 lines
drivers/gpu/drm/drm_edid.c static struct drm_display_mode *drm_mode_displayid_detailed(struct drm_device *d
Quoted 6 lines
drivers/gpu/drm/drm_edid.c +2
-2static int add_displayid_detailed_1_modes (struct drm_connector *connector, -struct displayid_block *block) +const struct +displayid_block *block) { - struct displayid_detailed_timing_block *det = (struct
displayid_detailed_timing_block*)block;Quoted 100 lines
Quoted 100 lines
drivers/gpu/drm/drm_edid.c +3
-0+const struct displayid_detailed_timing_block *det = + (const struct displayid_detailed_timing_block + *)block;int i;int num_timings; struct drm_display_mode *newmode; @@ -5099,7 +5137,7 @@static int add_displayid_detailed_1_modes(struct
drm_connector*connector,num_timings = block->num_bytes / 20; for (i = 0; i < num_timings; i++) {drivers/gpu/drm/drm_edid.c +5
-4-struct displayid_detailed_timings_1 *timings = &det->timings[i]; +const struct displayid_detailed_timings_1 *timings = + &det->timings[i]; newmode =drm_mode_displayid_detailed (connector->dev, timings);if (!newmode)@@ -5112,13 +5150,13 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, }static int add_displayid_detailed_modes (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) { -u8 *displayid; +const u8 *displayid;int ret;int idx =1 ;int length =EDID_LENGTH ; -struct displayid_block *block; +const struct displayid_block *block;int num_modes =0 ; displayid =drm_find_displayid_extension (edid);@@ -5720,9 +5758,10 @@drm_hdmi_vendor_infoframe_from_display_mode(struct
hdmi_vendor_infoframe*frame,EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode);static int drm_parse_tiled_block(struct
drm_connector*connector,drivers/gpu/drm/drm_edid.c +10
-7- struct displayid_block *block) +const struct displayid_block + *block) { -struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; +const struct displayid_tiled_block *tile = + (const struct displayid_tiled_block *)block;u16 w, h;u8 tile_v_loc, tile_h_loc;u8 num_v_tile, num_h_tile;@@ -5774,12 +5813,12 @@ static int drm_parse_tiled_block(struct drm_connector *connector, }static int drm_parse_display_id (struct drm_connector *connector, -u8 *displayid,int length, +const u8 *displayid,int length,bool is_edid_extension) {/* if this is an EDID extension the first byte will be 0x70 */ int idx =0 ; -struct displayid_block *block; +const struct displayid_block *block;int ret;if (is_edid_extension)@@ -5815,11 +5854,13 @@ static int drm_parse_display_id(struct drm_connector *connector, }static void drm_get_displayid (struct drm_connector *connector, -struct edid *edid) +const struct edid *edid) { -void *displayid =NULL ; +const void *displayid;int ret; + connector->has_tile = false; + displayid =drm_find_displayid_extension (edid);if (!displayid) {/* drop reference to any tile group we had */ diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.hindex
2113500b4075..c0f9ce3f4b24100644include/drm/drm_connector.h +4
-3@@ -1580,9 +1580,9 @@ struct drm_tile_group { };struct drm_tile_group *drm_mode_create_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 + topology[8 ]);struct drm_tile_group *drm_mode_get_tile_group (struct drm_device *dev, -char topology[8 ]); +const u8 + topology[8 ]);void drm_mode_put_tile_group (struct drm_device *dev,struct drm_tile_group *tg); --2.24.1
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel--
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/8 drm/edid: Dump bogus 18 byte descriptors
In reply to Ville SyrjalaFrom: Ville Syrjälä <[email protected]>
I'm curious if there are any bogus 18 byte descriptors around. Let's dump them out if we encounter them.
Not sure we'd actually want this, but at least I get to see if our CI has anything that hits this :)
--- drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +19 -3
@@ -2202,6 +2202,12 @@ static bool is_display_descriptor(const u8 d[18], u8 tag) d[2 ] ==0x00 && d[3 ] == tag; } +static bool is_any_display_descriptor (const u8 d[18 ]) +{ +return d[0 ] ==0x00 && d[1 ] ==0x00 && + d[2 ] ==0x00 ; +} +static bool is_detailed_timing_descriptor (const u8 d[18 ]) {return d[0 ] !=0x00 || d[1 ] !=0x00 ;
@@ -2209,6 +2215,15 @@ static bool is_detailed_timing_descriptor(const u8 d[18])typedef void detailed_cb (const struct detailed_timing *timing,void *closure); +static void do_detailed_block (const u8 d[18 ],detailed_cb *cb,void *closure) +{ +if (!is_detailed_timing_descriptor (d) && + !is_any_display_descriptor (d)) +DRM_WARN ("Unrecognized 18 byte descriptor: %*ph\n" ,18 , d); + +cb ((const struct detailed_timing *)d, closure); +} +static void cea_for_each_detailed_block (const u8 *ext,detailed_cb *cb,void *closure) {
@@ -2221,7 +2236,7 @@ cea_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void *closure) n = (127 - d) /18 ;for (i =0 ; i < n; i++) -cb ((const struct detailed_timing *)(det_base +18 * i), closure); +do_detailed_block (det_base +18 * i, cb, closure); } static void
@@ -2234,7 +2249,7 @@ vtb_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void *closure)return ;/* unknown version */ for (i =0 ; i < n; i++) -cb ((const struct detailed_timing *)(det_base +18 * i), closure); +do_detailed_block (det_base +18 * i, cb, closure); } static void
@@ -2247,7 +2262,8 @@ drm_for_each_detailed_block(const u8 *raw_edid, detailed_cb *cb, void *closure)return ;for (i =0 ; i <EDID_DETAILED_TIMINGS ; i++) -cb (&(edid->detailed_timings[i]), closure); +do_detailed_block ((const u8 *)&edid->detailed_timings[i], + cb, closure);for (i =1 ; i <= raw_edid[0x7e ]; i++) {const u8 *ext = raw_edid + (i *EDID_LENGTH );
Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 8/8] drm/edid: Dump bogus 18 byte descriptors
Quoted 10 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
I'm curious if there are any bogus 18 byte descriptors around. Let's dump them out if we encounter them.
Not sure we'd actually want this, but at least I get to see if our CI has anything that hits this :)
Signed-off-by Ville Syrjälä <[email protected]>
Quoted 68 lines
--- drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_edid.c +19
-4@@ -2202,6 +2202,12 @@ static bool is_display_descriptor(const u8 d[18], u8 tag) d[2 ] ==0x00 && d[3 ] == tag; } +static bool is_any_display_descriptor (const u8 d[18 ]) +{ +return d[0 ] ==0x00 && d[1 ] ==0x00 && + d[2 ] ==0x00 ; +} +static bool is_detailed_timing_descriptor (const u8 d[18 ]) {return d[0 ] !=0x00 || d[1 ] !=0x00 ;@@ -2209,6 +2215,15 @@ static bool is_detailed_timing_descriptor(const u8 d[18])typedef void detailed_cb (const struct detailed_timing *timing,void *closure); +static void do_detailed_block (const u8 d[18 ],detailed_cb *cb,void *closure) +{ +if (!is_detailed_timing_descriptor (d) && + !is_any_display_descriptor (d)) +DRM_WARN ("Unrecognized 18 byte descriptor: %*ph\n" ,18 , d); + +cb ((const struct detailed_timing *)d, closure); +} +static void cea_for_each_detailed_block (const u8 *ext,detailed_cb *cb,void *closure) {@@ -2221,7 +2236,7 @@ cea_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void *closure) n = (127 - d) /18 ;for (i =0 ; i < n; i++) -cb ((const struct detailed_timing *)(det_base +18 * i), closure); +do_detailed_block (det_base +18 * i, cb, closure); } static void@@ -2234,7 +2249,7 @@ vtb_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void *closure)return ;/* unknown version */ for (i =0 ; i < n; i++) -cb ((const struct detailed_timing *)(det_base +18 * i), closure); +do_detailed_block (det_base +18 * i, cb, closure); } static void@@ -2247,7 +2262,8 @@ drm_for_each_detailed_block(const u8 *raw_edid, detailed_cb *cb, void *closure)return ;for (i =0 ; i <EDID_DETAILED_TIMINGS ; i++) -cb (&(edid->detailed_timings[i]), closure); +do_detailed_block ((const u8 *)&edid->detailed_timings[i], + cb, closure);for (i =1 ; i <= raw_edid[0x7e ]; i++) {const u8 *ext = raw_edid + (i *EDID_LENGTH ); --2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma
Reviewed-byRE: [Intel-gfx] [PATCH 8/8] drm/edid: Dump bogus 18 byte descriptors
Quoted 18 lines
-----Original Message-----
From: Intel-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, January 28, 2020 4:09 AM
To: Ville Syrjala <[email protected]>
Cc: Intel Graphics Development <[email protected]>; Maling list - DRI developers <[email protected]>
Subject: Re: [Intel-gfx] [PATCH 8/8] drm/edid: Dump bogus 18 byte descriptorsQuoted 6 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
I'm curious if there are any bogus 18 byte descriptors around. Let's dump them out if we encounter them.
Quoted 6 lines
Quoted 4 lines
Not sure we'd actually want this, but at least I get to see if our CI has anything that hits this :)
Signed-off-by Ville Syrjälä <[email protected]>Acked-by Alex Deucher <[email protected]>
Looks good to me as well.
Quoted 69 lines
drivers/gpu/drm/drm_edid.c static bool is_display_descriptor(const u8 d[18], u8
Quoted 9 lines
--- drivers/gpu/drm/drm_edid.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_edid.c +0
-0@@ -2202,6 +2202,12 @@ static bool is_display_descriptor(const u8 d[18], u8tag)
drivers/gpu/drm/drm_edid.c vtb_for_each_detailed_block(const u8 *ext, detailed_cb
Quoted 36 lines
drivers/gpu/drm/drm_edid.c +5
-0d[2 ] ==0x00 && d[3 ] == tag; } +static bool is_any_display_descriptor (const u8 d[18 ]) { +return d[0 ] ==0x00 && d[1 ] ==0x00 && + d[2 ] ==0x00 ; +} +static bool is_detailed_timing_descriptor (const u8 d[18 ]) { return d[0] != 0x00 || d[1] != 0x00; @@ -2209,6 +2215,15 @@ static bool is_detailed_timing_descriptor(const u8 d[18]) typedef void detailed_cb(const struct detailed_timing *timing, void*closure);
drivers/gpu/drm/drm_edid.c +9
-0+static void do_detailed_block (const u8 d[18 ],detailed_cb *cb,void +*closure) { +if (!is_detailed_timing_descriptor (d) && + !is_any_display_descriptor (d)) +DRM_WARN ("Unrecognized 18 byte descriptor: %*ph\n" , +18 , d); + +cb ((const struct detailed_timing *)d, closure); } +static void cea_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void*closure) { @@ -2221,7 +2236,7 @@
cea_for_each_detailed_block(const u8 *ext, detailed_cb *cb, void *closure)n = (127 - d) / 18; for (i = 0; i < n; i++)drivers/gpu/drm/drm_edid.c +1
-1-cb ((const struct detailed_timing *)(det_base +18 * i), closure); +do_detailed_block (det_base +18 * i, cb, closure); } static void@@ -2234,7 +2249,7 @@ vtb_for_each_detailed_block(const u8 *ext, detailed_cb*cb, void *closure)
drivers/gpu/drm/drm_edid.c drm_for_each_detailed_block(const u8 *raw_edid,
Quoted 9 lines
drivers/gpu/drm/drm_edid.c +1
-1return ;/* unknown version */ for (i =0 ; i < n; i++) -cb ((const struct detailed_timing *)(det_base +18 * i), closure); +do_detailed_block (det_base +18 * i, cb, closure); } static void@@ -2247,7 +2262,8 @@ drm_for_each_detailed_block(const u8 *raw_edid,
detailed_cb*cb, void *closure)Quoted 12 lines
drivers/gpu/drm/drm_edid.c +2
-2return ;for (i =0 ; i <EDID_DETAILED_TIMINGS ; i++) -cb (&(edid->detailed_timings[i]), closure); +do_detailed_block ((const u8 *)&edid->detailed_timings[i], + cb, closure);for (i =1 ; i <= raw_edid[0x7e ]; i++) {const u8 *ext = raw_edid + (i *EDID_LENGTH ); --2.24.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext block
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext block
URL : https://patchwork.freedesktop.org/series/72550/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 3a501fdd02f1 drm/edid: Check the number of detailed timing descriptors in the CEA ext block 0e3a8bb18994 drm/edid: Don't accept any old garbage as a display descriptor 4a7295a41e0f drm/edid: Introduce is_detailed_timing_descritor() a60ef24fcf54 drm/i915: Clear out spurious whitespace 9618198833a0 drm/edid: Document why we don't bounds check the DispID CEA block start/end cf141fb33648 drm/edid: Add a FIXME about DispID CEA data block revision e49f5a0e43ea drm/edid: Constify lots of things -:757: WARNING:LONG_LINE: line over 100 characters #757: FILE: drivers/gpu/drm/drm_edid.c:5080: + const struct displayid_detailed_timings_1 *timings)
total: 0 errors, 1 warnings, 0 checks, 783 lines checked 120d72ced4d7 drm/edid: Dump bogus 18 byte descriptors
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✓ Fi.CI.BAT: success for series starting with [1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext block
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext block
URL : https://patchwork.freedesktop.org/series/72550/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_7811 -> Patchwork_16262
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/index.html
Known issues
------------
Here are the changes found in Patchwork_16262 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_exec_suspend@basic-s0:
- fi-cml-s: [PASS][1] -> [FAIL][2] ([fdo#103375])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-cml-s/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-cml-s/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-hsw-4770r: [PASS][3] -> [DMESG-FAIL][4] ([i915#725])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-hsw-4770r/igt@i915_selftest@live_blt.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-hsw-4770r/igt@i915_selftest@live_blt.html
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: [PASS][5] -> [FAIL][6] ([i915#217])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-icl-u2/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-icl-u2/igt@[email protected]
#### Possible fixes ####
* igt@gem_exec_parallel@fds:
- fi-hsw-peppy: [INCOMPLETE][7] ([i915#694]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-hsw-peppy/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-hsw-peppy/igt@[email protected]
* igt@gem_exec_suspend@basic-s3:
- fi-cml-s: [INCOMPLETE][9] ([i915#283]) -> [PASS][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-cml-s/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-cml-s/igt@[email protected]
* igt@i915_module_load@reload-with-fault-injection:
- fi-cfl-8700k: [DMESG-WARN][11] ([i915#889]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-cfl-8700k/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-cfl-8700k/igt@[email protected]
* igt@i915_selftest@live_blt:
- fi-hsw-4770: [DMESG-FAIL][13] ([i915#725]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-hsw-4770/igt@i915_selftest@live_blt.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-hsw-4770/igt@i915_selftest@live_blt.html
* igt@i915_selftest@live_gtt:
- fi-bdw-5557u: [TIMEOUT][15] ([fdo#112271]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-bdw-5557u/igt@i915_selftest@live_gtt.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-bdw-5557u/igt@i915_selftest@live_gtt.html
#### Warnings ####
* igt@kms_chamelium@common-hpd-after-suspend:
- fi-icl-u2: [FAIL][17] ([i915#217]) -> [DMESG-WARN][18] ([IGT#4] / [i915#263])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/fi-icl-u2/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/fi-icl-u2/igt@[email protected]
[IGT#4]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/4
[fdo#103375]: https://bugs.freedesktop.org/show_bug.cgi?id=103375
[fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
[i915#217]: https://gitlab.freedesktop.org/drm/intel/issues/217
[i915#263]: https://gitlab.freedesktop.org/drm/intel/issues/263
[i915#283]: https://gitlab.freedesktop.org/drm/intel/issues/283
[i915#694]: https://gitlab.freedesktop.org/drm/intel/issues/694
[i915#725]: https://gitlab.freedesktop.org/drm/intel/issues/725
[i915#889]: https://gitlab.freedesktop.org/drm/intel/issues/889
Participating hosts (47 -> 42)
------------------------------
Additional (2): fi-bsw-kefka fi-skl-6600u
Missing (7): fi-hsw-4200u fi-bsw-cyan fi-ilk-650 fi-ctg-p8600 fi-byt-clapper fi-bsw-nick fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7811 -> Patchwork_16262
CI-20190529: 20190529
CI_DRM_7811: f528982f5c837f075e82ca544df010ca5183064a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5384: fd6896567f7d612c76207970376d4f1e634ded55 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16262: 120d72ced4d75ab3be121475f9e90d762ec99d12 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
120d72ced4d7 drm/edid: Dump bogus 18 byte descriptorse49f5a0e43ea drm/edid: Constify lots of thingscf141fb33648 drm/edid: Add a FIXME about DispID CEA data block revision 9618198833a0 drm/edid: Document why we don't bounds check the DispID CEA block start/end a60ef24fcf54 drm/i915: Clear out spurious whitespace4a7295a41e0f drm/edid: Introduce is_detailed_timing_descritor()0e3a8bb18994 drm/edid: Don't accept any old garbage as a display descriptor 3a501fdd02f1 drm/edid: Check the number of detailed timing descriptors in the CEA ext block
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.IGT: failure for series starting with [1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext block
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext block
URL : https://patchwork.freedesktop.org/series/72550/
State : failure
== Summary ==
CI Bug Log - changes from CI_DRM_7811_full -> Patchwork_16262_full
====================================================
Summary
-------
**FAILURE**
Serious unknown changes coming with Patchwork_16262_full absolutely need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_16262_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
Possible new issues
-------------------
Here are the unknown changes that may have been introduced in Patchwork_16262_full:
### IGT changes ###
#### Possible regressions ####
* igt@gem_partial_pwrite_pread@reads:
- shard-hsw: [PASS][1] -> [FAIL][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-hsw7/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-hsw1/igt@[email protected]
Known issues
------------
Here are the changes found in Patchwork_16262_full that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@gem_ctx_isolation@vcs1-none:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#109276] / [fdo#112080]) +4 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb6/igt@[email protected]
* igt@gem_ctx_shared@exec-single-timeline-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#110841])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb2/igt@[email protected]
* igt@gem_exec_schedule@in-order-bsd:
- shard-iclb: [PASS][7] -> [SKIP][8] ([fdo#112146]) +3 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb2/igt@[email protected]
* igt@gem_exec_schedule@pi-distinct-iova-bsd:
- shard-iclb: [PASS][9] -> [SKIP][10] ([i915#677])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb8/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb2/igt@[email protected]
* igt@gem_exec_store@cachelines-vcs1:
- shard-iclb: [PASS][11] -> [SKIP][12] ([fdo#112080]) +7 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb7/igt@[email protected]
* igt@gem_wait@write-busy-vcs0:
- shard-skl: [PASS][13] -> [DMESG-WARN][14] ([i915#109]) +2 similar issues
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl4/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl6/igt@[email protected]
* igt@i915_pm_dc@dc5-dpms:
- shard-skl: [PASS][15] -> [INCOMPLETE][16] ([i915#198])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl2/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl1/igt@[email protected]
* igt@i915_pm_rps@waitboost:
- shard-iclb: [PASS][17] -> [FAIL][18] ([i915#413])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb7/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb1/igt@[email protected]
* igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible:
- shard-glk: [PASS][19] -> [FAIL][20] ([i915#34])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-glk2/igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-glk2/igt@kms_flip@2x-flip-vs-absolute-wf_vblank-interruptible.html
* igt@kms_flip@flip-vs-expired-vblank:
- shard-skl: [PASS][21] -> [FAIL][22] ([i915#79])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl9/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl2/igt@[email protected]
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-kbl: [PASS][23] -> [DMESG-WARN][24] ([i915#180]) +3 similar issues
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-kbl4/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-kbl4/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-c-constant-alpha-min:
- shard-skl: [PASS][25] -> [FAIL][26] ([fdo#108145])
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl7/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl3/igt@[email protected]
* igt@kms_psr@psr2_primary_mmap_cpu:
- shard-iclb: [PASS][27] -> [SKIP][28] ([fdo#109441]) +3 similar issues
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb2/igt@kms_psr@psr2_primary_mmap_cpu.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb3/igt@kms_psr@psr2_primary_mmap_cpu.html
* igt@kms_setmode@basic:
- shard-apl: [PASS][29] -> [FAIL][30] ([i915#31])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-apl3/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-apl7/igt@[email protected]
- shard-kbl: [PASS][31] -> [FAIL][32] ([i915#31])
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-kbl2/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-kbl6/igt@[email protected]
* igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
- shard-kbl: [PASS][33] -> [INCOMPLETE][34] ([fdo#103665])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-kbl7/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-kbl6/igt@[email protected]
* igt@prime_busy@hang-bsd2:
- shard-iclb: [PASS][35] -> [SKIP][36] ([fdo#109276]) +15 similar issues
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb2/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb3/igt@[email protected]
* igt@prime_mmap_coherency@ioctl-errors:
- shard-hsw: [PASS][37] -> [FAIL][38] ([i915#831])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-hsw2/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-hsw7/igt@[email protected]
#### Possible fixes ####
* igt@gem_busy@busy-vcs1:
- shard-iclb: [SKIP][39] ([fdo#112080]) -> [PASS][40] +10 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb8/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb2/igt@[email protected]
* igt@gem_exec_async@concurrent-writes-bsd:
- shard-iclb: [SKIP][41] ([fdo#112146]) -> [PASS][42] +6 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb2/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb6/igt@[email protected]
* igt@gem_exec_schedule@pi-shared-iova-bsd:
- shard-iclb: [SKIP][43] ([i915#677]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb2/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb6/igt@[email protected]
* igt@gem_ppgtt@flink-and-close-vma-leak:
- shard-skl: [FAIL][45] ([i915#644]) -> [PASS][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl8/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl7/igt@[email protected]
* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [FAIL][47] ([i915#454]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb4/igt@[email protected]
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb1/igt@[email protected]
* igt@kms_color@pipe-a-ctm-negative:
- shard-skl: [DMESG-WARN][49] ([i915#109]) -> [PASS][50] +1 similar issue
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl4/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl6/igt@[email protected]
* igt@kms_cursor_crc@pipe-c-cursor-suspend:
- shard-apl: [DMESG-WARN][51] ([i915#180]) -> [PASS][52] +2 similar issues
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-apl4/igt@[email protected]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-apl1/igt@[email protected]
* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-hsw: [INCOMPLETE][53] ([i915#61]) -> [PASS][54] +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-hsw7/igt@[email protected]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-hsw6/igt@[email protected]
* igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-shrfb-draw-render:
- shard-skl: [FAIL][55] ([i915#49]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl10/igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-shrfb-draw-render.html
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl2/igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-shrfb-draw-render.html
* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-skl: [INCOMPLETE][57] ([i915#69]) -> [PASS][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl8/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl9/igt@[email protected]
* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [FAIL][59] ([fdo#108145]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl10/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl2/igt@[email protected]
* igt@kms_prime@basic-crc:
- shard-skl: [FAIL][61] ([i915#1031]) -> [PASS][62]
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-skl10/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-skl2/igt@[email protected]
* igt@kms_psr@no_drrs:
- shard-iclb: [FAIL][63] ([i915#173]) -> [PASS][64]
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb1/igt@kms_psr@no_drrs.html
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb6/igt@kms_psr@no_drrs.html
* igt@kms_psr@psr2_cursor_mmap_cpu:
- shard-iclb: [SKIP][65] ([fdo#109441]) -> [PASS][66] +1 similar issue
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb8/igt@kms_psr@psr2_cursor_mmap_cpu.html
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb2/igt@kms_psr@psr2_cursor_mmap_cpu.html
* igt@prime_vgem@fence-wait-bsd2:
- shard-iclb: [SKIP][67] ([fdo#109276]) -> [PASS][68] +14 similar issues
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb5/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb2/igt@[email protected]
#### Warnings ####
* igt@gem_ctx_isolation@vcs1-nonpriv:
- shard-iclb: [FAIL][69] ([IGT#28]) -> [SKIP][70] ([fdo#109276] / [fdo#112080])
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-iclb1/igt@[email protected]
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-iclb6/igt@[email protected]
* igt@gem_tiled_blits@normal:
- shard-hsw: [FAIL][71] ([i915#694]) -> [FAIL][72] ([i915#818]) +1 similar issue
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7811/shard-hsw5/igt@[email protected]
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/shard-hsw2/igt@[email protected]
[IGT#28]: https://gitlab.freedesktop.org/drm/igt-gpu-tools/issues/28
[fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#110841]: https://bugs.freedesktop.org/show_bug.cgi?id=110841
[fdo#112080]: https://bugs.freedesktop.org/show_bug.cgi?id=112080
[fdo#112146]: https://bugs.freedesktop.org/show_bug.cgi?id=112146
[i915#1031]: https://gitlab.freedesktop.org/drm/intel/issues/1031
[i915#109]: https://gitlab.freedesktop.org/drm/intel/issues/109
[i915#173]: https://gitlab.freedesktop.org/drm/intel/issues/173
[i915#180]: https://gitlab.freedesktop.org/drm/intel/issues/180
[i915#198]: https://gitlab.freedesktop.org/drm/intel/issues/198
[i915#31]: https://gitlab.freedesktop.org/drm/intel/issues/31
[i915#34]: https://gitlab.freedesktop.org/drm/intel/issues/34
[i915#413]: https://gitlab.freedesktop.org/drm/intel/issues/413
[i915#454]: https://gitlab.freedesktop.org/drm/intel/issues/454
[i915#49]: https://gitlab.freedesktop.org/drm/intel/issues/49
[i915#61]: https://gitlab.freedesktop.org/drm/intel/issues/61
[i915#644]: https://gitlab.freedesktop.org/drm/intel/issues/644
[i915#677]: https://gitlab.freedesktop.org/drm/intel/issues/677
[i915#69]: https://gitlab.freedesktop.org/drm/intel/issues/69
[i915#694]: https://gitlab.freedesktop.org/drm/intel/issues/694
[i915#79]: https://gitlab.freedesktop.org/drm/intel/issues/79
[i915#818]: https://gitlab.freedesktop.org/drm/intel/issues/818
[i915#831]: https://gitlab.freedesktop.org/drm/intel/issues/831
Participating hosts (10 -> 10)
------------------------------
No changes in participating hosts
Build changes
-------------
* CI: CI-20190529 -> None
* Linux: CI_DRM_7811 -> Patchwork_16262
CI-20190529: 20190529
CI_DRM_7811: f528982f5c837f075e82ca544df010ca5183064a @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5384: fd6896567f7d612c76207970376d4f1e634ded55 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16262: 120d72ced4d75ab3be121475f9e90d762ec99d12 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16262/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
Quoted 2 lines
Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 26 lines
--- drivers/gpu/drm/drm_edid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_edid.c +4
-2@@ -2201,10 +2201,13 @@ typedef void detailed_cb(struct detailed_timing *timing, void *closure);static void cea_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) { -int i, n =0 ; +int i, n;u8 d = ext[0x02 ];u8 *det_base = ext + d; +if (d <4 || d >127 ) +return ; + n = (127 - d) /18 ;for (i =0 ; i < n; i++)cb ((struct detailed_timing *)(det_base +18 * i), closure); --2.24.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Shankar, Uma
Reviewed-byQuoted 29 lines
-----Original Message-----
From: dri-devel <[email protected]> On Behalf Of Alex Deucher
Sent: Tuesday, January 28, 2020 4:04 AM
To: Ville Syrjala <[email protected]>
Cc: Allen Chen <[email protected]>; Intel Graphics Development <intel- [email protected]>; Maling list - DRI developers <dri- [email protected]>
Subject: Re: [PATCH 1/8] drm/edid: Check the number of detailed timing descriptors in the CEA ext blockQuoted 15 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
Quoted 4 lines
Quoted 2 lines
Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Acked-by Alex Deucher <[email protected]>
Looks good to me as well.
Quoted 27 lines
Quoted 27 lines
--- drivers/gpu/drm/drm_edid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_edid.c +0
-0@@ -2201,10 +2201,13 @@ typedef void detailed_cb(struct
detailed_timing*timing, void *closure); static void
cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure)
{drivers/gpu/drm/drm_edid.c +4
-1-int i, n =0 ; +int i, n;u8 d = ext[0x02 ];u8 *det_base = ext + d; +if (d <4 || d >127 ) +return ; + n = (127 - d) /18 ;for (i =0 ; i < n; i++) cb((struct detailed_timing *)(det_base + 18 * i),closure);
--
2.24.1
Quoted 8 lines
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
Quoted 2 lines
Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Hm I think edid parsing is like the perfect use-case for some in-kernel unit tests ... In case anyone feels motivated?
-Daniel
Quoted 30 lines
--- drivers/gpu/drm/drm_edid.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/drm_edid.c +4
-1@@ -2201,10 +2201,13 @@ typedef void detailed_cb(struct detailed_timing *timing, void *closure);static void cea_for_each_detailed_block (u8 *ext,detailed_cb *cb,void *closure) { -int i, n =0 ; +int i, n;u8 d = ext[0x02 ];u8 *det_base = ext + d; +if (d <4 || d >127 ) +return ; + n = (127 - d) /18 ;for (i =0 ; i < n; i++)cb ((struct detailed_timing *)(det_base +18 * i), closure);Signature · 6 lines
2.24.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 15 lines · Daniel Vetter
Quoted 14 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
Quoted 5 lines
Quoted 2 lines
Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Hm I think edid parsing is like the perfect use-case for some in-kernel unit tests ... In case anyone feels motivated?
Another idea I've been putting off is simply shoving the parser into userspace. Kinda looks like with fork_usermode_blob() we could embed the executable into the kernel/module and thus avoid the problem of actually shipping the binary somehow.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 20 lines · Ville Syrjälä
Quoted 18 lines · Daniel Vetter
Quoted 16 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Quoted 7 lines
Quoted 2 lines
Hm I think edid parsing is like the perfect use-case for some in-kernel unit tests ... In case anyone feels motivated?
Another idea I've been putting off is simply shoving the parser into userspace. Kinda looks like with
fork_usermode_blob()we could embed the executable into the kernel/module and thus avoid the problem of actually shipping the binary somehow.
"How to run unit tests without losing hair" is essentially what kunit tries to solve. I think we should cut over to that (it's merged now, should be good enough for at least the edid parser, mocking stuff isn't there there), and then make sure CI runs that stuff for us. Then we could convert over at least the unit test like selftests eventually too.
-Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 30 lines · Daniel Vetter
Quoted 20 lines · Ville Syrjälä
Quoted 18 lines · Daniel Vetter
Quoted 16 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
CEA-861 says :
"d = offset for the byte following the reserved data block.
If no data is provided in the reserved data block, then d=4. If no DTDs are provided, then d=0."So let's not look for DTDs when d==0. In fact let's just make that <4 since those values would just mean that he DTDs overlap the block header. And let's also check that d isn't so big as to declare the descriptors to live past the block end, although the code does already survive that case as we'd just end up with a negative number of descriptors and the loop would not do anything.
Cc Allen Chen <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Quoted 7 lines
Quoted 2 lines
Hm I think edid parsing is like the perfect use-case for some in-kernel unit tests ... In case anyone feels motivated?
Another idea I've been putting off is simply shoving the parser into userspace. Kinda looks like with
fork_usermode_blob()we could embed the executable into the kernel/module and thus avoid the problem of actually shipping the binary somehow.
Quoted 6 lines
"How to run unit tests without losing hair" is essentially what kunit tries to solve. I think we should cut over to that (it's merged now, should be good enough for at least the edid parser, mocking stuff isn't there there), and then make sure CI runs that stuff for us. Then we could convert over at least the unit test like selftests eventually too.
I meant run it in userspace *always*, not just for testing.
Signature · 6 lines
Ville Syrjälä Intel _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx