drm/edid: Clean up display_info stuff
Subsystems (4)
v2 cover drm/edid: Clean up display_info stuff
From: Ville Syrjälä <[email protected]>
Rebased the series (previous version [1]) mostly due to code shuffling. i915 specific bits still need to be eyeballed by someone.
Series available here:git://github.com/vsyrjala/linux.git hdmi_sink_tmds_limit_4
[1] https://lists.freedesktop.org/archives/dri-devel/2016-August/114634.html
Ville Syrjälä (10):
drm/edid: Clear old audio latency values before parsing the new EDID drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new
EDID
drm/edid: Make max_tmds_clock kHz instead of MHz
drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info drm/edid: Don't pass around drm_display_info needlessly drm/edid: Reduce the number of times we parse the CEA extension block drm/edid: Clear the old cea_rev when there's no CEA extension in the
new EDID
drm/edid: Move dvi_dual/max_tmds_clock parsing out from
drm_edid_to_eld()
drm/i915: Replace a bunch of connector->base.display_info with a local
variable
drm/i915: Account for sink max TMDS clock when checking the port clock
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 +- drivers/gpu/drm/drm_edid.c | 248 +++++++++++++------------ drivers/gpu/drm/i915/intel_display.c | 14 +- drivers/gpu/drm/i915/intel_hdmi.c | 9 +- drivers/gpu/drm/radeon/radeon_connectors.c | 4 +- include/drm/drm_connector.h | 15 +- 6 files changed, 159 insertions(+), 135 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 1/10 drm/edid: Clear old audio latency values before parsing the new EDID
From: Ville Syrjälä <[email protected]>
Clear out stale audio latency information (potentially from a previous EDID) before constructing the ELD from the EDID.
--- drivers/gpu/drm/drm_edid.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/drm_edid.c +7 -0
@@ -3358,6 +3358,13 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)memset (eld,0 ,sizeof (connector->eld)); + connector->latency_present[0 ] = false; + connector->latency_present[1 ] = false; + connector->video_latency[0 ] =0 ; + connector->audio_latency[0 ] =0 ; + connector->video_latency[1 ] =0 ; + connector->audio_latency[1 ] =0 ; + cea =drm_find_cea_extension (edid);if (!cea) {DRM_DEBUG_KMS ("ELD: no CEA Extension found\n" );
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/10 drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new EDID
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Clear out old max_tmds_clock and dvi_dual information (possibly from a previous EDID) before parsing the current EDID. Tne current EDID might not even have these in its HDMI VSDB, which would mean that we'd leave the old stale values in place.
--- drivers/gpu/drm/drm_edid.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_edid.c +3 -0
@@ -3365,6 +3365,9 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) connector->video_latency[1 ] =0 ; connector->audio_latency[1 ] =0 ; + connector->max_tmds_clock =0 ; + connector->dvi_dual = false; + cea =drm_find_cea_extension (edid);if (!cea) {DRM_DEBUG_KMS ("ELD: no CEA Extension found\n" );
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/10 drm/edid: Make max_tmds_clock kHz instead of MHz
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We generally store clocks in kHz, so let's do that for the HDMI max TMDS clock value as well. Less surpising.
v2: Deal with superfluous code shuffling
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 +- drivers/gpu/drm/drm_edid.c | 2 +- drivers/gpu/drm/radeon/radeon_connectors.c | 2 +- include/drm/drm_connector.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -1
@@ -173,7 +173,7 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) mode_clock = amdgpu_connector->pixelclock_for_modeset;/* Maximum allowable input clock in kHz */ - max_tmds_clock = connector->max_tmds_clock *1000 ; + max_tmds_clock = connector->max_tmds_clock;DRM_DEBUG ("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n" , connector->name, mode_clock, max_tmds_clock);
drivers/gpu/drm/drm_edid.c +1 -1
@@ -3262,7 +3262,7 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db) connector->dvi_dual = db[6 ] &1 ; }if (len >=7 ) - connector->max_tmds_clock = db[7 ] *5 ; + connector->max_tmds_clock = db[7 ] *5000 ;if (len >=8 ) { connector->latency_present[0 ] = db[8 ] >>7 ; connector->latency_present[1 ] = (db[8 ] >>6 ) &1 ;
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
@@ -203,7 +203,7 @@ int radeon_get_monitor_bpc(struct drm_connector *connector) mode_clock = radeon_connector->pixelclock_for_modeset;/* Maximum allowable input clock in kHz */ - max_tmds_clock = connector->max_tmds_clock *1000 ; + max_tmds_clock = connector->max_tmds_clock;DRM_DEBUG ("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n" , connector->name, mode_clock, max_tmds_clock);
include/drm/drm_connector.h +1 -1
@@ -651,7 +651,7 @@ struct drm_connector {/* EDID bits */ uint8_t eld[MAX_ELD_BYTES ];bool dvi_dual; -int max_tmds_clock;/* in MHz */ +int max_tmds_clock;/* in kHz */ bool latency_present[2 ];int video_latency[2 ];/* [0]: progressive, [1]: interlaced */ int audio_latency[2 ];
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/10 drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We have the drm_display_info for storing information about the sink, so let's move dvi_dual and max_tmds_clock in there.
v2: Deal with superfluous code shuffling
Document dvi_dual and max_tmds_clock too
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 ++-- drivers/gpu/drm/drm_edid.c | 14 ++++++++------ drivers/gpu/drm/radeon/radeon_connectors.c | 4 ++-- include/drm/drm_connector.h | 15 +++++++++++---- 4 files changed, 23 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +2 -2
@@ -168,12 +168,12 @@ int amdgpu_connector_get_monitor_bpc(struct drm_connector *connector) }/* Any defined maximum tmds clock limit we must not exceed? */ -if (connector->max_tmds_clock >0 ) { +if (connector->display_info.max_tmds_clock >0 ) {/* mode_clock is clock in kHz for mode to be modeset on this connector */ mode_clock = amdgpu_connector->pixelclock_for_modeset;/* Maximum allowable input clock in kHz */ - max_tmds_clock = connector->max_tmds_clock; + max_tmds_clock = connector->display_info.max_tmds_clock;DRM_DEBUG ("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n" , connector->name, mode_clock, max_tmds_clock);
drivers/gpu/drm/drm_edid.c +8 -6
@@ -3255,14 +3255,15 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode)static void parse_hdmi_vsdb (struct drm_connector *connector,const u8 *db) { +struct drm_display_info *info = &connector->display_info;u8 len =cea_db_payload_len (db);if (len >=6 ) { connector->eld[5 ] |= (db[6 ] >>7 ) <<1 ;/* Supports_AI */ - connector->dvi_dual = db[6 ] &1 ; + info->dvi_dual = db[6 ] &1 ; }if (len >=7 ) - connector->max_tmds_clock = db[7 ] *5000 ; + info->max_tmds_clock = db[7 ] *5000 ;if (len >=8 ) { connector->latency_present[0 ] = db[8 ] >>7 ; connector->latency_present[1 ] = (db[8 ] >>6 ) &1 ;
@@ -3281,8 +3282,8 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)"latency present %d %d, " "video latency %d %d, " "audio latency %d %d\n" , - connector->dvi_dual, - connector->max_tmds_clock, + info->dvi_dual, + info->max_tmds_clock, (int ) connector->latency_present[0 ], (int ) connector->latency_present[1 ], connector->video_latency[0],
@@ -3349,6 +3350,7 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);*/ void drm_edid_to_eld (struct drm_connector *connector,struct edid *edid) { +struct drm_display_info *info = &connector->display_info;uint8_t *eld = connector->eld;u8 *cea;u8 *db;
@@ -3365,8 +3367,8 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) connector->video_latency[1 ] =0 ; connector->audio_latency[1 ] =0 ; - connector->max_tmds_clock =0 ; - connector->dvi_dual = false; + info->max_tmds_clock =0 ; + info->dvi_dual = false; cea =drm_find_cea_extension (edid);if (!cea) {
drivers/gpu/drm/radeon/radeon_connectors.c +2 -2
@@ -198,12 +198,12 @@ int radeon_get_monitor_bpc(struct drm_connector *connector) }/* Any defined maximum tmds clock limit we must not exceed? */ -if (connector->max_tmds_clock >0 ) { +if (connector->display_info.max_tmds_clock >0 ) {/* mode_clock is clock in kHz for mode to be modeset on this connector */ mode_clock = radeon_connector->pixelclock_for_modeset;/* Maximum allowable input clock in kHz */ - max_tmds_clock = connector->max_tmds_clock; + max_tmds_clock = connector->display_info.max_tmds_clock;DRM_DEBUG ("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n" , connector->name, mode_clock, max_tmds_clock);
include/drm/drm_connector.h +11 -4
@@ -167,6 +167,17 @@ struct drm_display_info {u32 bus_flags;/** +* @max_tmds_clock: Maximum TMDS clock rate supported by the +* sink in kHz. 0 means undefined. +*/ +int max_tmds_clock; + +/** +* @dvi_dual: Dual-link DVI sink? +*/ +bool dvi_dual; + +/** * @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even * more stuff redundant with @bus_formats. */
@@ -515,8 +526,6 @@ struct drm_cmdline_mode {* @encoder_ids: valid encoders for this connector * @encoder: encoder driving this connector, if any * @eld: EDID-like data, if present -* @dvi_dual: dual link DVI, if found -* @max_tmds_clock: max clock rate, if found * @latency_present: AV delay info from ELD, if found * @video_latency: video latency info from ELD, if found * @audio_latency: audio latency info from ELD, if found
@@ -650,8 +659,6 @@ struct drm_connector {#define MAX_ELD_BYTES 128/* EDID bits */ uint8_t eld[MAX_ELD_BYTES ]; -bool dvi_dual; -int max_tmds_clock;/* in kHz */ bool latency_present[2 ];int video_latency[2 ];/* [0]: progressive, [1]: interlaced */ int audio_latency[2 ];
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 5/10 drm/edid: Don't pass around drm_display_info needlessly
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We already pass the connector to drm_add_display_info() and drm_assign_hdmi_deep_color_info(), so passing the connector->display_info also is pointless.
--- drivers/gpu/drm/drm_edid.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +4 -4
@@ -3738,9 +3738,9 @@ EXPORT_SYMBOL(drm_rgb_quant_range_selectable);* Return true if HDMI deep color supported, false if not or unknown. */ static bool drm_assign_hdmi_deep_color_info (struct edid *edid, -struct drm_display_info *info,struct drm_connector *connector) { +struct drm_display_info *info = &connector->display_info;u8 *edid_ext, *hdmi;int i;int start_offset, end_offset;
@@ -3828,9 +3828,9 @@ static bool drm_assign_hdmi_deep_color_info(struct edid *edid, }static void drm_add_display_info (struct edid *edid, -struct drm_display_info *info,struct drm_connector *connector) { +struct drm_display_info *info = &connector->display_info;u8 *edid_ext; info->width_mm = edid->width_cm *10 ;
@@ -3860,7 +3860,7 @@ static void drm_add_display_info(struct edid *edid, }/* HDMI deep color modes supported? Assign to info, if so */ -drm_assign_hdmi_deep_color_info (edid, info, connector); +drm_assign_hdmi_deep_color_info (edid, connector);/* * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?
@@ -4096,7 +4096,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)if (quirks & (EDID_QUIRK_PREFER_LARGE_60 |EDID_QUIRK_PREFER_LARGE_75 ))edid_fixup_preferred (connector, quirks); -drm_add_display_info (edid, &connector->display_info, connector); +drm_add_display_info (edid, connector);if (quirks &EDID_QUIRK_FORCE_6BPC ) connector->display_info.bpc =6 ;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/10 drm/edid: Reduce the number of times we parse the CEA extension block
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Instead of parsing parts of the CEA extension block in two places to determine supported color formats and whatnot, let's just consolidate it to one function. This also makes it possible to neatly flatten drm_assign_hdmi_deep_color_info().
--- drivers/gpu/drm/drm_edid.c | 185 +++++++++++++++++++++------------------------ 1 file changed, 88 insertions(+), 97 deletions(-)
drivers/gpu/drm/drm_edid.c +88 -97
@@ -3733,105 +3733,110 @@ bool drm_rgb_quant_range_selectable(struct edid *edid) }EXPORT_SYMBOL (drm_rgb_quant_range_selectable); -/* -* Parse the CEA extension according to CEA-861-B. -* Return true if HDMI deep color supported, false if not or unknown. -*/ -static bool drm_assign_hdmi_deep_color_info (struct edid *edid, -struct drm_connector *connector) +static void drm_parse_hdmi_deep_color_info (struct drm_connector *connector, +const u8 *hdmi) {struct drm_display_info *info = &connector->display_info; -u8 *edid_ext, *hdmi; -int i; -int start_offset, end_offset;unsigned int dc_bpc =0 ; - edid_ext =drm_find_cea_extension (edid); -if (!edid_ext) -return false; +/* HDMI supports at least 8 bpc */ + info->bpc =8 ; -if (cea_db_offsets (edid_ext, &start_offset, &end_offset)) -return false; +if (cea_db_payload_len (hdmi) <6 ) +return ; + +if (hdmi[6 ] &DRM_EDID_HDMI_DC_30 ) { + dc_bpc =10 ; + info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_30 ; +DRM_DEBUG ("%s: HDMI sink does deep color 30.\n" , + connector->name); + } + +if (hdmi[6 ] &DRM_EDID_HDMI_DC_36 ) { + dc_bpc =12 ; + info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_36 ; +DRM_DEBUG ("%s: HDMI sink does deep color 36.\n" , + connector->name); + } + +if (hdmi[6 ] &DRM_EDID_HDMI_DC_48 ) { + dc_bpc =16 ; + info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_48 ; +DRM_DEBUG ("%s: HDMI sink does deep color 48.\n" , + connector->name); + } + +if (dc_bpc ==0 ) { +DRM_DEBUG ("%s: No deep color support on this HDMI sink.\n" , + connector->name); +return ; + } + +DRM_DEBUG ("%s: Assigning HDMI sink color depth as %d bpc.\n" , + connector->name, dc_bpc); + info->bpc = dc_bpc;/* -* Because HDMI identifier is in Vendor Specific Block, -* search it from all data blocks of CEA extension. +* Deep color support mandates RGB444 support for all video +* modes and forbids YCRCB422 support for all video modes per +* HDMI 1.3 spec. */ -for_each_cea_db (edid_ext, i, start_offset, end_offset) { -if (cea_db_is_hdmi_vsdb (&edid_ext[i])) { -/* HDMI supports at least 8 bpc */ - info->bpc =8 ; - - hdmi = &edid_ext[i]; -if (cea_db_payload_len (hdmi) <6 ) -return false; - -if (hdmi[6 ] &DRM_EDID_HDMI_DC_30 ) { - dc_bpc =10 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_30 ; -DRM_DEBUG ("%s: HDMI sink does deep color 30.\n" , - connector->name); - } + info->color_formats =DRM_COLOR_FORMAT_RGB444 ; -if (hdmi[6 ] &DRM_EDID_HDMI_DC_36 ) { - dc_bpc =12 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_36 ; -DRM_DEBUG ("%s: HDMI sink does deep color 36.\n" , - connector->name); - } +/* YCRCB444 is optional according to spec. */ +if (hdmi[6 ] &DRM_EDID_HDMI_DC_Y444 ) { + info->color_formats |=DRM_COLOR_FORMAT_YCRCB444 ; +DRM_DEBUG ("%s: HDMI sink does YCRCB444 in deep color.\n" , + connector->name); + } -if (hdmi[6 ] &DRM_EDID_HDMI_DC_48 ) { - dc_bpc =16 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_48 ; -DRM_DEBUG ("%s: HDMI sink does deep color 48.\n" , - connector->name); - } +/* +* Spec says that if any deep color mode is supported at all, +* then deep color 36 bit must be supported. +*/ +if (!(hdmi[6 ] &DRM_EDID_HDMI_DC_36 )) { +DRM_DEBUG ("%s: HDMI sink should do DC_36, but does not!\n" , + connector->name); + } +} -if (dc_bpc >0 ) { -DRM_DEBUG ("%s: Assigning HDMI sink color depth as %d bpc.\n" , - connector->name, dc_bpc); - info->bpc = dc_bpc; - -/* -* Deep color support mandates RGB444 support for all video -* modes and forbids YCRCB422 support for all video modes per -* HDMI 1.3 spec. -*/ - info->color_formats =DRM_COLOR_FORMAT_RGB444 ; - -/* YCRCB444 is optional according to spec. */ -if (hdmi[6 ] &DRM_EDID_HDMI_DC_Y444 ) { - info->color_formats |=DRM_COLOR_FORMAT_YCRCB444 ; -DRM_DEBUG ("%s: HDMI sink does YCRCB444 in deep color.\n" , - connector->name); - } +static void drm_parse_cea_ext (struct drm_connector *connector, +struct edid *edid) +{ +struct drm_display_info *info = &connector->display_info; +const u8 *edid_ext; +int i, start, end; -/* -* Spec says that if any deep color mode is supported at all, -* then deep color 36 bit must be supported. -*/ -if (!(hdmi[6 ] &DRM_EDID_HDMI_DC_36 )) { -DRM_DEBUG ("%s: HDMI sink should do DC_36, but does not!\n" , - connector->name); - } + edid_ext =drm_find_cea_extension (edid); +if (!edid_ext) +return ; -return true; - } -else { -DRM_DEBUG ("%s: No deep color support on this HDMI sink.\n" , - connector->name); - } - } - } + info->cea_rev = edid_ext[1 ]; -return false; +/* The existence of a CEA block should imply RGB support */ + info->color_formats =DRM_COLOR_FORMAT_RGB444 ; +if (edid_ext[3 ] &EDID_CEA_YCRCB444 ) + info->color_formats |=DRM_COLOR_FORMAT_YCRCB444 ; +if (edid_ext[3 ] &EDID_CEA_YCRCB422 ) + info->color_formats |=DRM_COLOR_FORMAT_YCRCB422 ; + +if (cea_db_offsets (edid_ext, &start, &end)) +return ; + +for_each_cea_db (edid_ext, i, start, end) { +const u8 *db = &edid_ext[i]; + +if (!cea_db_is_hdmi_vsdb (db)) +continue ; + +drm_parse_hdmi_deep_color_info (connector, db); + } } -static void drm_add_display_info (struct edid *edid, -struct drm_connector *connector) +static void drm_add_display_info (struct drm_connector *connector, +struct edid *edid) {struct drm_display_info *info = &connector->display_info; -u8 *edid_ext; info->width_mm = edid->width_cm *10 ; info->height_mm = edid->height_cm *10 ;
@@ -3846,21 +3851,7 @@ static void drm_add_display_info(struct edid *edid,if (!(edid->input &DRM_EDID_INPUT_DIGITAL ))return ; -/* Get data from CEA blocks if present */ - edid_ext =drm_find_cea_extension (edid); -if (edid_ext) { - info->cea_rev = edid_ext[1 ]; - -/* The existence of a CEA block should imply RGB support */ - info->color_formats =DRM_COLOR_FORMAT_RGB444 ; -if (edid_ext[3 ] &EDID_CEA_YCRCB444 ) - info->color_formats |=DRM_COLOR_FORMAT_YCRCB444 ; -if (edid_ext[3 ] &EDID_CEA_YCRCB422 ) - info->color_formats |=DRM_COLOR_FORMAT_YCRCB422 ; - } - -/* HDMI deep color modes supported? Assign to info, if so */ -drm_assign_hdmi_deep_color_info (edid, connector); +drm_parse_cea_ext (connector, edid);/* * Digital sink with "DFP 1.x compliant TMDS" according to EDID 1.3?
@@ -4096,7 +4087,7 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid)if (quirks & (EDID_QUIRK_PREFER_LARGE_60 |EDID_QUIRK_PREFER_LARGE_75 ))edid_fixup_preferred (connector, quirks); -drm_add_display_info (edid, connector); +drm_add_display_info (connector, edid);if (quirks &EDID_QUIRK_FORCE_6BPC ) connector->display_info.bpc =6 ;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 7/10 drm/edid: Clear the old cea_rev when there's no CEA extension in the new EDID
In reply to [email protected]From: Ville Syrjälä <[email protected]>
It's not a good idea to leave stale cea_rev in the drm_display_info. The current EDID might not even have a CEA ext block in which case we'd end up leaving the stale value in place.
--- drivers/gpu/drm/drm_edid.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_edid.c +1 -0
@@ -3844,6 +3844,7 @@ static void drm_add_display_info(struct drm_connector *connector,/* driver figures it out in this case */ info->bpc =0 ; info->color_formats =0 ; + info->cea_rev =0 ;if (edid->revision <3 )return ;
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 8/10 drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
drm_edid_to_eld() is just mean to cook up the ELD for the audio driver, so having it parse non-audio related stuff seems just wrong, and potentially could lead to that information not being even filled out if the function doesn't even get called. Let's move that stuff to the place where we parse the color formats and whatnot from the CEA ext block.
--- drivers/gpu/drm/drm_edid.c | 64 +++++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 29 deletions(-)
drivers/gpu/drm/drm_edid.c +35 -29
@@ -3253,17 +3253,12 @@ static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode) }static void -parse_hdmi_vsdb (struct drm_connector *connector,const u8 *db) +drm_parse_hdmi_vsdb_audio (struct drm_connector *connector,const u8 *db) { -struct drm_display_info *info = &connector->display_info;u8 len =cea_db_payload_len (db); -if (len >=6 ) { +if (len >=6 ) connector->eld[5 ] |= (db[6 ] >>7 ) <<1 ;/* Supports_AI */ - info->dvi_dual = db[6 ] &1 ; - } -if (len >=7 ) - info->max_tmds_clock = db[7 ] *5000 ;if (len >=8 ) { connector->latency_present[0 ] = db[8 ] >>7 ; connector->latency_present[1 ] = (db[8 ] >>6 ) &1 ;
@@ -3277,19 +3272,15 @@ parse_hdmi_vsdb(struct drm_connector *connector, const u8 *db)if (len >=12 ) connector->audio_latency[1 ] = db[12 ]; -DRM_DEBUG_KMS ("HDMI: DVI dual %d, " -"max TMDS clock %d, " -"latency present %d %d, " -"video latency %d %d, " -"audio latency %d %d\n" , - info->dvi_dual, - info->max_tmds_clock, - (int ) connector->latency_present[0 ], - (int ) connector->latency_present[1 ], - connector->video_latency[0 ], - connector->video_latency[1 ], - connector->audio_latency[0 ], - connector->audio_latency[1 ]); +DRM_DEBUG_KMS ("HDMI: latency present %d %d, " +"video latency %d %d, " +"audio latency %d %d\n" , + connector->latency_present[0 ], + connector->latency_present[1 ], + connector->video_latency[0 ], + connector->video_latency[1 ], + connector->audio_latency[0 ], + connector->audio_latency[1 ]); } static void
@@ -3350,7 +3341,6 @@ EXPORT_SYMBOL(drm_edid_get_monitor_name);*/ void drm_edid_to_eld (struct drm_connector *connector,struct edid *edid) { -struct drm_display_info *info = &connector->display_info;uint8_t *eld = connector->eld;u8 *cea;u8 *db;
@@ -3367,9 +3357,6 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) connector->video_latency[1 ] =0 ; connector->audio_latency[1 ] =0 ; - info->max_tmds_clock =0 ; - info->dvi_dual = false; - cea =drm_find_cea_extension (edid);if (!cea) {DRM_DEBUG_KMS ("ELD: no CEA Extension found\n" );
@@ -3419,7 +3406,7 @@ void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)case VENDOR_BLOCK :/* HDMI Vendor-Specific Data Block */ if (cea_db_is_hdmi_vsdb (db)) -parse_hdmi_vsdb (connector, db); +drm_parse_hdmi_vsdb_audio (connector, db);break ;default :break ;
@@ -3800,6 +3787,25 @@ static void drm_parse_hdmi_deep_color_info(struct drm_connector *connector, } } +static void +drm_parse_hdmi_vsdb_video (struct drm_connector *connector,const u8 *db) +{ +struct drm_display_info *info = &connector->display_info; +u8 len =cea_db_payload_len (db); + +if (len >=6 ) + info->dvi_dual = db[6 ] &1 ; +if (len >=7 ) + info->max_tmds_clock = db[7 ] *5000 ; + +DRM_DEBUG_KMS ("HDMI: DVI dual %d, " +"max TMDS clock %d kHz\n" , + info->dvi_dual, + info->max_tmds_clock); + +drm_parse_hdmi_deep_color_info (connector, db); +} +static void drm_parse_cea_ext (struct drm_connector *connector,struct edid *edid) {
@@ -3826,10 +3832,8 @@ static void drm_parse_cea_ext(struct drm_connector *connector,for_each_cea_db (edid_ext, i, start, end) {const u8 *db = &edid_ext[i]; -if (!cea_db_is_hdmi_vsdb (db)) -continue ; - -drm_parse_hdmi_deep_color_info (connector, db); +if (cea_db_is_hdmi_vsdb (db)) +drm_parse_hdmi_vsdb_video (connector, db); } }
@@ -3845,6 +3849,8 @@ static void drm_add_display_info(struct drm_connector *connector, info->bpc =0 ; info->color_formats =0 ; info->cea_rev =0 ; + info->max_tmds_clock =0 ; + info->dvi_dual = false;if (edid->revision <3 )return ;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 9/10 drm/i915: Replace a bunch of connector->base.display_info with a local variable
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Reduce the eyesore with a local variable.
--- drivers/gpu/drm/i915/intel_display.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/intel_display.c +7 -7
@@ -12657,22 +12657,22 @@ static void connected_sink_compute_bpp(struct intel_connector *connector, struct intel_crtc_state *pipe_config) { + const struct drm_display_info *info = &connector->base.display_info;int bpp = pipe_config->pipe_bpp;DRM_DEBUG_KMS ("[CONNECTOR:%d:%s] checking for sink bpp constrains\n" , - connector->base.base.id, - connector->base.name); + connector->base.base.id, + connector->base.name);/* Don't use an invalid EDID bpc value */ -if (connector->base.display_info.bpc && - connector->base.display_info.bpc *3 < bpp) { +if (info->bpc !=0 && info->bpc *3 < bpp) {DRM_DEBUG_KMS ("clamping display bpp (was %d) to EDID reported max of %d\n" , - bpp, connector->base.display_info.bpc*3 ); - pipe_config->pipe_bpp = connector->base.display_info.bpc*3 ; + bpp, info->bpc *3 ); + pipe_config->pipe_bpp = info->bpc *3 ; }/* Clamp bpp to 8 on screens without EDID 1.4 */ -if (connector->base.display_info.bpc ==0 && bpp >24 ) { +if (info->bpc ==0 && bpp >24 ) {DRM_DEBUG_KMS ("clamping display bpp (was %d) to default limit of 24\n" , bpp); pipe_config->pipe_bpp =24 ;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 09/10] drm/i915: Replace a bunch of connector->base.display_info with a local variable
Quoted 5 lines · On Wed, 2016-09-28 at 16:51 +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
Reduce the eyesore with a local variable.
Signed-off-by Ville Syrjälä <[email protected]>
Quoted 37 lines
---
drivers/gpu/drm/i915/intel_display.c | 14 +++++++-------1 file changed, 7 insertions(+), 7 deletions(-)drivers/gpu/drm/i915/intel_display.c +1
-0@@ -12657,22 +12657,22 @@ static void connected_sink_compute_bpp(struct intel_connector *connector, struct intel_crtc_state *pipe_config) { +const struct drm_display_info *info = &connector->base.display_info; int bpp = pipe_config->pipe_bpp;
DRM_DEBUG_KMS("[CONNECTOR:%d:%s] checking for sink bpp constrains\n",drivers/gpu/drm/i915/intel_display.c +2
-2- connector->base.base.id, - connector->base.name); + connector->base.base.id, + connector->base.name);
/* Don't use an invalid EDID bpc value */drivers/gpu/drm/i915/intel_display.c +1
-2-if (connector->base.display_info.bpc && - connector->base.display_info.bpc * 3 < bpp) { +if (info->bpc !=0 && info->bpc *3 < bpp) {DRM_DEBUG_KMS("clamping display bpp (was %d) to EDID reported max of %d\n",
drivers/gpu/drm/i915/intel_display.c +2
-2- bpp, connector->base.display_info.bpc*3); - pipe_config->pipe_bpp = connector->base.display_info.bpc*3 ; + bpp, info->bpc * 3); + pipe_config->pipe_bpp = info->bpc *3 ;}
/* Clamp bpp to 8 on screens without EDID 1.4 */drivers/gpu/drm/i915/intel_display.c +1
-1-if (connector->base.display_info.bpc ==0 && bpp >24 ) { +if (info->bpc ==0 && bpp >24 ) {
Quoted 4 lines
DRM_DEBUG_KMS("clamping display bpp (was %d) to default limit of 24\n",
bpp);
pipe_config->pipe_bpp= 24;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 10/10 drm/i915: Account for sink max TMDS clock when checking the port clock
In reply to [email protected]From: Ville Syrjälä <[email protected]>
It's perfectly legal for the sink to support 12bpc only for some lower resolution modes, while the higher resolution modes can only be used with 8bpc. So let's take the sink's max TMDS clock into account before we go and decide that a particular mode can be used with 12bpc.
--- drivers/gpu/drm/i915/intel_hdmi.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_hdmi.c +8 -1
@@ -1220,10 +1220,17 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi,int max_tmds_clock =intel_hdmi_source_max_tmds_clock (to_i915 (dev));if (respect_downstream_limits) { +struct intel_connector *connector = hdmi->attached_connector; +const struct drm_display_info *info = &connector->base.display_info; +if (hdmi->dp_dual_mode.max_tmds_clock) max_tmds_clock =min (max_tmds_clock, hdmi->dp_dual_mode.max_tmds_clock); -if (!hdmi->has_hdmi_sink) + +if (info->max_tmds_clock) + max_tmds_clock =min (max_tmds_clock, + info->max_tmds_clock); +else if (!hdmi->has_hdmi_sink) max_tmds_clock =min (max_tmds_clock,165000 ); }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/10] drm/i915: Account for sink max TMDS clock when checking the port clock
Quoted 7 lines · On Wed, 2016-09-28 at 16:51 +0300, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
It's perfectly legal for the sink to support 12bpc only for some lower resolution modes, while the higher resolution modes can only be used with 8bpc. So let's take the sink's max TMDS clock into account before we go and decide that a particular mode can be used with 12bpc.
Quoted 30 lines
Signed-off-by Ville Syrjälä <[email protected]>---
drivers/gpu/drm/i915/intel_hdmi.c | 9 ++++++++-1 file changed, 8 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_hdmi.c +0
-0@@ -1220,10 +1220,17 @@ static int hdmi_port_clock_limit(struct intel_hdmi *hdmi, int max_tmds_clock = intel_hdmi_source_max_tmds_clock(to_i915(dev));
if (respect_downstream_limits) {drivers/gpu/drm/i915/intel_hdmi.c +2
-0+struct intel_connector *connector = hdmi->attached_connector; + const struct drm_display_info *info = &connector-Quoted 1 line
base.display_info;
+
if (hdmi->dp_dual_mode.max_tmds_clock)max_tmds_clock= min(max_tmds_clock, hdmi-Quoted 1 line
dp_dual_mode.max_tmds_clock);
drivers/gpu/drm/i915/intel_hdmi.c +5
-1-if (!hdmi->has_hdmi_sink) + +if (info->max_tmds_clock) + max_tmds_clock =min (max_tmds_clock, + info->max_tmds_clock); +else if (!hdmi->has_hdmi_sink)
Quoted 3 lines
max_tmds_clock=min(max_tmds_clock, 165000); }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.BAT: warning for drm/edid: Clean up display_info stuff (rev2)
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/edid: Clean up display_info stuff (rev2)
URL : https://patchwork.freedesktop.org/series/10580/
State : warning
== Summary ==
Series 10580v2 drm/edid: Clean up display_info stuff
https://patchwork.freedesktop.org/api/1.0/series/10580/revisions/2/mbox/
Test kms_pipe_crc_basic:
Subgroup nonblocking-crc-pipe-b-frame-sequence:
dmesg-warn -> PASS (fi-ilk-650)
Test kms_psr_sink_crc:
Subgroup psr_basic:
pass -> DMESG-WARN (fi-skl-6700hq)fi-bdw-5557u total:244 pass:229 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:244 pass:202 dwarn:0 dfail:0 fail:0 skip:42 fi-bxt-t5700 total:244 pass:214 dwarn:0 dfail:0 fail:0 skip:30 fi-hsw-4770 total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-hsw-4770r total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-ilk-650 total:244 pass:182 dwarn:0 dfail:0 fail:2 skip:60 fi-ivb-3520m total:244 pass:219 dwarn:0 dfail:0 fail:0 skip:25 fi-ivb-3770 total:244 pass:207 dwarn:0 dfail:0 fail:0 skip:37 fi-skl-6260u total:244 pass:230 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:244 pass:221 dwarn:1 dfail:0 fail:0 skip:22 fi-skl-6700k total:244 pass:219 dwarn:1 dfail:0 fail:0 skip:24 fi-skl-6770hq total:244 pass:228 dwarn:1 dfail:0 fail:1 skip:14 fi-snb-2520m total:244 pass:208 dwarn:0 dfail:0 fail:0 skip:36 fi-snb-2600 total:244 pass:207 dwarn:0 dfail:0 fail:0 skip:37
Results at /archive/results/CI_IGT_test/Patchwork_2586/
bdb6dbd5e9c1a8dc3ccdd7964092cf5d6bc08ca2 drm-intel-nightly: 2016y-09m-28d-12h-10m-04s UTC integration manifest 15c5806 drm/i915: Account for sink max TMDS clock when checking the port clock
368d203 drm/i915: Replace a bunch of connector->base.display_info with a local variable f2ccacf drm/edid: Move dvi_dual/max_tmds_clock parsing out from drm_edid_to_eld()
69b7719 drm/edid: Clear the old cea_rev when there's no CEA extension in the new EDID 055e966 drm/edid: Reduce the number of times we parse the CEA extension block
a240775 drm/edid: Don't pass around drm_display_info needlessly
e7b391b drm/edid: Move dvi_dual/max_tmds_clock to drm_display_info
49c7407 drm/edid: Make max_tmds_clock kHz instead of MHz
35a8d87 drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new EDID
46aae61 drm/edid: Clear old audio latency values before parsing the new EDID
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · On Wed, Sep 28, 2016 at 9:51 AM, <[email protected]> wrote:
From: Ville Syrjälä <[email protected]>
Rebased the series (previous version [1]) mostly due to code shuffling. i915 specific bits still need to be eyeballed by someone.
Series available here:
git://github.com/vsyrjala/linux.githdmi_sink_tmds_limit_4[1] https://lists.freedesktop.org/archives/dri-devel/2016-August/114634.html
Patches 1-8 are:
Quoted 25 lines
Ville Syrjälä (10):
drm/edid: Clear old audio latency values before parsing the new EDID drm/edid: Clear old dvi_dual/max_tmds_clock before parsing the new
EDID
drm/edid: Makemax_tmds_clockkHz instead of MHz
drm/edid: Move dvi_dual/max_tmds_clock todrm_display_infodrm/edid: Don't pass arounddrm_display_infoneedlessly drm/edid: Reduce the number of times we parse the CEA extension block drm/edid: Clear the oldcea_revwhen there's no CEA extension in the
new EDID
drm/edid: Move dvi_dual/max_tmds_clock parsing out fromdrm_edid_to_eld()drm/i915: Replace a bunch of
connector->base.display_infowith a local
variable
drm/i915: Account for sink max TMDS clock when checking the port clockdrivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 4 +- drivers/gpu/drm/drm_edid.c | 248 +++++++++++++------------ drivers/gpu/drm/i915/intel_display.c | 14 +- drivers/gpu/drm/i915/intel_hdmi.c | 9 +- drivers/gpu/drm/radeon/radeon_connectors.c | 4 +- include/drm/drm_connector.h | 15 +- 6 files changed, 159 insertions(+), 135 deletions(-)
Quoted 7 lines
--
2.7.4_______________________________________________
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