• Lespiau, Damien's avatar
    drm: Pull the test on drm_debug in the logging macros · a73d4e91
    Lespiau, Damien authored
    In the logging code, we are currently checking is we need to output in
    drm_ut_debug_printk(). This is too late. The problem is that when we write
    something like:
    
        DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",
                         connector->base.id,
                         drm_get_connector_name(connector),
                         connector->encoder->base.id,
                         drm_get_encoder_name(connector->encoder));
    
    We start by evaluating the arguments (so call drm_get_connector_name() and
    drm_get_connector_name()) before ending up in drm_ut_debug_printk() which will
    then does nothing.
    
    This means we execute a lot of instructions (drm_get_connector_name(), in turn,
    calls snprintf() for example) to happily discard them in the normal case,
    drm.debug=0.
    
    So, let's put the test on drm_debug earlier, in the macros themselves.
    Sprinkle an unlikely() as well for good measure.
    Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    a73d4e91
drmP.h 53.8 KB