• José Expósito's avatar
    drm/vc4: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi · c3c2f38c
    José Expósito authored
    Once EDID is parsed, the monitor HDMI support information is cached in
    drm_display_info.is_hdmi by drm_parse_hdmi_vsdb_video().
    
    This driver calls drm_detect_hdmi_monitor() to receive the same
    information and stores its own cached value in
    vc4_hdmi_encoder.hdmi_monitor, which is less efficient.
    
    Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi
    instead. This also allows to remove vc4_hdmi_encoder.hdmi_monitor.
    
    drm_detect_hdmi_monitor() is called in vc4_hdmi_connector_detect() and
    vc4_hdmi_connector_get_modes(). In both cases it is safe to rely on
    drm_display_info.is_hdmi as shown by ftrace:
    
    $ sudo trace-cmd record -p function_graph -l "vc4_hdmi_*" -l "drm_*"
    
    vc4_hdmi_connector_detect:
    
        vc4_hdmi_connector_detect() {
          drm_get_edid() {
            drm_connector_update_edid_property() {
              drm_add_display_info() {
                drm_reset_display_info();
                drm_for_each_detailed_block.part.0();
                drm_parse_cea_ext() {
                  drm_find_cea_extension();
                  drm_parse_hdmi_vsdb_video();
                  /* drm_display_info.is_hdmi is cached here */
                }
              }
            }
          }
          /* drm_display_info.is_hdmi is used here */
        }
    
    vc4_hdmi_connector_get_modes:
    
        vc4_hdmi_connector_get_modes() {
          drm_get_edid() {
            drm_connector_update_edid_property() {
              drm_add_display_info() {
                drm_reset_display_info();
                drm_for_each_detailed_block.part.0();
                drm_parse_cea_ext() {
                  drm_find_cea_extension();
                  drm_parse_hdmi_vsdb_video();
                  /* drm_display_info.is_hdmi is cached here */
                }
              }
            }
          }
          /* drm_display_info.is_hdmi is used here */
          drm_connector_update_edid_property();
        }
    Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
    Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220420114500.187664-2-jose.exposito89@gmail.com
    c3c2f38c
vc4_hdmi.h 7.46 KB